/* ============ Stock Hub — market terminal theme ============ */
:root {
  --bg: #0a0b0d;
  --surface: #101216;
  --surface-2: #16181e;
  --surface-3: #1c1f26;
  --line: #23262e;
  --line-soft: #1a1d23;
  --text: #e8e6e1;
  --muted: #8b909c;
  --muted-2: #5f646e;
  --up: #22c55e;
  --down: #f0455a;
  --accent: #ffb020;
  --accent-dim: #7a5410;
  --radius: 4px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: "Sarabun", "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent; /* no grey flash on tap */
  -webkit-text-size-adjust: 100%;           /* no font inflation in landscape */
  overscroll-behavior: none;                /* no pull-to-refresh hijacking scroll */
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(1200px 500px at 80% -10%, rgba(255, 176, 32, 0.05), transparent 60%),
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
  min-height: 100dvh; /* 100vh overflows behind the mobile URL bar */
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Anything clickable fires on tap without the 300ms double-tap-zoom wait. */
button, a, [role="button"], .pin, .nav-btn, .btn, .range-tabs button,
.cur-toggle button, .sr-item, .wl-row, .mover, .strip-card, .news-item, .mag-idx {
  touch-action: manipulation;
}

/* Controls shouldn't be long-press-selectable; data text stays selectable. */
button, [role="button"], .pin, .nav-btn, .btn, .range-tabs button, .cur-toggle button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* iOS zooms the page when a focused input is under 16px, and never zooms back. */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px; }
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px)); /* clear the notch */
  background: rgba(10, 11, 13, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); flex: 0 0 auto; }
.brand-mark { width: 26px; height: 26px; }
.brand-name {
  font-family: var(--mono); font-weight: 700; letter-spacing: 2px;
  font-size: 15px; color: var(--text);
}
.brand-name em { color: var(--accent); font-style: normal; }

