@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Instrument+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: dark; /* native scrollbars, form controls & dialogs go dark */

  --bg: #131110;
  --bg-deep: #100E0D;
  --panel: #1B1815;
  --panel-2: #181512;
  --inset: #131110;
  --line: #2C2824;
  --line-soft: #221F1C;
  --line-strong: #3A342F;
  --ink: #F2EFEA;
  --ink-muted: #A39C93;
  --ink-faint: #6E675F;
  --ink-dim: #8A8480;
  --green: #3FC98C;
  --green-bright: #58D69E;
  --green-ink: #0E1F17;
  --red: #D9736E;
  --red-soft: #E7847E;
  --indigo: #8A90EE;
  --gold: #E8B450;

  accent-color: var(--green);
  scrollbar-color: #3A342F #181512;
}

* { box-sizing: border-box; }

/* Author `display: flex/grid` rules below would otherwise beat the
   browser's default `[hidden] { display: none }` — force it to win. */
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(63, 201, 140, 0.05), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(138, 144, 238, 0.045), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 14px;
}

::selection { background: rgba(63, 201, 140, 0.25); }

.serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.small-input { width: 64px !important; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.screen { width: 100%; min-height: 100vh; }
.screen.centered { display: flex; align-items: center; justify-content: center; padding: 24px; }

.logo-row { display: flex; align-items: baseline; gap: 8px; }
.logo-mark { font-size: 26px; }
.logo-word { font-size: 11px; letter-spacing: 0.28em; color: var(--ink-muted); }

/* ------------------------------------------------------------------ panels */
.panel {
  position: relative;
  background: linear-gradient(180deg, #1D1A17, var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.panel.narrow { width: 380px; max-width: 100%; }
.panel.narrow::before {
  content: '';
  position: absolute;
  top: -1px; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(63, 201, 140, 0.55), transparent);
}
.panel h1 { font-size: 26px; margin: 22px 0 8px; }
.panel p.muted { margin: 0 0 20px; line-height: 1.55; }

/* ------------------------------------------------------------------ inputs */
.input {
  width: 100%;
  background: var(--inset);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(63, 201, 140, 0.12);
}
select.input { appearance: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid #4A443D;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease,
    transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:hover { border-color: #6E675F; background: rgba(255, 255, 255, 0.02); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--green);
  color: var(--green-ink);
  border: none;
  font-weight: 600;
}
.btn.primary:hover {
  background: var(--green-bright);
  box-shadow: 0 4px 18px rgba(63, 201, 140, 0.25);
}
.btn.primary:disabled {
  background: var(--line-strong);
  color: var(--ink-faint);
  cursor: not-allowed;
  box-shadow: none;
}
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }
.btn.small { padding: 7px 14px; font-size: 12px; }
.btn.sell {
  border-color: rgba(217, 115, 110, 0.55);
  color: var(--red-soft);
}
.btn.sell:hover {
  border-color: var(--red-soft);
  background: rgba(217, 115, 110, 0.08);
}

.error-text { color: var(--red-soft); font-size: 13px; margin-top: 10px; }

/* ------------------------------------------------------------------ auth tabs */
.tabbar {
  display: flex; gap: 6px;
  margin-bottom: 22px;
  background: var(--inset);
  border-radius: 10px;
  padding: 4px;
}
.tabbtn {
  flex: 1;
  position: relative;
  padding: 9px 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.tabbtn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.035); }
.tabbtn:active { transform: translateY(1px); }
.tabbtn.active {
  background: linear-gradient(180deg, rgba(63, 201, 140, 0.16), rgba(63, 201, 140, 0.05));
  border-color: rgba(63, 201, 140, 0.34);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 6px 16px -10px rgba(63, 201, 140, 0.65);
}
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 6px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ------------------------------------------------------------------ app shell */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 21, 18, 0.88);
  backdrop-filter: blur(10px);
}
.app-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.apptabbtn {
  position: relative;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
/* an accent bar that grows out from the middle on hover, and stays lit when active */
.apptabbtn::after {
  content: '';
  position: absolute;
  left: 50%; right: 50%; bottom: 3px;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0;
  transition: left 0.22s ease, right 0.22s ease, opacity 0.22s ease;
}
.apptabbtn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.apptabbtn:hover::after { left: 24%; right: 24%; opacity: 0.45; }
.apptabbtn:active { transform: translateY(1px); }
.apptabbtn.active {
  background: linear-gradient(180deg, rgba(63, 201, 140, 0.14), rgba(63, 201, 140, 0.04));
  border-color: rgba(63, 201, 140, 0.40);
  color: var(--green);
}
.apptabbtn.active::after { left: 18%; right: 18%; opacity: 1; }
.app-user { display: flex; align-items: center; gap: 14px; }
.app-body { padding: 28px clamp(20px, 4vw, 48px) 60px; max-width: 1080px; margin: 0 auto; }
.apppane h4 { margin: 0 0 12px; }

@keyframes paneIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.apppane { animation: paneIn 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* ------------------------------------------------------------------ learn */
#learnContent { counter-reset: learncat; }
.learn-category { margin-bottom: 44px; }
.learn-category h2 {
  font-size: 22px;
  margin: 0 0 4px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  counter-increment: learncat;
}
.learn-category h2::before {
  content: '0' counter(learncat);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--green);
  letter-spacing: 0.1em;
}
.learn-category .cat-desc { color: var(--ink-muted); font-size: 13.5px; margin: 0 0 18px; }
.learn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .learn-grid { grid-template-columns: 1fr; } }
.term-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.term-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}
.term-card h3 { margin: 0 0 8px; font-size: 15px; }
.term-card p { margin: 0; font-size: 13.5px; line-height: 1.6; color: #B0AAA4; }

/* ------------------------------------------------------------------ backtester */
.bt-shell {
  background: linear-gradient(180deg, #1D1A17, var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}
.bt-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(217, 83, 79, 0.08);
  border: 1px solid rgba(217, 83, 79, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 13px;
  line-height: 1.6;
  color: #E7B4B1;
}
.controls-row { display: flex; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.control { min-width: 160px; }
.control.grow { flex: 1; }
.control label {
  display: block;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.control .value { color: var(--green); }
.control input[type='range'] { width: 100%; }
.control .input { margin-bottom: 0; }

.seg {
  display: inline-flex;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.segbtn {
  padding: 8px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.segbtn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.035); }
.segbtn:active { transform: translateY(1px); }
.segbtn.active {
  background: linear-gradient(180deg, rgba(63, 201, 140, 0.15), rgba(63, 201, 140, 0.05));
  border-color: rgba(63, 201, 140, 0.34);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.chart-box {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}
.chart-box h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chart-canvas-wrap { position: relative; height: 260px; }
.chart-canvas-wrap.short { height: 140px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.legend .lg { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-muted); }
.legend .lg i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.legend .lg i.dash { border-radius: 0; height: 2px; width: 14px; }
.legend .lg i.tri-up { width: 0; height: 0; border-radius: 0; background: none; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid; }
.legend .lg i.tri-down { width: 0; height: 0; border-radius: 0; background: none; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  transition: border-color 0.18s ease;
}
.stat:hover { border-color: var(--line-strong); }
.stat .label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat .val { font-size: 17px; font-weight: 600; font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.stat .val.pos { color: var(--green); }
.stat .val.neg { color: var(--red); }

/* ------------------------------------------------------------------ paper trading */
.paper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 980px) { .paper-layout { grid-template-columns: 1fr; } }

.paper-box {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}
.boxtitle {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.paper-ticker-list { display: flex; flex-direction: column; gap: 6px; }
.pt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pt-row:hover { background: rgba(255, 255, 255, 0.025); border-color: var(--line); }
.pt-row.active { background: var(--panel); border-color: var(--line-strong); }
.pt-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-sym { font-size: 13px; font-weight: 500; }
.pt-name { font-size: 11px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-spark { flex-shrink: 0; opacity: 0.85; }
.pt-quote { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.pt-price { font-size: 13px; }
.pt-chg { font-size: 11px; }

.paper-quote-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.paper-sym { font-size: 20px; font-weight: 600; letter-spacing: 0.04em; }
.paper-name { margin-top: 2px; }
.paper-price-wrap { text-align: right; }
.paper-price { font-size: 24px; font-weight: 600; }
.paper-change { margin-top: 2px; }
.paper-chart { height: 190px; margin-bottom: 14px; }

.paper-trade-controls { display: flex; gap: 10px; align-items: stretch; }
.paper-trade-controls .input { width: 110px; margin-bottom: 0; }
.paper-trade-controls .btn { flex: 1; }

.paper-motto {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-style: italic;
  font-size: 14.5px;
  color: var(--ink-faint);
  text-align: center;
}

.paper-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
}
.paper-log-head .boxtitle { margin-bottom: 0; }
.paper-trade-log { margin-top: 10px; line-height: 2; }
.pt-trade { border-bottom: 1px dashed var(--line-soft); padding: 2px 0; }
.pt-trade:last-child { border-bottom: none; }

/* ------------------------------------------------------------------ tools */
.tools-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 26px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #2C2824);
}
.tools-head:first-child { margin-top: 0; }
.tools-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

.lockpip {
  font-family: var(--mono, monospace);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #E8B450;
  border: 1px solid #4A3A22;
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
  margin-left: 6px;
}
.lockrow { display: flex; gap: 8px; }
.lockrow .input { flex: 1; min-width: 0; }
.lockrow .btn { flex: none; }
.locked-tool.wrong .input { border-color: #D9736E; }

.tools-featured {
  display: grid;
  /* Eleven games now — let them flow into as many columns as fit rather than
     forcing two very wide cards per row. */
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.tool-card.featured { justify-content: space-between; gap: 18px; }
.featured-head { display: flex; gap: 16px; align-items: flex-start; }
.featured-head svg { flex-shrink: 0; margin-top: 2px; }
.featured-head h3 { margin: 0 0 5px; }
.featured-head p { margin: 0; line-height: 1.55; }

.tools-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 860px) { .tools-grid { grid-template-columns: 1fr; } }
.tool-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.tool-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}
.tool-card h3 { margin: 0 0 6px; font-size: 16px; }
.dice-controls { display: flex; gap: 16px; margin: 12px 0; font-size: 12.5px; color: var(--ink-muted); align-items: center; }
.dice-controls label { display: flex; align-items: center; gap: 8px; }
.tool-result { margin-top: 16px; min-height: 28px; font-size: 15px; color: var(--green); }

/* ------------------------------------------------------------------ leaderboard */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  text-align: left;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.lb-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tbody tr { transition: background 0.12s ease; }
.lb-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.lb-table td.pos { color: var(--green); }
.lb-table td.neg { color: var(--red); }

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  .apppane { animation: none; }
  .btn, .term-card, .tool-card, .stat, .pt-row { transition: none; }
  .term-card:hover, .tool-card:hover { transform: none; }
}

/* ------------------------------------------------------------------ polish
   Brings the app shell in line with the marketing site: the same fine grain
   over the background, keyboard focus rings, and a little more presence on
   the active tab. Everything here is additive — nothing above is overridden
   in a way that changes layout. */

/* Fine grain, identical to the one on the marketing page, so the app doesn't
   read as a flatter surface than the site that links to it. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.03;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Keyboard focus. The inputs already had a focus ring; buttons and tabs did
   not, which made tabbing through the app invisible. :focus-visible keeps
   mouse clicks from drawing one. */
:is(.btn, .apptabbtn, .tabbtn, .segbtn, a):focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 999px;
}
.term-card:focus-visible, .tool-card:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* The active tab now reads as lit rather than merely tinted. */
.apptabbtn.active {
  box-shadow:
    0 0 0 1px rgba(63, 201, 140, 0.18),
    0 6px 18px -8px rgba(63, 201, 140, 0.5);
}

/* A hairline of accent under the sticky nav, fading out at the edges. */
.app-nav::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  inset-block-end: -1px;
  block-size: 1px;
  background: linear-gradient(90deg, transparent, rgba(63, 201, 140, 0.35), rgba(138, 144, 238, 0.28), transparent);
  pointer-events: none;
}
.app-nav { position: sticky; }

@media (prefers-reduced-motion: reduce) {
  body::after { display: none; }
}

/* ==========================================================================
   MARKETING-SITE POLISH
   Brings the app's tabs up to the same finish as the public first page:
   the same fine grain over everything, and a proper header on every tab
   (mono eyebrow, big serif line, one-sentence lede) instead of dropping
   the reader straight into controls.
   ========================================================================== */

/* Fine grain over the whole app — stops the flat dark from reading plastic.
   Sits above the background but below every interactive thing. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* keep the real UI above the grain */
.screen, .app-nav, .app-body { position: relative; z-index: 1; }

/* ---- per-tab header ---- */
.pane-head {
  margin-bottom: clamp(24px, 4vw, 38px);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.pane-eyebrow {
  display: block;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}
.pane-title {
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  font-weight: 400;
  background: linear-gradient(172deg, #FFFFFF 10%, var(--ink) 45%, var(--ink-muted) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.05em;   /* stops the gradient box clipping descenders */
}
.pane-title em { font-style: italic; color: var(--green); -webkit-text-fill-color: var(--green); }
.pane-lede {
  margin: 0;
  max-width: 56ch;
  color: var(--ink-muted);
  font-size: 14.5px;
  line-height: 1.7;
}

/* ---- reveal on entry ---- */
/* Panes are swapped with [hidden], so a plain CSS animation replays every
   time a tab is opened — no observer needed. */
.apppane:not([hidden]) .reveal {
  animation: paneRise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes paneRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---- lift the big surfaces closer to the site's cards ---- */
.bt-shell, .panel {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 60px -28px rgba(0, 0, 0, 0.9);
}

/* Learn's section counter: two digits stay two digits past nine. */
.learn-category h2::before { content: counter(learncat, decimal-leading-zero); }

@media (prefers-reduced-motion: reduce) {
  .apppane:not([hidden]) .reveal { animation: none; }
}

/* ==========================================================================
   MOVING PARTS
   The public first page is alive — a drifting ticker, glows that float, stats
   that count up, a chart that draws itself. Same treatment in the app.
   ========================================================================== */

/* ---- drifting ticker under the nav ---- */
.apptick {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding-block: 7px;
  border-bottom: 1px solid var(--line);
  background: rgba(19, 17, 16, 0.55);
}
.apptick-track {
  display: inline-flex;
  white-space: nowrap;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  animation: appdrift 110s linear infinite;
  will-change: transform;
}
.apptick-track > span { padding-inline-end: 2.4rem; }
.apptick-track .up { color: var(--green); }
.apptick-track .down { color: var(--red); }
.apptick-track .sym { color: var(--ink-muted); }
@keyframes appdrift { to { transform: translateX(-50%); } }

/* ---- floating ambient glows ---- */
.app-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(8px);
}
.app-glow--a {
  top: -22%; left: -10%;
  width: min(42rem, 80vw); height: min(42rem, 80vw);
  background: radial-gradient(circle, rgba(63, 201, 140, 0.10), transparent 62%);
  animation: appfloat 15s ease-in-out infinite;
}
.app-glow--b {
  bottom: -30%; right: -12%;
  width: min(38rem, 75vw); height: min(38rem, 75vw);
  background: radial-gradient(circle, rgba(138, 144, 238, 0.09), transparent 62%);
  animation: appfloat 19s ease-in-out -7s infinite;
}
@keyframes appfloat { 50% { transform: translateY(-16px); } }

/* ---- candles rise into place when you switch company ---- */
.candle-in { animation: candleIn 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes candleIn {
  from { opacity: 0; transform: translateY(10px) scaleY(0.72); }
  to   { opacity: 1; transform: none; }
}

/* ---- the backtester line draws itself in ---- */
svg path.drawin {
  stroke-dasharray: 2600;
  stroke-dashoffset: 2600;
  animation: chartDraw 1.8s cubic-bezier(0.3, 0.6, 0.2, 1) forwards;
}
@keyframes chartDraw { to { stroke-dashoffset: 0; } }

/* ---- a value that just changed gets a brief accent flash ---- */
.tickflash { animation: tickFlash 0.6s ease-out; }
@keyframes tickFlash {
  from { color: var(--green-bright); }
  to   { color: inherit; }
}

/* ---- market rows slide slightly on hover, like the site's list rows ---- */
.pt-row { transition: background 0.18s ease, border-color 0.18s ease, padding-inline-start 0.18s ease; }
.pt-row:hover { padding-inline-start: 16px; }

@media (prefers-reduced-motion: reduce) {
  .apptick-track { animation: none; }
  .app-glow { animation: none; }
  .candle-in { animation: none; }
  svg path.drawin { stroke-dashoffset: 0; animation: none; }
  .tickflash { animation: none; }
  .pt-row:hover { padding-inline-start: 0; }
}

/* Tool-launch feedback */
.demo-boot { padding: 24px; color: var(--ink-muted); }
.demo-boot a, .tool-launch-status a { color: var(--green); text-decoration: underline; }
.tool-launch-status { margin: 12px 0 0; font-size: 14px; line-height: 1.6; color: var(--red-soft); }