.search { position: relative; flex: 1 1 auto; max-width: 520px; }
.search-ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2;
  stroke-linecap: round; pointer-events: none;
}
#searchInput {
  width: 100%; padding: 9px 12px 9px 34px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); font-size: 13px;
  outline: none; transition: border-color .15s;
}
#searchInput:focus { border-color: var(--accent); }
#searchInput::placeholder { color: var(--muted-2); }

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.5); max-height: 60vh; overflow-y: auto;
}
.sr-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.sr-item:last-child { border-bottom: 0; }
.sr-item.active { background: var(--surface-3); }
.sr-sym { font-family: var(--mono); font-weight: 600; color: var(--text); min-width: 78px; }
.sr-name { flex: 1; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-exch { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.sr-empty { padding: 14px; color: var(--muted-2); text-align: center; font-size: 12.5px; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }
.clock { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); transition: background .3s; }
.dot.ok { background: var(--up); box-shadow: 0 0 8px var(--up); }
.dot.err { background: var(--down); box-shadow: 0 0 8px var(--down); }

/* ---------- market strip ---------- */
.strip {
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.strip::-webkit-scrollbar { display: none; }
.strip-card {
  flex: 0 0 auto; min-width: 168px; padding: 10px 16px;
  border-right: 1px solid var(--line-soft); cursor: pointer;
}
.strip-name { font-size: 11.5px; color: var(--muted); letter-spacing: .3px; margin-bottom: 3px; }
.strip-row { display: flex; align-items: baseline; gap: 8px; }
.strip-price { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.strip-chg { font-family: var(--mono); font-size: 12px; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* price-change flash (plays when a number updates) */
@keyframes flashUp {
  0% { background: rgba(34,197,94,.28); }
  100% { background: transparent; }
}
@keyframes flashDown {
  0% { background: rgba(240,69,90,.28); }
  100% { background: transparent; }
}
.flash-up { animation: flashUp .8s ease-out; }
.flash-down { animation: flashDown .8s ease-out; }

/* ---------- views ---------- */
.view {
  padding: 20px 18px 60px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); /* clear the home bar */
  max-width: 1240px; margin: 0 auto;
}

.dash-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.dash-head h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: .2px; }
.dash-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.updated { font-family: var(--mono); font-size: 11.5px; color: var(--muted-2); }

.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 7px 13px; border-radius: var(--radius); font-size: 12.5px;
  transition: background .15s, border-color .15s;
}
.btn.ghost { background: transparent; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1a1200; font-weight: 600; }
.btn.back { margin-bottom: 14px; }

/* ---------- watchlist ---------- */
.watchlist { display: grid; gap: 22px; }
.wl-group h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--muted-2); margin: 0 0 8px; font-weight: 600;
}
.wl-table { width: 100%; border-collapse: collapse; }
.wl-table th {
  text-align: right; font-size: 11px; color: var(--muted-2);
  font-weight: 500; padding: 6px 10px; border-bottom: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: .5px;
}
.wl-table th:first-child { text-align: left; }
.wl-row { cursor: pointer; transition: background .12s; }
.wl-row td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
.wl-sym { text-align: left; }
.wl-sym .s { font-family: var(--mono); font-weight: 600; font-size: 13.5px; }
.wl-sym .n { display: block; font-size: 11.5px; color: var(--muted-2); margin-top: 1px;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.spark { width: 84px; height: 26px; display: block; }
.pin {
  background: none; border: 0; color: var(--muted-2); font-size: 15px;
  padding: 2px 6px; line-height: 1; transition: color .15s, transform .15s;
}
.pin.on { color: var(--accent); }
.pin.big { font-size: 26px; }

/* ---------- detail ---------- */
.detail-head {
  display: flex; align-items: flex-end; gap: 18px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
  flex-wrap: wrap;
}
.dh-sym { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.dh-name { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.dh-tags { display: flex; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 10.5px; font-family: var(--mono); letter-spacing: .4px;
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted);
}
.dh-right { margin-left: auto; text-align: right; }
.dh-price { font-family: var(--mono); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dh-change { font-family: var(--mono); font-size: 15px; margin-top: 2px; }

.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 18px;
  position: relative;
  transition: opacity .15s;
}
.chart-card.loading { opacity: .45; }
.range-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.range-tabs button {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 5px 11px; border-radius: 3px; font-size: 12px; font-family: var(--mono);
}
.range-tabs button.active { color: var(--accent); border-color: var(--accent-dim); background: rgba(255,176,32,.08); }
.chart { height: 340px; width: 100%; }
.chart-legend { font-family: var(--mono); font-size: 11.5px; color: var(--muted-2); margin-top: 6px; min-height: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.panel h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted-2); margin: 0 0 14px; font-weight: 600;
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.stat { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line-soft); padding-bottom: 7px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; }

.trend { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.trend-badge {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  padding: 6px 12px; border-radius: 3px; border: 1px solid;
}
.trend-badge.up { color: var(--up); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }
.trend-badge.down { color: var(--down); border-color: rgba(240,69,90,.4); background: rgba(240,69,90,.1); }
.trend-badge.side { color: var(--accent); border-color: var(--accent-dim); background: rgba(255,176,32,.1); }
.trend-score { font-family: var(--mono); color: var(--muted); font-size: 12.5px; }

.signals { list-style: none; padding: 0; margin: 0 0 14px; }
.signals li {
  font-size: 12.5px; color: var(--text); padding: 6px 0 6px 18px;
  border-bottom: 1px solid var(--line-soft); position: relative;
}
.signals li::before {
  content: "▸"; position: absolute; left: 2px; color: var(--accent); font-size: 11px;
}
.ai-box {
  margin-top: 14px; padding: 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius); font-size: 13px; line-height: 1.65; white-space: pre-wrap;
}
.ai-box .ai-model { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); margin-top: 10px; }
.ai-loading { color: var(--accent); font-size: 12.5px; font-family: var(--mono); }

.news { display: grid; gap: 0; }
.news-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.news-item:last-child { border-bottom: 0; }
.news-thumb { width: 72px; height: 48px; border-radius: 3px; object-fit: cover; flex: 0 0 auto; background: var(--surface-3); }
.news-body { min-width: 0; }
.news-title { font-size: 13.5px; line-height: 1.4; color: var(--text); }
.news-meta { font-size: 11px; color: var(--muted-2); margin-top: 4px; font-family: var(--mono); }

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: var(--radius); font-size: 13px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); z-index: 60;
}

.skeleton { color: var(--muted-2); font-family: var(--mono); font-size: 12px; padding: 14px 0; }

/* ---------- nav ---------- */
.nav { display: flex; gap: 2px; flex: 0 0 auto; }
.nav-btn {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 6px 12px 5px; font-size: 13px; font-weight: 500;
  letter-spacing: .3px; transition: color .15s, border-color .15s;
}
.nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- magazine ---------- */
.mag-head {
  display: flex; align-items: flex-end; gap: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.mag-kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 6px;
}
.mag-head h1 { font-size: 24px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.mag-head .btn { margin-left: auto; }

.mag-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.mag-article {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; font-size: 15px; line-height: 1.85; color: #d9d7d2;
  border-top: 2px solid var(--accent);
}
.mag-article strong { color: var(--text); }
.mag-article .ai-model {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted-2);
  margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.mag-side { display: grid; gap: 18px; position: sticky; top: 68px; }
.mag-indices { display: grid; gap: 0; }
.mag-idx {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.mag-idx:last-child { border-bottom: 0; }
.mag-idx .k { color: var(--muted); font-size: 12.5px; }
.mag-idx .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.mag-idx .v em { font-style: normal; font-size: 11.5px; opacity: .85; }

/* ---------- summary box ---------- */
.summary-box {
  background: linear-gradient(180deg, rgba(255,176,32,.07), rgba(255,176,32,.02));
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 14px;
  font-size: 13.5px; line-height: 1.7; color: #ded9cf;
}
.summary-head {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.news-note {
  font-size: 12px; color: var(--muted-2); font-family: var(--mono);
  padding: 6px 0 10px; border-bottom: 1px dashed var(--line);
  margin-bottom: 6px;
}
.market-news-panel { margin-top: 22px; }

/* ---------- portfolio ---------- */
.pf-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px;
}
.pf-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; border-left: 2px solid var(--line);
}
.pf-card.up { border-left-color: var(--up); }
.pf-card.down { border-left-color: var(--down); }
.pf-k { font-size: 11.5px; color: var(--muted-2); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 8px; }
.pf-v { font-family: var(--mono); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-sub { font-family: var(--mono); font-size: 13px; margin-top: 3px; }
.pf-empty, .pf-note {
  grid-column: 1 / -1; font-size: 12.5px; color: var(--muted-2); font-family: var(--mono);
}
.pf-note { color: var(--accent); }

.pf-form-panel { margin-bottom: 18px; }
.pf-desc {
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
  margin: -6px 0 14px; max-width: 620px;
}
.pf-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pf-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 150px; min-width: 130px; }
.pf-field label { font-size: 11.5px; color: var(--muted); }
.pf-field input {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); padding: 9px 11px; font-size: 13.5px; font-family: var(--mono); outline: none;
}
.pf-field input:focus { border-color: var(--accent); }
.pf-field input:disabled { opacity: .6; }
.pf-form .btn { padding: 10px 18px; }
.pf-hint { font-size: 12.5px; color: var(--muted-2); margin-top: 10px; min-height: 16px; }
.pf-hint.err { color: var(--down); }
.pf-actions { white-space: nowrap; }
.pf-actions .pin { font-size: 14px; }
.pf-sync-panel { margin-bottom: 18px; }
.pf-sync { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pf-sync .pf-field { flex: 1 1 260px; }
.pf-sync .btn { padding: 10px 16px; }

/* ---------- donate ---------- */
.donate-nav { color: var(--accent); }
.donate-nav.active { color: var(--accent); }
.donate {
  display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start;
  margin-bottom: 18px;
}
.donate-why {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 2px solid var(--accent); border-radius: var(--radius); padding: 20px 22px;
}
.donate-lead { margin: 0 0 16px; font-size: 14px; line-height: 1.85; color: #d9d7d2; }
.donate-lead b { color: var(--text); }
.donate-uses { margin: 0; padding-left: 0; list-style: none; }
.donate-uses li {
  position: relative; padding: 8px 0 8px 18px;
  font-size: 13.5px; line-height: 1.75; color: #d0cec9;
  border-bottom: 1px solid var(--line-soft);
}
.donate-uses li:last-child { border-bottom: 0; }
.donate-uses li::before {
  content: "▸"; position: absolute; left: 0; top: 8px; color: var(--accent); font-size: 11px;
}
.donate-uses li b { color: var(--text); }
.donate-note {
  margin: 14px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--muted);
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}

.donate-qr-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; text-align: center;
  position: sticky; top: 68px;
}
.donate-qr-title {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.donate-qr {
  width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px;
}
.donate-steps {
  margin: 0; padding-left: 0; list-style: none; counter-reset: dstep; text-align: left;
}
.donate-steps li {
  position: relative; padding: 6px 0 6px 30px;
  font-size: 12.5px; line-height: 1.7; color: #d0cec9; counter-increment: dstep;
}
.donate-steps li::before {
  content: counter(dstep);
  position: absolute; left: 0; top: 6px;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); border: 1px solid var(--accent-dim); color: var(--accent);
  border-radius: 50%; font-family: var(--mono); font-size: 10.5px; font-weight: 700;
}
.donate-steps li b { color: var(--text); }
.donate-privacy {
  margin: 14px 0 0; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono);
}

.donate-claim-panel, .donate-admin-panel { margin-bottom: 18px; }
.donate-claim-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.donate-claim-form .pf-field { flex: 1 1 150px; }
.donate-claim-form .pf-field.wide { flex: 2 1 260px; }
.donate-claim-form .btn { padding: 10px 18px; }
.donate-list { margin-top: 14px; }
.dn-item {
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.dn-item:last-of-type { border-bottom: 0; }
.dn-item-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.dn-item-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.dn-item-amt { font-family: var(--mono); color: var(--accent); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.dn-item-note { font-size: 13px; color: #d0cec9; line-height: 1.7; margin-top: 5px; }
.dn-item-time { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-top: 5px; }

/* ---------- buy calculator ---------- */
.calc-panel { margin-bottom: 18px; }
.calc-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.calc-form .pf-field { flex: 1 1 200px; }
.calc-out { margin-top: 16px; }
.calc-hint { font-size: 12.5px; color: var(--muted-2); font-family: var(--mono); }
.calc-main {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--surface-2);
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius);
}
.calc-shares { display: flex; align-items: baseline; gap: 6px; }
.calc-shares-v {
  font-family: var(--mono); font-size: 26px; font-weight: 700;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.calc-shares-u { font-size: 14px; color: var(--muted); }
.calc-sub { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.calc-what { margin-top: 14px; }
.calc-what-h {
  font-size: 11.5px; color: var(--muted-2); letter-spacing: .5px;
  text-transform: uppercase; margin-bottom: 8px;
}
.calc-table { width: 100%; border-collapse: collapse; }
.calc-table th {
  text-align: left; font-size: 11px; color: var(--muted-2); font-weight: 500;
  padding: 5px 8px; border-bottom: 1px solid var(--line);
}
.calc-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); }
.calc-table tr:last-child td { border-bottom: 0; }
.calc-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* ---------- guide ---------- */
.guide { max-width: 860px; }
.guide-intro {
  font-size: 14.5px; line-height: 1.8; color: #d9d7d2;
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius); margin: 0 0 22px;
}
.guide-intro b { color: var(--text); }
.guide-sec {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.guide-sec h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 15.5px; font-weight: 600; color: var(--text);
  margin: 0 0 12px; letter-spacing: .2px;
}
.guide-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: 0 0 auto;
  background: var(--accent); color: #1a1200;
  border-radius: 50%; font-family: var(--mono); font-size: 12.5px; font-weight: 700;
}
.guide-sec ul { margin: 0; padding-left: 0; list-style: none; }
.guide-sec li {
  position: relative; padding: 7px 0 7px 18px;
  font-size: 13.5px; line-height: 1.75; color: #d0cec9;
  border-bottom: 1px solid var(--line-soft);
}
.guide-sec li:last-child { border-bottom: 0; }
.guide-sec li::before {
  content: "▸"; position: absolute; left: 0; top: 7px;
  color: var(--accent); font-size: 11px;
}
.guide-sec li b { color: var(--text); font-weight: 600; }
.guide-sec code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 3px; color: var(--accent);
}
.guide-note {
  margin: 10px 0 0; padding: 9px 12px; font-size: 12.5px; line-height: 1.7;
  background: rgba(255,176,32,.08); border-left: 2px solid var(--accent);
  border-radius: 3px; color: #ded9cf;
}

/* guide: illustrated install steps */
.guide-lead { margin: 0 0 14px; font-size: 13.5px; line-height: 1.8; color: #d0cec9; }
.guide-lead b { color: var(--text); }
.guide-step {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft);
}
.guide-step:first-of-type { border-top: 0; padding-top: 0; }
.guide-step h3 {
  font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 10px;
}
.guide-step ol {
  margin: 0 0 14px; padding-left: 0; list-style: none; counter-reset: gstep;
}
.guide-step ol li {
  position: relative; padding: 6px 0 6px 32px;
  font-size: 13.5px; line-height: 1.75; color: #d0cec9;
  counter-increment: gstep;
}
.guide-step ol li::before {
  content: counter(gstep);
  position: absolute; left: 0; top: 7px;
  width: 21px; height: 21px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); border: 1px solid var(--accent-dim);
  color: var(--accent); border-radius: 50%;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.guide-step ol li b { color: var(--text); }
.guide-img {
  display: block; width: 100%; max-width: 560px; height: auto;
  margin: 4px 0 6px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #0f1115;
}
.guide-img.narrow { max-width: 300px; }
.guide-tip {
  margin: 8px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--muted);
}
.guide-tip b { color: var(--text); }
.guide-step ul { margin: 10px 0 0; padding-left: 0; list-style: none; }
.guide-step ul li {
  position: relative; padding: 6px 0 6px 18px;
  font-size: 13.5px; line-height: 1.75; color: #d0cec9;
}
.guide-step ul li::before {
  content: "▸"; position: absolute; left: 0; top: 6px;
  color: var(--accent); font-size: 11px;
}
.guide-step ul li b { color: var(--text); }

/* ---------- DCA planner ---------- */
.plan-form-panel { margin-bottom: 18px; }
.plan-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.plan-form .pf-field { flex: 1 1 150px; }
.plan-form .btn { padding: 10px 20px; }
.pf-field select {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); padding: 9px 11px; font-size: 13.5px; font-family: var(--mono);
  outline: none; appearance: none;
}
.pf-field select:focus { border-color: var(--accent); }
.cur-toggle { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cur-toggle button {
  flex: 1; background: var(--surface-2); border: 0; color: var(--muted);
  padding: 10px 14px; font-size: 13px; font-family: var(--mono); transition: background .15s, color .15s;
}
.cur-toggle button + button { border-left: 1px solid var(--line); }
.cur-toggle button.active { background: var(--accent); color: #1a1200; font-weight: 600; }
.plan-check {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.plan-check input { width: 16px; height: 16px; accent-color: var(--accent); }

.dca-head { margin-bottom: 16px; }
.dca-title { font-size: 18px; font-weight: 600; }
.dca-sym { font-family: var(--mono); color: var(--muted); font-size: 14px; margin-left: 6px; }
.dca-sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.dca-chart-wrap { margin-top: 18px; }
.dca-chart { height: 300px; width: 100%; }
.dca-legend { display: flex; gap: 20px; font-size: 12px; color: var(--muted); margin-top: 8px; font-family: var(--mono); }
.dca-legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.sw-invested { background: #5f646e; }
.sw-value { background: var(--accent); }
.dca-note { font-size: 11.5px; color: var(--muted-2); line-height: 1.7; margin-top: 14px; font-family: var(--mono); }

/* ---------- movers ---------- */
.movers-panel { margin-top: 22px; }
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
.movers-col { min-width: 0; }
.movers-h {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 1px;
  padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.movers-h.up { color: var(--up); }
.movers-h.down { color: var(--down); }
.mover {
  display: grid; grid-template-columns: 78px 1fr auto auto;
  align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.mover:last-child { border-bottom: 0; }
.mover-sym { font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
.mover-name {
  font-size: 11.5px; color: var(--muted-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.mover-price { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mover-chg {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; min-width: 62px; text-align: right;
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .chart { height: 260px; }
  .dh-right { margin-left: 0; text-align: left; width: 100%; }
  .dh-price { font-size: 26px; }
  .col-spark, .spark { display: none; }
  .view { padding: 16px 12px 60px; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .mag-grid { grid-template-columns: 1fr; }
  .mag-side { position: static; }
  .mag-article { padding: 20px 18px; font-size: 14.5px; }
  .mag-head h1 { font-size: 20px; }
}

@media (max-width: 560px) {
  .col-abs { display: none; }
  .wl-sym .n { max-width: 130px; }
  .wl-row td { padding: 9px 6px; }
  .wl-table th { padding: 6px 6px; }
  .col-pin { width: 34px; }
  .panel { padding: 13px; }
  .pf-summary { grid-template-columns: 1fr; gap: 10px; }
  .pf-v { font-size: 20px; }
  .pf-form .btn { flex: 1 1 100%; }
  .pf-table .col-abs, .pf-table th:nth-child(3), .pf-table td:nth-child(3) { display: none; }
  .movers { grid-template-columns: 1fr; gap: 18px 0; }
  .mover { grid-template-columns: 70px 1fr auto; }
  .mover-price { display: none; }
  .pf-sync .btn { flex: 1 1 100%; }
  .donate { grid-template-columns: 1fr; }
  .donate-qr-card { position: static; }
  .donate-claim-form .pf-field, .donate-claim-form .btn { flex: 1 1 100%; }
  .plan-form .pf-field { flex: 1 1 100%; }
  .plan-form .btn { flex: 1 1 100%; }
  .dca-chart { height: 220px; }
  .dca-legend { flex-wrap: wrap; gap: 12px; }
  .pf-table th:nth-child(4), .pf-table td:nth-child(4),
  .pf-table th:nth-child(5), .pf-table td:nth-child(5) { display: none; }
}

/* Hover only where a real pointer exists. On touch the browser fakes
   :hover on first tap and leaves it stuck until you tap elsewhere. */
@media (hover: hover) and (pointer: fine) {
  .sr-item:hover { background: var(--surface-3); }
  .strip-card:hover { background: var(--surface-2); }
  .btn:hover { background: var(--surface-3); border-color: var(--muted-2); }
  .btn.accent:hover { background: #ffc24d; }
  .wl-row:hover { background: var(--surface-2); }
  .pin:hover { transform: scale(1.2); }
  .range-tabs button:hover { color: var(--text); background: var(--surface-2); }
  .news-item:hover .news-title { color: var(--accent); }
  .nav-btn:hover { color: var(--text); }
  .mover:hover { background: var(--surface-2); }
}
