:root {
  --ink: #08152b;
  --muted: #667085;
  --line: #ded6c7;
  --paper: #f8f6f0;
  --panel: #fffdfa;
  --green: #21865a;
  --red: #b54d4d;
  --amber: #c99a3d;
  --blue: #0e2a52;
  --teal: #c99a3d;
  --navy: #08152b;
  --navy-2: #0d1f3e;
  --gold: #c99a3d;
  --gold-2: #e2bd68;
  --gold-soft: #f2e4c4;
  --panel-soft: #f1ece1;
  --shadow: 0 22px 58px rgba(8, 21, 43, 0.13);
  --chart-bg: #fffefa;
  --future-mask: rgba(248, 246, 240, .9);
  --future-zone: rgba(201, 154, 61, .11);
  --rail: #08152b;
  --rail-bg: #08152b;
  --press: #eee5d7;
  --paper-rgb: 248, 246, 240;
  --ink-rgb: 8, 21, 43;
  --candle-outline: #08152b;
  --candle-up: #fffefa;
  --candle-down: #0d1f3e;
  --volume-up: rgba(33, 134, 90, .20);
  --volume-down: rgba(181, 77, 77, .24);
  --chart-line: #c99a3d;
  --measure: #9b7841;
}

body[data-theme="dark"] {
  --ink: #f8f3e8;
  --muted: #b9c0cc;
  --line: #2c3850;
  --paper: #061023;
  --panel: #0b172d;
  --green: #8fd8a8;
  --red: #f0a0a0;
  --amber: #e2bd68;
  --blue: #9eb7e7;
  --teal: #e2bd68;
  --navy: #061023;
  --navy-2: #0b172d;
  --gold: #d9ab50;
  --gold-2: #f2d887;
  --gold-soft: #2f2718;
  --panel-soft: #101f39;
  --shadow: 0 20px 58px rgba(0, 0, 0, 0.42);
  --chart-bg: #08152b;
  --future-mask: rgba(6, 16, 35, .88);
  --future-zone: rgba(226, 189, 104, .13);
  --future-hidden-tint: rgba(14, 14, 14, .35);
  --future-hidden-slash: rgba(102, 113, 132, .32);
  --rail: #061023;
  --rail-bg: #061023;
  --press: #162846;
  --paper-rgb: 6, 16, 35;
  --ink-rgb: 248, 243, 232;
  --candle-outline: #f8f3e8;
  --candle-up: #08152b;
  --candle-down: #f8f3e8;
  --volume-up: rgba(143, 216, 168, .22);
  --volume-down: rgba(240, 160, 160, .25);
  --chart-line: #e2bd68;
  --measure: #d5b874;
}

/* A playful, brand-colored cartoon glove replaces the desktop mouse arrow in Gamify. */
@media (hover: hover) and (pointer: fine) {
  body[data-theme="gamify"],
  body[data-theme="gamify"] :not(.chart-canvas-wrap, .chart-canvas-wrap *) {
    cursor: url("./assets/cartoon-glove-cursor.svg?v=32") 14 2, auto !important;
  }

  :is(input:not([type="button"]):not([type="checkbox"]):not([type="color"]):not([type="radio"]):not([type="range"]):not([type="reset"]):not([type="submit"]), textarea, [contenteditable="true"]) {
    cursor: text !important;
  }

  body :is(:disabled, [aria-disabled="true"]) {
    cursor: not-allowed !important;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  transition: background .18s ease, color .18s ease;
}
button, input, select, textarea { font: inherit; }
.settings-shortcut {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 130;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--gold) 72%, var(--ink));
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-2);
  box-shadow: 0 12px 30px rgba(8, 21, 43, .28);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.settings-shortcut:hover {
  transform: translateY(-2px) rotate(12deg);
  background: var(--navy-2);
  box-shadow: 0 16px 36px rgba(8, 21, 43, .34);
}
.settings-shortcut:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold-2) 78%, white);
  outline-offset: 3px;
}
.settings-shortcut[aria-current="page"] {
  background: var(--gold);
  color: var(--navy);
}
.settings-shortcut svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: color-mix(in srgb, var(--paper) 90%, white);
}
.onboarding.hidden { display: none; }
.round-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(9, 17, 15, .38);
}
.round-modal.hidden { display: none; }
.round-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
}
.round-kicker {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.round-card h2 { margin-top: 8px; font-size: 30px; }
.round-card p { color: var(--muted); line-height: 1.5; }
#roundText[hidden] { display: none !important; }
.round-bullets {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}
.round-bullets li {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--ink);
  font-weight: 800;
}
.round-actions { display: flex; justify-content: flex-end; }
.round-actions button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-weight: 900;
}
body.panel-staged .workspace { grid-template-columns: 1fr; }
body.panel-staged .panel { display: none; }
body.learn-mode .workspace { grid-template-columns: 1fr; }
body.learn-mode .chart-panel,
body.learn-mode .lower,
body.learn-mode .mode-copy,
body.learn-mode #nextBtn { display: none; }
body.learn-mode .panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
body.learn-mode .mode-surface {
  padding: 0;
  border: 0;
  background: transparent;
}
body.learn-mode .choices {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}
body.learn-mode .choices,
body.versus-waiting .choices,
body.versus-waiting #nextBtn {
  display: none;
}
body.learn-mode .result,
body.review-empty .result,
body.versus-waiting .result {
  display: none;
}
body.review-empty .workspace,
body.versus-waiting .workspace {
  grid-template-columns: 1fr;
}
body.review-empty .chart-panel,
body.versus-waiting .chart-panel {
  display: none;
}
body.versus-waiting .mode-surface {
  flex: 1;
  display: flex;
  flex-direction: column;
}
body.versus-waiting .versus-actions {
  margin-top: auto;
}

/* Desktop sidebar: pinned by default, with an optional hover-reveal mode. */
:root {
  --side-menu-width: 264px;
  --side-menu-toggle-size: 42px;
}

@media (min-width: 981px) {
  .app {
    grid-template-columns: var(--side-menu-width) minmax(0, 1fr);
    transition: grid-template-columns 240ms cubic-bezier(.2, .8, .2, 1);
  }

  .rail {
    z-index: 70;
    width: var(--side-menu-width);
    transform: translateX(0);
    transition: transform 240ms cubic-bezier(.2, .8, .2, 1), box-shadow 240ms ease;
    will-change: transform;
  }

  .rail-hover-zone {
    position: fixed;
    z-index: 68;
    inset: 0 auto 0 0;
    display: none;
    /* Require the pointer to reach the viewport's left border. */
    width: 1px;
  }

  .rail-collapse-toggle {
    position: fixed;
    z-index: 72;
    top: 18px;
    left: calc(var(--side-menu-width) - (var(--side-menu-toggle-size) / 2));
    width: var(--side-menu-toggle-size);
    height: var(--side-menu-toggle-size);
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 9px;
    background: rgba(16, 18, 22, .82);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    opacity: .5;
    transition: left 240ms cubic-bezier(.2, .8, .2, 1), background 160ms ease, transform 160ms ease, opacity 160ms ease;
  }

  .rail-collapse-toggle:is(:hover, :active, :focus-visible) {
    opacity: 1;
  }

  .rail-collapse-toggle:hover {
    background: rgba(5, 7, 10, .94);
    transform: translateY(-1px);
  }

  .rail-collapse-toggle:focus-visible {
    outline-color: #fff;
  }

  .rail-collapse-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 200ms ease;
  }

  body.rail-auto-hide .app {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  body.rail-auto-hide .rail {
    transform: translateX(-100%);
    box-shadow: none;
  }

  body.rail-auto-hide .rail-hover-zone {
    display: block;
  }

  body.rail-auto-hide .rail-collapse-toggle {
    left: 10px;
  }

  body.rail-auto-hide .rail-collapse-toggle svg {
    transform: rotate(180deg);
  }

  body.rail-auto-hide.rail-revealed .app {
    grid-template-columns: var(--side-menu-width) minmax(0, 1fr);
  }

  body.rail-auto-hide.rail-revealed .rail {
    transform: translateX(0);
    box-shadow: 18px 0 54px rgba(8, 21, 43, .24);
  }

  body.rail-auto-hide.rail-revealed .rail-collapse-toggle {
    left: calc(var(--side-menu-width) - (var(--side-menu-toggle-size) / 2));
  }
}

@media (max-width: 980px) {
  .rail-hover-zone,
  .rail-collapse-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app,
  .rail,
  .rail-collapse-toggle,
  .rail-collapse-toggle svg,
  .settings-shortcut {
    transition-duration: 0.01ms !important;
  }

  .settings-shortcut:hover {
    transform: none;
  }
}
body.symbol-results-open .workspace,
body.symbol-results-open .lower {
  display: none;
}
.symbol-results-page {
  min-height: calc(100vh - 150px);
  padding: clamp(22px, 4vw, 52px);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: none;
}
.symbol-results-page[hidden] {
  display: none;
}
.symbol-results-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(18px, 4vw, 46px);
  align-items: start;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.symbol-results-back,
.symbol-results-search button,
.symbol-result-row > button,
.symbol-results-empty button {
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--paper);
  background: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.symbol-results-back {
  color: var(--ink);
  background: transparent;
}
.symbol-results-head span,
.symbol-results-empty > span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.symbol-results-head h1 {
  margin: 8px 0 6px;
  font-size: clamp(30px, 5vw, 58px);
  font-weight: 600;
  line-height: .98;
}
.symbol-results-head p,
.symbol-results-empty p {
  margin: 0;
  color: var(--muted);
}
.symbol-results-search {
  display: grid;
  gap: 9px;
  margin: 28px 0;
}
.symbol-results-search label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.symbol-results-search > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.symbol-results-search input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}
.symbol-results-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.symbol-result-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(150px, .75fr) auto;
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  min-width: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  transition: background .16s ease;
}
.symbol-result-row:last-child {
  border-bottom: 0;
}
.symbol-result-row:hover {
  background: var(--panel-soft);
}
.symbol-result-identity h2 {
  margin: 0 0 5px;
  font-size: clamp(18px, 2.1vw, 24px);
}
.symbol-result-identity p {
  display: grid;
  grid-template-columns: 90px 8px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}
.symbol-result-ticker {
  overflow-wrap: anywhere;
  text-transform: uppercase;
}
.symbol-result-separator {
  text-align: center;
}
.symbol-result-market {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.symbol-result-market span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.symbol-result-market strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.symbol-result-row > button {
  min-width: 132px;
  white-space: nowrap;
}
.symbol-results-empty,
.symbol-results-loading {
  grid-column: 1 / -1;
  display: grid;
  justify-items: start;
  gap: 12px;
  min-height: 260px;
  align-content: center;
  padding: clamp(28px, 6vw, 72px);
  border: 1px dashed var(--line);
  background: var(--paper);
}
.symbol-results-empty h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
}
.symbol-results-loading span {
  color: var(--muted);
}
@media (max-width: 760px) {
  .symbol-results-head {
    grid-template-columns: 1fr;
  }
  .symbol-results-back {
    justify-self: start;
  }
  .symbol-results-list {
    grid-template-columns: 1fr;
  }
  .symbol-result-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 18px;
    padding: 18px 2px;
  }
  .symbol-result-market {
    grid-column: 1;
    grid-row: 2;
  }
  .symbol-result-row > button {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 0;
  }
  .symbol-results-search > div {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .symbol-result-row {
    grid-template-columns: 1fr;
  }
  .symbol-result-market,
  .symbol-result-row > button {
    grid-column: 1;
    grid-row: auto;
  }
  .symbol-result-row > button {
    justify-self: start;
  }
}
#practicePlanPanel {
  display: none;
}
body.review-mode #practicePlanPanel {
  display: block;
}
.welcome-card {
  width: min(980px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.welcome-kicker {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.welcome-copy h1 {
  max-width: 560px;
  margin-bottom: 18px;
  font-size: clamp(42px, 6vw, 74px);
}
.welcome-copy p {
  max-width: 540px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}
.welcome-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.welcome-points span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 800;
  font-size: 13px;
}
.welcome-demo {
  position: relative;
  height: 330px;
  display: flex;
  align-items: end;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
  overflow: hidden;
  background: var(--chart-bg);
}
.welcome-demo::before {
  content: "";
  position: absolute;
  inset: 30px;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 54px, 88px 100%;
  opacity: .6;
}
.demo-bar {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 126px;
  border-radius: 8px 8px 3px 3px;
  background: var(--green);
}
.demo-bar.tall { height: 190px; }
.demo-bar.mid { height: 156px; }
.demo-bar.down { height: 92px; background: var(--red); }
.demo-mask {
  position: absolute;
  z-index: 2;
  top: 30px;
  right: 30px;
  bottom: 30px;
  width: 42%;
  display: grid;
  place-items: center;
  border-left: 1px dashed var(--teal);
  color: var(--teal);
  background: var(--future-mask);
  font-weight: 900;
}
.welcome-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
.welcome-actions button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 15px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}
.welcome-actions button:first-child {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.rail {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: var(--rail);
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; gap: 12px; align-items: center; }
button.brand { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -.03em;
}
.brand small, .account small { color: rgba(var(--paper-rgb), .68); display: block; }
nav { display: grid; gap: 8px; }
.nav {
  border: 0;
  border-radius: 8px;
  padding: 11px 13px;
  text-align: left;
  color: rgba(var(--paper-rgb), .86);
  background: transparent;
  cursor: pointer;
}
.nav.active, .nav:hover { background: rgba(255,255,255,0.13); color: white; box-shadow: inset 3px 0 0 var(--paper); }
.account { margin-top: auto; padding: 15px; border: 1px solid rgba(255,255,255,0.16); border-radius: 10px; background: rgba(255,255,255,.05); }
.theme-card { display: grid; gap: 8px; padding: 13px; border: 1px solid rgba(255,255,255,0.16); border-radius: 10px; background: rgba(255,255,255,.05); }
.theme-card span { color: rgba(var(--paper-rgb), .68); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: center; }
.theme-card button {
  border: 2px solid black;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, border-width .16s ease, box-shadow .16s ease;
}
.theme-card button[data-theme-choice="light"] {
  background: white;
  color: black;
}
.theme-card button[data-theme-choice="dark"] {
  background: black;
  color: white;
}
.theme-card button.active {
  border-width: 3px;
  font-weight: 1000;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--paper);
}
.xp { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.15); margin: 12px 0 8px; overflow: hidden; }
.xp span { display: block; height: 100%; width: 58%; background: var(--paper); }
main { padding: 20px 22px 24px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 16px; }
.eyebrow, .chart-head small { margin: 0 0 6px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(28px, 3vw, 38px); line-height: 1.02; max-width: 780px; letter-spacing: 0; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-width: 330px; }
.metrics div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: none; }
.metrics strong { display: block; font-size: 20px; }
.metrics span { color: var(--muted); font-size: 12px; }
.workspace { display: grid; grid-template-columns: minmax(620px, 1fr) 310px; gap: 16px; align-items: stretch; }
.chart-panel, .panel, .lower > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(22, 35, 30, 0.06);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.chart-panel { padding: 16px; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; gap: 18px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
h2, h3 { margin: 0; letter-spacing: 0; }
#tickerForm, .market-controls { display: flex; gap: 8px; }
.market-controls { align-items: end; flex-wrap: wrap; justify-content: flex-end; }
.market-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
input, select {
  width: 108px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel-soft);
}
input:disabled, select:disabled, button:disabled {
  opacity: .52;
  cursor: not-allowed;
}
select { width: 160px; }
.symbol-search { position: relative; }
.suggestions {
  position: absolute;
  z-index: 8;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, 82vw);
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
  padding: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.suggestions::-webkit-scrollbar { display: none; }
.suggestion {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: center;
  padding: 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.suggestion:hover,
.suggestion.active { background: rgba(15, 140, 154, .12); }
.suggestion strong { min-width: 0; font-size: 13px; }
.suggestion span { grid-column: 1; grid-row: 2; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion small { grid-column: 2; grid-row: 1 / 3; color: var(--teal); font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.symbol-status {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.symbol-status.error { color: var(--red); }
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
#tickerForm button, .choices button, .secondary, .packs button {
  border: 0;
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-weight: 800;
}
.chart-shell { position: relative; margin-top: 10px; }
.chart-topbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: color-mix(in srgb, var(--panel) 90%, var(--chart-bg));
  padding: 7px;
  overflow: hidden;
}
.timeframes, .chart-modes { display: flex; gap: 6px; }
.timeframes { flex: 0 0 auto; }
.chart-modes {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.chart-modes::-webkit-scrollbar { height: 4px; }
.chart-modes::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.timeframes > button, .chart-modes button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.timeframes > button.active, .chart-modes button.active {
  border-color: color-mix(in srgb, var(--teal) 44%, var(--line));
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(20,143,139,.12);
}
canvas { width: 100%; aspect-ratio: 2 / 1; display: block; border-radius: 8px; background: var(--chart-bg); border: 1px solid var(--line); cursor: grab; touch-action: none; }
canvas#chart.eraser-active { cursor: url("./assets/eraser-cursor.svg?v=2") 3 22, crosshair !important; }
.chart-topbar + .chart-toolbar + canvas,
.chart-topbar + .chart-toolbar + canvas#chart {
  border-radius: 0 0 8px 8px;
}
.chart-toolbar { position: absolute; z-index: 2; top: 50px; right: 9px; display: flex; gap: 5px; }
.chart-toolbar button {
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--chart-bg));
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.chart-tip {
  position: absolute;
  z-index: 3;
  min-width: 178px;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.35;
}
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip span { color: var(--muted); }
.axis-label {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  border-radius: 6px;
  padding: 4px 7px;
  background: var(--teal);
  color: var(--paper);
  font-size: 11px;
  font-weight: 900;
}
.timeline { display: grid; grid-template-columns: 1fr auto; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 9px; }
#revealTag { color: var(--amber); font-weight: 800; }
.panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.mode-copy { color: var(--muted); line-height: 1.45; }
.result:empty { display: none !important; }
.mode-surface {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--panel-soft);
  animation: surfaceIn .18s ease;
}
.mode-surface:empty { display: none; }
.mode-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mode-row strong { font-size: 17px; }
.mode-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-actions button, .mini-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.mode-actions button:hover, .mini-button:hover { transform: translateY(-1px); border-color: var(--teal); }
.mode-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}
.mode-tabs button.active { color: var(--ink); background: var(--panel); border-color: var(--teal); }
.date-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.date-control input { width: 100%; }
.live-puzzle-controls { display: grid; gap: 10px; min-width: 0; }
.live-puzzle-controls select { width: 100%; min-width: 0; min-height: 44px; }
.live-puzzle-controls p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.5; overflow-wrap: anywhere; }
.live-puzzle-clock { color: var(--teal); font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer {
  font-variant-numeric: tabular-nums;
  color: var(--amber);
}
.mode-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mode-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}
.mode-list li:last-child { border-bottom: 0; }
.mode-list small { color: var(--muted); }
body.versus-mode .mode-copy {
  display: none;
}
.competitive-mode-copy {
  margin: -2px 0 4px;
  color: var(--muted);
  line-height: 1.45;
}
.versus-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) 230px;
  width: 712px;
  max-width: 100%;
}
.versus-actions button[data-action="versus-start"] {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  align-self: end;
  width: 100%;
  height: 56px;
  border: 3px solid #32136f;
  border-radius: 17px;
  padding: 12px 14px;
  color: #fff;
  background: linear-gradient(135deg, #7048e8, #1769b0);
  box-shadow: 6px 6px 0 #32136f, 0 12px 22px rgba(74, 45, 170, .22);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.08;
  text-shadow: 0 2px 0 rgba(50, 19, 111, .35);
}
.versus-actions button[data-action="versus-start"]:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #32136f, 0 15px 25px rgba(74, 45, 170, .26);
}
.versus-actions button[data-action="versus-start"]:active {
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 #32136f, 0 6px 12px rgba(74, 45, 170, .18);
}
.versus-actions .game-mode-button {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: stretch;
  justify-self: end;
  align-self: end;
  width: 75%;
  height: 45px;
  overflow: hidden;
  border: 3px solid #32136f;
  border-radius: 17px;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, #7048e8, #1769b0);
  box-shadow: 6px 6px 0 #32136f, 0 12px 22px rgba(74, 45, 170, .22);
  cursor: default;
}
.versus-actions .game-mode-button:not([aria-disabled="true"]):hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #32136f, 0 15px 25px rgba(74, 45, 170, .26);
}
.versus-actions .game-mode-button[aria-disabled="true"] {
  opacity: .38;
  filter: grayscale(1);
  cursor: not-allowed;
}
.versus-actions .game-mode-arrow:disabled {
  opacity: 1;
}
.versus-actions .game-mode-arrow {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  place-items: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #fff;
  background: rgba(50, 19, 111, .23);
  box-shadow: none;
  cursor: pointer;
}
.versus-actions .game-mode-arrow:not(:disabled):hover {
  border-color: transparent;
  background: rgba(50, 19, 111, .34);
  box-shadow: none;
  transform: none;
}
.versus-actions .game-mode-arrow:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -5px;
}
.versus-actions .game-mode-arrow svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.versus-actions .game-mode-arrow::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, .78);
}
.game-mode-button-label {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 10px 9px;
  overflow: hidden;
  pointer-events: none;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 2px 0 rgba(50, 19, 111, .35);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-mode-menu-open {
  overflow: hidden;
}
.game-mode-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}
.game-mode-modal.hidden {
  display: none;
}
.game-mode-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: rgba(5, 35, 92, .62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: default;
}
.game-mode-catalog {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 10px;
  padding: clamp(20px, 4vw, 34px);
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(77, 163, 255, .42), transparent 18rem),
    linear-gradient(145deg, #0c5cc4, #082c72 72%);
  box-shadow: 0 28px 90px rgba(0, 14, 49, .52), 10px 10px 0 rgba(3, 21, 61, .82);
}
.game-mode-catalog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.game-mode-catalog-head span {
  display: block;
  margin-bottom: 8px;
  color: #a9d4ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.game-mode-catalog-head h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1;
}
.game-mode-close {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 7px;
  padding: 0;
  color: #fff;
  background: rgba(1, 22, 62, .34);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.game-mode-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.game-mode-list button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 7px;
  padding: 15px 16px;
  color: #fff;
  background: rgba(3, 30, 82, .5);
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.game-mode-list button:hover,
.game-mode-list button:focus-visible {
  border-color: rgba(255, 255, 255, .72);
  background: rgba(31, 119, 232, .64);
  transform: translateX(4px);
}
.game-mode-list button.active {
  border-color: #fff;
  background: #1477e5;
  box-shadow: inset 4px 0 0 #9fd1ff;
}
.game-mode-list button > span {
  color: #a9d4ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
}
.game-mode-list button > div {
  display: grid;
  gap: 4px;
}
.game-mode-list strong {
  color: #fff;
  font-size: 18px;
}
.game-mode-list small {
  color: #d6eaff;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.game-mode-list em {
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  padding: 6px 9px;
  color: #e8f4ff;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
@media (max-width: 560px) {
  .game-mode-modal {
    padding: 12px;
  }
  .game-mode-catalog {
    max-height: calc(100vh - 24px);
    padding: 18px;
    box-shadow: 6px 6px 0 rgba(3, 21, 61, .82);
  }
  .game-mode-list button {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .game-mode-list em {
    grid-column: 2;
    justify-self: start;
  }
}
.room-code-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.room-code-control input {
  border: 1px solid var(--line);
  padding: 10px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
}
.private-lobby {
  display: grid;
  gap: 9px;
  border: 1px solid var(--ink);
  padding: 10px;
  background: var(--panel);
}
.private-lobby span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.private-lobby strong {
  display: block;
  font-size: 20px;
  letter-spacing: .04em;
}
.private-lobby p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.lobby-heading,
.lobby-roster div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lobby-heading small {
  border: 1px solid var(--line);
  padding: 5px 7px;
  color: var(--muted);
  font-weight: 900;
}
.lobby-room-code {
  display: block;
  border: 0;
  border-radius: 4px;
  padding: 2px 4px;
  color: var(--ink);
  background: transparent;
  cursor: copy;
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .04em;
  text-align: left;
}
.lobby-room-code:hover,
.lobby-room-code:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lobby-room-code:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.lobby-roster {
  display: grid;
  gap: 6px;
}
.lobby-roster div {
  border: 1px solid var(--line);
  padding: 9px;
}
.lobby-roster span {
  letter-spacing: 0;
  text-transform: none;
}
.lobby-actions {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.lobby-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.assignment-grid {
  display: grid;
  gap: 8px;
}
.assignment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
}
.assignment-card strong { display: block; }
.assignment-card span { color: var(--muted); font-size: 12px; }
.teach-stack {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
}
.learn-hero {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  background: var(--panel);
}
.learn-hero span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.learn-hero h2 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}
.learn-hero p {
  max-width: 820px;
  color: var(--muted);
  line-height: 1.55;
}
.learn-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.learn-progress-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  padding: 16px;
  background: var(--panel);
}
.learn-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.learn-progress-copy strong {
  font-size: 18px;
}
.learn-progress-copy span {
  color: var(--muted);
  font-weight: 900;
}
.learn-progress-track {
  height: 10px;
  border: 1px solid var(--ink);
  background: var(--panel-soft);
}
.learn-progress-track span {
  display: block;
  height: 100%;
  background: var(--ink);
  transition: width .2s ease;
}
.learn-progress-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.learn-progress-actions button,
.module-actions button,
.review-record button {
  border: 1px solid var(--ink);
  padding: 9px 11px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}
.learn-finish {
  border: 1px solid var(--ink);
  padding: 14px;
  color: var(--paper);
  background: var(--ink);
}
.learn-finish p {
  margin: 6px 0 0;
  color: rgba(var(--paper-rgb), .72);
}
.learn-path {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  grid-column: 1 / -1;
}
.learn-path article {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--panel);
}
.learn-path article span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
}
.learn-path article small { color: var(--muted); line-height: 1.35; }
.learn-layout > .engine,
.learn-module {
  grid-column: 1 / -1;
}
.learn-module {
  display: grid;
  grid-template-columns: minmax(220px, .65fr) minmax(260px, 1.2fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--panel);
}
.module-head {
  display: grid;
  align-content: start;
  gap: 8px;
}
.module-head span {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.theme-card .sound-toggle { grid-column: 1 / -1; background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.25); }
.theme-card .sound-toggle.active { background: var(--paper); color: var(--ink); }

.paper-portfolio-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.paper-sell-all { border: 1px solid #d94b5f; color: #d94b5f; background: transparent; border-radius: 8px; padding: 8px 11px; font-weight: 900; cursor: pointer; }
.paper-sell-all:disabled { opacity: .42; cursor: not-allowed; }
.paper-sell-all-confirm { margin: 14px 0; padding: 14px; display: flex; justify-content: space-between; gap: 16px; align-items: center; border: 1px solid #d94b5f; border-radius: 10px; background: color-mix(in srgb, #d94b5f 8%, var(--panel)); }
.paper-sell-all-confirm div:first-child { display: grid; gap: 4px; }
.paper-sell-all-confirm span { color: var(--muted); font-size: 12px; }
.paper-sell-all-confirm .danger { background: #c92f48; color: white; border-color: #c92f48; }

.achievement-burst { position: fixed; left: 50%; top: 46%; width: 8px; height: 8px; z-index: 10000; pointer-events: none; }
.achievement-burst i { --angle: calc(var(--i) * 30deg); position: absolute; width: 9px; height: 9px; border-radius: 2px; background: hsl(calc(var(--i) * 31) 88% 62%); animation: achievement-pop .9s ease-out forwards; transform: rotate(var(--angle)) translateX(0); }
@keyframes achievement-pop { 70% { opacity: 1; transform: rotate(var(--angle)) translateX(115px) rotate(220deg); } 100% { opacity: 0; transform: rotate(var(--angle)) translateX(145px) rotate(320deg) scale(.2); } }
body[data-theme="gamify"] button:not(:disabled) { transition: transform .14s ease, filter .14s ease, box-shadow .14s ease; }
body[data-theme="gamify"] button:not(:disabled):active { transform: translateY(1px) scale(.97); }
@media (prefers-reduced-motion: reduce) { .achievement-burst { display: none; } }
@media (max-width: 700px) { .paper-sell-all-confirm { align-items: stretch; flex-direction: column; } .paper-portfolio-tools { justify-content: flex-start; } }
.module-head .module-track-tag {
  width: fit-content;
  margin: -2px 0 2px;
  border-left: 3px solid var(--gold);
  padding: 3px 0 3px 8px;
  color: var(--gold);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.module-head p { color: var(--muted); line-height: 1.45; }
.module-details {
  display: grid;
  gap: 8px;
}
.module-details article {
  border: 1px solid var(--line);
  padding: 10px;
  background: var(--panel-soft);
}
.module-details article small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}
.module-terms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  grid-column: 1 / -1;
}
.module-terms article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: var(--panel-soft);
}
.module-terms b { display: block; }
.module-terms small { display: block; color: var(--muted); line-height: 1.35; margin-top: 3px; }
.module-videos {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
}
.quiz-launch {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--ink);
  padding: 14px;
  background: var(--paper);
}
.quiz-launch strong,
.quiz-launch small {
  display: block;
}
.quiz-launch small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}
.quiz-launch button {
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
  cursor: pointer;
}
.quiz-launch.complete {
  border-color: var(--green);
}
.quiz-launch.complete button {
  opacity: .62;
}
.module-quiz {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  border: 1px solid var(--ink);
  padding: 14px;
  background: var(--paper);
}
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.quiz-head strong {
  font-size: 16px;
}
.quiz-head small {
  color: var(--muted);
  font-weight: 800;
}
.module-quiz fieldset {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  margin: 0;
  padding: 12px;
  background: var(--panel-soft);
}
.module-quiz legend {
  padding: 0 6px;
  font-weight: 900;
}
.module-quiz label {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--muted);
  line-height: 1.35;
  cursor: pointer;
}
.module-quiz input {
  margin-top: 2px;
  accent-color: var(--ink);
}
.quiz-feedback {
  margin: 0;
  border: 1px solid var(--line);
  padding: 9px 10px;
  font-weight: 900;
}
.quiz-feedback.pass {
  border-color: var(--green);
}
.quiz-feedback.retry {
  border-color: var(--red);
}
.module-quiz button {
  justify-self: end;
  border: 1px solid var(--ink);
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
  cursor: pointer;
}
.module-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}
.teach-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
}
.teach-card.engine { background: color-mix(in srgb, var(--panel) 78%, var(--ink)); }
.teach-grid {
  display: grid;
  gap: 8px;
}
.teach-grid article {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.teach-grid b, .video-card b { display: block; color: var(--ink); }
.teach-grid span, .video-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}
.engine-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.engine-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.engine-list span { font-weight: 900; }
.video-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.video-card {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: var(--panel-soft);
  text-decoration: none;
}
.video-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.video-card span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choices button { min-height: 50px; background: var(--panel-soft); color: var(--ink); border: 1px solid var(--line); transition: transform .15s ease, border-color .15s ease, background .15s ease; }
body[data-theme="dark"] .choices button,
body[data-theme="dark"] .lessons article,
body[data-theme="dark"] .packs button { background: var(--paper); }
.choices button:hover { border-color: var(--teal); transform: translateY(-1px); }
.choices button.correct { background: rgba(var(--ink-rgb), .15); border-color: var(--green); }
.choices button.wrong { background: rgba(var(--ink-rgb), .14); border-color: var(--red); }
.secondary { background: var(--blue); }
.result {
  width: 100%;
  min-height: 108px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: var(--panel-soft);
  line-height: 1.45;
}
.result strong { display: block; }
.result p { color: var(--muted); margin: 6px 0 0; }
.lower { display: grid; grid-template-columns: 1.15fr .95fr .9fr; gap: 14px; margin-top: 14px; }
.lower > div { padding: 15px; box-shadow: none; background: color-mix(in srgb, var(--panel) 92%, var(--paper)); }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.section-head span { color: var(--teal); font-weight: 800; font-size: 12px; }
.leader-tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.leader-tabs button {
  border: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}
.leader-tabs button.active { background: var(--ink); color: var(--paper); }
body[data-theme="dark"] .leader-tabs button.active { background: var(--ink); color: var(--paper); }
.lessons, .packs, .pack-panel { display: grid; gap: 10px; }
.lessons article { padding: 12px; border-radius: 10px; background: var(--panel-soft); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.lessons span { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lesson-actions span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--ink);
  background: var(--panel);
}
.packs { grid-template-columns: repeat(2, 1fr); }
.pack-panel { max-height: 250px; overflow: auto; padding-right: 2px; }
.pack-card {
  display: grid;
  gap: 4px;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.pack-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.pack-card span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pack-card strong { font-size: 14px; }
.pack-card small, .pack-card em { color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.35; }
.pack-card.compact { min-height: 70px; }
.board { margin: 0; padding-left: 20px; }
.board li { margin: 8px 0; padding-right: 4px; }
.board span { display: inline-block; min-width: 122px; }
.board li.you { color: var(--teal); font-weight: 900; }
.rank-card {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.rank-card strong { color: var(--ink); }
@keyframes surfaceIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 1fr; }
  .panel {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr);
    align-items: start;
  }
  .mode-copy, .mode-surface, .result { grid-column: 1; }
  .choices, #nextBtn { grid-column: 2; }
  .choices { grid-template-columns: repeat(3, 1fr); }
  body.learn-mode .panel { grid-template-columns: minmax(0, 1fr); }
  body.learn-mode .mode-surface,
  body.learn-mode .result,
  body.learn-mode .choices { grid-column: 1; }
  body.learn-mode .choices { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 980px) {
  .welcome-card { grid-template-columns: 1fr; min-height: auto; }
  .welcome-demo { height: 220px; }
  .welcome-actions { justify-content: stretch; flex-wrap: wrap; }
  .welcome-actions button { flex: 1 1 160px; }
  .app { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; overflow: visible; }
  nav { grid-template-columns: repeat(4, 1fr); }
  .workspace, .lower, .topbar { grid-template-columns: 1fr; display: grid; }
  .panel { display: flex; }
  body.learn-mode .panel { display: grid; }
  .learn-layout, .learn-path, .learn-module, .module-terms, .video-list { grid-template-columns: 1fr; }
  .metrics { min-width: 0; }
}

@media (max-width: 620px) {
  .onboarding { padding: 14px; }
  .welcome-card { padding: 20px; }
  .welcome-copy h1 { font-size: 38px; }
  .welcome-copy p { font-size: 16px; }
  .welcome-demo { display: none; }
  main { padding: 16px; }
  nav, .metrics, .choices, .packs { grid-template-columns: 1fr 1fr; }
  body.learn-mode .choices { grid-template-columns: 1fr 1fr; }
  .chart-head, #tickerForm, .market-controls { flex-direction: column; align-items: stretch; }
  input, select { width: 100%; }
  .chart-topbar { align-items: stretch; flex-direction: column; }
  .chart-modes { flex-wrap: nowrap; }
  .chart-toolbar { position: static; margin-top: 8px; justify-content: flex-end; }
  .timeline { grid-template-columns: 1fr; }
}

/* Editorial monochrome system */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    linear-gradient(90deg, rgba(var(--ink-rgb), .035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(var(--ink-rgb), .03) 1px, transparent 1px),
    var(--paper);
  background-size: 72px 72px, 72px 72px, auto;
}

button,
input,
select {
  font-family: inherit;
}

button,
a,
input,
select,
.chart-panel,
.panel,
.lower > div,
.welcome-card,
.round-card,
.mode-surface,
.learn-module,
.video-card,
.pack-card,
.metrics div {
  transition:
    background .18s ease,
    border-color .18s ease,
    color .18s ease,
    box-shadow .18s ease,
    opacity .18s ease,
    transform .18s ease;
}

button:active,
.pack-card:active,
.video-card:active {
  transform: translateY(1px) scale(.99);
}

button:disabled,
input:disabled,
select:disabled {
  opacity: .38;
  filter: grayscale(1);
  cursor: not-allowed;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.scroll-progress {
  position: fixed;
  z-index: 80;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--ink);
}

body.is-loading .scroll-progress {
  animation: editorialLoad 1.45s cubic-bezier(.2, .7, .2, 1) infinite;
  transform: scaleX(0);
}

.toast-region {
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  border: 1px solid var(--ink);
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(var(--paper-rgb), .84);
  box-shadow: 8px 8px 0 var(--ink);
  backdrop-filter: blur(14px);
  animation: toastIn .22s ease both;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.toast.leaving {
  animation: toastOut .18s ease both;
}

.toast.free-play-scope-notice {
  position: fixed;
  z-index: 1;
  left: max(16px, calc(50vw - 260px));
  right: auto;
  bottom: max(16px, calc(16px + env(safe-area-inset-bottom)));
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  pointer-events: auto;
}

.free-play-scope-notice p { margin: 0; }

.free-play-scope-notice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 8px;
}

.free-play-scope-notice label {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}

.free-play-scope-notice input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--gold);
}

.free-play-scope-notice button {
  min-height: 44px;
  border: 1px solid var(--gold);
  padding: 10px 14px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 900;
  cursor: pointer;
}

.toast.toast-feedback-warning {
  position: fixed;
  left: max(16px, calc(50vw - 350px));
  right: auto;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(700px, calc(100vw - 32px));
  border: 2px solid #ba2525;
  border-radius: 12px;
  color: #521414;
  background: #fff0f0;
  box-shadow: 0 12px 35px rgba(88, 12, 12, .22);
  text-align: center;
}

.feedback-warning-icon {
  flex: 0 0 25px;
  display: grid;
  height: 25px;
  place-items: center;
  clip-path: polygon(50% 0, 100% 92%, 93% 100%, 7% 100%, 0 92%);
  color: #1b1700;
  background: #f5c542;
  font-size: 17px;
  font-weight: 1000;
}

.cache-status {
  position: fixed;
  z-index: 35;
  left: 270px;
  bottom: 14px;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(var(--paper-rgb), .82);
  backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.cache-status.offline {
  border-style: dashed;
  color: var(--ink);
}

.onboarding,
.round-modal {
  background: rgba(var(--paper-rgb), .86);
  backdrop-filter: blur(18px);
}

.welcome-card,
.round-card {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 18px 18px 0 var(--ink);
}

.welcome-card {
  min-height: 620px;
  grid-template-columns: 1.08fr .92fr;
  padding: clamp(24px, 4vw, 52px);
}

@media (max-width: 980px) {
  .welcome-card {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .welcome-card { padding: 20px; }
}

.welcome-kicker,
.round-kicker,
.eyebrow,
.chart-head small,
.learn-hero span,
.module-head span,
.pack-card span,
.video-card span,
.theme-card span,
.section-head span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.welcome-copy h1,
.topbar h1,
.learn-hero h2,
.round-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

.welcome-copy h1 {
  max-width: 620px;
  font-size: clamp(56px, 8vw, 108px);
  line-height: .86;
}

.welcome-copy p,
.round-card p,
.learn-hero p,
.module-head p,
.mode-copy,
.result p {
  color: var(--muted);
}

.welcome-points span,
.lesson-actions span {
  border-radius: 0;
  border-color: var(--ink);
  background: var(--paper);
}

.welcome-demo {
  border-color: var(--ink);
  border-radius: 0;
  background: var(--chart-bg);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.welcome-demo::before {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  opacity: 1;
}

.demo-bar,
.demo-bar.down {
  border-radius: 0;
  border: 1px solid var(--ink);
  background: var(--ink);
}

.demo-bar.up,
.demo-bar.up.tall,
.demo-bar.up.mid {
  background: var(--paper);
}

.demo-mask {
  border-left: 1px dashed var(--ink);
  color: var(--ink);
  background: rgba(var(--paper-rgb), .84);
  backdrop-filter: blur(8px);
}

.welcome-actions button,
.round-actions button,
#tickerForm button,
.choices button,
.secondary,
.packs button,
.mode-actions button,
.mini-button,
.mode-tabs button,
.leader-tabs button,
.theme-card button,
.timeframes > button,
.chart-modes button,
.chart-toolbar button {
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: none;
  cursor: pointer;
  font-weight: 900;
}

.welcome-actions button:first-child,
.round-actions button,
#tickerForm button,
.secondary,
.leader-tabs button.active,
.theme-options button.active,
.mode-tabs button.active,
.timeframes > button.active,
.chart-modes button.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.welcome-actions button:hover,
.round-actions button:hover,
#tickerForm button:hover,
.choices button:hover,
.secondary:hover,
.packs button:hover,
.mode-actions button:hover,
.mini-button:hover,
.mode-tabs button:hover,
.leader-tabs button:hover,
.theme-card button:hover,
.timeframes > button:hover,
.chart-modes button:hover,
.chart-toolbar button:hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.app {
  grid-template-columns: 264px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  min-height: 100vh;
  height: 100vh;
  border-right: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.brand {
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(var(--paper-rgb), .3);
}

.brand > span:last-child {
  min-width: 0;
}

.brand strong {
  display: block;
  font-size: 26px;
  line-height: .95;
  font-weight: 400;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mark {
  width: 46px;
  height: 46px;
  border: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: currentColor;
  font-size: 25px;
  font-weight: 400;
}

.brand small,
.account small,
.theme-card span {
  color: rgba(var(--paper-rgb), .68);
}

nav {
  gap: 2px;
}

.nav {
  position: relative;
  border-radius: 0;
  color: rgba(var(--paper-rgb), .7);
  font-size: 17px;
  background: transparent;
}

.nav:hover,
.nav.active {
  color: var(--paper);
  background: transparent;
  box-shadow: none;
}

.theme-card,
.account {
  border-radius: 0;
  border: 1px solid rgba(var(--paper-rgb), .34);
  background: transparent;
}

.xp {
  border-radius: 0;
  height: 2px;
  background: rgba(var(--paper-rgb), .24);
}

.xp span {
  background: var(--paper);
}

main {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 0 24px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  margin: 0 -24px 18px;
  padding: 18px 24px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(var(--paper-rgb), .84);
  backdrop-filter: blur(18px);
}

.breadcrumb {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: clamp(48px, 6vw, 96px);
  line-height: .84;
}

.metrics {
  min-width: 400px;
}

.metrics div {
  border-radius: 0;
  border-color: var(--ink);
  background: var(--panel);
}

.metrics div:hover,
.chart-panel:hover,
.panel:hover,
.lower > div:hover {
  transform: translateY(-1px);
  box-shadow: 7px 7px 0 var(--ink);
}

.metrics strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
}

.workspace {
  grid-template-columns: minmax(640px, 1fr) 336px;
}

.chart-panel,
.panel,
.lower > div,
.mode-surface,
.result,
.learn-hero,
.learn-path article,
.learn-module,
.teach-card,
.module-terms article,
.video-card,
.lessons article,
.pack-card,
.assignment-card,
.rank-card {
  border-radius: 0;
  border-color: var(--ink);
  background: var(--panel);
  box-shadow: none;
}

.chart-panel,
.panel,
.lower > div {
  border-width: 1px;
}

.chart-head {
  border-bottom-color: var(--ink);
}

h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.chart-head h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.chart-head .chart-ticker,
.chart-head .chart-company-name {
  display: block;
}

.chart-head .chart-ticker {
  font-size: 2.5rem;
}

.chart-head .chart-loading-label {
  font-size: .65em;
}

/* Preserve punctuation width and accessible text while the visible dots hop. */
.loading-word {
  white-space: nowrap;
  font: inherit;
}

.loading-dots {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  color: inherit;
  font: inherit;
}

.loading-dots > i {
  opacity: 0;
  font: inherit;
}

.loading-dots::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, currentColor 50%, transparent 60%),
    radial-gradient(circle, currentColor 50%, transparent 60%),
    radial-gradient(circle, currentColor 50%, transparent 60%);
  background-size: .14em .14em;
  background-repeat: no-repeat;
  animation: loading-dots-hop 1.2s ease-in-out infinite;
}

@keyframes loading-dots-hop {
  0%, 60%, 100% { background-position: 10% 82%, 50% 82%, 90% 82%; }
  15% { background-position: 10% 58%, 50% 82%, 90% 82%; }
  30% { background-position: 10% 82%, 50% 58%, 90% 82%; }
  45% { background-position: 10% 82%, 50% 82%, 90% 58%; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-dots > i { opacity: 1; }
  .loading-dots::after { display: none; animation: none; }
}

.chart-head .chart-company-name {
  font-size: 1rem;
}

input,
select {
  width: 126px;
  border-radius: 0;
  border-color: var(--ink);
  color: var(--ink);
  background: var(--paper);
}

select {
  width: 180px;
}

input.valid {
  box-shadow: inset 0 -3px 0 var(--ink);
}

input.invalid {
  border-style: dashed;
  box-shadow: inset 0 -3px 0 var(--ink);
}

.suggestions {
  border-radius: 0;
  border-color: var(--ink);
  box-shadow: none;
}

.suggestion {
  border-radius: 0;
}

.suggestion:hover,
.suggestion.active {
  color: var(--paper);
  background: var(--ink);
}

.suggestion:hover span,
.suggestion:hover small,
.suggestion.active span,
.suggestion.active small {
  color: var(--paper);
}

.suggestion small {
  color: var(--ink);
}

.symbol-status {
  color: var(--muted);
}

.symbol-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border: 1px solid var(--ink);
  vertical-align: 1px;
}

.symbol-status.loading::before {
  animation: dotSpin .8s linear infinite;
}

.symbol-status.error {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.chart-shell {
  isolation: isolate;
}

.chart-topbar {
  border-radius: 0;
  border-color: var(--ink);
  background: var(--paper);
}

.chart-modes::-webkit-scrollbar-thumb {
  background: var(--ink);
}

.timeframes,
.chart-modes {
  gap: 4px;
}

.timeframes > button,
.chart-modes button {
  border-color: var(--line);
  color: var(--muted);
  letter-spacing: .05em;
}

.timeframes > button.active,
.chart-modes button.active {
  box-shadow: none;
  color: var(--paper);
  background: var(--ink);
}

canvas {
  border-radius: 0;
  border-color: var(--ink);
  background: var(--chart-bg);
}

.chart-topbar + .chart-toolbar + canvas,
.chart-topbar + .chart-toolbar + canvas#chart {
  border-radius: 0;
}

.chart-toolbar {
  top: 54px;
}

.chart-toolbar button {
  min-width: 36px;
  background: rgba(var(--paper-rgb), .88);
  backdrop-filter: blur(10px);
}

.chart-tip,
.axis-label {
  border-radius: 0;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: rgba(var(--paper-rgb), .9);
  box-shadow: 7px 7px 0 var(--ink);
  backdrop-filter: blur(12px);
}

.chart-loading {
  position: absolute;
  inset: 44px 0 0;
  z-index: 6;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 38px;
  border: 1px solid var(--ink);
  background: rgba(var(--paper-rgb), .9);
  backdrop-filter: blur(10px);
}

.chart-loading.hidden {
  display: none;
}

.skeleton-line,
.skeleton-grid span {
  display: block;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(var(--ink-rgb), .05), rgba(var(--ink-rgb), .19), rgba(var(--ink-rgb), .05));
  background-size: 220% 100%;
  animation: skeletonPulse 1.25s linear infinite;
}

.skeleton-line {
  width: 72%;
  height: 22px;
}

.skeleton-line.wide {
  width: 88%;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 14px;
  height: 190px;
}

.skeleton-grid span:nth-child(1) { height: 36%; }
.skeleton-grid span:nth-child(2) { height: 68%; }
.skeleton-grid span:nth-child(3) { height: 48%; }
.skeleton-grid span:nth-child(4) { height: 82%; }
.skeleton-grid span:nth-child(5) { height: 54%; }
.skeleton-grid span:nth-child(6) { height: 72%; }

.chart-loading strong {
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.timeline {
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

#revealTag,
.timer {
  color: var(--ink);
}

.mode-surface {
  background: var(--panel-soft);
}

.mode-row strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 400;
}

.mode-row span,
.mode-list small,
.assignment-card span,
.pack-card small,
.pack-card em,
.board,
.rank-card,
.module-terms small,
.video-card small {
  color: var(--muted);
}

.mode-list li {
  border-bottom-color: var(--line);
}

.learn-hero {
  padding: clamp(22px, 4vw, 48px);
}

.learn-hero h2 {
  max-width: 900px;
  font-size: clamp(48px, 7vw, 98px);
  line-height: .86;
}

.learn-path {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.learn-path article span {
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--paper);
  background: var(--ink);
}

.module-head span {
  border-radius: 0;
}

.teach-card.engine {
  background: repeating-linear-gradient(
    135deg,
    var(--panel),
    var(--panel) 10px,
    var(--panel-soft) 10px,
    var(--panel-soft) 20px
  );
}

.engine-list li {
  border-top-color: var(--ink);
}

.video-card {
  position: relative;
  overflow: hidden;
}

.video-card::after,
.pack-card::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 7px;
  height: 1px;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--ink);
  transition: transform .18s ease;
}

.video-card:hover,
.pack-card:hover,
.module-terms article:hover,
.learn-path article:hover,
.lessons article:hover,
.assignment-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.video-card:hover::after,
.pack-card:hover::after {
  transform: scaleX(1);
}

.video-card span,
.pack-card span {
  color: var(--ink);
}

.choices button {
  min-height: 56px;
  background: var(--paper);
  color: var(--ink);
}

.choices button:disabled {
  cursor: default;
  opacity: .86;
  transform: none;
}

.choices button.selected {
  outline: 3px solid color-mix(in srgb, var(--teal) 48%, transparent);
  outline-offset: 2px;
}

.choices button.correct {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
}

.choices button.wrong {
  background: var(--paper);
  color: var(--ink);
  border-style: dashed;
}

body[data-theme="dark"] .choices button,
body[data-theme="dark"] .lessons article,
body[data-theme="dark"] .packs button {
  background: var(--paper);
}

.lower > div {
  background: var(--panel);
}

.leader-tabs {
  border-radius: 0;
  border-color: var(--ink);
}

.leader-tabs button.active,
body[data-theme="dark"] .leader-tabs button.active {
  color: var(--paper);
  background: var(--ink);
}

.packs {
  gap: 12px;
}

.pack-card {
  position: relative;
  background: var(--paper);
}

.pack-card.compact {
  min-height: 76px;
}

.board li {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.board li.you {
  color: var(--ink);
  font-weight: 900;
}

.rank-card {
  border-width: 1px 0 0;
}

body.learn-mode .choices {
  position: sticky;
  bottom: 18px;
  z-index: 10;
  padding: 10px;
  border: 1px solid var(--ink);
  background: rgba(var(--paper-rgb), .9);
  backdrop-filter: blur(12px);
}

body.panel-staged .workspace {
  opacity: .4;
  filter: grayscale(1);
}

@keyframes skeletonPulse {
  from { background-position: 220% 0; }
  to { background-position: -220% 0; }
}

@keyframes editorialLoad {
  0% { transform: scaleX(0); opacity: .45; }
  72% { transform: scaleX(.86); opacity: 1; }
  100% { transform: scaleX(1); opacity: .25; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(.98); }
}

@keyframes dotSpin {
  0% { transform: rotate(0deg); border-style: solid; }
  50% { transform: rotate(180deg); border-style: dashed; }
  100% { transform: rotate(360deg); border-style: solid; }
}

@media (max-width: 1320px) {
  .learn-path {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    min-height: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .cache-status {
    left: 14px;
  }

  .topbar {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .metrics {
    min-width: 0;
  }

  .learn-path {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .welcome-copy h1,
  .learn-hero h2 {
    font-size: 48px;
  }

  .topbar h1 {
    font-size: 54px;
  }

  .toast-region {
    right: 14px;
    bottom: 58px;
  }

  .cache-status {
    right: 14px;
  }

  .learn-path,
  .skeleton-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Trading workstation upgrade */
:root {
  --chart-up: #16a34a;
  --chart-down: #dc2626;
  --chart-volume-up: rgba(22, 163, 74, .24);
  --chart-volume-down: rgba(220, 38, 38, .25);
  --chart-line-color: #2563eb;
  --chart-drawing: #2962ff;
  --chart-measure: #f59e0b;
  --chart-sma: #7c3aed;
  --chart-ema: #ea580c;
  --chart-bb: #0891b2;
  --chart-bb-fill: rgba(8, 145, 178, .08);
  --chart-fib: #9333ea;
  --chart-zone: rgba(41, 98, 255, .08);
  --chart-profit-zone: rgba(22, 163, 74, .14);
  --chart-risk-zone: rgba(220, 38, 38, .12);
}

body[data-theme="dark"] {
  --chart-bg: #050505;
  --chart-up: #22c55e;
  --chart-down: #ef4444;
  --chart-volume-up: rgba(34, 197, 94, .24);
  --chart-volume-down: rgba(239, 68, 68, .26);
  --chart-line-color: #60a5fa;
  --chart-drawing: #60a5fa;
  --chart-measure: #fbbf24;
  --chart-sma: #c084fc;
  --chart-ema: #fb923c;
  --chart-bb: #22d3ee;
  --chart-bb-fill: rgba(34, 211, 238, .08);
  --chart-fib: #d8b4fe;
  --chart-zone: rgba(96, 165, 250, .12);
  --chart-profit-zone: rgba(34, 197, 94, .16);
  --chart-risk-zone: rgba(239, 68, 68, .14);
}

button.account {
  width: 100%;
  text-align: left;
  color: var(--paper);
  font: inherit;
  cursor: pointer;
}

button.account:hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 rgba(var(--paper-rgb), .42);
}

.level-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(var(--paper-rgb), .84);
  backdrop-filter: blur(18px);
}

.level-modal.hidden {
  display: none;
}

.level-card {
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--ink);
  padding: clamp(18px, 3vw, 34px);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 18px 18px 0 var(--ink);
}

.level-head,
.level-current,
.level-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.level-head span {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.level-head button {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 900;
  cursor: pointer;
}

.level-card h2 {
  max-width: 760px;
  margin: 18px 0 8px;
  font-size: clamp(42px, 6vw, 80px);
  line-height: .88;
}

.level-card p,
.level-current span,
.level-list small,
.level-list em {
  color: var(--muted);
}

.level-current {
  margin: 18px 0;
  border: 1px solid var(--ink);
  padding: 14px;
  background: var(--panel-soft);
}

.level-current strong {
  font-size: 22px;
  font-weight: 400;
}

.level-list {
  display: grid;
  gap: 18px;
}

.rank-tier-group {
  --tier-color: var(--ink);
  display: grid;
  gap: 8px;
  scroll-margin-top: 18px;
}

.rank-tier-group > header {
  position: sticky;
  z-index: 2;
  top: -1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--tier-color) 75%, var(--ink));
  padding: 10px 12px;
  background: color-mix(in srgb, var(--tier-color) 16%, var(--panel));
  box-shadow: inset 5px 0 0 var(--tier-color);
}

.rank-tier-group > header div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rank-tier-group > header strong {
  font-size: 18px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rank-tier-group > header small {
  color: var(--muted);
  font-weight: 800;
}

.tier-medallion {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--tier-color) 72%, var(--ink));
  border-radius: 50%;
  background: var(--tier-color);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .28);
}

.rank-tier-levels {
  display: grid;
  gap: 8px;
}

.level-list article {
  border: 1px solid var(--line);
  padding: 10px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--tier-color) 8%, transparent), transparent 28%),
    var(--panel);
}

.level-list article.unlocked {
  border-color: color-mix(in srgb, var(--tier-color) 72%, var(--ink));
  box-shadow: inset 4px 0 0 var(--tier-color);
}

.level-list article.current {
  outline: 2px solid var(--tier-color);
  outline-offset: 2px;
}

.level-list article > span {
  width: 46px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--tier-color) 70%, var(--ink));
  color: #fff;
  background: color-mix(in srgb, var(--tier-color) 80%, var(--ink));
  font-weight: 900;
}

.level-list article div {
  flex: 1;
}

.level-list article strong,
.level-list article small {
  display: block;
}

.level-list em {
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.tier-copper { --tier-color: #b87333; }
.tier-bronze { --tier-color: #8f5b34; }
.tier-silver { --tier-color: #8b99a6; }
.tier-diamond { --tier-color: #31a7c4; }
.tier-platinum { --tier-color: #7167d8; }
.tier-legendary { --tier-color: #e08a24; }

.level-current[class*="tier-"] {
  border-color: var(--tier-color);
  box-shadow: inset 5px 0 0 var(--tier-color);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--tier-color) 14%, transparent), transparent 48%),
    var(--panel-soft);
}

.chart-topbar {
  flex-wrap: wrap;
  align-items: stretch;
}

.primary-timeframes,
.advanced-intervals,
.chart-modes {
  min-width: 0;
}

.primary-timeframes {
  flex: 1 1 420px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chart-modes {
  flex: 0 1 auto;
}

.advanced-intervals {
  display: flex;
  gap: 4px;
  border: 1px solid var(--ink);
  border-top: 0;
  padding: 7px;
  background: var(--paper);
  overflow-x: auto;
}

.advanced-intervals[hidden] {
  display: none;
}

.advanced-intervals button,
.drawing-rail button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
}

.advanced-intervals button.active,
.drawing-rail button.active,
#advancedToggle.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.chart-stage {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: stretch;
}

.drawing-rail {
  display: grid;
  align-content: start;
  gap: 5px;
  border: 1px solid var(--ink);
  border-right: 0;
  padding: 7px;
  background: var(--paper);
  max-height: 560px;
  overflow-y: auto;
}

.drawing-rail button {
  min-height: 32px;
  padding: 6px 4px;
}

.chart-canvas-wrap {
  position: relative;
  min-width: 0;
}

.chart-toolbar {
  top: 9px;
  right: 9px;
}

.chart-loading {
  inset: 0;
}

.chart-tip {
  border-color: var(--chart-line-color);
}

.axis-label {
  background: var(--chart-line-color);
  color: white;
}

canvas {
  border-left: 1px solid var(--ink);
}

@media (max-width: 980px) {
  .chart-stage {
    grid-template-columns: 1fr;
  }

  .drawing-rail {
    grid-template-columns: repeat(8, minmax(62px, 1fr));
    border-right: 1px solid var(--ink);
    border-bottom: 0;
    max-height: none;
    overflow-x: auto;
  }

  .level-head,
  .level-current,
  .level-list article {
    align-items: flex-start;
    flex-direction: column;
  }

  .level-list em {
    text-align: left;
  }
}

/* Interaction cleanup pass */
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.workspace {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  min-height: calc(100vh - 168px);
}

.chart-panel {
  display: flex;
  flex-direction: column;
  min-height: min(760px, calc(100vh - 150px));
}

.chart-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.chart-stage {
  flex: 1;
  min-height: min(640px, calc(100vh - 320px));
}

.chart-canvas-wrap {
  display: flex;
  min-height: 0;
}

canvas#chart {
  width: 100%;
  /* Keep layout independent of the backing bitmap, which redraws resize for DPR. */
  height: min(640px, calc(100vh - 320px));
  min-height: 420px;
  max-height: calc(100vh - 310px);
  aspect-ratio: auto;
  image-rendering: auto;
}

.drawing-rail {
  max-height: none;
  overflow-y: visible;
}

.drawing-rail button {
  min-height: 28px;
  padding-block: 4px;
}

.symbol-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.timeline {
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, .8fr) auto;
  align-items: center;
}

#chartCitation {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choices button.correct,
body[data-theme="dark"] .choices button.correct {
  color: #ffffff;
  background: #16a34a;
  border-color: #15803d;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.28), 5px 5px 0 rgba(21, 128, 61, .35);
}

.choices button.wrong,
body[data-theme="dark"] .choices button.wrong {
  color: #ffffff;
  background: #dc2626;
  border-color: #b91c1c;
  border-style: solid;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.24);
}

.learn-path button {
  display: grid;
  gap: 8px;
  align-content: start;
  width: 100%;
  min-height: 178px;
  border: 1px solid var(--line);
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.learn-path button span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
  font-weight: 900;
}
.learn-path button.complete {
  border-color: var(--ink);
  background: var(--panel-soft);
}
.learn-path button.complete span {
  color: var(--ink);
  background: var(--paper);
}

.learn-path button strong {
  font-size: 16px;
  line-height: 1.1;
}

.learn-path button small {
  color: var(--muted);
  line-height: 1.35;
}

.learn-path button:hover,
.learn-path button:focus-visible {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.review-chart-prompt {
  display: none;
}

body.review-mode .review-awaiting-puzzle .review-chart-prompt {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--navy);
  font-size: clamp(16px, 2vw, 22px);
  text-align: center;
}

.review-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 14px;
  background: var(--panel);
}
.review-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
}
.review-stat-card {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 147px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel-soft);
  cursor: pointer;
  text-align: left;
}
.review-stat-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.review-stat-card.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.review-stat-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.review-stat-card > strong {
  color: var(--ink);
  font-size: clamp(28px, 3vw, 40px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.review-stat-card > small,
.review-stat-card > p {
  color: var(--muted);
  line-height: 1.35;
}
.review-stat-card > small {
  font-weight: 800;
}
.review-stat-card > p {
  align-self: end;
  margin: 4px 0 0;
  font-size: 11px;
}
.review-stat-detail {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(16px, 2.5vw, 24px);
  background: var(--panel-soft);
}
.review-stat-detail-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}
.review-stat-detail-head > div:first-child {
  min-width: 0;
}
.review-stat-detail-head span,
.review-week-heading span,
.review-week-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.review-stat-detail-head h4 {
  margin: 3px 0 5px;
  color: var(--ink);
  font-size: clamp(20px, 2.4vw, 28px);
}
.review-stat-detail-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.review-stat-detail-highlight {
  flex: 0 0 auto;
  display: grid;
  gap: 4px;
  min-width: 120px;
  text-align: right;
}
.review-stat-detail-highlight strong {
  color: var(--ink);
  font-size: clamp(30px, 4vw, 44px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.review-stat-detail-highlight small {
  color: var(--muted);
  font-weight: 800;
}
.review-week-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px;
  scrollbar-width: thin;
}
.review-week-picker button {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.review-week-picker button.active {
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
}
.review-pattern-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.review-mode-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.review-mode-picker button {
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 800;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.review-mode-picker button.active {
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
}
.review-mode-detail .review-week-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.review-pattern-picker button {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  color: #fff;
  background: var(--review-pattern-fill, var(--panel));
  background-size: 140% 140%;
  animation: review-pattern-color-drift 6s ease-in-out infinite alternate;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .65);
  cursor: pointer;
  text-align: left;
}
/* Match the prediction hover palettes without moving the Review controls. */
.review-pattern-picker button[data-review-pattern="Up"] {
  --review-pattern-fill:
    radial-gradient(circle at 50% 110%, rgba(203, 255, 223, .82), transparent 52%),
    linear-gradient(145deg, #27e879, #07934e 56%, #056237);
}
.review-pattern-picker button[data-review-pattern="Down"] {
  --review-pattern-fill:
    radial-gradient(ellipse at 50% 0, rgba(255, 220, 226, .92), transparent 58%),
    linear-gradient(180deg, #ff6680, #e11d48 52%, #9f1239);
  animation-delay: -1s;
}
.review-pattern-picker button[data-review-pattern="Sideways"] {
  --review-pattern-fill:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, #18c8e4, #1684df 58%, #3158c8);
  animation-delay: -2s;
}
.review-pattern-picker button[data-review-pattern="Breakout"] {
  --review-pattern-fill:
    radial-gradient(circle at 30% 95%, rgba(255, 247, 179, .94), transparent 38%),
    linear-gradient(145deg, #ffbd3f, #f97316 58%, #d94a08);
  animation-delay: -3s;
}
.review-pattern-picker button[data-review-pattern="Reversal"] {
  --review-pattern-fill:
    radial-gradient(circle at 50% 50%, rgba(255, 238, 140, .32), transparent 34%),
    linear-gradient(135deg, #7949e8, #d94fc8 52%, #5c43d7);
  animation-delay: -4s;
}
.review-pattern-picker button[data-review-pattern="Volatility spike"] {
  --review-pattern-fill:
    radial-gradient(circle at 50% 50%, rgba(255, 245, 113, .5), transparent 38%),
    linear-gradient(135deg, #ffba28, #ff4f76 54%, #ba2bd4);
  animation-delay: -5s;
}
.review-pattern-picker button:hover,
.review-pattern-picker button:focus-visible,
.review-pattern-picker button.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.review-pattern-picker button.active {
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px #fff;
}
@keyframes review-pattern-color-drift {
  from { background-position: 0% 30%; }
  to { background-position: 100% 70%; }
}
@media (prefers-reduced-motion: reduce) {
  .review-pattern-picker button {
    animation: none;
    background-position: 50% 50%;
  }
}
.review-pattern-picker button span {
  overflow-wrap: anywhere;
  font-weight: 900;
}
.review-pattern-picker button small {
  color: inherit;
  line-height: 1.3;
}
.review-pattern-picker button.active small {
  color: inherit;
  opacity: 1;
}
.review-pattern-heading {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.review-pattern-heading > div {
  display: grid;
  gap: 3px;
}
.review-pattern-heading span,
.review-pattern-insight > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.review-pattern-heading strong {
  color: var(--ink);
  font-size: 20px;
}
.review-pattern-heading > small {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}
.review-pattern-insight {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: baseline;
  border-left: 4px solid var(--ink);
  padding: 10px 12px;
  background: var(--panel);
}
.review-pattern-insight > span {
  grid-column: 1 / -1;
}
.review-pattern-insight strong {
  color: var(--ink);
}
.review-pattern-insight p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}
.review-week-heading {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.review-week-heading strong {
  color: var(--ink);
}
.review-week-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.review-week-metrics > div {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  background: var(--panel);
}
.review-week-metrics strong {
  color: var(--ink);
  font-size: clamp(22px, 3vw, 32px);
  font-variant-numeric: tabular-nums;
}
.review-week-metrics > [data-review-count="correct"] {
  background: color-mix(in srgb, var(--green) 14%, var(--panel));
}
.review-week-metrics > [data-review-count="missed"] {
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
}
.review-records {
  display: grid;
  gap: 10px;
}
.review-record {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  padding: 12px;
  background: var(--panel-soft);
}
.review-record span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.review-record small {
  color: var(--muted);
  line-height: 1.4;
}
.review-record.missed {
  border-color: var(--ink);
}
.review-record.group {
  background: var(--panel);
}

body.learn-mode .choices {
  position: static;
  bottom: auto;
  z-index: auto;
  margin-top: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.lessons article strong {
  display: block;
  margin-bottom: 6px;
}

.lessons .lesson-actions {
  margin-block: 10px;
}

@media (max-height: 760px) and (min-width: 981px) {
  .drawing-rail {
    overflow-y: auto;
  }

  canvas#chart {
    min-height: 360px;
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .chart-panel {
    min-height: auto;
  }

  .chart-stage {
    min-height: auto;
  }

  canvas#chart {
    height: min(64vh, 560px);
    min-height: 360px;
  }

  .drawing-rail {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .timeline {
    grid-template-columns: 1fr;
  }

}

.cache-status[hidden] {
  display: none;
}

.scenario-library-panel {
  display: none;
}

body.packs-mode .scenario-library-panel {
  display: block;
}

.lower {
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .9fr);
}

body.packs-mode .lower {
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .95fr) minmax(260px, .9fr);
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.plan-actions button {
  border: 1px solid var(--ink);
  padding: 8px 10px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
}

.plan-actions button:hover,
.plan-actions button:focus-visible {
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-1px);
  box-shadow: 4px 4px 0 var(--ink);
}

@media (max-width: 980px) {
  .lower,
  body.packs-mode .lower {
    grid-template-columns: 1fr;
  }
}

/* Whole-screen appearance + About mode */
body[data-theme="light"] {
  color-scheme: light;
}

body[data-theme="dark"] {
  color-scheme: dark;
}

html,
body,
.app,
main,
.rail {
  background: var(--paper);
  color: var(--ink);
}

.rail {
  border-right: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.brand {
  border-bottom-color: var(--line);
}

.brand small,
.account small,
.theme-card span,
.nav {
  color: var(--muted);
}

.mark {
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
}

.nav:hover,
.nav.active {
  color: var(--ink);
  background: var(--panel-soft);
}

.theme-card,
.account {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel);
}

button.account {
  color: var(--ink);
}

button.account:hover {
  box-shadow: 5px 5px 0 var(--ink);
}

.theme-options button {
  border-color: #000;
  font-size: 13px;
  font-weight: 900;
}

.theme-options button[data-theme-choice="light"] {
  color: #000;
  background: #fff;
}

.theme-options button[data-theme-choice="dark"] {
  color: #fff;
  background: #000;
}

body[data-theme="dark"] .theme-options button {
  border-color: #fff;
}

.theme-options button.active,
body[data-theme="dark"] .theme-options button.active {
  border-width: 3px;
  font-weight: 1000;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--paper), 4px 4px 0 var(--ink);
}

.xp {
  background: var(--line);
}

.xp span {
  background: var(--ink);
}

.topbar,
.toast,
.chart-loading,
.chart-tip,
.axis-label,
.round-card,
.level-card,
.welcome-card {
  color: var(--ink);
  background: rgba(var(--paper-rgb), .92);
}

.round-modal,
.level-modal,
.onboarding {
  background: rgba(var(--paper-rgb), .88);
}

body.about-mode .workspace,
body.privacy-mode .workspace,
body.terms-mode .workspace,
body.support-mode .workspace,
body.suggestions-mode .workspace,
body.account-mode .workspace,
body.socials-mode .workspace {
  grid-template-columns: 1fr;
}

body.about-mode .chart-panel,
body.privacy-mode .chart-panel,
body.terms-mode .chart-panel,
body.support-mode .chart-panel,
body.suggestions-mode .chart-panel,
body.account-mode .chart-panel,
body.socials-mode .chart-panel,
body.about-mode .lower,
body.privacy-mode .lower,
body.terms-mode .lower,
body.support-mode .lower,
body.suggestions-mode .lower,
body.account-mode .lower,
body.socials-mode .lower,
body.about-mode .mode-copy,
body.privacy-mode .mode-copy,
body.terms-mode .mode-copy,
body.support-mode .mode-copy,
body.suggestions-mode .mode-copy,
body.account-mode .mode-copy,
body.socials-mode .mode-copy,
body.about-mode #nextBtn,
body.privacy-mode #nextBtn,
body.terms-mode #nextBtn,
body.support-mode #nextBtn,
body.suggestions-mode #nextBtn,
body.account-mode #nextBtn,
body.socials-mode #nextBtn,
body.about-mode .choices {
  display: none;
}

body.privacy-mode .choices,
body.terms-mode .choices,
body.support-mode .choices,
body.suggestions-mode .choices,
body.account-mode .choices,
body.socials-mode .choices,
body.about-mode .result,
body.privacy-mode .result,
body.terms-mode .result,
body.support-mode .result,
body.suggestions-mode .result,
body.account-mode .result,
body.socials-mode .result {
  display: none;
}

body.about-mode .panel,
body.privacy-mode .panel,
body.terms-mode .panel,
body.support-mode .panel,
body.suggestions-mode .panel,
body.account-mode .panel,
body.socials-mode .panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.about-mode .mode-surface,
body.privacy-mode .mode-surface,
body.terms-mode .mode-surface,
body.support-mode .mode-surface,
body.suggestions-mode .mode-surface,
body.account-mode .mode-surface,
body.socials-mode .mode-surface {
  padding: 0;
  border: 0;
  background: transparent;
}

.about-hero {
  display: grid;
  gap: 18px;
  border: 1px solid var(--ink);
  padding: clamp(24px, 5vw, 58px);
  background: var(--panel);
}

.about-hero span,
.about-grid article span {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.about-hero h2 {
  max-width: 980px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(54px, 9vw, 132px);
  font-weight: 400;
  line-height: .84;
}

.about-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.about-grid article,
.about-stack > div {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 16px;
  background: var(--panel);
}

.about-grid article strong,
.about-stack strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}

.about-grid article p,
.about-stack p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.about-stack {
  display: grid;
  gap: 12px;
}

.about-socials {
  display:grid;
  gap:22px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:24px;
  padding:clamp(24px,4vw,44px);
  background:
    radial-gradient(circle at 90% 0,color-mix(in srgb,var(--teal) 16%,transparent),transparent 24rem),
    linear-gradient(145deg,var(--panel),color-mix(in srgb,var(--panel) 91%,var(--rail-bg)));
  box-shadow:var(--shadow);
}

.about-socials > header {
  display:grid;
  grid-template-columns:minmax(260px,.8fr) minmax(280px,1fr);
  gap:24px;
  align-items:end;
}

.about-socials > header span {
  color:var(--teal);
  font-size:10px;
  font-weight:950;
  letter-spacing:.16em;
  text-transform:uppercase;
}

.about-socials > header h3 {
  margin:6px 0 0;
  font-family:Georgia,"Times New Roman",serif;
  font-size:clamp(36px,5vw,62px);
  font-weight:400;
  letter-spacing:-.04em;
  line-height:.95;
}

.about-socials > header p { margin:0;color:var(--muted);line-height:1.6; }
.about-social-grid { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px; }

.about-social-link {
  --social-accent:var(--teal);
  position:relative;
  display:grid;
  grid-template-columns:52px minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  min-width:0;
  border:1px solid color-mix(in srgb,var(--social-accent) 28%,var(--line));
  border-radius:16px;
  padding:13px;
  color:var(--ink);
  background:linear-gradient(135deg,color-mix(in srgb,var(--social-accent) 9%,var(--panel)),var(--panel));
  text-decoration:none;
  transition:transform 170ms ease,border-color 170ms ease,box-shadow 170ms ease;
}

.about-social-link:hover,.about-social-link:focus-visible {
  border-color:color-mix(in srgb,var(--social-accent) 68%,var(--line));
  box-shadow:0 14px 32px color-mix(in srgb,var(--social-accent) 14%,transparent);
  transform:translateY(-3px);
}

.about-social-link:focus-visible { outline:2px solid var(--social-accent);outline-offset:3px; }
.about-social-icon { display:grid;width:52px;height:52px;place-items:center;border-radius:14px;color:#fff;background:linear-gradient(145deg,color-mix(in srgb,var(--social-accent) 82%,#fff),var(--social-accent));box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 10px 22px color-mix(in srgb,var(--social-accent) 18%,transparent); }
.about-social-icon svg { width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round; }
.about-social-icon .social-icon-fill { fill:currentColor;stroke:none; }
.about-social-link > span:nth-child(2) { display:grid;min-width:0;gap:3px; }
.about-social-link strong { overflow:hidden;font-size:13px;text-overflow:ellipsis;white-space:nowrap; }
.about-social-link small { overflow:hidden;color:var(--muted);font-size:9px;text-overflow:ellipsis;white-space:nowrap; }
.about-social-link > i { color:var(--social-accent);font-size:16px;font-style:normal;transition:transform 170ms ease; }
.about-social-link:hover > i { transform:translate(2px,-2px); }
.social-instagram { --social-accent:#d946ef; }
.social-email { --social-accent:#d6a443; }
.social-facebook { --social-accent:#1877f2; }
.social-youtube { --social-accent:#ff0033; }
.social-tiktok { --social-accent:#18d6d0; }
.social-snapchat { --social-accent:#d1b900; }
.social-discord { --social-accent:#5865f2; }
.social-reddit { --social-accent:#ff4500; }
.social-linkedin { --social-accent:#0a66c2; }
.social-x { --social-accent:#1b1f23; }

.privacy-policy {
  display: grid;
  gap: 14px;
}

.privacy-policy article {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(18px, 3vw, 28px);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(var(--ink-rgb), .08);
}

.privacy-policy article > span {
  width: fit-content;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, var(--line));
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--rail-bg);
  background: var(--gold-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.privacy-policy h3,
.privacy-policy p,
.privacy-policy ul {
  margin: 0;
}

.privacy-policy h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3vw, 42px);
  font-weight: 400;
  line-height: 1;
}

.privacy-policy p,
.privacy-policy li {
  color: var(--muted);
  line-height: 1.58;
}

.privacy-policy ul {
  display: grid;
  gap: 10px;
  padding-left: 22px;
}

.privacy-policy li::marker {
  color: var(--gold);
}

.privacy-policy b,
.privacy-policy strong,
.privacy-policy a {
  color: var(--ink);
}

.privacy-callout,
.privacy-warning {
  border-color: color-mix(in srgb, var(--gold) 48%, var(--line)) !important;
  background:
    radial-gradient(circle at 92% 8%, var(--gold-soft), transparent 18rem),
    var(--panel) !important;
}

.privacy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.privacy-actions a,
.privacy-actions button {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 11px 14px;
  color: var(--paper);
  background: var(--ink);
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.privacy-actions a {
  color: var(--ink);
  background: var(--panel);
}

body.terms-mode .topbar {
  display: none;
}

body.terms-mode main {
  padding-top: clamp(18px, 3vw, 34px);
}

body.terms-mode .workspace {
  min-height: auto;
}

.terms-page {
  display: grid;
  width: min(100%, 1320px);
  margin: 0 auto;
  gap: clamp(22px, 4vw, 44px);
}

.terms-masthead,
.terms-wordmark {
  display: flex;
  align-items: center;
}

.terms-masthead {
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.terms-wordmark {
  gap: 10px;
  min-width: 0;
}

.terms-wordmark img {
  width: 140px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.terms-wordmark strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 400;
}

.terms-masthead > button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  height: 34px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--paper);
  background: var(--ink);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.terms-masthead > button:hover {
  transform: translateY(-1px);
}

.terms-hero {
  display: grid;
  justify-items: center;
  min-height: clamp(340px, 50vh, 560px);
  align-content: center;
  gap: 16px;
  border: 1px solid var(--ink);
  padding: clamp(44px, 8vw, 108px) clamp(22px, 6vw, 80px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 18%, var(--gold-soft), transparent 26rem),
    var(--panel);
}

.terms-hero > span,
.terms-contents > span {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.terms-hero h1 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .16em;
  max-width: none;
  margin: 0;
  color: var(--ink);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(68px, 10.5vw, 154px);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.065em;
  text-shadow: 0 .055em 0 color-mix(in srgb, var(--gold) 42%, transparent);
  -webkit-text-stroke: .008em var(--ink);
}

.terms-title-of {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: .005em;
  letter-spacing: -.08em;
  line-height: 1;
}

.terms-title-of img {
  display: block;
  width: .72em;
  height: .72em;
  flex: 0 0 .72em;
  align-self: center;
  object-fit: contain;
  filter: drop-shadow(0 .045em 0 color-mix(in srgb, var(--gold) 42%, transparent));
}

body[data-theme="dark"] .terms-title-of img {
  filter: invert(1) drop-shadow(0 .045em 0 color-mix(in srgb, var(--gold) 42%, transparent));
}

body[data-theme="dark"] .terms-wordmark img {
  filter: invert(1);
}

.terms-hero p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.6;
}

.terms-hero .terms-effective {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.terms-layout {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 54px);
  align-items: start;
}

.terms-contents {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 0;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}

.terms-contents > span {
  font-size: 13.75px;
  margin-bottom: 12px;
}

.terms-contents a {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  text-decoration: none;
}

.terms-contents a:hover {
  color: var(--ink);
  padding-left: 5px;
}

.terms-document {
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: 0 22px 64px rgba(var(--ink-rgb), .08);
}

.terms-intro,
.terms-note {
  display: grid;
  gap: 10px;
  padding: clamp(24px, 4vw, 46px);
  background:
    radial-gradient(circle at 94% 8%, var(--gold-soft), transparent 18rem),
    var(--panel);
}

.terms-intro {
  border-bottom: 1px solid var(--ink);
}

.terms-intro strong,
.terms-note strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 400;
}

.terms-intro p,
.terms-note p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.terms-intro button {
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.terms-document article {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: clamp(16px, 3vw, 34px);
  scroll-margin-top: 24px;
  border-bottom: 1px solid var(--line);
  padding: clamp(26px, 5vw, 58px) clamp(22px, 5vw, 58px);
}

.terms-document article > span {
  padding-top: 5px;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 14.3px;
  font-weight: 900;
  letter-spacing: .14em;
}

.terms-document article > div {
  display: grid;
  gap: 16px;
}

.terms-document h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 400;
  line-height: 1;
}

.terms-document article p {
  max-width: 850px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.terms-document a {
  color: var(--ink);
  font-weight: 800;
}

.terms-note {
  border-top: 1px solid var(--ink);
}

@media (max-width: 840px) {
  .terms-layout {
    grid-template-columns: 1fr;
  }

  .terms-contents {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
  }

  .terms-contents > span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .terms-hero {
    min-height: 310px;
  }

  .terms-hero h1 {
    gap: .13em;
    font-size: clamp(54px, 16vw, 88px);
  }

  .terms-contents {
    grid-template-columns: 1fr;
  }

  .terms-document article {
    grid-template-columns: 1fr;
  }

  .terms-document article > span {
    padding-top: 0;
  }
}

.support-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.support-page-header h2,
.support-option h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

.support-landing {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.support-option {
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.support-option p,
.support-ticket-form p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.support-ticket-form {
  margin-top: 18px;
}

.support-ticket-form a {
  color: var(--ink);
}

.support-ticket-form input,
.support-ticket-form textarea {
  min-width: 0;
}

.support-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr);
  gap: 18px;
  margin-top: 18px;
}

.support-form,
.support-side article,
.support-empty,
.support-report-list article,
.product-suggestion-list article {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
  box-shadow: var(--shadow);
}

.support-form {
  display: grid;
  gap: 14px;
}

.support-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.support-form label {
  display: grid;
  gap: 7px;
}

.support-form label span,
.support-context strong,
.support-side span,
.support-report-list span,
.product-suggestion-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.support-form input,
.support-form select,
.support-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  padding: 11px 12px;
}

.support-form textarea {
  resize: vertical;
  min-height: 88px;
}

.support-context {
  border: 1px dashed var(--line);
  background: var(--panel-soft);
  padding: 14px;
  display: grid;
  gap: 6px;
}

.support-context p,
.support-context small,
.support-side p,
.support-empty p,
.support-report-list p,
.support-report-list small,
.product-suggestion-list p,
.product-suggestion-list small {
  color: var(--muted);
  line-height: 1.55;
}

.support-report-list .support-screenshot-meta {
  padding: 8px 10px;
  border: 1px solid rgba(30, 91, 77, .16);
  border-radius: 8px;
  background: rgba(30, 91, 77, .08);
  color: var(--ink);
}

.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.support-actions button,
.support-side button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: #fffdf8;
  font-weight: 900;
}

.support-actions button:last-child {
  background: transparent;
  color: var(--ink);
}

.support-landing .support-actions button,
.support-landing .support-actions button:last-child {
  border-color: var(--navy);
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: #fffdf8;
}

body[data-theme="dark"] .support-landing .support-actions button {
  border-color: var(--gold);
}

.support-side button:disabled {
  opacity: .52;
  cursor: not-allowed;
}

.support-side,
.support-report-list,
.product-suggestion-list {
  display: grid;
  gap: 12px;
}

.suggestions-layout .support-side {
  align-self: stretch;
}

.suggestions-layout .support-form {
  align-self: start;
  align-content: start;
}

.support-side .suggestion-drafts-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}

.support-side .suggestion-drafts-card .suggestion-drafts-action {
  display: grid;
  min-height: 42px;
  place-items: center;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: #1765b0;
}

.support-side .suggestion-drafts-card:focus-visible {
  outline: 3px solid #1765b0;
  outline-offset: 3px;
}

#suggestionDraftList .product-suggestion-list {
  grid-template-columns: 1fr;
}

.product-suggestion-list article {
  padding: 0;
}

.product-suggestion-list article button {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 6px;
  border: 0;
  border-radius: inherit;
  padding: 18px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.product-suggestion-list article button:is(:hover, :focus-visible) {
  outline: 2px solid #1765b0;
  outline-offset: -2px;
}

.product-suggestion-list .suggestion-draft-preview {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
  line-height: 1.55;
  overflow-wrap: anywhere;
  text-transform: none;
}

.suggestion-clear-drafts {
  margin-top: 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
}

.support-report-list,
.product-suggestion-list {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.support-report-list article,
.product-suggestion-list article,
.support-side article {
  display: grid;
  gap: 9px;
}


.support-side strong,
.support-empty strong,
.support-report-list strong,
.product-suggestion-list strong {
  font-size: clamp(18px, 2vw, 24px);
  color: var(--ink);
}

body[data-theme="dark"] .support-form,
body[data-theme="dark"] .support-side article,
body[data-theme="dark"] .support-empty,
body[data-theme="dark"] .support-report-list article,
body[data-theme="dark"] .product-suggestion-list article {
  background: rgba(11, 23, 45, .9);
}

body[data-theme="dark"] .support-form input,
body[data-theme="dark"] .support-form select,
body[data-theme="dark"] .support-form textarea,
body[data-theme="dark"] .support-context {
  background: rgba(255,255,255,.05);
  color: var(--ink);
}

body[data-theme="dark"] .support-report-list .support-screenshot-meta {
  background: rgba(167, 212, 196, .10);
  border-color: rgba(167, 212, 196, .22);
  color: var(--ink);
}

@media (max-width: 1100px) {

  .about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-social-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .support-landing,
  .support-layout,
  .support-form-grid,
  .support-report-list,
  .product-suggestion-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-socials > header,.about-social-grid { grid-template-columns:1fr; }
}

/* Home launchpad and independent navigation folders. */
.nav-home {
  min-height: 44px;
  justify-content: flex-start;
  padding-inline: 13px;
  font-weight: 900;
}

body.home-mode .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.home-mode .chart-panel,
body.home-mode .lower,
body.home-mode .mode-copy,
body.home-mode #nextBtn,
body.home-mode .choices,
body.home-mode .result {
  display: none;
}

body.home-mode .panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.home-mode .mode-surface {
  display: grid;
  gap: 20px;
  padding: 0;
  border: 0;
  background: transparent;
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: clamp(30px, 6vw, 80px);
  align-items: center;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--gold) 36%, var(--line));
  border-radius: 26px;
  padding: clamp(34px, 6vw, 76px);
  background:
    radial-gradient(circle at 88% 16%, color-mix(in srgb, var(--gold) 23%, transparent), transparent 20rem),
    radial-gradient(circle at 3% 100%, color-mix(in srgb, var(--teal) 14%, transparent), transparent 24rem),
    linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--panel) 84%, var(--paper)));
  box-shadow: 0 24px 60px rgba(var(--ink-rgb), .10);
}

.home-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 280px;
  height: 280px;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 34px color-mix(in srgb, var(--gold) 7%, transparent), 0 0 0 70px color-mix(in srgb, var(--teal) 5%, transparent);
  pointer-events: none;
}

.home-hero-copy {
  position: relative;
  z-index: 1;
}

.home-hero-copy > span,
.home-launchpad > header span,
.home-destination > span,
.home-account-strip span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.home-hero h1 {
  max-width: 760px;
  margin: 12px 0 18px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 6vw, 78px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .96;
}

.home-hero-copy > p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.55;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.home-hero-actions button,
.home-account-strip button {
  min-height: 46px;
  border: 1px solid var(--navy);
  border-radius: 12px;
  padding: 0 18px;
  color: #fffdf8;
  background: linear-gradient(135deg, var(--navy), #112b55);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.home-hero-actions button + button,
.home-account-strip button + button {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.home-hero-actions button:hover,
.home-account-strip button:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 10px 24px rgba(var(--ink-rgb), .12);
}

.home-progress {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.home-progress article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label value" "note value";
  align-items: center;
  min-height: 90px;
  border: 1px solid color-mix(in srgb, var(--gold) 26%, var(--line));
  border-radius: 16px;
  padding: 16px 18px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 12px 28px rgba(var(--ink-rgb), .07);
  backdrop-filter: blur(10px);
}

.home-progress span {
  grid-area: label;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.home-progress strong {
  grid-area: value;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 500;
  line-height: 1;
}

.home-progress small {
  grid-area: note;
  color: var(--muted);
}

.home-launchpad {
  display: grid;
  gap: 18px;
}

.home-launchpad > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 4px 2px;
}

.home-launchpad h2 {
  margin: 7px 0 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: -.035em;
}

.home-launchpad > header p {
  max-width: 510px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-destination-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.home-destination {
  --home-accent: var(--gold);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  min-height: 290px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(22px, 3vw, 34px);
  background:
    linear-gradient(90deg, var(--home-accent), var(--home-accent)) 0 0 / 100% 4px no-repeat,
    var(--panel);
  box-shadow: 0 14px 38px rgba(var(--ink-rgb), .075);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.home-destination:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--home-accent) 50%, var(--line));
  box-shadow: 0 20px 46px rgba(var(--ink-rgb), .11);
}

.home-destination-lab { --home-accent: var(--teal); }
.home-destination-growth { --home-accent: var(--blue); }
.home-destination-community { --home-accent: var(--accent-warm); }

.home-destination h3 {
  max-width: 560px;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.08;
}

.home-destination > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-destination > div {
  display: grid;
  border-top: 1px solid var(--line);
}

.home-destination button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.home-destination button:last-child {
  border-bottom: 0;
}

.home-destination button i {
  color: var(--home-accent);
  font-size: 19px;
  font-style: normal;
  transition: transform 150ms ease;
}

.home-destination button:hover i {
  transform: translateX(4px);
}

.home-account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  background: color-mix(in srgb, var(--panel) 86%, var(--gold));
}

.home-account-strip > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.home-account-strip > div:first-child {
  display: grid;
  gap: 5px;
}

.home-account-strip strong {
  color: var(--ink);
  font-size: 18px;
}

body[data-theme="dark"] .home-hero,
body[data-theme="dark"] .home-destination,
body[data-theme="dark"] .home-account-strip {
  background-color: var(--panel);
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-progress article {
    grid-template-columns: 1fr;
    grid-template-areas: "label" "value" "note";
  }
}

@media (max-width: 700px) {
  .home-destination-grid,
  .home-progress {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-launchpad > header,
  .home-account-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .home-account-strip > div:last-child,
  .home-account-strip button {
    width: 100%;
  }
}

/* Course, rankings, calendar, and expandable history */
.topbar {
  justify-content: flex-end;
  align-items: center;
}

body:not(.packs-mode) .lower {
  display: none;
}

body.leaderboards-mode .workspace,
body.news-mode .workspace {
  grid-template-columns: 1fr;
}

body.leaderboards-mode .chart-panel,
body.news-mode .chart-panel,
body.leaderboards-mode .lower,
body.news-mode .lower,
body.leaderboards-mode .mode-copy,
body.news-mode .mode-copy,
body.leaderboards-mode #nextBtn,
body.news-mode #nextBtn,
body.leaderboards-mode .choices,
body.news-mode .choices,
body.leaderboards-mode .result,
body.news-mode .result {
  display: none;
}

body.leaderboards-mode .panel,
body.news-mode .panel {
  display: grid;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.leaderboards-mode .mode-surface,
body.news-mode .mode-surface {
  padding: 0;
  border: 0;
  background: transparent;
}

.speed-parameters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel-soft);
}

.speed-parameters > strong {
  grid-column: 1 / -1;
  color: var(--ink);
}

.speed-parameters label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.speed-parameters :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--panel);
}

@media (max-width: 620px) {
  .speed-parameters { grid-template-columns: 1fr; }
}

.speed-result-skip-layer {
  position: fixed;
  inset: 0;
  z-index: 12030;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  animation: none !important;
  transition: none !important;
}

.ready-button {
  width: 100%;
  border: 1px solid var(--ink);
  padding: 14px;
  color: var(--paper);
  background: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.course-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--ink);
  padding: 4px 0 20px;
}

.course-header span,
.leaderboard-hero span,
.course-section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.course-header h2,
.leaderboard-hero h2 {
  margin-top: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 64px);
}

.course-header p,
.leaderboard-hero p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
}

.course-header > strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
}

.course-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.course-syllabus {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.course-syllabus-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.course-syllabus-head small {
  color: var(--muted);
}

.course-chapter-list {
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.course-chapter-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.course-chapter-list button.active {
  color: var(--paper);
  background: var(--ink);
}

.course-chapter-list button.complete:not(.active) {
  background: var(--panel-soft);
}

.course-chapter-list button > span {
  font-weight: 900;
}

.course-chapter-list button strong,
.course-chapter-list button small {
  display: block;
}

.course-chapter-list button small {
  margin-top: 3px;
  color: inherit;
  opacity: .7;
}

.course-lesson.learn-module {
  grid-template-columns: minmax(0, 1fr);
  padding: 20px;
}

.course-lesson-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.course-lesson-nav button {
  border: 1px solid var(--line);
  padding: 9px 11px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

.course-lesson-nav button:last-child {
  justify-self: end;
}

.course-lesson-nav span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.course-section-label {
  margin-top: 8px;
}

.leaderboard-page {
  display: grid;
  gap: 16px;
}

.leader-tabs {
  width: min(460px, 100%);
}

.leaderboard-page > .leader-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  gap: 10px;
  border: 0;
  overflow: visible;
}

.leaderboard-page > .leader-tabs button {
  min-height: 44px;
  height: 100%;
}

.leaderboard-stat-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: var(--panel);
}

.leaderboard-stat-switch button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--panel-soft);
  cursor: pointer;
  font-weight: 850;
}

.leaderboard-stat-switch button.active {
  border-color: var(--teal);
  color: var(--navy);
  background: var(--teal);
}

@media (max-width: 980px) {
  .leaderboard-page > .leader-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .leaderboard-page > .leader-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.leaderboard-full {
  border: 1px solid var(--line);
  background: var(--panel);
}

.leaderboard-results {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.leaderboard-results .leaderboard-view-banner {
  border: 0;
  border-radius: 17px 17px 0 0;
  box-shadow: none;
}

.leaderboard-results .leaderboard-list-tools {
  padding: 0 16px;
  background: var(--panel);
}

.leaderboard-results .leaderboard-full {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.leaderboard-list-tools {
  display: flex;
  justify-content: flex-end;
  min-height: 44px;
}

.leaderboard-filter-control {
  position: relative;
}

.leaderboard-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(var(--ink-rgb), .08);
  cursor: pointer;
  font-weight: 900;
}

.leaderboard-filter-button:hover,
.leaderboard-filter-button[aria-expanded="true"] {
  border-color: var(--teal);
  background: var(--panel-soft);
}

.leaderboard-filter-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  gap: 8px;
  width: 210px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.leaderboard-filter-menu[hidden] {
  display: none;
}

.leaderboard-filter-menu strong {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.leaderboard-filter-menu button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  color: var(--ink);
  background: var(--panel-soft);
  cursor: pointer;
  font-weight: 850;
}

.leaderboard-filter-menu button.active {
  border-color: var(--teal);
  color: var(--paper);
  background: var(--teal);
}

.leaderboard-full li {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.leaderboard-full li:last-child {
  border-bottom: 0;
}

.leaderboard-full li.podium {
  background: var(--panel-soft);
}

.leaderboard-full b {
  display: inline-block;
  width: 34px;
}

.news-page {
  display: grid;
  gap: 16px;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.news-card,
.news-briefing,
.course-activity-card  {
  border: 1px solid var(--line);
  padding: 16px;
  background: var(--panel);
}

.news-card {
  display: grid;
  gap: 12px;
}

.news-card-head,
.course-activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.news-card-head span,
.course-activity-head span  {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.news-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1.05;
}

.news-card p,
.news-briefing p,
.course-reflection p  {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.news-watch {
  display: grid;
  gap: 6px;
}

.news-watch small {
  border-left: 3px solid var(--ink);
  padding-left: 9px;
  color: var(--muted);
  line-height: 1.35;
}

.news-card blockquote {
  margin: 0;
  border: 1px dashed var(--line);
  padding: 10px;
  color: var(--ink);
  background: var(--panel-soft);
  line-height: 1.4;
}
.course-reflection textarea  {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}
.news-actions button,
.course-checklist label,
.course-flashcard,
.course-reflection button  {
  border: 1px solid var(--ink);
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

.course-activity-card {
  display: grid;
  gap: 12px;
}

.course-checklist,
.course-flashcards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.course-checklist label {
  display: grid;
  grid-template-columns: 18px 24px 1fr;
  gap: 8px;
  text-align: left;
  align-items: start;
}

.course-checklist input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--ink);
}

.course-checklist label.complete,
.course-flashcard[open] {
  color: var(--paper);
  background: var(--ink);
}

.course-checklist small,
.course-flashcard small,
.course-activity-head small {
  display: block;
  margin-top: 4px;
  color: inherit;
  opacity: .72;
  line-height: 1.35;
}

.course-flashcard {
  min-height: 92px;
  text-align: left;
}

.course-flashcard summary {
  cursor: pointer;
  list-style: none;
}

.course-flashcard summary::-webkit-details-marker {
  display: none;
}

.course-flashcard p {
  margin: 10px 0 0;
  line-height: 1.4;
}

.daily-calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(var(--paper-rgb), .84);
  backdrop-filter: blur(12px);
}

.daily-calendar-modal.hidden {
  display: none;
}

.daily-calendar-card {
  width: min(660px, 100%);
  border: 1px solid var(--ink);
  padding: 18px;
  background: var(--paper);
  box-shadow: 10px 10px 0 var(--ink);
}

.daily-calendar-head,
.daily-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.daily-calendar-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.daily-calendar-head button,
.daily-calendar-nav button {
  border: 1px solid var(--line);
  padding: 8px 10px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

.daily-calendar-nav {
  margin: 18px 0 10px;
}

.daily-calendar-weekdays,
.daily-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.daily-calendar-weekdays span {
  padding: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.daily-calendar-grid button,
.calendar-blank {
  min-height: 64px;
}

.daily-calendar-grid button {
  display: flex;
  align-items: start;
  justify-content: space-between;
  border: 1px solid var(--line);
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

.daily-calendar-grid button.correct {
  color: #fff;
  background: #15803d;
}

.daily-calendar-grid button.missed {
  color: #fff;
  background: #b91c1c;
}

.daily-calendar-grid button.locked {
  opacity: .32;
}

.daily-calendar-grid button.selected {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}

.daily-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.daily-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-list-controls {
  display: flex;
  gap: 8px;
}
.review-disclosure > summary,
.practice-plan-disclosure > summary {
  cursor: pointer;
  list-style: none;
}
.review-disclosure > summary::-webkit-details-marker,
.practice-plan-disclosure > summary::-webkit-details-marker {
  display: none;
}
.review-disclosure > summary::after {
  content: "−";
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}
.review-disclosure:not([open]) > summary::after {
  content: "+";
}
.practice-plan-disclosure > summary::after {
  content: "Collapse";
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.practice-plan-disclosure:not([open]) > summary::after {
  content: "Expand";
}
.practice-plan-disclosure {
  border: 0;
}
.practice-plan-disclosure .lessons {
  margin-top: 12px;
}

.review-section-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.review-list-controls button,
.review-record button {
  border: 1px solid var(--ink);
  padding: 8px 10px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

details.review-record {
  display: block;
  padding: 0;
}

.review-record summary {
  display: grid;
  grid-template-columns: minmax(100px, .55fr) minmax(180px, 1fr) auto 20px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.review-record summary::-webkit-details-marker {
  display: none;
}

.review-record summary::after {
  content: none;
}

.review-record-detail,
.review-round-list {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.review-record-detail p {
  margin: 0;
  color: var(--muted);
}

.review-round {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 10px;
}

.review-round div span,
.review-round div strong {
  display: block;
}

.review-round.missed {
  border-color: var(--ink);
}

@media (max-width: 900px) {
  .course-workspace {
    grid-template-columns: 1fr;
  }

  .course-syllabus {
    position: static;
  }

  .course-chapter-list {
    max-height: 340px;
  }

  .news-grid,
  .course-checklist,
  .course-flashcards  {
    grid-template-columns: 1fr;
  }

  .review-record summary,
  .review-round {
    grid-template-columns: 1fr;
  }

  .review-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-week-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-pattern-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .review-stat-detail-head,
  .review-week-heading,
  .review-pattern-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-stat-detail-highlight {
    text-align: left;
  }

  .review-pattern-heading > small {
    text-align: left;
  }

  .review-pattern-insight {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px), (max-width: 900px) and (max-height: 520px) {
  .review-stat-detail {
    gap: 10px;
    padding: 10px;
  }

  .review-stat-detail-head {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .review-stat-detail-head h4 {
    margin: 0;
    font-size: 16px;
  }

  .review-stat-detail-highlight {
    min-width: 0;
    text-align: right;
  }

  .review-stat-detail-highlight strong {
    font-size: 28px;
  }

  .review-pattern-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .review-pattern-picker button {
    gap: 4px;
    padding: 8px 6px;
  }

  .review-pattern-picker button span {
    font-size: 11px;
    line-height: 1.2;
  }

  .review-pattern-picker button small {
    font-size: 10px;
  }

  .review-week-metrics {
    gap: 8px;
  }

  .review-week-metrics > div {
    gap: 4px;
    padding: 10px;
  }

  .review-week-metrics span {
    font-size: 10px;
    letter-spacing: .04em;
  }
}

/* Comfort pass: keep the newspaper-like identity, but make it calmer to read and use. */
:root {
  --chart-up: #21865a;
  --chart-down: #b54d4d;
  --chart-volume-up: rgba(33, 134, 90, .20);
  --chart-volume-down: rgba(181, 77, 77, .24);
  --chart-line-color: #2f8178;
  --chart-drawing: #416fa8;
  --chart-measure: #b7791f;
  --chart-sma: #7b61a8;
  --chart-ema: #bd6f35;
  --chart-bb: #2f8178;
  --chart-fib: #8564aa;
}

body[data-theme="dark"] {
  --chart-bg: #211d18;
  --chart-up: #8fd8a8;
  --chart-down: #f0a0a0;
  --chart-volume-up: rgba(143, 216, 168, .22);
  --chart-volume-down: rgba(240, 160, 160, .25);
  --chart-line-color: #95d7ce;
  --chart-drawing: #a8c7f0;
  --chart-measure: #e6bd72;
  --chart-sma: #d5b5ff;
  --chart-ema: #e8a77d;
  --chart-bb: #95d7ce;
  --chart-fib: #d5b5ff;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(47, 129, 120, .08), transparent 34rem),
    linear-gradient(90deg, rgba(var(--ink-rgb), .018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(var(--ink-rgb), .016) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 86px 86px, 86px 86px, auto;
}

button,
input,
select,
textarea {
  border-radius: 11px;
}

textarea {
  color: var(--ink);
  background: var(--panel);
}

button:focus-visible,
input:focus,
select:focus,
textarea:focus,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--teal) 58%, transparent);
  outline-offset: 3px;
}

.rail {
  background: linear-gradient(180deg, var(--ink), color-mix(in srgb, var(--ink) 88%, var(--teal)));
}

.welcome-card,
.round-card,
.chart-panel,
.panel,
.lower > div,
.mode-surface,
.result,
.learn-hero,
.learn-path article,
.learn-module,
.teach-card,
.module-terms article,
.video-card,
.lessons article,
.pack-card,
.assignment-card,
.rank-card,
.course-syllabus,
.leaderboard-full,
.news-card,
.news-briefing,
.review-record,
.review-round,
.private-lobby  {
  border-color: var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.chart-panel:hover,
.panel:hover,
.lower > div:hover,
.metrics div:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.welcome-actions button,
.round-actions button,
#tickerForm button,
.choices button,
.secondary,
.packs button,
.mode-actions button,
.mini-button,
.mode-tabs button,
.leader-tabs button,
.theme-card button,
.timeframes > button,
.chart-modes button,
.chart-toolbar button,
.ready-button,
.course-lesson-nav button,
.review-list-controls button,
.review-record button,
.news-actions button,
.course-reflection button  {
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: none;
}

.welcome-actions button:hover,
.round-actions button:hover,
#tickerForm button:hover,
.choices button:hover,
.secondary:hover,
.packs button:hover,
.mode-actions button:hover,
.mini-button:hover,
.mode-tabs button:hover,
.leader-tabs button:hover,
.theme-card button:hover,
.timeframes > button:hover,
.chart-modes button:hover,
.chart-toolbar button:hover,
.ready-button:hover,
.course-lesson-nav button:hover,
.review-list-controls button:hover,
.review-record button:hover,
.news-actions button:hover,
.course-reflection button:hover  {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(var(--ink-rgb), .10);
}

.nav,
.theme-card,
.account,
.mark,
.xp,
.metrics div,
input,
select,
.course-syllabus,
.leaderboard-full,
.review-round {
  border-radius: 14px;
}

.course-chapter-list button {
  border-radius: 0;
}

.course-chapter-list button:first-child {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.course-chapter-list button:last-child {
  border-bottom: 0;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.toast {
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(var(--ink-rgb), .14);
}

/* Product polish pass: no inverted colors, clearer hierarchy, more inviting tabs. */
:root {
  --rail-bg: #203645;
  --rail-bg-2: #2f8178;
  --rail-text: #fff7ed;
  --accent-warm: #e88f45;
  --accent-soft: rgba(232, 143, 69, .14);
  --success-soft: rgba(33, 134, 90, .13);
  --danger-soft: rgba(181, 77, 77, .12);
}

body[data-theme="dark"] {
  --paper: #061023;
  --panel: #0b172d;
  --panel-soft: #101f39;
  --ink: #f8f3e8;
  --muted: #b9c0cc;
  --line: #2c3850;
  --paper-rgb: 6, 16, 35;
  --ink-rgb: 248, 243, 232;
  --rail-bg: #061023;
  --rail-bg-2: #0d1f3e;
  --rail-text: #f8f3e8;
  --chart-bg: #08152b;
  --future-mask: rgba(6, 16, 35, .88);
}

.rail {
  background:
    radial-gradient(circle at 30% 10%, rgba(232, 143, 69, .22), transparent 16rem),
    linear-gradient(180deg, var(--rail-bg), var(--rail-bg-2));
  color: var(--rail-text);
}

.rail .brand small,
.rail .account small,
.rail .theme-card span {
  color: color-mix(in srgb, var(--rail-text) 72%, transparent);
}

.rail .nav {
  color: color-mix(in srgb, var(--rail-text) 72%, transparent);
}

.rail .nav:hover,
.rail .nav.active {
  color: var(--rail-text);
  background: rgba(255, 255, 255, .08);
}

.rail .theme-card,
.rail .account,
.rail .mark {
  border-color: color-mix(in srgb, var(--rail-text) 28%, transparent);
}

.rail .theme-card button {
  color: var(--rail-text);
  background: rgba(255, 255, 255, .06);
  border-color: color-mix(in srgb, var(--rail-text) 22%, transparent);
}

.rail .theme-card button.active {
  color: var(--rail-bg);
  background: var(--rail-text);
}

.leaderboard-hero,
.course-header,
.about-hero {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 8%, var(--accent-soft), transparent 18rem),
    linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--panel) 82%, var(--teal)));
  box-shadow: var(--shadow);
}

.leader-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.leader-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-weight: 900;
}

.leader-tabs button.active {
  border-color: var(--teal);
  color: #fffdf8;
  background: linear-gradient(135deg, #805d13, var(--rail-bg));
  box-shadow: 0 12px 28px rgba(var(--ink-rgb), .14);
}

.leaderboard-view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid color-mix(in srgb, var(--teal) 45%, var(--line));
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 14%, var(--panel)), var(--panel));
  box-shadow: var(--shadow);
}

.leaderboard-view-banner span,
.leaderboard-user-chip small {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.leaderboard-view-banner strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 42px);
}

.leaderboard-view-banner p {
  margin: 6px 0 0;
  color: var(--muted);
}

.leaderboard-user-chip {
  min-width: 150px;
  border-radius: 18px;
  padding: 14px;
  color: var(--paper);
  background: linear-gradient(135deg, var(--rail-bg), var(--teal));
  text-align: center;
}

.leaderboard-user-chip b,
.leaderboard-user-chip em {
  display: block;
}

.leaderboard-user-chip b {
  font-size: 34px;
  line-height: 1;
}

.leaderboard-user-chip em {
  margin-top: 4px;
  font-style: normal;
  color: color-mix(in srgb, var(--rail-text) 82%, transparent);
}

.course-workspace {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
}

.course-syllabus {
  top: 96px;
  border-radius: 20px;
  overflow: hidden;
}

.course-lesson.learn-module {
  min-width: 0;
  border-radius: 22px;
}

.course-status-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.course-objective,
.course-gate {
  border: 1px solid color-mix(in srgb, var(--teal) 38%, var(--line));
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 10%, var(--panel)), var(--panel));
}

.course-objective span,
.course-gate span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.course-objective strong,
.course-gate strong {
  display: block;
  margin: 4px 0;
}

.course-objective small,
.course-gate small {
  color: var(--muted);
}

.course-chapter-list button.locked {
  opacity: .48;
  cursor: not-allowed;
  filter: saturate(.55);
}

.course-chapter-list button.unlocked:not(.active):not(.complete) {
  background: color-mix(in srgb, var(--teal) 7%, var(--panel));
}

.course-chapter-list button.active {
  background: linear-gradient(135deg, var(--teal), var(--rail-bg));
}

.course-checklist label.complete {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: var(--success-soft);
}

.quiz-launch.locked {
  opacity: .78;
  background: var(--panel-soft);
}

.quiz-launch.locked button {
  cursor: not-allowed;
}

.chat-monitor-pill {
  justify-self: start;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--green);
  background: var(--success-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.course-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.course-lesson.learn-module {
  grid-column: 1;
  grid-row: 1;
}

.course-syllabus {
  grid-column: 2;
  grid-row: 1;
}

body.learn-mode .mode-surface {
  width: 100%;
}

@media (max-width: 980px) {
  .leaderboard-view-banner {
    grid-template-columns: 1fr;
  }

  .course-workspace {
    grid-template-columns: 1fr;
  }

  .course-lesson.learn-module,
  .course-syllabus {
    grid-column: 1;
  }

  .course-syllabus {
    position: static;
  }
}

/* Final readability and quiz control fixes */
.theme-options button,
.theme-card button {
  min-height: 42px;
  border: 2px solid var(--line);
  text-shadow: none;
}

.theme-options button[data-theme-choice="light"] {
  color: #182434;
  background: #fffdf8;
  border-color: #9aa4b2;
}

.theme-options button[data-theme-choice="dark"] {
  color: #fffdf8;
  background: #182434;
  border-color: #182434;
}

body[data-theme="dark"] .theme-options button[data-theme-choice="light"] {
  color: #182434;
  background: #f7f4ee;
  border-color: #d7dfeb;
}

body[data-theme="dark"] .theme-options button[data-theme-choice="dark"] {
  color: #fffdf8;
  background: #0f1720;
  border-color: #95d7ce;
}

.theme-options button.active {
  outline: 3px solid color-mix(in srgb, var(--teal) 72%, transparent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--panel);
}

.module-quiz {
  border-color: var(--line);
  border-radius: 20px;
  background: var(--panel);
}

.module-quiz fieldset {
  border-radius: 16px;
  padding: 16px;
  background: color-mix(in srgb, var(--panel-soft) 80%, var(--panel));
}

.module-quiz legend {
  max-width: 100%;
  color: var(--ink);
  line-height: 1.35;
  white-space: normal;
}

.module-quiz label {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  background: var(--panel);
}

.module-quiz label:hover {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 8%, var(--panel));
}

.module-quiz label:has(input[type="radio"]:checked) {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 14%, var(--panel));
}

.module-quiz label span {
  display: block;
  min-width: 0;
  padding-top: 1px;
  overflow-wrap: anywhere;
}

.module-quiz input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 2px 0 0;
  padding: 0;
  justify-self: center;
  accent-color: var(--teal);
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 17, 15, .46);
}

.account-modal.hidden {
  display: none;
}

.account-edit-modal {
  position: fixed;
  z-index: 82;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 17, 15, .34);
  backdrop-filter: blur(9px);
}

.account-edit-modal.hidden { display: none; }
.nickname-modal { z-index: 160; -webkit-backdrop-filter: blur(9px); }
.account-edit-card.nickname-card { width: min(480px, 100%); }
.nickname-input-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; gap: 8px; }
.nickname-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.nickname-text-viewport { min-width: 0; overflow: hidden; border-radius: 11px 0 0 11px; }
.nickname-text-viewport.is-scrolled {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16px);
  mask-image: linear-gradient(to right, transparent, #000 16px);
}
.nickname-card #nicknameInput { border: 0; border-radius: 0; background: transparent; outline: none; }
body:not(.pointer-focus) .nickname-input-shell:focus-within { outline: 2px solid var(--gold); outline-offset: 3px; }
.nickname-counter { padding-inline-end: 12px; color: #626d7b; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
body[data-theme="dark"] .nickname-counter { color: #aab2bf; }
.nickname-input-row button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 10px;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: var(--panel-soft);
  cursor: pointer;
}
.nickname-input-row .nickname-save { color: var(--green); color: color-mix(in srgb, var(--green) 80%, var(--ink)); }
.nickname-input-row .nickname-cancel { color: var(--red); }
.nickname-card .account-edit-error { color: var(--red); color: color-mix(in srgb, var(--red) 75%, var(--ink)); }
.nickname-input-row svg, .nickname-edit svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nickname-input-row button:hover { background: var(--press); }
.account-edit-card {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 32px);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .3);
}
.account-edit-head { margin-bottom: 22px; }
.account-edit-head > span { color: var(--teal); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.account-edit-head h2 { margin: 6px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 4vw, 34px); }
.account-edit-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.account-edit-form { display: grid; gap: 18px; }
.account-edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.account-edit-form label { display: grid; min-width: 0; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 850; }
.account-edit-form input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ink); background: var(--panel-soft); font: inherit; }
.account-edit-error { margin: 0; color: var(--red); font-size: 13px; line-height: 1.45; }
.account-edit-actions { display: flex; justify-content: flex-end; gap: 10px; }
.account-edit-actions button { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; color: var(--ink); background: var(--panel-soft); font: inherit; font-weight: 850; cursor: pointer; }
.account-edit-actions button[type="submit"] { border-color: var(--teal); color: var(--paper); background: linear-gradient(135deg, var(--teal), var(--rail-bg, var(--ink))); }
.account-edit-modal :is(button, input):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (max-width: 520px) {
  .account-edit-modal { padding: 14px; }
  .account-edit-fields { grid-template-columns: minmax(0, 1fr); }
  .account-edit-actions button { flex: 1; }
}

.account-auth-card {
  width: min(860px, 100%);
  max-height: min(86vh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .28);
}

.account-auth-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent;
}

/* Keep the slim scroll rail inside the frame, away from its rounded shadow. */
@supports selector(::-webkit-scrollbar) {
  .account-auth-scroll { scrollbar-width: auto; scrollbar-color: auto; }
  .account-auth-scroll::-webkit-scrollbar { width: 6px; }
  .account-auth-scroll::-webkit-scrollbar-track { background: transparent; }
  .account-auth-scroll::-webkit-scrollbar-thumb {
    min-height: 40px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 55%, transparent);
  }
  .account-auth-scroll::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--muted) 80%, transparent);
  }
  .account-auth-scroll::-webkit-scrollbar-button { display: none; }
}

body:is(.auth-required, .auth-page) .app {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

body.auth-required .account-modal {
  z-index: 80;
  background: var(--paper);
}

body.auth-required .account-auth-card {
  width: min(960px, 100%);
  border-radius: 30px;
}

.account-auth-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.account-rank-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-rank-copy {
  min-width: min(360px, 60vw);
}

.account-rank-progress-bar {
  width: min(360px, 52vw);
  height: 6px;
  margin: 10px 0 6px;
  background: color-mix(in srgb, var(--gold) 18%, var(--line));
}

.account-rank-progress-bar span {
  width: 0;
  background: var(--gold);
}

#accountModalRankProgress {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rank-status-logo {
  --tier-color: var(--gold);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border: 2px solid color-mix(in srgb, var(--tier-color) 78%, var(--ink));
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .48), transparent 24%),
    color-mix(in srgb, var(--tier-color) 86%, var(--ink));
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, .22),
    0 5px 12px color-mix(in srgb, var(--tier-color) 24%, transparent);
}

.rank-status-mark {
  color: #fff !important;
  font-size: 18px !important;
  font-weight: 950 !important;
  line-height: 1;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .34);
}

.account-rank-heading .rank-status-logo {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
}

.account-rank-heading .rank-status-mark {
  font-size: 21px !important;
}

.account-rank-heading #accountModalTitle {
  margin: 0;
}

.account-auth-head span,
.account-profile-card span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.account-auth-head h2,
.account-profile-card h3 {
  margin: 4px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 44px);
}

.account-auth-head button,
.auth-tabs button,
.auth-form button,
.account-actions button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel-soft);
  cursor: pointer;
  font-weight: 900;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.auth-tabs button.active,
.auth-form > button,
.account-actions button:first-child:not(:disabled) {
  border-color: var(--teal);
  color: var(--paper);
  background: linear-gradient(135deg, var(--teal), var(--rail-bg, var(--ink)));
}

.auth-form,
.account-profile {
  display: grid;
  gap: 16px;
}

.auth-gate-copy {
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--teal) 34%, var(--line));
  border-radius: 22px;
  margin-bottom: 16px;
  padding: 18px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--teal) 16%, transparent), transparent 14rem),
    var(--panel-soft);
}

.auth-gate-copy span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth-gate-copy h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 46px);
}

.auth-gate-copy p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.guest-account-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line));
  border-radius: 16px;
  color: var(--ink);
  background: var(--panel-soft);
}

/* Rank road: a swipeable, top-of-account view of the complete progression. */
.account-auth-head {
  position: relative;
  display: block;
  align-items: stretch;
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.rank-road {
  min-width: 0;
  flex: 1 1 auto;
}

.rank-road-viewport {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-inline: none;
  touch-action: pan-y pinch-zoom;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
}

.rank-road-viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.rank-road-viewport.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.rank-road-viewport:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--teal) 72%, transparent);
  outline-offset: 4px;
  border-radius: 18px;
}

.rank-road-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: max-content;
  padding: 12px 12px 14px;
}

.rank-road-level {
  position: relative;
  width: 128px;
  min-width: 128px;
  display: grid;
  grid-template-rows: 28px 22px 24px 44px;
  justify-items: center;
  align-items: center;
  row-gap: 14px;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  cursor: inherit;
}

.account-auth-head .rank-road-level,
body[data-theme="gamify"] .account-auth-head .rank-road-level {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

.rank-road-level > strong {
  grid-row: 1;
  max-width: 100%;
  color: var(--tier-color);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.3;
  white-space: nowrap;
}

.rank-road-segment {
  position: relative;
  grid-row: 2;
  width: 100%;
  height: 22px;
  border-block: 2px solid color-mix(in srgb, var(--ink) 45%, var(--line));
  background: color-mix(in srgb, var(--muted) 22%, var(--panel));
  box-shadow: inset 0 2px 3px rgba(var(--ink-rgb), .12);
}

.rank-road-segment::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #edbe73, #c58239);
  content: "";
}

.rank-road-level.is-locked .rank-road-segment::before { display: none; }
.rank-road-level.is-current .rank-road-segment::before { width: 50%; }

.rank-road-segment::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 1px);
  width: 2px;
  background: color-mix(in srgb, var(--ink) 40%, transparent);
  transform: skewX(-15deg);
  content: "";
}

.rank-road-level.is-current .rank-road-segment::after {
  top: -6px;
  bottom: -6px;
  left: calc(50% - 3px);
  width: 6px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--panel);
  transform: none;
}

.rank-road-level.is-rank-start {
  width: 128px;
  min-width: 128px;
}

.rank-road-level.rank-road-opening {
  --tier-color: var(--gold);
  width: 164px;
  min-width: 164px;
}

.rank-road-opening > strong {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rank-road-opening svg {
  width: 20px;
  height: 20px;
  fill: color-mix(in srgb, var(--gold) 20%, transparent);
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rank-road-opening .rank-road-segment {
  width: 50%;
  justify-self: end;
  border-left: 2px solid var(--gold);
  border-radius: 5px 0 0 5px;
  overflow: hidden;
}

.rank-road-opening .rank-road-segment::after { display: none; }

.rank-road-level > small {
  grid-row: 3;
  padding: 3px 8px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 900;
  white-space: nowrap;
}

.rank-road-level.is-current > small {
  border-radius: 5px;
  color: var(--ink);
  background: color-mix(in srgb, var(--gold) 23%, var(--panel));
}

.rank-road-level:focus-visible { outline: none; }
.rank-road-level:focus-visible > small {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .rank-road-viewport { scroll-behavior: auto; }
}

@media (max-width: 620px) {
  .account-auth-scroll { padding: 8px 14px 8px 8px; }
  .account-auth-head { gap: 10px; }
  .rank-road-level { width: 112px; min-width: 112px; }
  .rank-road-level.is-rank-start { width: 112px; min-width: 112px; }
}

.guest-account-banner[hidden] {
  display: none;
}

.guest-account-banner > div {
  flex: 1 1 260px;
}

.guest-account-banner strong,
.guest-account-banner small {
  display: block;
  line-height: 1.5;
}

.guest-account-banner small {
  margin-top: 3px;
  color: var(--muted);
}

.guest-account-banner button,
.auth-gate-copy .guest-play-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-gate-copy .guest-play-button {
  justify-self: start;
}

.guest-account-banner button:hover,
.auth-gate-copy .guest-play-button:hover {
  background: var(--gold-soft);
}

.guest-account-banner button:focus-visible,
.auth-gate-copy .guest-play-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.inline-policy-button {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 900;
  cursor: pointer;
}

.inline-policy-button:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-form label:not(.terms-check) {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  background: var(--panel-soft);
}
.terms-check,
.account-profile-card p,
.account-profile-card small,
.account-security-card p,
.account-security-card small,
.account-role-summary p {
  color: var(--muted);
  line-height: 1.5;
}

.terms-check {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 13px;
  font-weight: 750;
}

.terms-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.password-meter {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--panel-soft);
}

.password-meter > div {
  height: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}

.password-meter > div span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--teal), var(--green));
}

.password-meter ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.password-meter li.ok {
  color: var(--green);
}

.account-profile {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-profile-card,
.account-security-card,
.account-role-summary {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: var(--panel-soft);
}

.account-profile-card {
  background:
    radial-gradient(circle at 14% 8%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 14rem),
    var(--panel-soft);
}

.account-role-summary,
.account-actions {
  grid-column: 1 / -1;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 760px) {
  .auth-grid,
  .password-meter ul,
  .account-profile {
    grid-template-columns: 1fr;
  }
}

/* Launch-readiness fit and feedback polish */
button,
.nav,
.mode-row,
.mode-list li,
.result,
.leaderboard-view-banner,
.news-card,
.pack-card,
.course-lesson,
.module-quiz label,
.quiz-review-panel,
.speed-end-screen  {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

button {
  white-space: normal;
  line-height: 1.18;
}

.mode-row,
.mode-list li,
.leaderboard-view-banner,
.speed-score-grid  {
  flex-wrap: wrap;
}

.speed-end-screen {
  display: grid;
  gap: 16px;
}

.speed-end-hero {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(18px, 3vw, 28px);
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--amber) 22%, transparent), transparent 14rem),
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 12%, var(--panel)), var(--panel));
}

.speed-end-hero span,
.quiz-review-head small,
.speed-score-grid small,
.speed-round-review span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.speed-end-hero strong {
  display: block;
  margin: 6px 0;
  font-size: clamp(36px, 7vw, 74px);
  line-height: .95;
}

.speed-end-hero p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
}

.speed-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.speed-score-grid article,
.speed-round-review article,
.quiz-review-panel article {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--panel);
}

.speed-score-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.speed-round-review {
  display: grid;
  gap: 10px;
}

.speed-round-review > strong {
  font-size: 16px;
}

.speed-round-review article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.speed-round-review article.correct {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--panel));
}

.speed-round-review article.missed,
.quiz-review-panel article.missed {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  background: color-mix(in srgb, var(--red) 8%, var(--panel));
}

.speed-end-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-review-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--panel-soft) 60%, var(--panel));
}

.quiz-review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quiz-review-panel article {
  display: grid;
  gap: 6px;
}

.quiz-review-panel article.correct {
  border-color: color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--panel));
}

.quiz-review-panel article p,
.quiz-review-panel article small {
  margin: 0;
}

@media (max-width: 780px) {
  .speed-score-grid,
  .speed-end-actions {
    grid-template-columns: 1fr;
  }

  .speed-round-review article {
    grid-template-columns: 1fr;
  }
}

/* Paper trading */
body.paper-mode .mode-surface {
  max-height: none;
  overflow: visible;
}

body.paper-mode .choices,
body.paper-mode #nextBtn {
  display: none !important;
}

body.paper-mode .chart-panel,
body.paper-mode .chart-canvas-wrap {
  min-width: 0;
}

body.paper-mode .result {
  min-height: 0;
}

/* Fixed ledger lives outside the workspace so opening it never reflows the chart. */
.paper-ledger[hidden],
.paper-ledger-panel[hidden] { display: none; }

.paper-ledger-toggle {
  position: fixed;
  z-index: 74;
  right: 0;
  top: 72%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 9px 0 0 9px;
  background: rgba(16, 18, 22, .82);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: .5;
  cursor: pointer;
  transition: background 160ms ease, opacity 160ms ease;
}

.paper-ledger-toggle:is(:hover, :active, :focus-visible, [aria-expanded="true"]) {
  opacity: 1;
  background: rgba(5, 7, 10, .94);
}

.paper-ledger-toggle:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.paper-ledger-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.paper-ledger-panel {
  position: fixed;
  z-index: 74;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 64px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
  overflow-wrap: anywhere;
}

.paper-ledger-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.paper-ledger-head h2 { margin: 0; font-size: 1.2rem; min-width: 0; }
.paper-ledger-head button { flex: 0 0 44px; min-height: 44px; padding: 0; font-size: 1.5rem; }
.paper-ledger-summary { margin: 8px 0; font-size: .85rem; color: var(--muted); }
.paper-ledger-panel .paper-order-list { margin: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.paper-ledger-panel .paper-order + .paper-order { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .paper-ledger-toggle { transition: none; }
}

.paper-sidebar {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.paper-account-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.paper-account-summary article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
}

.paper-account-summary small,
.paper-account-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.paper-account-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.paper-account-summary strong {
  margin-top: 3px;
  font-size: 18px;
}

.paper-account-summary > span {
  grid-column: 1 / -1;
  font-size: 12px;
}

.paper-page,
.paper-trade-grid,
.paper-position-list,
.paper-order-list {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.paper-hero,
.paper-card,
.paper-summary-grid article {
  border: 1px solid rgba(var(--ink-rgb), .12);
  border-radius: 24px;
  background: rgba(var(--paper-rgb), .9);
  box-shadow: 0 18px 55px rgba(24, 37, 55, .08);
  min-width: 0;
}

body[data-theme="dark"] .paper-hero,
body[data-theme="dark"] .paper-card,
body[data-theme="dark"] .paper-summary-grid article {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .055);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .24);
}

.paper-hero {
  position: relative;
  padding: clamp(22px, 4vw, 34px);
  background:
    radial-gradient(circle at top right, rgba(47, 129, 120, .2), transparent 34%),
    linear-gradient(135deg, rgba(var(--paper-rgb), .96), rgba(235, 229, 220, .75));
}

.paper-hero-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.paper-hero-close:hover {
  color: var(--paper);
  background: var(--ink);
}

body[data-theme="dark"] .paper-hero {
  background:
    radial-gradient(circle at top right, rgba(149, 215, 206, .22), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
}

.paper-hero span,
.paper-card span,
.paper-summary-grid small,
.paper-order small,
.paper-position small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.paper-hero h2 {
  margin: 8px 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: .98;
  overflow-wrap: anywhere;
}

.paper-hero p,
.paper-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.paper-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 12px;
}

.paper-summary-grid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.paper-summary-grid strong {
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.paper-trade-grid {
  grid-template-columns: minmax(280px, .9fr) minmax(280px, 1.1fr);
  align-items: stretch;
}

.paper-card,
.paper-ticket {
  padding: 18px;
}

.paper-ticket {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(var(--ink-rgb), .12);
  border-radius: 24px;
  background: rgba(var(--paper-rgb), .94);
  min-width: 0;
}

body[data-theme="dark"] .paper-ticket {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
}

.paper-ticket-compact {
  gap: 12px;
  border-color: var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--panel-soft);
}

body[data-theme="dark"] .paper-ticket-compact {
  border-color: var(--line);
  background: var(--panel-soft);
}

.paper-ticket-compact > div:first-child strong {
  display: block;
  margin-top: 2px;
}

.paper-ticket-compact > div:first-child span,
.paper-ticket-compact label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.paper-ticket-compact .paper-card {
  gap: 9px;
  border-color: var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--panel);
  box-shadow: none;
}

.paper-ticket-compact .paper-price-row b {
  font-size: clamp(26px, 3vw, 34px);
}

.paper-ticket-compact .paper-quote-actions button {
  min-width: 0;
}

.paper-account-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.paper-account-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px;
  cursor: pointer;
  list-style: none;
}

.paper-account-details summary::-webkit-details-marker {
  display: none;
}

.paper-account-details summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.paper-account-details summary strong {
  font-size: 12px;
}

.paper-details-body {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 11px;
}

.paper-details-body .paper-position-list,
.paper-details-body.paper-order-list {
  margin-top: 0;
}

.paper-details-body .paper-position,
.paper-details-body .paper-order {
  grid-template-columns: 1fr;
}

.paper-details-body .paper-position-actions {
  justify-content: flex-start;
}

.paper-ticket label,
.paper-ticket input {
  min-width: 0;
}

.paper-ticket input {
  width: 100%;
}

.paper-order-field {
  position: relative;
  display: block;
  min-width: 0;
  border-radius: 8px;
}

.paper-order-field input {
  padding-right: 38px;
}

.paper-order-error-icon {
  position: absolute;
  top: 50%;
  right: 10px;
  display: none;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  pointer-events: auto;
  transform: translateY(-50%);
}

.paper-order-error-icon::before,
.paper-order-error-icon::after {
  position: absolute;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.paper-order-error-icon::before {
  right: -5px;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: min(220px, calc(100vw - 40px));
  border-radius: 5px;
  padding: 6px 8px;
  color: #fff;
  background: #111;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .24);
  content: attr(data-tooltip);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  transform: translateY(3px);
}

.paper-order-error-icon::after {
  right: 3px;
  bottom: calc(100% + 2px);
  border: 5px solid transparent;
  border-top-color: #111;
  content: "";
  transform: translateY(3px);
}

.paper-order-error-icon[data-tooltip].is-open::before,
.paper-order-error-icon[data-tooltip].is-open::after {
  opacity: 1;
  transform: translateY(0);
}

.paper-order-error-icon:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (min-width: 981px) {
  .paper-order-error-icon[data-tooltip]:hover::before,
  .paper-order-error-icon[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateY(0);
  }
}

.paper-order-field.is-invalid {
  animation: paper-order-field-shake 260ms ease-in-out 1;
}

.paper-order-field.is-invalid input {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, var(--panel));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 18%, transparent);
}

.paper-order-field.is-invalid .paper-order-error-icon {
  display: grid;
}

.paper-order-alert {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes paper-order-field-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .paper-order-field.is-invalid { animation: none; }
  .paper-order-error-icon::before,
  .paper-order-error-icon::after { transition: none; }
}

.paper-ticket-actions,
.paper-order-actions,
.paper-quote-actions,
.paper-position-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.paper-ticket-actions button,
.paper-order-actions button,
.paper-quote-actions button,
.paper-position-actions button {
  min-width: min(100%, 112px);
}

.paper-quote-card {
  display: grid;
  gap: 14px;
}

.paper-quote-head,
.paper-price-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.paper-quote-head strong {
  display: block;
  overflow-wrap: anywhere;
}

.paper-quote-head em {
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(var(--ink-rgb), .08);
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.paper-price-row b {
  font-size: clamp(30px, 4vw, 48px);
  line-height: .95;
}

.paper-price-row small,
.gain {
  color: var(--green);
  font-weight: 900;
}

.paper-quote-card.down .paper-price-row small,
.loss {
  color: var(--red);
  font-weight: 900;
}

.paper-quote-card.error {
  border-color: rgba(181, 77, 77, .35);
}

.paper-quote-card.loading {
  border-color: rgba(47, 129, 120, .35);
}

.paper-risk-note {
  background: linear-gradient(135deg, rgba(47, 129, 120, .12), rgba(235, 229, 220, .36));
}

.paper-position-list,
.paper-order-list {
  margin-top: 12px;
}

.paper-position,
.paper-order {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr));
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(var(--ink-rgb), .1);
  border-radius: 18px;
  padding: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.paper-order {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr));
}

body[data-theme="dark"] .paper-position,
body[data-theme="dark"] .paper-order {
  border-color: rgba(255,255,255,.1);
}

.paper-position strong,
.paper-order strong {
  display: block;
  overflow-wrap: anywhere;
}

.paper-position-actions {
  justify-content: flex-end;
}

@media (max-width: 1320px) {
  body.paper-mode .panel {
    display: flex;
  }
}

@media (max-width: 1080px) {
  .paper-trade-grid {
    grid-template-columns: 1fr;
  }

  .paper-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paper-position,
  .paper-order {
    grid-template-columns: 1fr 1fr;
  }

  .paper-position-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .paper-summary-grid,
  .paper-position,
  .paper-order {
    grid-template-columns: 1fr;
  }

  .paper-quote-head,
  .paper-price-row {
    display: grid;
  }
}

/* Quant Lab */
body.quant-mode .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.quant-mode .chart-panel,
body.quant-mode .lower,
body.quant-mode .mode-copy,
body.quant-mode .result {
  display: none;
}

body.quant-mode .panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.quant-mode .mode-surface {
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

body.quant-mode #nextBtn,
body.quant-mode .choices {
  display: none;
}

.quant-coming-soon {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: min(70vh, 700px);
  padding: 48px 12px 96px;
  text-align: center;
}

.quant-coming-soon h1 {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  column-gap: .25em;
  row-gap: .7em;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 7vw, 6.5rem);
  font-weight: 600;
  line-height: 1.15;
}

.quant-letter-word { position: relative; display: inline-flex; align-items: baseline; }
.quant-gear-letter { width: .58em; height: .58em; align-self: center; margin-top: .15em; overflow: visible; }
.quant-coming-soon h1::after {
  content: "";
  position: absolute;
  top: calc(100% + .9em);
  left: 5%;
  width: 90%;
  height: .2em;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(8, 21, 43, .28), transparent 70%);
  filter: blur(3px);
  pointer-events: none;
}
body[data-theme="dark"] .quant-coming-soon h1::after {
  background: radial-gradient(ellipse, rgba(0, 0, 0, .9), transparent 70%);
}
.quant-final-n { position: relative; }
/* Keep the string and spider inside the final n, suspended from its top arch. */
.quant-hanging-spider { position: absolute; left: .24em; top: .4em; width: .24em; height: .44em; color: var(--ink); opacity: .9; pointer-events: none; }
.quant-spider-thread { opacity: .6; }
.quant-corner-decoration { position: absolute; width: clamp(70px, 12vw, 150px); height: auto; color: var(--muted); opacity: .4; pointer-events: none; }
.quant-corner-top { top: 0; left: 0; }
.quant-corner-bottom { bottom: 0; right: 0; transform: rotate(180deg); }
.quant-corner-dust { animation: quant-corner-dust-drift 8s ease-in-out infinite alternate; }
@keyframes quant-corner-dust-drift { to { opacity: .4; transform: translate(2px, 3px); } }
@media (prefers-reduced-motion: reduce) { .quant-corner-dust { animation: none; } }

.quant-page {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.quant-hero,
.quant-builder,
.quant-rule-card,
.quant-code-panel,
.quant-metrics article,
.quant-signal-list,
.quant-critique {
  border: 1px solid rgba(var(--ink-rgb), .12);
  border-radius: 20px;
  background: rgba(var(--paper-rgb), .92);
  box-shadow: 0 16px 45px rgba(24, 37, 55, .07);
  min-width: 0;
}

body[data-theme="dark"] .quant-hero,
body[data-theme="dark"] .quant-builder,
body[data-theme="dark"] .quant-rule-card,
body[data-theme="dark"] .quant-code-panel,
body[data-theme="dark"] .quant-metrics article,
body[data-theme="dark"] .quant-signal-list,
body[data-theme="dark"] .quant-critique {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
}

.quant-hero {
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(47, 129, 120, .14), rgba(235, 229, 220, .54)),
    rgba(var(--paper-rgb), .96);
}

.quant-hero span,
.quant-builder span,
.quant-code-panel span,
.quant-rule-card span,
.quant-metrics span,
.quant-signal-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.quant-hero h2 {
  margin: 6px 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.quant-hero p,
.quant-code-panel p,
.quant-rule-card span,
.quant-critique p,
.quant-signal-list small,
.quant-metrics small {
  color: var(--muted);
  line-height: 1.45;
}

.quant-builder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.quant-builder label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.quant-builder input,
.quant-builder select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--panel-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  min-width: 0;
}

.quant-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quant-actions button {
  border: 1px solid rgba(198, 160, 83, .45);
  border-radius: 14px;
  padding: 12px 10px;
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: white;
  font-weight: 900;
}

.quant-rule-card,
.quant-code-panel,
.quant-critique,
.quant-signal-list {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.quant-code-panel {
  border: 1px solid rgba(var(--ink-rgb), .12);
  border-radius: 20px;
  background: rgba(var(--paper-rgb), .92);
  box-shadow: 0 16px 45px rgba(24, 37, 55, .07);
}

.quant-code-panel label {
  display: grid;
  gap: 6px;
}

.quant-code-panel select,
.quant-code-panel textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--panel-soft) 82%, white);
  color: var(--ink);
  font: 800 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.quant-code-panel p,
.quant-rule-card em {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.quant-rule-card em {
  color: var(--red);
  font-style: normal;
  font-weight: 900;
}

body[data-theme="dark"] .quant-code-panel {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
}

body[data-theme="dark"] .quant-code-panel select,
.quant-code-panel textarea {
  background: rgba(255,255,255,.06);
}

.quant-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quant-metrics article {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.quant-metrics strong {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.quant-signal-list article {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.quant-signal-list article:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.quant-critique {
  border-color: rgba(181, 77, 77, .24);
}

.quant-critique p {
  margin: 0;
}

@media (max-width: 1080px) {
  body.quant-mode .workspace,
  .quant-builder,
  .quant-actions,
  .quant-metrics {
    grid-template-columns: 1fr;
  }
}

/* Final production overflow guardrails */
.app,
main,
.workspace,
.chart-panel,
.panel,
.mode-surface,
.choices,
.result {
  min-width: 0;
  max-width: 100%;
}

.panel > *,
.choices,
#nextBtn {
  max-width: 100%;
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .panel {
    display: flex !important;
    grid-template-columns: none !important;
    width: 100%;
    min-width: 0;
  }

  body.suggestions-mode .panel {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .mode-copy,
  .mode-surface,
  .result,
  .choices,
  #nextBtn {
    grid-column: auto !important;
  }

  .choices {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr)) !important;
  }
}

/* Finance Labs 101 brand system: logo-led navy, gold, and warm white UI */
body {
  background:
    radial-gradient(circle at 86% -10%, rgba(201, 154, 61, .18), transparent 28rem),
    radial-gradient(circle at 8% 8%, rgba(8, 21, 43, .08), transparent 24rem),
    linear-gradient(135deg, var(--paper), color-mix(in srgb, var(--paper) 84%, white));
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at 86% -10%, rgba(226, 189, 104, .18), transparent 26rem),
    radial-gradient(circle at 4% 12%, rgba(255, 255, 255, .06), transparent 20rem),
    linear-gradient(135deg, #050d1c, var(--paper));
}

.brand-wordmark {
  display: block;
  width: min(360px, 100%);
  height: auto;
  object-fit: contain;
}

.welcome-wordmark {
  max-width: 390px;
  margin: 0 0 18px;
  filter: drop-shadow(0 10px 24px rgba(8, 21, 43, .09));
}

.auth-wordmark {
  max-width: 260px;
  margin-bottom: 10px;
}

body[data-theme="dark"] .brand-wordmark,
body[data-theme="dark"] .welcome-wordmark,
body[data-theme="dark"] .auth-wordmark {
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .94);
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .28));
}

.rail {
  background:
    radial-gradient(circle at 12% 0%, rgba(201, 154, 61, .22), transparent 15rem),
    linear-gradient(180deg, #09162b 0%, #071126 55%, #050c1b 100%);
  border-right: 1px solid rgba(201, 154, 61, .24);
  box-shadow: 18px 0 54px rgba(8, 21, 43, .12);
}

.brand {
  align-items: center;
  border-bottom: 1px solid rgba(226, 189, 104, .20);
  padding-bottom: 16px;
}

.mark {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border: 0;
  border-radius: 50%;
  overflow: visible;
  background: transparent;
  color: var(--navy);
  box-shadow: none;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: invert(1);
}

.brand strong {
  color: #fffefa;
  letter-spacing: .01em;
}

.brand small,
.theme-card span,
.account small {
  color: rgba(248, 243, 232, .72);
}

.nav {
  border: 1px solid transparent;
  color: rgba(248, 243, 232, .82);
}

.nav.active,
.nav:hover {
  border-color: rgba(226, 189, 104, .34);
  background:
    linear-gradient(90deg, rgba(201, 154, 61, .22), rgba(255,255,255,.07));
  color: #fffdf8;
  box-shadow: inset 3px 0 0 var(--gold-2), 0 8px 20px rgba(0, 0, 0, .12);
}

.theme-card,
.account {
  border-color: rgba(226, 189, 104, .24);
  background: rgba(255, 255, 255, .065);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.xp span {
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

.welcome-card,
.round-card,
.level-card,
.account-auth-card,
.daily-calendar-card,
.chart-panel,
.panel,
.lower > div,
.metrics div,
.mode-surface,
.result,
.paper-hero,
.paper-card,
.paper-ticket,
.paper-summary-grid article {
  border-color: color-mix(in srgb, var(--gold) 28%, var(--line));
  box-shadow: var(--shadow);
}

.welcome-card,
.account-auth-card {
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 22rem),
    linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--paper) 62%, var(--panel)));
}

body[data-theme="dark"] .welcome-card,
body[data-theme="dark"] .account-auth-card,
body[data-theme="dark"] .chart-panel,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .mode-surface,
body[data-theme="dark"] .lower > div,
body[data-theme="dark"] .metrics div,
body[data-theme="dark"] .accuracy-popover,
body[data-theme="dark"] .streak-popover {
  background:
    radial-gradient(circle at 100% 0%, rgba(226, 189, 104, .08), transparent 20rem),
    color-mix(in srgb, var(--panel) 94%, white 6%);
}

.welcome-kicker,
.round-kicker,
.eyebrow,
.chart-head small,
.learn-hero span,
.paper-hero span,
.paper-card span,
.account-auth-head span,
.auth-gate-copy span,
.section-head span,
.suggestion small {
  color: var(--gold);
}

.welcome-copy h1,
.account-auth-head h2,
.auth-gate-copy h3,
.learn-hero h2,
.paper-hero h2 {
  color: var(--navy);
}

body[data-theme="dark"] .welcome-copy h1,
body[data-theme="dark"] .account-auth-head h2,
body[data-theme="dark"] .auth-gate-copy h3,
body[data-theme="dark"] .learn-hero h2,
body[data-theme="dark"] .paper-hero h2 {
  color: var(--ink);
}

#tickerForm button,
.choices button,
.secondary,
.packs button,
.round-actions button,
.welcome-actions button:first-child,
.auth-form > button,
.account-actions button:first-child:not(:disabled) {
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: #fffdf8;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent);
  box-shadow: 0 12px 28px rgba(8, 21, 43, .16);
}

body[data-theme="dark"] #tickerForm button,
body[data-theme="dark"] .secondary,
body[data-theme="dark"] .packs button,
body[data-theme="dark"] .round-actions button,
body[data-theme="dark"] .welcome-actions button:first-child,
body[data-theme="dark"] .auth-form > button,
body[data-theme="dark"] .account-actions button:first-child:not(:disabled) {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #08152b;
}

.choices button {
  border: 1px solid color-mix(in srgb, var(--gold) 18%, var(--line));
}

.choices button:not([data-state]) {
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel) 92%, var(--gold)), var(--panel));
  color: var(--ink);
  box-shadow: none;
}

/* Match the dark login page's charcoal surface before an answer is revealed. */
body[data-theme="dark"] .choices button:not([data-state]) {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}

.timeframes > button.active,
.chart-modes button.active,
.mode-tabs button.active,
.module-quiz label:has(input[type="radio"]:checked) {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 13%, var(--panel));
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(201, 154, 61, .16);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline-color: var(--gold);
}

.chart-shell,
.welcome-demo,
canvas {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--chart-bg) 98%, var(--gold)), var(--chart-bg));
}

.chart-topbar,
.advanced-intervals,
.chart-toolbar button {
  border-color: color-mix(in srgb, var(--gold) 22%, var(--line));
}

.mode-surface,
.auth-gate-copy,
.paper-risk-note,
.speed-end-hero {
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--gold) 16%, transparent), transparent 16rem),
    color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.cache-status,
.toast {
  border-color: color-mix(in srgb, var(--gold) 34%, var(--line));
  background: var(--navy);
  color: #fffdf8;
}

.theme-options button[data-theme-choice="light"] {
  background: #fffdf8;
  color: #08152b;
  border-color: rgba(201, 154, 61, .56);
}

.theme-options button[data-theme-choice="dark"] {
  background: #08152b;
  color: #fffdf8;
  border-color: rgba(226, 189, 104, .62);
}

.theme-options button.active {
  outline-color: color-mix(in srgb, var(--gold) 70%, transparent);
}

@media (max-width: 760px) {
  .welcome-wordmark {
    max-width: 300px;
  }

  .auth-wordmark {
    max-width: 220px;
  }
}

/* Sidebar usability: let the mode list use the full height below the brand. */
.rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  height: 100vh;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
  padding: 18px 16px 0;
}

.rail nav {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  align-content: start;
  padding-right: 4px;
}

/* Keep native scrolling with a rounded gray thumb and no track background. */
.rail,
.rail nav {
  scrollbar-color: #8a8a8a transparent;
}

@supports selector(::-webkit-scrollbar) {
  .rail,
  .rail nav { scrollbar-width: auto; scrollbar-color: auto; }
  .rail::-webkit-scrollbar,
  .rail nav::-webkit-scrollbar { width: 6px; }
  .rail::-webkit-scrollbar-track,
  .rail nav::-webkit-scrollbar-track,
  .rail::-webkit-scrollbar-corner,
  .rail nav::-webkit-scrollbar-corner { background: transparent; }
  .rail::-webkit-scrollbar-thumb,
  .rail nav::-webkit-scrollbar-thumb { background: #8a8a8a; border-radius: 999px; }
  .rail::-webkit-scrollbar-thumb:hover,
  .rail nav::-webkit-scrollbar-thumb:hover { background: #aaa; }
  .rail::-webkit-scrollbar-button,
  .rail nav::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
}

.rail .theme-card,
.rail .account {
  margin-top: 0;
}

button.account {
  width: 100%;
  display: grid;
  gap: 7px;
  text-align: left;
  color: #fffdf8;
  cursor: pointer;
}

#accountLevel {
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#accountTitle {
  display: block;
  overflow: hidden;
  color: #fffdf8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#accountProgress {
  line-height: 1.35;
}

.rail .xp {
  margin: 8px 0 5px;
}

@media (max-width: 980px) {
  .rail {
    display: flex;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .rail nav {
    overflow: visible;
    padding-right: 0;
  }
}

/* Account progress belongs with the user's live stats, not inside navigation. */
.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(360px, 1fr);
  gap: 14px;
}

.topbar .metrics {
  width: 100%;
  min-width: 0;
  /* Reserve the original wall gap again, doubling Accuracy's edge spacing. */
  position: relative;
  padding-inline-end: 24px;
  grid-template-columns: repeat(3, minmax(0, 112px));
  justify-content: end;
  align-self: center;
}

.topbar .topbar-tools {
  position: absolute;
  inset-inline-end: -12px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  grid-template-rows: repeat(3, 24px);
  width: 24px;
  color: var(--ink);
}

.topbar .topbar-tool {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.topbar button.topbar-tool {
  cursor: pointer;
}

.topbar button.topbar-tool:hover {
  color: var(--gold);
}

.topbar button.topbar-tool:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.topbar-tool svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-tool .sound-mute-slash {
  display: none;
  stroke: #dc2626;
  stroke-width: 2;
}

.topbar-tool.is-muted .sound-speaker {
  color: var(--muted);
  opacity: .4;
}

.topbar-tool.is-muted .sound-mute-slash { display: block; }

.topbar .topbar-tools.appearance-open { z-index: 41; }

.appearance-menu {
  position: relative;
  width: 24px;
  height: 24px;
}

.topbar .appearance-popover {
  position: absolute;
  z-index: 40;
  top: 0;
  inset-inline-end: calc(100% + 8px);
  display: grid;
  width: 180px;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 38px rgba(var(--ink-rgb), .18);
}

.topbar .appearance-popover[hidden] { display: none; }

/* Keep the hover path connected between the eye and its adjacent menu. */
.appearance-popover::before {
  content: "";
  position: absolute;
  inset-inline-start: 100%;
  top: 0;
  width: 8px;
  height: 100%;
}

.topbar .appearance-heading {
  color: var(--ink);
  font-weight: 800;
}

.topbar .appearance-popover .theme-options {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.appearance-popover .theme-options button { min-height: 44px; }

.appearance-content {
  display: grid;
  gap: 8px;
  min-width: 0;
  /* Leave room for the existing 5px button shadows and focus outlines. */
  padding: 6px;
  margin: -6px;
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  overflow-y: auto;
}

.cloud-weather-options {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: .75rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cloud-weather-options button { min-height: 44px; }
.cloud-weather-options a { color: inherit; text-decoration: underline; }
body:not([data-theme="gamify"]) .cloud-weather-options { display: none; }

.animation-options {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: .75rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.animation-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}

.animation-options input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--gold);
}

.animation-options input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

body[data-animation-xp="off"] :is(#levelButton .xp span, .xp-metric) { transition: none; }

.topbar .metrics div {
  padding: 8px 10px;
}

.topbar .metrics strong {
  font-size: 20px;
}

.topbar-account {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 9rem),
    var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

button.topbar-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "identity"
    "bar"
    "progress";
  align-items: baseline;
  gap: 4px;
  text-align: left;
}

button.topbar-account:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--gold) 68%, var(--line));
  box-shadow: 0 12px 26px rgba(var(--ink-rgb), .10);
}

.topbar-account .account-identity {
  grid-area: identity;
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
}

.topbar-account #accountLevel {
  flex: 0 0 auto;
  color: var(--gold);
  white-space: nowrap;
}

.topbar-account #accountTitle {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
}

.topbar-account .xp {
  grid-area: bar;
  height: 5px;
  margin: 5px 0 2px;
  background: color-mix(in srgb, var(--gold) 18%, var(--line));
}

.topbar-account #accountProgress {
  grid-area: progress;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Keep the Practice selector level with the ticker input. */
.market-controls {
  flex: 0 0 auto;
  align-items: flex-start;
  flex-wrap: nowrap;
}

.chart-head > div:first-child {
  min-width: 0;
}

#tickerForm {
  display: grid;
  grid-template-columns: 160px;
  grid-template-rows: 16px 43px;
  column-gap: 8px;
  row-gap: 5px;
  align-items: start;
  padding-top: 0;
}

.ticker-search-field {
  display: contents;
}

.market-controls > label > span,
.ticker-search-field > label {
  line-height: 16px;
}

.ticker-search-field > label {
  grid-column: 1;
  grid-row: 1;
}

.ticker-search-field > .symbol-search {
  grid-column: 1;
  grid-row: 2;
}

#tickerInput,
#tickerForm button:not(.suggestion),
.market-controls select {
  height: 43px;
}

#tickerInput,
.market-controls select {
  width: 160px;
  color: var(--ink);
  background: var(--panel-soft);
  font: inherit;
}

#assetSelect {
  box-shadow: inset 0 -3px 0 var(--ink);
}

.asset-select-label { position: relative; }

/* Native option text cannot contain animated markup; keep the native control
   and mirror only its placeholder using the control's padding and height. */
#assetSelect.loading-placeholder { text-indent: -9999px; }
#assetSelect option { text-indent: 0; }
.asset-loading-label {
  position: absolute;
  inset-inline: 13px 24px;
  bottom: 0;
  display: none;
  align-items: center;
  height: 43px;
  color: var(--ink);
  font: inherit;
  pointer-events: none;
}
#assetSelect.loading-placeholder + .asset-loading-label { display: flex; }
#assetSelect:disabled + .asset-loading-label { opacity: .52; }

/* Pointer input stays free of persistent focus halos. Tab restores keyboard focus styling. */
body.pointer-focus :focus {
  outline: none !important;
}

#mobileSearchToggle,
#mobileSearchClose,
.mobile-search-icon { display: none; }

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-account {
    justify-self: start;
    max-width: 420px;
  }
}

@media (max-width: 620px) {
  .topbar .metrics {
    /* The phone layout also has an 8px outer page inset: 14px + 8px. */
    padding-inline-end: 22px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar-account {
    max-width: none;
  }

  .market-controls {
    align-items: stretch;
  }

  #tickerForm {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 16px 43px;
    width: 100%;
    padding-top: 0;
  }

  #tickerInput,
  .market-controls select {
    width: 100%;
  }

  /* The shared lookup controls stay compact beside the chart title on phones. */
  .chart-head {
    position: relative;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }
  .chart-head > div:first-child { flex: 1 1 0; }
  .chart-head .market-controls {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }
  .market-controls > label { gap: 4px; }
  .market-controls > label > span { font-size: 11px; }
  .market-controls #assetSelect {
    width: clamp(84px, 27vw, 112px);
    min-height: 44px;
    height: 44px;
    padding: 8px 6px;
    font-size: 12px;
  }
  .asset-loading-label { inset-inline-start: 7px; height: 44px; font-size: 12px; }
}

@media (max-width: 620px), (max-width: 980px) and (max-height: 500px) and (pointer: coarse) {
  #tickerForm {
    display: flex;
    flex-direction: row;
    width: 44px;
    gap: 0;
  }
  #tickerForm #mobileSearchToggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 10px;
  }
  #mobileSearchToggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
  #tickerForm .ticker-search-field {
    display: none;
  }
  .ticker-search-field > label { display: none; }
  /* Mounted on body while open so chart transforms cannot trap the fixed bar. */
  #tickerSearchField.mobile-search-sheet {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    z-index: 12030;
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--mobile-search-bottom, 0px) + 10px + var(--mobile-search-safe-bottom, env(safe-area-inset-bottom, 0px)));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    animation: mobileSearchIn .22s ease-out;
  }
  .mobile-search-sheet .symbol-search { flex: 1; min-width: 0; }
  .mobile-search-sheet .mobile-search-icon {
    display: block;
    position: absolute;
    top: 14px;
    left: 16px;
    width: 22px;
    height: 22px;
    color: var(--muted);
    pointer-events: none;
  }
  .mobile-search-sheet svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
  .mobile-search-sheet #tickerInput {
    width: 100%;
    height: 50px;
    padding: 0 18px 0 48px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--ink);
    font: 400 17px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .12);
  }
  .mobile-search-sheet #tickerInput:focus {
    outline: 2px solid var(--muted);
    outline-offset: 2px;
  }
  .mobile-search-sheet #tickerInput::placeholder { color: var(--muted); opacity: 1; }
  #tickerSearchField #mobileSearchClose {
    display: grid;
    place-items: center;
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    background: var(--panel-soft);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .12);
    cursor: pointer;
  }
  #mobileSearchClose svg { width: 26px; height: 26px; }
  .mobile-search-sheet .suggestions {
    top: auto;
    right: auto;
    left: 0;
    bottom: calc(100% + 12px);
    width: 100%;
    max-height: min(320px, calc(var(--mobile-search-height, 100vh) - 90px));
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--panel);
    box-shadow: none;
    padding: 0;
  }
  .mobile-search-sheet .suggestion {
    min-height: 52px;
    height: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
    padding: 10px 12px;
    border-radius: 0;
    font-family: inherit;
  }
  .mobile-search-sheet .suggestion strong { font-size: 15px; }
  .mobile-search-sheet .suggestion span { grid-column: 1; grid-row: 2; font-size: 13px; }
  .mobile-search-sheet .suggestion small { grid-column: 2; grid-row: 1 / 3; font-size: 10px; }
  @keyframes mobileSearchIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
  #tickerInput { height: 44px; font-size: 16px; }
  #tickerForm .suggestions {
    width: 100%;
    max-height: min(280px, 40vh);
  }
}

@media (max-width: 360px) {
  .chart-head { flex-wrap: wrap; }
  .chart-head .market-controls { order: -1; margin-inline-start: auto; }
  .chart-head > div:first-child { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #tickerSearchField.mobile-search-sheet { animation: none; }
}


.quant-code-editor textarea {
  min-height: 260px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}

.quant-compiled-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quant-compiled-grid article {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 12px;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.quant-compiled-grid code {
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.product-suggestion-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 860px) {
  .quant-compiled-grid,
  .product-suggestion-list {
    grid-template-columns: 1fr;
  }
}


.screenshot-upload,
.screenshot-preview,
.account-dashboard-grid article,
.account-security-note {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.screenshot-upload {
  display: grid;
  gap: 10px;
}

.screenshot-upload label {
  display: grid;
  gap: 7px;
}

.screenshot-upload input[type="file"] {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  padding: 10px;
}

.screenshot-preview {
  box-shadow: none;
  background: var(--panel-soft);
  display: grid;
  gap: 6px;
}

.screenshot-preview p,
.account-dashboard-grid p,
.account-security-note p {
  color: var(--muted);
  line-height: 1.55;
}

.screenshot-preview.ready {
  border-color: var(--teal);
}

.screenshot-preview.error {
  border-color: var(--red);
}

.account-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.account-dashboard-grid article {
  display: grid;
  gap: 8px;
}

.account-dashboard-grid span,
.screenshot-upload span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.account-dashboard-grid strong {
  color: var(--ink);
  font-size: clamp(18px, 2.2vw, 26px);
}

.account-dashboard-grid button {
  min-height: 38px;
  border: 1px solid var(--ink);
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: var(--paper);
  font-weight: 900;
  padding: 0 12px;
}

.account-security-note {
  margin-top: 18px;
}

.account-data-controls {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.account-data-controls > div:first-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.account-data-controls .privacy-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 0;
}

.account-data-controls .danger-button {
  background: color-mix(in srgb, var(--red) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--red) 64%, var(--line));
  color: var(--red);
}

body[data-theme="dark"] .account-data-controls .danger-button {
  background: rgba(246, 92, 92, .12);
  color: #ffb4b4;
}

body[data-theme="dark"] .screenshot-upload,
body[data-theme="dark"] .screenshot-preview,
body[data-theme="dark"] .account-dashboard-grid article,
body[data-theme="dark"] .account-security-note {
  background: rgba(11, 23, 45, .9);
}

@media (max-width: 1050px) {
  .account-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .account-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .account-data-controls {
    align-items: stretch;
    display: grid;
  }

  .account-data-controls .privacy-actions {
    justify-content: stretch;
  }
}

/* Settings uses a section rail, reading pane, and local outline. */
.settings-page { width: 100%; max-width: 1440px; margin-inline: auto; min-width: 0; }
.settings-heading { padding-block: 12px 28px; border-bottom: 1px solid var(--line); }
.settings-heading h2 { margin: 0 0 8px; font-size: clamp(26px, 3vw, 36px); line-height: 1.2; }
.settings-heading p, .settings-section-heading p, .settings-topic p { margin: 0; color: var(--muted); line-height: 1.65; }
.settings-layout { display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) minmax(130px, 170px); grid-template-areas: "nav content outline"; align-items: start; gap: clamp(20px, 3vw, 48px); padding-block: 28px; }
.settings-nav { grid-area: nav; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; border-right: 1px solid var(--line); padding-right: 18px; }
.settings-nav-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.settings-nav button, .settings-outline button { min-width: 0; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 600; line-height: 1.45; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.settings-nav button:hover, .settings-outline button:hover { color: var(--ink); background: var(--panel-soft); }
.settings-nav button[aria-current] { background: var(--gold-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--gold); }
.settings-content { grid-area: content; min-width: 0; overflow-wrap: anywhere; }
.settings-section-heading { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.settings-section-heading h2 { margin: 0 0 10px; font-size: clamp(24px, 2.5vw, 32px); line-height: 1.25; }
.settings-topic { display: grid; gap: 14px; padding-block: 28px; scroll-margin-block: 24px; }
.settings-topic + .settings-topic { border-top: 1px solid var(--line); }
.settings-topic h3 { margin: 0; font-size: 19px; line-height: 1.4; }
#websiteLanguage { width: 100%; max-width: 28rem; min-width: 0; min-height: 44px; }
#websiteLanguageStatus:empty { display: none; }
/* Reading direction follows the selected language without mirroring market charts. */
html[lang="ar"] .settings-page :is(button, h2, h3, p, label) { text-align: start; }
.settings-details { display: grid; gap: 18px; margin: 0; }
.settings-details > div { display: grid; gap: 5px; }
.settings-details dt { color: var(--muted); font-size: 13px; }
.settings-details dd { margin: 0; font-weight: 600; }
.settings-stat { font-size: clamp(24px, 3vw, 32px); }
.settings-topic .privacy-actions { margin: 0; }
.settings-topic .privacy-actions button { max-width: 100%; min-height: 44px; overflow-wrap: anywhere; }
.settings-topic .danger-button { background: var(--panel); color: var(--red); border-color: var(--red); }
.settings-outline { grid-area: outline; display: grid; grid-template-columns: minmax(0, 1fr); border-left: 1px solid var(--line); padding-left: 14px; }
.settings-outline button { border-radius: 0; padding-inline: 10px; font-size: 12px; }
.settings-outline button[aria-current] { box-shadow: -15px 0 0 -13px var(--gold); color: var(--ink); }
.settings-page :is(button, h2, h3):focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
@media (max-width: 1200px) {
  .settings-layout { grid-template-columns: 160px minmax(0, 1fr); grid-template-areas: "nav outline" "nav content"; gap: 24px; }
  .settings-outline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border-left: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
  .settings-outline .settings-nav-label { flex-basis: 100%; margin-bottom: 0; }
  .settings-outline button[aria-current] { box-shadow: inset 0 -2px 0 var(--gold); }
}
@media (max-width: 680px) {
  .settings-heading { padding-bottom: 20px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "nav" "outline" "content"; gap: 20px; padding-block: 20px; }
  .settings-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; padding-right: 0; }
  .settings-nav-label { grid-column: 1 / -1; }
  .settings-section-heading { padding-bottom: 20px; }
  .settings-topic { padding-block: 22px; }
}

.socials-hero {
  background:
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--teal) 22%, transparent), transparent 14rem),
    var(--panel);
}

.socials-profile-strip,
.socials-card,
.socials-safety-note {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.socials-profile-strip {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
}

.socials-avatar {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold), var(--gold-2));
  color: var(--navy);
  font-size: 24px;
  font-weight: 950;
}

.socials-profile-strip > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.socials-profile-strip span,
.socials-safety-note > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.socials-profile-strip strong {
  color: var(--ink);
  font-size: clamp(20px, 2.4vw, 28px);
}

.socials-profile-strip p,
.socials-card p,
.socials-safety-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.socials-profile-strip > b {
  border: 1px solid color-mix(in srgb, var(--teal) 46%, var(--line));
  border-radius: 999px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--teal) 9%, var(--panel));
  color: var(--teal);
  white-space: nowrap;
}

.socials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.socials-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  gap: 16px;
  padding: 18px;
}

.socials-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.socials-platform-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
  color: var(--gold-2);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.02em;
}

.socials-card-head > div {
  display: grid;
  gap: 3px;
}

.socials-card-head strong {
  color: var(--ink);
  font-size: 19px;
}

.socials-card-head small {
  color: var(--muted);
}

.socials-card button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: #fffdf8;
  font-weight: 900;
  cursor: pointer;
}

.socials-card button:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.socials-safety-note {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  padding: 18px;
}

.socials-safety-note strong {
  color: var(--ink);
  font-size: 18px;
}

body[data-theme="dark"] .socials-profile-strip,
body[data-theme="dark"] .socials-card,
body[data-theme="dark"] .socials-safety-note {
  background: rgba(11, 23, 45, .9);
}

body[data-theme="dark"] .socials-profile-strip strong,
body[data-theme="dark"] .socials-card-head strong,
body[data-theme="dark"] .socials-safety-note strong {
  color: #fffdf8;
}

@media (max-width: 720px) {
  .socials-profile-strip {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .socials-avatar {
    width: 52px;
    height: 52px;
  }

  .socials-profile-strip > b {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .socials-grid {
    grid-template-columns: 1fr;
  }
}

/* Final readability layer: grouped nav and text-safe cards/pills across themes. */
.rail nav.nav-folders {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.nav-folder {
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .045);
  padding: 8px;
  min-width: 0;
}

.nav-folder summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 253, 248, .82);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1.25;
  list-style: none;
  min-width: 0;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.nav-folder summary::-webkit-details-marker {
  display: none;
}

.nav-folder summary::after {
  content: "+";
  color: var(--gold-2);
  font-size: 14px;
  line-height: 1;
}

.nav-folder[open] summary::after {
  content: "-";
}

.nav-folder-items {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  min-width: 0;
}

.nav-folder-items .nav {
  justify-content: flex-start;
  min-height: 36px;
  min-width: 0;
  padding: 8px 10px;
  white-space: normal;
}

.nav-folder-items .nav.active {
  border-color: color-mix(in srgb, var(--gold) 72%, rgba(255, 255, 255, .2));
}

:is(
  .mode-surface p,
  .mode-surface small,
  .mode-surface label span,
  .welcome-card p,
  .round-card p,
  .account-panel p,
  .account-panel small,
  .support-form p,
  .support-form small
) {
  overflow-wrap: anywhere;
  word-break: normal;
}
body[data-theme="dark"] :is(
  .account-dashboard-grid p,
  .account-security-note p,
  .account-panel small,
  .privacy-card p,
  .about-card p
)  {
  color: rgba(255, 253, 248, .78);
}
body[data-theme="dark"] :is(
  .account-dashboard-grid strong,
  .account-security-note strong,
  .privacy-card strong,
  .about-card strong
)  {
  color: #fffdf8;
}

body[data-theme="dark"] :is(.chat-monitor-pill, .welcome-points span)  {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .16);
  color: #fffdf8;
}

@media (max-width: 980px) {
  .rail nav.nav-folders {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
}

@media (max-width: 560px) {
  .rail nav.nav-folders {
    grid-template-columns: 1fr;
  }
}

/* Final type comfort pass: numbers, symbols, and dense copy adapt to the active appearance. */
:root {
  --number-ink: #08152b;
  --symbol-ink: #805d13;
  --symbol-chip-bg: rgba(201, 154, 61, .13);
  --chart-axis-number: #1b2a44;
  --chart-axis-time: #485568;
  --chart-axis-strong: #08152b;
  --chart-symbol-label: #805d13;
  --chart-label-bg: rgba(255, 253, 248, .96);
  --chart-label-text: #08152b;
  --chart-crosshair-bg: #08152b;
  --chart-crosshair-text: #fffdf8;
}

body[data-theme="dark"] {
  --number-ink: #fff7e6;
  --symbol-ink: #f2d887;
  --symbol-chip-bg: rgba(242, 216, 135, .14);
  --chart-axis-number: #fff7e6;
  --chart-axis-time: #d8d0c2;
  --chart-axis-strong: #ffffff;
  --chart-symbol-label: #f2d887;
  --chart-label-bg: rgba(6, 16, 35, .94);
  --chart-label-text: #fff7e6;
  --chart-crosshair-bg: #f2d887;
  --chart-crosshair-text: #08152b;
}

:is(
  p,
  li,
  small,
  label span,
  .mode-copy,
  .result,
  .account-panel,
  .support-form,
  .product-suggestion-form,
  .privacy-card,
  .about-card
)  {
  word-spacing: .035em;
}

:is(
  button,
  input,
  select,
  textarea,
  .nav,
  .timeline,
  .chart-tip,
  .axis-label,
  .metric,
  .mode-list small
) {
  letter-spacing: .01em;
}

:is(
  .metrics strong,
  .paper-price-row b,
  .paper-position > span,
  .paper-order span,
  .paper-order em,
  .quant-metrics strong,
  .account-dashboard-grid strong,
  .timeline,
  .chart-tip,
  .axis-label
) {
  color: var(--number-ink);
  font-variant-numeric: tabular-nums;
}

.timeframes > button,
.chart-modes button,
.advanced-intervals button,
.chart-toolbar button {
  color: var(--symbol-ink);
}

:is(
  .paper-quote-head em,
  .chat-monitor-pill,
  #revealTag,
  .section-head span
) {
  color: var(--symbol-ink);
}

.nav-folder summary::after {
  color: var(--symbol-ink);
}

.paper-quote-head em,
.chat-monitor-pill,
.welcome-points span,
.mode-list li  {
  background-color: var(--symbol-chip-bg);
}

body[data-theme="dark"] :is(
  input,
  select,
  textarea,
  .suggestions,
  .chart-tip,
  .axis-label,
  .paper-quote-head em
) {
  color: var(--number-ink);
}

body[data-theme="dark"] :is(
  .timeframes > button.active,
  .chart-modes button.active,
  .advanced-intervals button.active,
  .chart-toolbar button
) {
  color: var(--number-ink);
}

body[data-theme="dark"] :is(.timeframes > button:not(.active), .chart-modes button:not(.active), .advanced-intervals button:not(.active)) {
  color: rgba(255, 247, 230, .78);
}

@media (max-height: 760px) {
  .onboarding {
    overflow: auto;
    place-items: start center;
    padding: 16px;
  }

  .welcome-card {
    min-height: 0;
    max-height: none;
    gap: 16px;
    padding: 22px;
  }

  .welcome-copy h1 {
    font-size: clamp(34px, 4.8vw, 56px);
  }

  .welcome-copy p {
    font-size: 16px;
  }

  .welcome-demo {
    height: 240px;
  }

  .welcome-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* Competitive background and site-wide cursor crosshair */
.market-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
  background-color: #fbfcfa;
  background-image:
    linear-gradient(rgba(8, 21, 43, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 21, 43, .055) 1px, transparent 1px);
  background-size: 46px 46px;
}

body[data-theme="dark"] .market-backdrop {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
}

body:is(.versus-mode, .quant-mode) .market-backdrop {
  display: block;
}

body:is(.versus-mode, .quant-mode) .app,
body:is(.versus-mode, .quant-mode) main {
  background: transparent;
}

body:is(.versus-mode, .quant-mode) .app {
  position: relative;
  z-index: 1;
}

/* Allow navigation to share the preview layer above the Competitive backdrop. */
body.versus-mode.panel-staged .app { z-index: auto; }

.mouse-wind-trail {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  fill: none;
  stroke: #56c9ee;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body:not([data-theme="gamify"]) .mouse-wind-trail {
  display: none;
}

.mouse-wind-glint {
  fill: #fff3a3;
  stroke: #ffd34d;
  filter: drop-shadow(0 0 2px rgba(255, 211, 77, .55));
}

.mouse-wind-dust {
  fill: #ffd34d;
  stroke: none;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .mouse-wind-trail { display: none; }
}

.site-crosshair {
  --market-cursor-x: 50vw;
  --market-cursor-y: 50vh;
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: none;
  pointer-events: none;
}

body[data-theme="gamify"] .site-crosshair {
  display: block;
}

.market-crosshair {
  position: fixed;
  display: block;
  opacity: 0;
  will-change: top, left;
}

.market-crosshair-x {
  top: var(--market-cursor-y);
  left: 0;
  width: 100vw;
  height: 1px;
  background: repeating-linear-gradient(90deg, #e2bd68 0 5px, transparent 5px 10px);
}

.market-crosshair-y {
  top: 0;
  left: var(--market-cursor-x);
  width: 1px;
  height: 100vh;
  background: repeating-linear-gradient(180deg, #e2bd68 0 5px, transparent 5px 10px);
}

body[data-theme="gamify"].market-pointer-active .market-crosshair {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .market-crosshair {
    display: none;
  }
}/* Content containment: let cards and controls grow with their full messages. */

#chartCitation {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

@media (max-width: 980px) {
  .chart-topbar {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .primary-timeframes,
  .chart-modes {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .chart-canvas-wrap {
    position: relative;
  }

  .chart-toolbar {
    position: absolute;
    top: 9px;
    right: 9px;
    margin: 0;
  }

  canvas#chart {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 980px) {
  body.versus-waiting .workspace,
  body.versus-waiting .panel,
  body.versus-waiting .mode-surface {
    height: auto;
    min-height: 0;
  }

  body.versus-waiting .mode-surface {
    flex: none;
  }

  .versus-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .versus-actions .game-mode-button,
  .versus-actions button[data-action="versus-start"] {
    grid-column: 1;
    grid-row: auto;
    height: auto;
    min-height: 52px;
  }

  .versus-actions .game-mode-button {
    grid-template-columns: 42px minmax(0, 1fr);
    justify-self: end;
    width: 75%;
  }

  .game-mode-button-label {
    height: auto;
    min-height: 50px;
    padding: 11px 12px;
    line-height: 28px;
    text-overflow: clip;
    white-space: normal;
  }

  .versus-actions button[data-action="versus-start"] {
    justify-self: stretch;
    width: 100%;
    padding: 12px 16px;
    line-height: 1.3;
    white-space: normal;
  }
}

/* Friends: a Terms-style contents list with focused, switchable content. */
body.socials-mode .mode-surface {
  align-self: stretch;
}

.socials-shell {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 54px);
  align-items: start;
}

.socials-menu {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 0;
  min-width: 0;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}

.socials-menu-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.socials-menu-profile > span,
.socials-avatar,
.social-friend-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-2);
  font-weight: 950;
}

.socials-menu-profile > span {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.socials-menu-profile > div,
.socials-profile-strip > div:nth-child(2),
.social-friend-card > div:nth-child(2),
.socials-card-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.socials-menu-profile strong,
.socials-menu-profile small,
.social-friend-card strong,
.social-friend-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.socials-menu-profile strong {
  font-size: 13px;
}

.socials-menu-profile small {
  color: var(--muted);
  font-size: 11px;
}

.socials-menu-label {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 13.75px;
  font-weight: 700;
}

.socials-menu > button {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, padding 150ms ease;
}

.socials-menu > button::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.socials-menu > button:hover {
  color: var(--ink);
  padding-left: 5px;
}

.socials-menu > button.active {
  color: var(--ink);
  font-weight: 900;
  padding-left: 10px;
}

.socials-menu > button.active::before {
  background: var(--teal);
}

.socials-menu > button svg,
.social-add-card svg,
.socials-empty-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.socials-menu > button > small {
  min-width: 21px;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 62%, transparent);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.socials-menu > p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 9px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.socials-menu > p span {
  color: var(--teal);
  font-size: 8px;
}

.socials-content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.socials-page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(4px, 1vw, 12px) 0 8px;
}

.socials-page-heading > div,
.socials-section-heading > div {
  display: grid;
  gap: 6px;
}

.socials-page-heading span,
.socials-section-heading span,
.socials-profile-strip > div > span,
.socials-safety-note > span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.socials-page-heading h2 {
  max-width: 660px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5.4vw, 72px);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: .98;
}

.socials-page-heading > p {
  max-width: 330px;
  margin: 0 0 4px;
  color: var(--muted);
  line-height: 1.55;
}

.socials-profile-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, var(--teal) 12%);
}

.socials-online-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--green);
  border-radius: 12px;
  background: var(--panel);
  background: color-mix(in srgb, var(--green) 12%, var(--panel));
  color: var(--green);
  font-size: 13px;
}

.socials-online-strip > i {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.socials-avatar {
  width: 46px;
  height: 46px;
}

.socials-profile-strip strong {
  font-size: 17px;
}

.socials-profile-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.socials-profile-strip > b,
.socials-section-heading > b {
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--teal) 42%, var(--line));
  border-radius: 999px;
  color: var(--teal);
  font-size: 11px;
  white-space: nowrap;
}

.socials-section {
  display: grid;
  gap: 18px;
  padding-top: 9px;
}

.socials-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}

.socials-section-heading h3 {
  margin: 0;
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: -.025em;
}

.socials-section-heading h3:focus {
  outline: none;
}

.socials-section-heading p,
.socials-card > p,
.socials-safety-note p,
.socials-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.social-friend-list,
.socials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.social-friend-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  transition: border-color 150ms ease, transform 150ms ease;
}

.social-friend-card:hover {
  border-color: color-mix(in srgb, var(--teal) 48%, var(--line));
  transform: translateY(-1px);
}

.social-friend-avatar {
  width: 42px;
  height: 42px;
  font-size: 12px;
}

.social-friend-avatar.gold {
  background: #6d5514;
}

.social-friend-avatar.teal {
  background: #176863;
  color: #f6fffd;
}

.social-friend-card span {
  color: var(--muted);
  font-size: 12px;
}

.social-friend-card > small {
  display: flex;
  align-items: center;
  gap: 6px;
  min-inline-size: calc(7px + 6px + 7ch);
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.social-friend-card > small i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 12%, transparent);
}

.social-friend-card > small i.offline {
  background: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 13%, transparent);
}

.social-add-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  max-width: 760px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(var(--ink-rgb), .06);
}

.social-add-card label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.social-add-card label span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.social-add-card label small {
  color: var(--muted);
  font-weight: 500;
}

.social-add-card input {
  min-width: 0;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--panel-soft);
  color: var(--ink);
}

.social-add-card input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 12%, transparent);
}

.social-add-card > button,
.socials-card button,
.socials-empty button {
  min-height: 42px;
  border: 1px solid var(--navy);
  border-radius: 9px;
  padding: 0 15px;
  background: var(--navy);
  color: #fffdf8;
  font-weight: 900;
  cursor: pointer;
}

.social-add-card > button,
.socials-card button {
  justify-self: start;
}

.social-add-card > p {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.social-add-card > p svg {
  flex: 0 0 auto;
  color: var(--teal);
}

.socials-card {
  display: grid;
  gap: 15px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.socials-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.socials-platform-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--navy);
  color: var(--gold-2);
  font-size: 11px;
  font-weight: 950;
}

.socials-card-head small {
  color: var(--muted);
}

.socials-safety-note {
  display: grid;
  gap: 7px;
  padding: 17px;
  border-left: 3px solid var(--teal);
  background: color-mix(in srgb, var(--teal) 7%, var(--panel));
}

.socials-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  min-height: 220px;
  place-content: center;
  padding: 28px;
  border: 1px dashed color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  text-align: center;
}

.socials-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--teal) 10%, var(--panel));
  color: var(--teal);
}

body[data-theme="dark"] .socials-profile-strip,
body[data-theme="dark"] .socials-safety-note {
  background: rgba(37, 169, 159, .09);
}

body[data-theme="dark"] .social-friend-card,
body[data-theme="dark"] .social-add-card,
body[data-theme="dark"] .socials-card {
  background: rgba(11, 23, 45, .9);
}

@media (max-width: 900px) {
  .socials-shell {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .socials-menu {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
    padding-top: 16px;
  }

  .socials-menu-label {
    grid-column: 1 / -1;
  }

  .socials-menu > button {
    grid-template-columns: 19px minmax(0, 1fr);
  }

  .socials-menu > button > small {
    display: none;
  }
}

@media (max-width: 680px) {
  .socials-page-heading {
    display: grid;
    gap: 12px;
  }

  .socials-page-heading > p {
    max-width: none;
  }

  .socials-profile-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .socials-profile-strip > b {
    grid-column: 2;
    justify-self: start;
  }

  .social-friend-list,
  .socials-grid,
  .social-add-card {
    grid-template-columns: 1fr;
  }

  .social-add-card > p {
    justify-self: start;
  }

  .social-friend-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .social-friend-card > small {
    grid-column: 2;
  }
}

@media (max-width: 520px) {
  .socials-menu {
    grid-template-columns: 1fr;
  }

  .socials-menu-label {
    grid-column: 1;
  }

  .socials-section-heading {
    display: grid;
  }

  .socials-section-heading > b {
    justify-self: start;
  }
}

/* A consistent visual full-stop and breathing room at the end of every page. */
.site-end-space {
  display: block;
  flex: 0 0 auto;
  width: calc(100% + 48px);
  box-sizing: border-box;
  margin-top: auto;
  margin-right: -24px;
  margin-bottom: -28px;
  margin-left: -24px;
  padding-top: clamp(84px, 13vh, 150px);
}

.site-end-band {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: clamp(72px, 8vw, 106px);
  box-sizing: border-box;
  padding: 0 clamp(18px, 4vw, 48px);
  border: 1px solid color-mix(in srgb, var(--rail) 82%, white);
  border-radius: 3px 3px 0 0;
  background: var(--rail);
  box-shadow: 0 18px 45px rgba(10, 44, 91, .16);
}

.site-end-links {
  grid-template-columns: none;
  grid-auto-flow: column;
  gap: clamp(18px, 3vw, 42px);
}

.site-end-links .site-end-link {
  min-width: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f7fbff;
  box-shadow: none;
  font-weight: 850;
  text-align: center;
  text-decoration: underline;
  text-decoration-color: rgba(247, 251, 255, .78);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  white-space: nowrap;
}

.site-end-links .site-end-link:hover,
.site-end-links .site-end-link.active {
  background: transparent;
  color: #ffffff;
  box-shadow: none;
  text-decoration-thickness: 2px;
  text-decoration-color: #ffffff;
}

.site-end-links .site-end-link:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 5px;
}

body[data-theme="dark"] .site-end-band {
  border-color: color-mix(in srgb, var(--rail) 78%, white);
  background: var(--rail);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

body[data-theme="dark"] .site-end-links .site-end-link,
body[data-theme="dark"] .site-end-links .site-end-link:hover,
body[data-theme="dark"] .site-end-links .site-end-link.active {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

body[data-theme="dark"] .site-end-links .site-end-link:focus-visible {
  outline-color: var(--ink);
}

@media (max-width: 680px) {
  .site-end-space {
    padding-top: 72px;
  }

  .site-end-band {
    height: 72px;
    padding-inline: 14px;
  }

  .site-end-links {
    gap: clamp(10px, 3.5vw, 20px);
  }

  .site-end-links .site-end-link {
    font-size: 12px;
  }
}

/* Gamify appearance: a brighter, reward-led third theme option. */
body[data-theme="gamify"] {
  color-scheme: light;
  --ink: #27105f;
  --muted: #655984;
  --line: #9b83e8;
  --paper: #dff6ff;
  --panel: #fffaf0;
  --panel-soft: #ddfff4;
  --green: #00a979;
  --red: #ed3f79;
  --amber: #ff9f1c;
  --blue: #4d5dff;
  --teal: #00aebd;
  --navy: #3a187d;
  --navy-2: #6942d6;
  --gold: #ffad20;
  --gold-2: #ffe36e;
  --gold-soft: #fff2ad;
  --shadow: 8px 8px 0 #a98fe8, 0 22px 42px rgba(65, 35, 148, .18);
  --chart-bg: #fffdf8;
  --future-mask: rgba(223, 246, 255, .88);
  --future-zone: rgba(255, 173, 32, .18);
  --rail: #fff;
  --rail-bg: #3a187d;
  --rail-bg-2: #305fcf;
  --rail-text: #fff;
  --press: #d5c4ff;
  --paper-rgb: 223, 246, 255;
  --ink-rgb: 39, 16, 95;
  --candle-outline: #27105f;
  --candle-up: #00a979;
  --candle-down: #ed3f79;
  --volume-up: rgba(0, 169, 121, .25);
  --volume-down: rgba(237, 63, 121, .25);
  --chart-line: #4d5dff;
  --chart-line-color: #4d5dff;
  --chart-drawing: #00aebd;
  --chart-measure: #ff9f1c;
  --chart-sma: #8e4de1;
  --chart-ema: #ed3f79;
  --chart-bb: #00aebd;
  --chart-fib: #8e4de1;
  background:
    radial-gradient(circle at 88% 5%, rgba(255, 227, 110, .88), transparent 19rem),
    radial-gradient(circle at 10% 14%, rgba(255, 102, 153, .28), transparent 23rem),
    radial-gradient(circle at 55% 72%, rgba(0, 205, 190, .18), transparent 28rem),
    linear-gradient(135deg, #e9dcff 0%, #d9f8ff 48%, #e5fff2 100%);
  background-attachment: fixed;
}

/* Keep the bottom quick-link box visible against Gamify's light --rail color. */
body[data-theme="gamify"] .site-end-band {
  border: 2px solid #32136f;
  border-radius: 24px 24px 0 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 227, 110, .42), transparent 12rem),
    linear-gradient(135deg, #3a187d, #305fcf);
  box-shadow: 8px 8px 0 #aa91e9, 0 22px 42px rgba(65, 35, 148, .2);
}

body[data-theme="gamify"] .site-end-links .site-end-link,
body[data-theme="gamify"] .site-end-links .site-end-link:hover,
body[data-theme="gamify"] .site-end-links .site-end-link.active {
  color: #fff;
  text-decoration-color: #ffe36e;
}

body[data-theme="gamify"] .site-end-links .site-end-link:focus-visible {
  outline-color: #ffe36e;
}

body[data-theme="gamify"] .rail {
  background:
    radial-gradient(circle at 18% 4%, rgba(255, 227, 110, .55), transparent 13rem),
    radial-gradient(circle at 90% 48%, rgba(0, 222, 210, .32), transparent 16rem),
    linear-gradient(165deg, #3a187d 0%, #6942d6 52%, #186ec9 100%);
  border-right: 3px solid #ffe36e;
  box-shadow: 10px 0 0 rgba(74, 49, 168, .22), 20px 0 44px rgba(45, 24, 108, .22);
}

body[data-theme="gamify"] :is(
  .welcome-card,
  .round-card,
  .level-card,
  .account-auth-card,
  .daily-calendar-card,
  .chart-panel,
  .panel,
  .lower > div,
  .metrics div,
  .mode-surface,
  .result,
  .paper-hero,
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article
) {
  border: 2px solid #5c3ac7;
  border-radius: 24px;
  background:
    radial-gradient(circle at 94% 6%, rgba(255, 227, 110, .32), transparent 10rem),
    linear-gradient(145deg, #fffdf8, #f6efff);
  box-shadow:
    8px 8px 0 #aa91e9,
    inset 0 2px 0 rgba(255, 255, 255, .9),
    0 22px 42px rgba(65, 35, 148, .17);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

body[data-theme="gamify"] :is(
  #tickerForm button,
  [data-action="speed-next"],
  .secondary,
  .packs button,
  .round-actions button,
  .welcome-actions button:first-child,
  .auth-form > button,
  .account-actions button:first-child:not(:disabled)
) {
  border: 2px solid #32136f;
  border-radius: 16px;
  background: linear-gradient(135deg, #7048e8, #1769b0);
  color: #fff;
  box-shadow: 5px 5px 0 #32136f, 0 12px 22px rgba(74, 45, 170, .22);
}

.theme-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-options button {
  min-width: 0;
  padding-inline: 5px;
  font-size: 12px;
  white-space: nowrap;
}

.theme-options button[data-theme-choice="gamify"] {
  border-color: #ffd166;
  background: linear-gradient(135deg, #7048d8, #007f7d);
  color: #fff;
}

body[data-theme="gamify"] :is(
  article,
  .chart-panel,
  .panel,
  .mode-surface,
  .lower > div,
  .metrics div,
  .result,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card,
  .socials-safety-note
)  {
  border: 2px solid #5c3ac7;
  border-radius: 24px;
  background:
    radial-gradient(circle at 94% 6%, rgba(255, 227, 110, .3), transparent 9rem),
    linear-gradient(145deg, #fffdf8, #f4efff);
  box-shadow:
    8px 8px 0 #aa91e9,
    inset 0 2px 0 rgba(255, 255, 255, .92),
    0 22px 42px rgba(65, 35, 148, .16);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

body[data-theme="gamify"] :is(
  article,
  .chart-panel,
  .panel,
  .mode-surface,
  .lower > div,
  .metrics div,
  .result,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card
):hover  {
  transform: translate(-2px, -2px);
  box-shadow:
    11px 11px 0 #9a7fe0,
    inset 0 2px 0 rgba(255, 255, 255, .92),
    0 25px 46px rgba(65, 35, 148, .2);
}

body[data-theme="gamify"] .metrics div:nth-child(1) {
  background: linear-gradient(145deg, #fff4ad, #ffd77a);
  box-shadow: 7px 7px 0 #e99b27;
}

body[data-theme="gamify"] .metrics div:nth-child(2) {
  background: linear-gradient(145deg, #ffd8e8, #ff9fc5);
  box-shadow: 7px 7px 0 #d94378;
}

body[data-theme="gamify"] .metrics div:nth-child(3) {
  background: linear-gradient(145deg, #c9fff1, #7ee7dd);
  box-shadow: 7px 7px 0 #009a9b;
}

body[data-theme="gamify"] .metrics > div:where(.streak-menu) {
  border-color: #d94378;
}

body[data-theme="gamify"] .metrics > div:where(:nth-child(3)) {
  border-color: #009a9b;
}

body[data-theme="gamify"] :is(
  .choices button:not([data-state]),
  .timeframes > button,
  .chart-modes button,
  .advanced-intervals button,
  .mode-tabs button,
  .leader-tabs button,
  .leaderboard-stat-switch button,
  .mini-button
) {
  border: 2px solid #5633bd;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #e9ddff);
  color: #27105f;
  box-shadow: 4px 4px 0 #8c70d2;
}

body[data-theme="gamify"] :is(
  .choices button:not([data-state]),
  .timeframes > button,
  .chart-modes button,
  .advanced-intervals button,
  .mode-tabs button,
  .leader-tabs button,
  .leaderboard-stat-switch button,
  .mini-button
):hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 #7658c5;
}

body[data-theme="gamify"] :is(
  .timeframes > button.active,
  .chart-modes button.active,
  .advanced-intervals button.active,
  .mode-tabs button.active,
  .leader-tabs button.active,
  .leaderboard-stat-switch button.active
) {
  border-color: #7a4210;
  background: linear-gradient(145deg, #ffe36e, #ffad20);
  color: #27105f;
  box-shadow: 4px 4px 0 #b96018;
}

body[data-theme="gamify"] .theme-options button.active {
  border: 2px solid #32136f;
  background: linear-gradient(145deg, #ffe36e, #ff9f1c);
  color: #27105f;
  box-shadow: 5px 5px 0 #32136f;
  transform: translate(-2px, -2px);
}

@media (max-width: 680px) {
  body[data-theme="gamify"] :is(
    article,
    .chart-panel,
    .panel,
    .mode-surface,
    .lower > div,
    .metrics div,
    .result,
    .support-form,
    .socials-profile-strip,
    .social-friend-card,
    .social-add-card,
    .socials-card
  )  {
    border-radius: 20px;
    box-shadow: 5px 5px 0 #aa91e9, 0 15px 28px rgba(65, 35, 148, .14);
  }
}

/* Carry the Gamify bubble system through policy, account, social, and utility pages. */
body[data-theme="gamify"] :is(
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .terms-intro,
  .terms-note,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context) {
  border: 2px solid #5c3ac7;
  border-radius: 24px;
  background:
    radial-gradient(circle at 94% 6%, rgba(255, 227, 110, .3), transparent 9rem),
    linear-gradient(145deg, #fffdf8, #f4efff);
  box-shadow:
    8px 8px 0 #aa91e9,
    inset 0 2px 0 rgba(255, 255, 255, .92),
    0 22px 42px rgba(65, 35, 148, .16);
}

body[data-theme="gamify"] :is(
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .terms-intro,
  .terms-note,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context):hover {
  transform: translate(-2px, -2px);
  box-shadow:
    11px 11px 0 #9a7fe0,
    inset 0 2px 0 rgba(255, 255, 255, .92),
    0 25px 46px rgba(65, 35, 148, .2);
}

body[data-theme="gamify"] .terms-contents,
body[data-theme="gamify"] .socials-menu {
  padding: 20px;
}

body[data-theme="gamify"] .terms-document {
  display: grid;
  gap: 18px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-theme="gamify"] :is(
  .terms-intro,
  .terms-document article,
  .terms-note
) {
  border: 2px solid #5c3ac7;
  border-radius: 24px;
  background:
    radial-gradient(circle at 94% 6%, rgba(255, 227, 110, .3), transparent 9rem),
    linear-gradient(145deg, #fffdf8, #f4efff);
  box-shadow:
    8px 8px 0 #aa91e9,
    inset 0 2px 0 rgba(255, 255, 255, .92),
    0 22px 42px rgba(65, 35, 148, .16);
}

body[data-theme="gamify"] :is(
  .privacy-actions button,
  .privacy-actions a,
  .account-dashboard-grid button,
  .socials-menu > button,
  .socials-card button,
  .socials-empty button
) {
  border: 2px solid #32136f;
  border-radius: 15px;
  background: linear-gradient(145deg, #7048e8, #1769b0);
  color: #fff;
  box-shadow: 4px 4px 0 #32136f;
}

body[data-theme="gamify"] .socials-menu > button {
  margin-bottom: 8px;
  padding: 10px 12px;
}

body[data-theme="gamify"] .socials-menu > button.active {
  background: linear-gradient(145deg, #ffe36e, #ffad20);
  color: #27105f;
}

@media (max-width: 680px) {
  body[data-theme="gamify"] :is(
    .about-hero,
    .about-stack > div,
    .terms-hero,
    .terms-contents,
    .terms-intro,
    .terms-document article,
    .terms-note,
    .socials-menu,
    .socials-empty,
    .account-profile-card,
    .account-security-card,
    .account-role-summary,
    .account-security-note,
    .screenshot-upload,
    .screenshot-preview,
    .support-empty,
    .support-context) {
    border-radius: 20px;
    box-shadow: 5px 5px 0 #aa91e9, 0 15px 28px rgba(65, 35, 148, .14);
  }
}

/* Short, line-only ripple emitted from the pointer on every primary click. */
.cursor-click-ripple {
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 1px solid color-mix(in srgb, var(--teal) 78%, white);
  border-radius: 50%;
  background: transparent;
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--teal) 34%, transparent),
    0 0 0 10px color-mix(in srgb, var(--teal) 16%, transparent);
  pointer-events: none;
  transform: scale(.28);
  transform-origin: center;
  animation: cursor-click-ripple 560ms cubic-bezier(.18, .72, .26, 1) forwards;
  will-change: transform, opacity;
}

@keyframes cursor-click-ripple {
  0% {
    opacity: 0;
    transform: scale(.28);
  }

  18% {
    opacity: .78;
  }

  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-click-ripple {
    animation: cursor-click-ripple-reduced 180ms ease-out forwards;
  }

  @keyframes cursor-click-ripple-reduced {
    from { opacity: .55; transform: scale(.8); }
    to { opacity: 0; transform: scale(1); }
  }
}

/* Direction labels keep their market colors only in Gamify. */
body[data-theme="gamify"] .choices button.direction-choice-up:not(.correct):not(.wrong) {
  color: #086f39 !important;
}

body[data-theme="gamify"] .choices button.direction-choice-down:not(.correct):not(.wrong) {
  color: #b4142f !important;
}

body:not([data-theme="gamify"]) .choices button.up-choice .up-arrow-flood {
  display: none;
}

body:not([data-theme="gamify"]) .choices button.down-choice .down-arrow-flood {
  display: none;
}

/* Gamify "Up" choice: a looping, rising-arrow charge while the pointer stays over it. */
.choices button.up-choice .up-arrow-flood {
  display: none;
}

body[data-theme="gamify"] .choices button.up-choice {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform-origin: 50% 82%;
  color: #086f39 !important;
}

body[data-theme="gamify"] .choices button.up-choice .choice-label {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-size: 1.05em;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .72);
}

body[data-theme="gamify"] .choices button.up-choice .up-arrow-flood {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

body[data-theme="gamify"] .choices button.up-choice .up-arrow {
  --arrow-x: 50%;
  --arrow-delay: 0s;
  --arrow-duration: 1.05s;
  --arrow-size: 18px;
  position: absolute;
  left: var(--arrow-x);
  bottom: -24px;
  color: #dcffe9;
  font-size: var(--arrow-size);
  font-weight: 1000;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 2px 0 rgba(0, 76, 42, .45));
  transform: translateX(-50%) scale(.65);
}

body[data-theme="gamify"] .choices button.up-choice .up-arrow-1  { --arrow-x: 7%;  --arrow-delay: -.02s; --arrow-duration: .82s; --arrow-size: 15px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-2  { --arrow-x: 17%; --arrow-delay: -.51s; --arrow-duration: 1.08s; --arrow-size: 22px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-3  { --arrow-x: 28%; --arrow-delay: -.23s; --arrow-duration: .94s; --arrow-size: 17px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-4  { --arrow-x: 39%; --arrow-delay: -.74s; --arrow-duration: 1.18s; --arrow-size: 24px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-5  { --arrow-x: 51%; --arrow-delay: -.15s; --arrow-duration: .76s; --arrow-size: 16px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-6  { --arrow-x: 63%; --arrow-delay: -.64s; --arrow-duration: 1.02s; --arrow-size: 21px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-7  { --arrow-x: 74%; --arrow-delay: -.31s; --arrow-duration: .88s; --arrow-size: 14px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-8  { --arrow-x: 86%; --arrow-delay: -.85s; --arrow-duration: 1.14s; --arrow-size: 23px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-9  { --arrow-x: 95%; --arrow-delay: -.42s; --arrow-duration: .8s;  --arrow-size: 17px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-10 { --arrow-x: 12%; --arrow-delay: -.92s; --arrow-duration: 1.22s; --arrow-size: 20px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-11 { --arrow-x: 34%; --arrow-delay: -.58s; --arrow-duration: .9s;  --arrow-size: 13px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-12 { --arrow-x: 57%; --arrow-delay: -.96s; --arrow-duration: 1.25s; --arrow-size: 25px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-13 { --arrow-x: 68%; --arrow-delay: -.06s; --arrow-duration: 1.1s;  --arrow-size: 16px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-14 { --arrow-x: 81%; --arrow-delay: -.48s; --arrow-duration: .84s; --arrow-size: 19px; }
body[data-theme="gamify"] .choices button.up-choice .up-arrow-15 { --arrow-x: 44%; --arrow-delay: -.36s; --arrow-duration: 1.16s; --arrow-size: 14px; }

body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible) {
  z-index: 3;
  border-color: #064e2c;
  background:
    radial-gradient(circle at 50% 110%, rgba(203, 255, 223, .82), transparent 52%),
    linear-gradient(145deg, #27e879, #07934e 56%, #056237);
  color: #fff !important;
  box-shadow:
    0 8px 0 #075f38,
    0 16px 26px rgba(0, 169, 98, .38),
    inset 0 2px 0 rgba(230, 255, 239, .8);
  animation: gamify-up-button-charge 1.28s cubic-bezier(.2, .8, .25, 1) infinite;
}

body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible) .choice-label {
  color: #fff;
  text-shadow:
    0 2px 0 #08743f,
    0 0 12px rgba(220, 255, 233, .95);
  animation: gamify-up-label-overload 1.28s ease-in-out infinite;
}

body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible) .up-arrow {
  animation: gamify-up-arrow-rise var(--arrow-duration) linear var(--arrow-delay) infinite;
}

@keyframes gamify-up-button-charge {
  0%, 100% { transform: translateY(-5px) scale(1.055) rotate(0); }
  12% { transform: translate(-1px, -7px) scale(1.075) rotate(-.45deg); }
  24% { transform: translate(1px, -8px) scale(1.085) rotate(.45deg); }
  38% { transform: translate(-1px, -7px) scale(1.095) rotate(-.35deg); }
  54% { transform: translate(1px, -9px) scale(1.11) rotate(.35deg); }
  72% { transform: translate(-1px, -8px) scale(1.125) rotate(-.25deg); }
  88% { transform: translate(1px, -7px) scale(1.08) rotate(.2deg); }
}

@keyframes gamify-up-label-overload {
  0%, 100% { transform: translateY(1px) scale(1); }
  18% { transform: translate(-1px, -1px) scale(1.18) rotate(-2deg); }
  32% { transform: translate(1px, -2px) scale(1.28) rotate(2deg); }
  48% { transform: translate(-1px, -3px) scale(1.38) rotate(-1.5deg); }
  64% { transform: translate(1px, -4px) scale(1.52) rotate(1.5deg); }
  78% { transform: translate(-1px, -3px) scale(1.43) rotate(-1deg); }
  90% { transform: translate(1px, -1px) scale(1.2) rotate(.75deg); }
}

@keyframes gamify-up-arrow-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(.55) rotate(-4deg);
  }
  13% { opacity: .9; }
  68% { opacity: .78; }
  100% {
    opacity: 0;
    transform: translate(-50%, -82px) scale(1.28) rotate(4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible),
  body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible) .choice-label,
  body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible) .up-arrow {
    animation: none;
  }

  body[data-theme="gamify"] .choices button.up-choice:not(:disabled):is(:hover, :focus-visible) {
    transform: translateY(-3px) scale(1.03);
  }
}

/* Gamify "Down" choice: the button depresses into a U-shaped trough as arrows fall. */
body[data-theme="gamify"] .choices button.down-choice {
  position: relative;
  isolation: isolate;
  overflow: visible;
  width: calc(100% - 12px);
  justify-self: center;
  transform-origin: 50% 100%;
  color: #b4142f !important;
}

/* Keep the button itself stationary so its hover/click target never follows the
   pressed-down artwork. Only this pointer-transparent layer is animated. */
body[data-theme="gamify"] .choices button.down-choice::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border: 1px solid #710b22;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 0, rgba(255, 220, 226, .92), transparent 58%),
    linear-gradient(180deg, #ff6680, #e11d48 52%, #9f1239);
  box-shadow:
    0 2px 0 #710b22,
    0 8px 16px rgba(184, 18, 57, .3),
    inset 0 9px 0 rgba(119, 7, 34, .35),
    inset 0 -2px 0 rgba(255, 205, 216, .55);
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 100%;
}

body[data-theme="gamify"] .choices button.down-choice .down-choice-label {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 74px;
  font-size: 1.05em;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .75);
  pointer-events: none;
}

body[data-theme="gamify"] .choices button.down-choice .down-letter {
  display: inline-block;
  transform-origin: 50% 0;
  transition: transform 220ms cubic-bezier(.2, .9, .3, 1.25);
}

body[data-theme="gamify"] .choices button.down-choice .down-arrow-flood {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

body[data-theme="gamify"] .choices button.down-choice .down-arrow {
  --arrow-x: 50%;
  --arrow-delay: 0s;
  --arrow-duration: 1s;
  --arrow-size: 18px;
  position: absolute;
  top: -25px;
  left: var(--arrow-x);
  color: #ff173f;
  font-size: var(--arrow-size);
  font-weight: 1000;
  line-height: 1;
  opacity: 0;
  filter:
    drop-shadow(0 2px 0 rgba(102, 0, 22, .62))
    drop-shadow(0 0 5px rgba(255, 79, 107, .62));
  transform: translateX(-50%) scale(.62);
}

body[data-theme="gamify"] .choices button.down-choice .down-arrow-1  { --arrow-x: 5%;  --arrow-delay: -.04s; --arrow-duration: .78s; --arrow-size: 15px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-2  { --arrow-x: 14%; --arrow-delay: -.48s; --arrow-duration: 1.06s; --arrow-size: 22px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-3  { --arrow-x: 23%; --arrow-delay: -.19s; --arrow-duration: .88s; --arrow-size: 17px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-4  { --arrow-x: 33%; --arrow-delay: -.72s; --arrow-duration: 1.16s; --arrow-size: 24px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-5  { --arrow-x: 43%; --arrow-delay: -.13s; --arrow-duration: .74s; --arrow-size: 16px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-6  { --arrow-x: 52%; --arrow-delay: -.61s; --arrow-duration: 1s;    --arrow-size: 21px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-7  { --arrow-x: 62%; --arrow-delay: -.29s; --arrow-duration: .84s; --arrow-size: 14px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-8  { --arrow-x: 72%; --arrow-delay: -.82s; --arrow-duration: 1.12s; --arrow-size: 23px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-9  { --arrow-x: 82%; --arrow-delay: -.4s;  --arrow-duration: .8s;  --arrow-size: 17px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-10 { --arrow-x: 93%; --arrow-delay: -.91s; --arrow-duration: 1.2s;  --arrow-size: 20px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-11 { --arrow-x: 10%; --arrow-delay: -.57s; --arrow-duration: .86s; --arrow-size: 13px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-12 { --arrow-x: 28%; --arrow-delay: -.95s; --arrow-duration: 1.23s; --arrow-size: 25px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-13 { --arrow-x: 38%; --arrow-delay: -.07s; --arrow-duration: 1.07s; --arrow-size: 16px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-14 { --arrow-x: 58%; --arrow-delay: -.46s; --arrow-duration: .82s; --arrow-size: 19px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-15 { --arrow-x: 68%; --arrow-delay: -.34s; --arrow-duration: 1.14s; --arrow-size: 14px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-16 { --arrow-x: 78%; --arrow-delay: -.68s; --arrow-duration: .92s; --arrow-size: 21px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-17 { --arrow-x: 88%; --arrow-delay: -.22s; --arrow-duration: 1.09s; --arrow-size: 16px; }
body[data-theme="gamify"] .choices button.down-choice .down-arrow-18 { --arrow-x: 48%; --arrow-delay: -.78s; --arrow-duration: .76s; --arrow-size: 12px; }

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) {
  z-index: 3;
  border-color: transparent;
  border-radius: 16px;
  background: transparent;
  color: #fff !important;
  box-shadow: none;
  transform: none;
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible)::before {
  opacity: 1;
  animation: gamify-down-button-press .72s cubic-bezier(.18, .82, .25, 1) infinite alternate;
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-choice-label {
  color: #fff;
  text-shadow:
    0 2px 0 #8f1230,
    0 0 10px rgba(255, 221, 227, .92);
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-letter-1 {
  transform: translateY(-3px) rotate(-7deg);
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-letter-2 {
  transform: translateY(7px) rotate(-3deg) scaleY(.9);
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-letter-3 {
  transform: translateY(7px) rotate(3deg) scaleY(.9);
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-letter-4 {
  transform: translateY(-3px) rotate(7deg);
}

body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-arrow {
  animation: gamify-down-arrow-fall var(--arrow-duration) linear var(--arrow-delay) infinite;
}

@keyframes gamify-down-button-press {
  from {
    transform: scaleX(.98) scaleY(.78);
    clip-path: polygon(
      0 0,
      14% 0,
      24% 3%,
      33% 9%,
      41% 17%,
      47% 22%,
      50% 23%,
      53% 22%,
      59% 17%,
      67% 9%,
      76% 3%,
      86% 0,
      100% 0,
      100% 100%,
      0 100%
    );
  }
  to {
    transform: scaleX(1) scaleY(.68);
    clip-path: polygon(
      0 0,
      14% 0,
      24% 4%,
      33% 12%,
      41% 23%,
      47% 30%,
      50% 32%,
      53% 30%,
      59% 23%,
      67% 12%,
      76% 4%,
      86% 0,
      100% 0,
      100% 100%,
      0 100%
    );
  }
}

@keyframes gamify-down-arrow-fall {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(.5) rotate(3deg);
  }
  14% { opacity: .96; }
  70% { opacity: .82; }
  100% {
    opacity: 0;
    transform: translate(-50%, 82px) scale(1.3) rotate(-3deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible)::before,
  body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-arrow {
    animation: none;
  }

  body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible)::before {
    transform: scaleX(.98) scaleY(.78);
  }

  body[data-theme="gamify"] .choices button.down-choice:not(:disabled):is(:hover, :focus-visible) .down-arrow {
    top: 16px;
    opacity: .68;
  }
}

/* Each remaining prediction gets a literal, game-like motion cue in Gamify mode. */
.choices button .choice-action-effect {
  display: none;
}

body[data-theme="gamify"] .choices button:is(
  .sideways-choice,
  .breakout-choice,
  .reversal-choice,
  .volatility-choice
) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

body[data-theme="gamify"] .choices button:is(
  .sideways-choice,
  .breakout-choice,
  .reversal-choice,
  .volatility-choice
) .choice-label {
  position: relative;
  z-index: 3;
  display: inline-block;
  font-size: 1.02em;
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}

body[data-theme="gamify"] .choices button .choice-action-effect {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

/* Sideways: price stays trapped in a horizontal lane. */
body[data-theme="gamify"] .choices button.sideways-choice {
  color: #075da8;
  transform-origin: 50% 50%;
}

body[data-theme="gamify"] .sideways-range {
  position: absolute;
  top: 16%;
  right: 8%;
  bottom: 16%;
  left: 8%;
  border-top: 2px dashed rgba(220, 248, 255, .72);
  border-bottom: 2px dashed rgba(220, 248, 255, .72);
  opacity: 0;
}

body[data-theme="gamify"] .sideways-arrow {
  position: absolute;
  color: #e9fdff;
  font-size: 25px;
  font-weight: 1000;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 2px 0 rgba(0, 65, 125, .55));
}

body[data-theme="gamify"] .sideways-arrow-right {
  top: 4px;
  left: -30px;
}

body[data-theme="gamify"] .sideways-arrow-left {
  right: -30px;
  bottom: 4px;
}

body[data-theme="gamify"] .choices button.sideways-choice:not(:disabled):is(:hover, :focus-visible) {
  z-index: 3;
  border-color: #075985;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, #18c8e4, #1684df 58%, #3158c8);
  color: #fff;
  box-shadow:
    7px 7px 0 #194e9f,
    0 14px 24px rgba(18, 132, 201, .34),
    inset 0 2px 0 rgba(224, 252, 255, .72);
  animation: gamify-sideways-button 760ms ease-in-out infinite alternate;
}

body[data-theme="gamify"] .choices button.sideways-choice:not(:disabled):is(:hover, :focus-visible) .choice-label {
  color: #fff;
  text-shadow: 0 2px 0 #0a5f9f, 0 0 12px #bdf8ff;
  animation: gamify-sideways-label 760ms ease-in-out infinite alternate;
}

body[data-theme="gamify"] .choices button.sideways-choice:not(:disabled):is(:hover, :focus-visible) .sideways-range {
  opacity: .62;
  animation: gamify-sideways-range 1.2s ease-in-out infinite;
}

body[data-theme="gamify"] .choices button.sideways-choice:not(:disabled):is(:hover, :focus-visible) .sideways-arrow-right {
  animation: gamify-sideways-right 1.05s linear infinite;
}

body[data-theme="gamify"] .choices button.sideways-choice:not(:disabled):is(:hover, :focus-visible) .sideways-arrow-left {
  animation: gamify-sideways-left 1.05s linear -.52s infinite;
}

@keyframes gamify-sideways-button {
  from { transform: translateX(-3px) scaleX(1.025); }
  to { transform: translateX(3px) scaleX(1.055); }
}

@keyframes gamify-sideways-label {
  from { transform: translateX(-5px); }
  to { transform: translateX(5px); }
}

@keyframes gamify-sideways-range {
  0%, 100% { transform: scaleX(.94); opacity: .42; }
  50% { transform: scaleX(1.04); opacity: .8; }
}

@keyframes gamify-sideways-right {
  0% { left: -30px; opacity: 0; }
  16%, 82% { opacity: .9; }
  100% { left: calc(100% + 4px); opacity: 0; }
}

@keyframes gamify-sideways-left {
  0% { right: -30px; opacity: 0; }
  16%, 82% { opacity: .9; }
  100% { right: calc(100% + 4px); opacity: 0; }
}

/* Breakout: a charged arrow punches through resistance. */
body[data-theme="gamify"] .choices button.breakout-choice {
  color: #9a3d00;
  transform-origin: 50% 100%;
}

body[data-theme="gamify"] .breakout-ceiling {
  position: absolute;
  top: 17px;
  left: 7%;
  width: 86%;
  height: 4px;
  border-radius: 999px;
  background: #ffe7ac;
  box-shadow: 0 2px 0 rgba(137, 61, 0, .48);
  opacity: 0;
}

body[data-theme="gamify"] .breakout-arrow {
  position: absolute;
  left: 17%;
  bottom: -34px;
  color: #fff8d6;
  font-size: 36px;
  font-weight: 1000;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 3px 0 #b74d00) drop-shadow(0 0 8px #fff1a6);
}

body[data-theme="gamify"] .breakout-shard {
  --shard-x: 50%;
  --shard-drift: 0px;
  position: absolute;
  top: 13px;
  left: var(--shard-x);
  color: #fff1aa;
  font-size: 8px;
  line-height: 1;
  opacity: 0;
}

body[data-theme="gamify"] .breakout-shard-1 { --shard-x: 18%; --shard-drift: -18px; }
body[data-theme="gamify"] .breakout-shard-2 { --shard-x: 31%; --shard-drift: 8px; }
body[data-theme="gamify"] .breakout-shard-3 { --shard-x: 43%; --shard-drift: -10px; }
body[data-theme="gamify"] .breakout-shard-4 { --shard-x: 57%; --shard-drift: 14px; }
body[data-theme="gamify"] .breakout-shard-5 { --shard-x: 69%; --shard-drift: -7px; }
body[data-theme="gamify"] .breakout-shard-6 { --shard-x: 81%; --shard-drift: 18px; }
body[data-theme="gamify"] .breakout-shard-7 { --shard-x: 91%; --shard-drift: 9px; }

body[data-theme="gamify"] .choices button.breakout-choice:not(:disabled):is(:hover, :focus-visible) {
  z-index: 3;
  border-color: #9a3d00;
  background:
    radial-gradient(circle at 30% 95%, rgba(255, 247, 179, .94), transparent 38%),
    linear-gradient(145deg, #ffbd3f, #f97316 58%, #d94a08);
  color: #fff;
  box-shadow:
    0 8px 0 #9a3d00,
    0 17px 28px rgba(226, 88, 11, .32),
    inset 0 2px 0 rgba(255, 246, 203, .76);
  animation: gamify-breakout-button 980ms cubic-bezier(.2, .8, .25, 1) infinite;
}

body[data-theme="gamify"] .choices button.breakout-choice:not(:disabled):is(:hover, :focus-visible) .choice-label {
  color: #fff;
  text-shadow: 0 2px 0 #a54106, 0 0 11px #fff0a6;
  animation: gamify-breakout-label 980ms cubic-bezier(.2, .8, .25, 1) infinite;
}

body[data-theme="gamify"] .choices button.breakout-choice:not(:disabled):is(:hover, :focus-visible) .breakout-ceiling {
  animation: gamify-breakout-ceiling 980ms ease-out infinite;
}

body[data-theme="gamify"] .choices button.breakout-choice:not(:disabled):is(:hover, :focus-visible) .breakout-arrow {
  animation: gamify-breakout-arrow 980ms cubic-bezier(.2, .78, .22, 1) infinite;
}

body[data-theme="gamify"] .choices button.breakout-choice:not(:disabled):is(:hover, :focus-visible) .breakout-shard {
  animation: gamify-breakout-shard 980ms ease-out infinite;
}

@keyframes gamify-breakout-button {
  0%, 100% { transform: translateY(-2px) scale(1.025); }
  36% { transform: translateY(1px) scale(.99, .96); }
  49% { transform: translateY(-7px) scale(1.075, 1.1); }
  62% { transform: translateY(-4px) scale(1.04); }
}

@keyframes gamify-breakout-label {
  0%, 34%, 100% { transform: translateY(0); }
  48% { transform: translateY(-9px) scale(1.16); }
  62% { transform: translateY(-3px) scale(1.04); }
}

@keyframes gamify-breakout-ceiling {
  0%, 32% { opacity: .8; transform: scaleX(1); }
  46% { opacity: 1; transform: scaleX(.5) translateX(7%); }
  58%, 100% { opacity: 0; transform: scaleX(.2) translateX(160%); }
}

@keyframes gamify-breakout-arrow {
  0%, 22% { opacity: 0; transform: translate(0, 0) scale(.6); }
  34% { opacity: .96; }
  60% { opacity: .86; }
  100% { opacity: 0; transform: translate(96px, -92px) scale(1.4); }
}

@keyframes gamify-breakout-shard {
  0%, 42% { opacity: 0; transform: translate(0, 0) rotate(0) scale(.4); }
  48% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--shard-drift), -30px) rotate(180deg) scale(1.1); }
}

/* Reversal: opposing arrows orbit a pivot and switch direction. */
body[data-theme="gamify"] .choices button.reversal-choice {
  color: #7137b8;
  transform-origin: 50% 50%;
}

body[data-theme="gamify"] .reversal-orbit {
  overflow: visible !important;
}

body[data-theme="gamify"] .reversal-pivot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 3px solid #fff5ff;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 12px #ffd1ff;
  transform: translate(-50%, -50%);
}

body[data-theme="gamify"] .reversal-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  color: #fff1ff;
  font-size: 28px;
  font-weight: 1000;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 2px 0 rgba(74, 20, 132, .62));
}

body[data-theme="gamify"] .reversal-arrow-back {
  color: #ffe475;
}

body[data-theme="gamify"] .choices button.reversal-choice:not(:disabled):is(:hover, :focus-visible) {
  z-index: 3;
  border-color: #54208d;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 238, 140, .32), transparent 34%),
    linear-gradient(135deg, #7949e8, #d94fc8 52%, #5c43d7);
  color: #fff;
  box-shadow:
    6px 7px 0 #54208d,
    0 15px 27px rgba(111, 52, 192, .35),
    inset 0 2px 0 rgba(255, 235, 255, .7);
  animation: gamify-reversal-button 860ms ease-in-out infinite;
}

body[data-theme="gamify"] .choices button.reversal-choice:not(:disabled):is(:hover, :focus-visible) .choice-label {
  color: #fff;
  text-shadow: 0 2px 0 #6e2692, 0 0 13px #ffd8ff;
  animation: gamify-reversal-label 860ms cubic-bezier(.4, 0, .2, 1) infinite;
}

body[data-theme="gamify"] .choices button.reversal-choice:not(:disabled):is(:hover, :focus-visible) .reversal-pivot {
  animation: gamify-reversal-pivot 860ms ease-in-out infinite;
}

body[data-theme="gamify"] .choices button.reversal-choice:not(:disabled):is(:hover, :focus-visible) .reversal-arrow-out {
  animation: gamify-reversal-out 860ms ease-in-out infinite;
}

body[data-theme="gamify"] .choices button.reversal-choice:not(:disabled):is(:hover, :focus-visible) .reversal-arrow-back {
  animation: gamify-reversal-back 860ms ease-in-out infinite;
}

@keyframes gamify-reversal-button {
  0%, 100% { transform: rotate(-1.2deg) scale(1.035); }
  50% { transform: rotate(1.2deg) scale(1.065); }
}

@keyframes gamify-reversal-label {
  0%, 42%, 100% { transform: rotateX(0) scale(1); }
  50% { transform: rotateX(90deg) scale(.9); }
  58% { transform: rotateX(0) scale(1.13); }
}

@keyframes gamify-reversal-pivot {
  0%, 100% { opacity: .25; transform: translate(-50%, -50%) scale(.72); }
  50% { opacity: .9; transform: translate(-50%, -50%) scale(1.35); }
}

@keyframes gamify-reversal-out {
  0% { opacity: 0; transform: translate(-58px, 18px) rotate(-20deg) scale(.65); }
  22%, 55% { opacity: .9; }
  62% { opacity: .15; transform: translate(38px, -40px) rotate(12deg) scale(1.2); }
  100% { opacity: 0; transform: translate(58px, 18px) rotate(112deg) scale(.65); }
}

@keyframes gamify-reversal-back {
  0% { opacity: 0; transform: translate(52px, -38px) rotate(10deg) scale(.7); }
  32%, 72% { opacity: .9; }
  100% { opacity: 0; transform: translate(-58px, 22px) rotate(-12deg) scale(1.22); }
}

/* Volatility spike: a live range meter expands around the label. */
body[data-theme="gamify"] .choices button.volatility-choice {
  padding-inline: 6px;
  color: #b52a55;
  transform-origin: 50% 50%;
}

body[data-theme="gamify"] .choices button.volatility-choice .volatility-choice-label {
  display: grid;
  width: 100%;
  justify-items: center;
  white-space: nowrap;
  transform-origin: center;
  line-height: 1.05;
  text-align: center;
}

body[data-theme="gamify"] .volatility-choice-label > :is(span, b) {
  width: 100%;
  min-width: 0;
  text-align: center;
}

body[data-theme="gamify"] .volatility-choice-label b {
  color: inherit;
  font: inherit;
}

body[data-theme="gamify"] .volatility-meter {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

body[data-theme="gamify"] .volatility-bar {
  width: 4px;
  height: var(--bar-height);
  border-radius: 99px;
  background: #fff5a8;
  box-shadow: 0 0 7px rgba(255, 249, 160, .88);
  opacity: 0;
  transform: scaleY(.25);
}

body[data-theme="gamify"] .volatility-bolt {
  position: absolute;
  color: #fff479;
  font-size: 22px;
  opacity: 0;
  filter: drop-shadow(0 0 5px #ffed68);
}

body[data-theme="gamify"] .volatility-bolt-left {
  top: 3px;
  left: 8px;
  transform: rotate(-16deg);
}

body[data-theme="gamify"] .volatility-bolt-right {
  right: 8px;
  bottom: 2px;
  transform: rotate(18deg);
}

body[data-theme="gamify"] .choices button.volatility-choice:not(:disabled):is(:hover, :focus-visible) {
  z-index: 3;
  border-color: #8b1644;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 245, 113, .5), transparent 38%),
    linear-gradient(135deg, #ffba28, #ff4f76 54%, #ba2bd4);
  color: #fff;
  box-shadow:
    6px 7px 0 #7c245e,
    0 15px 28px rgba(215, 47, 104, .37),
    inset 0 2px 0 rgba(255, 249, 191, .75);
  animation: gamify-volatility-button 440ms steps(2, end) infinite;
}

body[data-theme="gamify"] .choices button.volatility-choice:not(:disabled):is(:hover, :focus-visible) .choice-label {
  color: #fff;
  text-shadow: 0 2px 0 #a61d54, 0 0 11px #fff495;
  animation: gamify-volatility-label 560ms ease-in-out infinite alternate;
}

body[data-theme="gamify"] .choices button.volatility-choice:not(:disabled):is(:hover, :focus-visible) .volatility-bar {
  opacity: .74;
  animation: gamify-volatility-bar 520ms ease-in-out infinite alternate;
}

body[data-theme="gamify"] .volatility-bar-1 { animation-delay: -72ms !important; }
body[data-theme="gamify"] .volatility-bar-2 { animation-delay: -144ms !important; }
body[data-theme="gamify"] .volatility-bar-3 { animation-delay: -216ms !important; }
body[data-theme="gamify"] .volatility-bar-4 { animation-delay: -288ms !important; }
body[data-theme="gamify"] .volatility-bar-5 { animation-delay: -360ms !important; }
body[data-theme="gamify"] .volatility-bar-6 { animation-delay: -432ms !important; }
body[data-theme="gamify"] .volatility-bar-7 { animation-delay: -504ms !important; }

body[data-theme="gamify"] .choices button.volatility-choice:not(:disabled):is(:hover, :focus-visible) .volatility-bolt-left {
  animation: gamify-volatility-bolt 620ms ease-out infinite;
}

body[data-theme="gamify"] .choices button.volatility-choice:not(:disabled):is(:hover, :focus-visible) .volatility-bolt-right {
  animation: gamify-volatility-bolt 620ms ease-out -310ms infinite;
}

/* Submitted prediction results stay unmistakable in every app and appearance mode. */
body .choices button[data-state="correct"] {
  color: #ffffff !important;
  background: #16a34a !important;
  border-color: #15803d !important;
  border-style: solid;
  opacity: 1;
  filter: none !important;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28), 0 5px 0 rgba(21, 128, 61, .35) !important;
}

body .choices button[data-state="wrong"] {
  color: #ffffff !important;
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  border-style: solid;
  opacity: 1;
  filter: none !important;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .24), 0 5px 0 rgba(153, 27, 27, .32) !important;
}

body .choices button[data-state="correct"] .choice-label,
body .choices button[data-state="correct"] .choice-label b,
body .choices button[data-state="wrong"] .choice-label,
body .choices button[data-state="wrong"] .choice-label b {
  color: #ffffff !important;
  text-shadow: none;
}

@keyframes gamify-volatility-button {
  0%, 100% { transform: translate(-1px, -2px) scale(1.03); }
  25% { transform: translate(2px, -4px) scale(1.06, .98) rotate(.5deg); }
  50% { transform: translate(-2px, -1px) scale(.99, 1.08) rotate(-.5deg); }
  75% { transform: translate(1px, -5px) scale(1.07); }
}

@keyframes gamify-volatility-label {
  from { transform: scale(.94); }
  to { transform: scale(1.04); }
}

@keyframes gamify-volatility-bar {
  from { transform: scaleY(.25); opacity: .35; }
  to { transform: scaleY(2.15); opacity: .88; }
}

@keyframes gamify-volatility-bolt {
  0% { opacity: 0; filter: drop-shadow(0 0 0 #fff79a); }
  34% { opacity: 1; filter: drop-shadow(0 0 8px #fff79a); }
  100% { opacity: 0; filter: drop-shadow(0 0 2px #fff79a); }
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme="gamify"] .choices button:is(
    .sideways-choice,
    .breakout-choice,
    .reversal-choice,
    .volatility-choice
  ):not(:disabled):is(:hover, :focus-visible),
  body[data-theme="gamify"] .choices button:is(
    .sideways-choice,
    .breakout-choice,
    .reversal-choice,
    .volatility-choice
  ):not(:disabled):is(:hover, :focus-visible) * {
    animation: none !important;
  }

  body[data-theme="gamify"] .choices button:is(
    .sideways-choice,
    .breakout-choice,
    .reversal-choice,
    .volatility-choice
  ):not(:disabled):is(:hover, :focus-visible) {
    transform: translateY(-3px) scale(1.025);
  }

  body[data-theme="gamify"] .choices button.sideways-choice:not(:disabled):is(:hover, :focus-visible) .sideways-range,
  body[data-theme="gamify"] .choices button.breakout-choice:not(:disabled):is(:hover, :focus-visible) .breakout-ceiling,
  body[data-theme="gamify"] .choices button.reversal-choice:not(:disabled):is(:hover, :focus-visible) .reversal-pivot,
  body[data-theme="gamify"] .choices button.volatility-choice:not(:disabled):is(:hover, :focus-visible) .volatility-bar {
    opacity: .65;
  }
}

/* A correct Up call takes over the viewport with a rising-arrow celebration. */
.correct-up-celebration {
  position: fixed;
  z-index: 12000;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 58%, rgba(74, 255, 151, .24), transparent 28%),
    radial-gradient(circle at 12% 108%, rgba(18, 226, 112, .36), transparent 42%),
    radial-gradient(circle at 92% 98%, rgba(130, 255, 181, .28), transparent 38%),
    linear-gradient(155deg, #031d19 0%, #06452f 54%, #02251d 100%);
  color: #ecfff3;
  pointer-events: none;
  animation: correct-up-screen-arrive 280ms cubic-bezier(.16, 1, .3, 1) both;
}

.correct-up-celebration::before,
.correct-up-celebration::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 58vmax;
  height: 58vmax;
  border: 2px solid rgba(102, 255, 166, .2);
  border-radius: 50%;
  box-shadow:
    0 0 0 8vmax rgba(23, 197, 101, .06),
    0 0 0 18vmax rgba(23, 197, 101, .04);
  animation: correct-up-ring-pulse 1.65s ease-out both;
}

.correct-up-celebration::after {
  width: 30vmax;
  height: 30vmax;
  animation-delay: 180ms;
}

.correct-up-celebration.is-leaving {
  animation: correct-up-screen-leave 520ms cubic-bezier(.7, 0, .84, 0) forwards;
}

.correct-up-arrow-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.correct-up-rising-arrow {
  position: absolute;
  left: var(--celebration-x);
  bottom: -18vh;
  color: #34f58b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--celebration-size);
  font-weight: 1000;
  line-height: 1;
  opacity: 0;
  filter:
    drop-shadow(0 5px 0 rgba(0, 54, 29, .72))
    drop-shadow(0 0 14px rgba(69, 255, 148, .46));
  transform: translate3d(-50%, 12vh, 0) rotate(var(--celebration-rotation)) scale(.7);
  animation: correct-up-arrow-balloon-rise var(--celebration-duration) cubic-bezier(.23, .62, .32, 1)
    var(--celebration-delay) both;
  will-change: transform, opacity;
}

.correct-up-rising-arrow.correct-up-green-1 { color: #6dffa9; }
.correct-up-rising-arrow.correct-up-green-2 { color: #12cf69; }
.correct-up-rising-arrow.correct-up-green-3 { color: #b0ffd0; }

@keyframes correct-up-screen-arrive {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes correct-up-screen-leave {
  from { opacity: 1; }
  to { opacity: 0; transform: scale(1.035); }
}

@keyframes correct-up-ring-pulse {
  from { opacity: 0; transform: scale(.3); }
  36% { opacity: .9; }
  to { opacity: 0; transform: scale(1.5); }
}

@keyframes correct-up-arrow-balloon-rise {
  0% {
    opacity: 0;
    transform: translate3d(-50%, 12vh, 0) rotate(var(--celebration-rotation)) scale(.7);
  }
  12% { opacity: .96; }
  38% {
    transform: translate3d(calc(-50% + var(--celebration-drift) * -.32), -38vh, 0)
      rotate(calc(var(--celebration-rotation) * -.55)) scale(1);
  }
  72% {
    opacity: .96;
    transform: translate3d(calc(-50% + var(--celebration-drift)), -88vh, 0)
      rotate(var(--celebration-rotation)) scale(1.12);
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--celebration-drift) * .62), -132vh, 0)
      rotate(calc(var(--celebration-rotation) * -.4)) scale(1.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  .correct-up-celebration {
    animation-duration: 120ms;
  }

  .correct-up-celebration::before,
  .correct-up-celebration::after,
  .correct-up-rising-arrow {
    animation: none;
  }

  .correct-up-rising-arrow {
    bottom: auto;
    top: var(--celebration-y);
    opacity: .72;
    transform: translateX(-50%);
  }

  .correct-up-celebration.is-leaving {
    animation-duration: 260ms;
  }
}

/* Make the top-right XP readout feel like a bright earned reward. */
.metrics .xp-metric [hidden] { display: none; }
.metrics .xp-metric:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
body[data-theme="gamify"] .metrics .xp-metric {
  position: relative;
  overflow: visible;
  border-color: color-mix(in srgb, #ffd84d 58%, var(--line));
  background:
    radial-gradient(circle at 82% 66%, rgba(255, 220, 77, .18), transparent 42%),
    var(--panel);
  box-shadow:
    0 0 18px rgba(255, 205, 44, .18),
    inset 0 1px 0 rgba(255, 246, 179, .48);
}

body[data-theme="gamify"] .metrics .xp-metric .xp-label {
  position: relative;
  z-index: 1;
  display: inline-block;
  overflow: visible;
  color: #e4a900;
  font-weight: 1000;
  letter-spacing: .1em;
  text-shadow:
    0 0 4px rgba(255, 248, 174, .95),
    0 0 10px rgba(255, 204, 38, .72),
    0 0 20px rgba(255, 190, 0, .44);
  animation: xp-golden-pulse 2.4s ease-in-out infinite;
}

body .metrics .xp-metric[data-stat="credit"] .xp-label {
  font-size: 10px;
  letter-spacing: 0;
  white-space: nowrap;
}

body[data-theme="gamify"] .metrics .xp-metric .xp-label::before,
body[data-theme="gamify"] .metrics .xp-metric .xp-label::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 100%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  pointer-events: none;
  background: #fff9bd;
  box-shadow:
    -20px -5px 0 #ffd12f,
    -13px 3px 0 #fff5a3,
    -6px -2px 0 #ffae00,
    2px 4px 0 #ffe05c,
    9px -4px 0 #fffbd4,
    16px 2px 0 #ffc21c,
    23px -2px 0 #ffef83;
  filter: drop-shadow(0 0 3px rgba(255, 199, 30, .95));
}

body[data-theme="gamify"] .metrics .xp-metric .xp-label::before {
  animation: xp-glitter-fall 1.8s ease-in infinite;
}

body[data-theme="gamify"] .metrics .xp-metric .xp-label::after {
  animation: xp-glitter-fall-alt 1.8s ease-in .9s infinite;
}

@keyframes xp-golden-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.28); }
}

@keyframes xp-glitter-fall {
  0% {
    opacity: 0;
    transform: translate(-50%, -3px) rotate(0deg) scale(.45);
  }
  14% {
    opacity: 1;
  }
  70% {
    opacity: .86;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% - 8px), 34px) rotate(120deg) scale(.85);
  }
}

@keyframes xp-glitter-fall-alt {
  0% {
    opacity: 0;
    transform: translate(-50%, -2px) rotate(24deg) scale(.4);
  }
  16% {
    opacity: 1;
  }
  72% {
    opacity: .8;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + 9px), 39px) rotate(-135deg) scale(.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme="gamify"] .metrics .xp-metric .xp-label,
  body[data-theme="gamify"] .metrics .xp-metric .xp-label::before,
  body[data-theme="gamify"] .metrics .xp-metric .xp-label::after {
    animation: none;
  }
}

/* Gamify XP reward: launch with drag, then bend smoothly into account progress. */
.xp-orb-field {
  position: fixed;
  z-index: 20000;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.xp-orb {
  --orb-size: 17px;
  --orb-a: rgba(134, 105, 148, .88);
  --orb-b: rgba(110, 80, 162, .86);
  --orb-c: rgba(83, 51, 168, .84);
  --orb-d: rgba(255, 221, 92, .88);
  position: absolute;
  top: 0;
  left: 0;
  width: var(--orb-size);
  height: var(--orb-size);
  border: 1px solid rgba(235, 255, 253, .54);
  border-radius: 50%;
  opacity: 0;
  background:
    radial-gradient(circle at 38% 31%, rgba(255,255,255,.96) 0 7%, rgba(255,255,255,.24) 13%, transparent 27%),
    radial-gradient(circle at 51% 52%, rgba(255,255,255,.38) 0 11%, var(--orb-a) 24%, var(--orb-b) 45%, var(--orb-c) 65%, rgba(32,12,92,.08) 82%, transparent 100%);
  box-shadow:
    0 0 5px rgba(235,255,253,.95),
    0 0 14px var(--orb-a),
    0 0 28px var(--orb-b),
    0 0 46px rgba(184,82,255,.42),
    inset 0 0 8px rgba(255,255,255,.55);
  filter: saturate(1.35) brightness(1.2) hue-rotate(0deg);
  animation: xp-orb-spectrum-cycle 4s linear infinite;
  will-change: transform, opacity, filter;
}

.xp-orb::before,
.xp-orb::after {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  content: "";
}

.xp-orb::before {
  inset: -48%;
  background:
    radial-gradient(circle at 30% 35%, var(--orb-a) 0 14%, transparent 38%),
    radial-gradient(circle at 72% 64%, var(--orb-b) 0 16%, transparent 42%),
    linear-gradient(135deg, var(--orb-c), var(--orb-a) 48%, var(--orb-b));
  background-size: 155% 155%, 165% 165%, 160% 160%;
  filter: blur(3px);
  opacity: .82;
  animation: xp-orb-color-drift 1.4s ease-in-out infinite alternate;
}

.xp-orb::after {
  inset: 18%;
  background: radial-gradient(circle at 38% 34%, rgba(255,255,255,.98), var(--orb-d) 20%, var(--orb-a) 44%, rgba(109,67,255,.18) 75%, transparent 100%);
  box-shadow: 0 0 8px var(--orb-d), 0 0 14px var(--orb-a);
  opacity: .78;
  animation: xp-orb-core-radiate 680ms ease-in-out infinite alternate;
}

.xp-orb-status {
  position: fixed;
  z-index: 20001;
  bottom: calc(54px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 32px);
  overflow-wrap: anywhere;
  text-align: center;
  border: 2px solid rgba(92, 58, 199, .48);
  border-radius: 999px;
  padding: 8px 14px;
  color: #32136f;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 9px 24px rgba(65, 35, 148, .18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(100% + 54px));
  transition: opacity 80ms ease, transform 80ms ease;
  font-size: 12px;
  font-weight: 900;
}

body[data-theme="dark"] .xp-orb-status {
  color: var(--ink);
  background: var(--panel);
}

.xp-orb-status.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

#levelButton .xp.xp-orb-hit {
  animation: xp-orb-bar-hit 180ms ease-out;
}

#levelButton .xp.xp-orb-collecting span {
  transition: width 90ms cubic-bezier(.2,.75,.25,1);
}

#xp.xp-orb-ticking {
  color: #7048e8;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(119,206,255,.8);
}

.xp-metric.xp-orb-complete {
  animation: xp-orb-counter-complete 310ms ease-out;
}

@keyframes xp-orb-bar-hit {
  50% {
    filter: brightness(1.45);
    box-shadow: 0 0 0 3px rgba(112, 72, 232, .2), 0 0 18px rgba(35, 141, 228, .75);
  }
}

@keyframes xp-orb-color-drift {
  from { background-position: 10% 16%, 92% 84%, 0% 50%; }
  to { background-position: 38% 34%, 62% 58%, 100% 50%; }
}

@keyframes xp-orb-spectrum-cycle {
  from { filter: saturate(1.35) brightness(1.2) hue-rotate(0deg); }
  to { filter: saturate(1.35) brightness(1.2) hue-rotate(360deg); }
}

@keyframes xp-orb-core-radiate {
  from { opacity: .58; filter: brightness(.96); }
  to { opacity: .88; filter: brightness(1.12); }
}

@keyframes xp-orb-counter-complete {
  40% { transform: translateY(-2px) scale(1.06); filter: brightness(1.25); }
}

@media (max-width: 720px) {
  .xp-orb { --orb-size: 12px; }
  .xp-orb-status { bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .xp-orb-field { display: none; }
  .xp-orb-status { transition: none; }
  #levelButton .xp.xp-orb-hit,
  .xp-orb,
  .xp-orb::before,
  .xp-orb::after,
  .xp-metric.xp-orb-complete { animation: none; }
}

/* Accuracy selection preserves the existing metric's size and theme. */
.accuracy-menu { cursor: pointer; }
.accuracy-menu:focus-visible,
.accuracy-popover input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}
.accuracy-popover,
.streak-popover {
  position: fixed;
  z-index: 110;
  box-sizing: border-box;
  width: min(300px, calc(100% - 16px));
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 38px rgba(var(--ink-rgb), .18);
}
.accuracy-popover[hidden],
.streak-popover[hidden] { display: none; }
.accuracy-popover h3 { margin: 0; font-size: 16px; }
.accuracy-popover p { margin: 8px 0 12px; font-size: 12px; line-height: 1.5; }
.accuracy-popover fieldset { display: grid; gap: 4px; margin: 0; padding: 0; border: 0; min-width: 0; }
.accuracy-popover legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.accuracy-popover label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.accuracy-popover label:hover { background: rgba(var(--ink-rgb), .05); }
.accuracy-popover input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.accuracy-popover output { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.accuracy-popover .accuracy-summary { margin-bottom: 0; padding-top: 10px; border-top: 1px solid var(--line); }
body[data-theme="gamify"] .accuracy-popover {
  border: 2px solid #009a9b;
  background: linear-gradient(145deg, #c9fff1, #7ee7dd);
  box-shadow: 7px 7px 0 #009a9b, 0 16px 38px rgba(var(--ink-rgb), .18);
}

/* Compact day-streak calendar shared by every mode and appearance. */
.topbar .metrics .streak-menu {
  position: relative;
  z-index: 16;
  overflow: visible;
}

.streak-trigger {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "count icon"
    "label icon";
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.streak-trigger strong {
  grid-area: count;
}

.topbar .metrics .streak-trigger > span {
  grid-area: label;
}

.streak-trigger svg {
  grid-area: icon;
  width: 14px;
  height: 14px;
  margin-left: 7px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  opacity: .52;
  transition: transform .16s ease, opacity .16s ease;
}

.streak-menu.is-open .streak-trigger svg {
  transform: rotate(180deg);
  opacity: .9;
}

.streak-trigger:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 4px;
}

.streak-popover {
  display: grid;
  width: min(380px, calc(100% - 16px));
  gap: var(--box-separation);
}

.streak-popover-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.streak-popover .streak-popover-head span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.streak-popover .streak-popover-head strong {
  display: inline;
  color: var(--green);
  font-size: 14px;
}

.streak-popover-head small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.streak-month-strip,
.streak-calendar-weekdays,
.streak-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.streak-month-picker {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.streak-linked-nav,
.streak-month-picker-head,
.streak-calendar-head {
  display: grid;
  align-items: center;
}

.streak-linked-nav,
.streak-month-picker-head {
  grid-template-columns: 18px 1fr 18px;
  gap: 6px;
}

.streak-linked-nav {
  margin: 1px 2px 3px;
}

.streak-popover .streak-linked-nav small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.streak-month-year {
  justify-self: center;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.streak-month-strip {
  width: calc(100% + 10px);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  touch-action: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  /* Reserve the 5px selected outline outside the original seven-column content box. */
  padding: 5px;
  margin: -5px;
}

.streak-month-strip::-webkit-scrollbar {
  display: none;
}

.streak-month-strip.is-dragging,
.streak-month-strip.is-dragging .streak-month-button {
  cursor: grabbing;
}

.streak-popover .streak-panel-arrow {
  display: grid;
  width: 18px;
  height: 18px;
  min-width: 18px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  border-radius: 6px;
  padding: 0;
  color: var(--ink);
  background: var(--streak-empty-bg, #fff);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.streak-popover .streak-panel-arrow:hover,
.streak-popover .streak-panel-arrow:focus-visible {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
  outline: none;
}

.streak-popover .streak-month-button {
  --streak-month-consistency: 0%;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ink) 17%, transparent);
  border-radius: 5px;
  padding: 0;
  color: var(--streak-tile-ink, #17211d);
  background: linear-gradient(
    to top,
    var(--streak-fill-bg, #ffdd00) 0 var(--streak-month-consistency),
    var(--streak-empty-bg, #fff) var(--streak-month-consistency) 100%
  );
  background-origin: border-box;
  background-repeat: no-repeat;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.streak-popover .streak-month-button:hover,
.streak-popover .streak-month-button:focus-visible {
  border-color: var(--green);
  outline: 2px solid color-mix(in srgb, var(--green) 45%, transparent);
  outline-offset: 1px;
}

.streak-popover .streak-month-button.is-selected {
  border-color: color-mix(in srgb, var(--ink) 17%, transparent);
  color: var(--streak-tile-ink, #17211d);
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.streak-calendar {
  display: grid;
  gap: 6px;
  touch-action: pan-y;
}

.streak-calendar-head {
  grid-template-columns: 18px 1fr 18px;
  gap: 6px;
}

body[data-theme="gamify"] .streak-popover .streak-month-picker {
  background: linear-gradient(145deg, #ffd8e8, #ff9fc5);
  box-shadow: 4px 4px 0 #d94378;
}

body[data-theme="gamify"] .streak-popover .streak-calendar {
  background: linear-gradient(145deg, #c9fff1, #7ee7dd);
  box-shadow: 4px 4px 0 #009a9b;
}

.streak-calendar-month {
  display: block;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.streak-calendar-days {
  min-width: 0;
}

.streak-popover .streak-calendar-weekdays > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.streak-popover .streak-day,
.streak-day-empty {
  aspect-ratio: 1;
}

.streak-popover .streak-day {
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ink) 17%, transparent);
  border-radius: 5px;
  color: var(--streak-tile-ink, #17211d);
  background: var(--streak-empty-bg, #fff);
  font-size: 9px;
  font-weight: 800;
}

.streak-popover .streak-day.is-active {
  border-color: color-mix(in srgb, var(--green) 76%, #075d43);
  color: #fff;
  background: var(--green);
}

.streak-popover .streak-day.is-today {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.streak-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.streak-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--green);
}

body[data-theme="gamify"] .streak-popover {
  border: 2px solid #d94378;
  background: linear-gradient(145deg, #ffd8e8, #ff9fc5);
  box-shadow: 7px 7px 0 #d94378, 0 16px 38px rgba(var(--ink-rgb), .18);
}

/* Free Play random practice stays inside the scope selected by the user. */
.free-randomizer {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(14px, 2vw, 20px);
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--gold) 15%, transparent), transparent 18rem),
    color-mix(in srgb, var(--panel) 93%, var(--paper));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.free-randomizer > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.free-randomizer > header span,
.free-asset-picker legend,
.free-instrument-picker > span {
  display: block;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.free-randomizer > header strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: clamp(18px, 2.3vw, 25px);
  line-height: 1.08;
}

.free-randomizer > header small {
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: right;
}

.free-random-modes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin-bottom: 14px;
}

.free-random-modes button[data-free-random-mode],
.free-random-label {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 20px;
  color: var(--ink);
  background: var(--panel-soft);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--line) 72%, transparent);
  text-align: center;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.free-random-modes button[data-free-random-mode]:hover,
.free-random-label:not([aria-disabled="true"]):hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.free-random-modes button[data-free-random-mode]:not(.active):hover,
.free-random-label:not(.active, [aria-disabled="true"]):hover {
  background: var(--panel-soft);
}

.free-random-modes button.active,
.free-random-label.active {
  color: #fff;
  border-color: var(--navy-2);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--navy-2) 72%, transparent);
}

.free-random-modes button.active {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 15%, var(--panel)), color-mix(in srgb, var(--teal) 14%, var(--panel)));
}

.free-random-modes button b,
.free-random-modes button span {
  display: block;
}

.free-random-modes button b {
  font-size: 16px;
  font-weight: 900;
}

.free-random-label { display: grid; place-items: center; line-height: 1.18; list-style: none; cursor: pointer; }
.free-random-label::-webkit-details-marker { display: none; }
.free-random-label b { font-size: 16px; font-weight: 900; }

.free-random-label.is-muted {
  opacity: .45;
}

.free-random-modes button[data-free-random-mode].is-muted {
  opacity: .45;
}

.free-random-modes button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.free-random-mode {
  min-width: 0;
}

.free-random-modes button:focus-visible,
.free-random-label:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.free-settings-inline { min-width: 0; padding-top: 12px; }

.free-random-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(230px, .8fr);
  gap: 12px;
}

.free-asset-picker,
.free-instrument-picker {
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: color-mix(in srgb, var(--paper) 78%, var(--panel));
  transition: opacity 150ms ease, filter 150ms ease;
}

.free-asset-picker[hidden],
.free-instrument-picker[hidden] {
  display: none;
}

.free-asset-picker legend,
.free-instrument-picker legend {
  padding: 0 5px;
}

.free-asset-picker > p,
.free-instrument-picker > small {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.free-asset-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.free-asset-options label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.free-asset-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.free-asset-options span {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 7px;
  color: var(--ink);
  background: var(--panel);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.free-asset-options label:hover span {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.free-asset-options input:focus-visible + span {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.free-random-label.active,
.free-asset-options input:checked + span,
.free-instrument-options label:has(> input:checked) {
  border-color: var(--navy-2);
  color: #fff;
  background: linear-gradient(135deg, #08152b, #112b55);
}

body[data-theme="light"] .free-random-modes button[data-free-random-mode].active {
  background: linear-gradient(135deg, var(--navy), #112b55);
}

.free-asset-options input:checked + span {
  box-shadow: 0 3px 0 color-mix(in srgb, var(--navy-2) 74%, #000);
}

.free-instrument-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 3px;
  overscroll-behavior: contain;
}

.free-instrument-options label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 8px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.free-instrument-options label:hover {
  border-color: var(--teal);
}

.free-instrument-options label:has(> input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.free-instrument-options input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}

.free-instrument-options input:focus {
  outline: none;
}

.free-instrument-options input:checked + span {
  color: #fff;
  font-weight: 850;
}

.free-instrument-options label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.free-instrument-empty,
.paper-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
}

.free-randomizer > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.free-randomizer > footer p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
}

.free-randomizer > footer button {
  flex: 0 0 auto;
  border: 1px solid var(--navy-2);
  border-radius: 11px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-2), var(--teal));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--navy-2) 75%, #000);
  font-weight: 900;
}

.free-randomizer > footer button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--navy-2) 75%, #000);
}

.free-randomizer > footer button:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

body[data-theme="dark"] .free-randomizer,
body[data-theme="dark"] .free-asset-picker,
body[data-theme="dark"] .free-instrument-picker {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}

body[data-theme="gamify"] .free-randomizer {
  border: 2px solid #5c3ac7;
  border-radius: 20px;
  background:
    radial-gradient(circle at 96% 0, rgba(255, 227, 110, .45), transparent 15rem),
    linear-gradient(145deg, #fffdf8, #f3edff);
  box-shadow: 6px 6px 0 #aa91e9, inset 0 2px 0 rgba(255, 255, 255, .9);
}

body[data-theme="gamify"] .free-random-modes button.active,
body[data-theme="gamify"] .free-random-label.active,
body[data-theme="gamify"] .free-randomizer > footer button {
  border: 2px solid #32136f;
  box-shadow: 4px 4px 0 #32136f;
}

body[data-theme="gamify"] .free-random-modes button.active,
body[data-theme="gamify"] .free-randomizer > footer button {
  background: linear-gradient(135deg, #7048e8, #00a7a5);
}

@media (max-width: 900px) {
  .free-random-grid {
    grid-template-columns: 1fr;
  }

  .free-instrument-options { max-height: 220px; }
}

@media (max-width: 620px) {
  .free-randomizer > header,
  .free-randomizer > footer {
    align-items: stretch;
    flex-direction: column;
  }

  .free-randomizer > header small {
    max-width: none;
    text-align: left;
  }

  .free-random-modes {
    grid-template-columns: 1fr;
  }

  .free-asset-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .free-randomizer > footer button {
    width: 100%;
  }
}

/* Verified primary-source news board */
.news-hero { overflow: hidden; }
.news-trust-strip { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.news-trust-strip > * { border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line)); border-radius: 999px; padding: 7px 11px; color: var(--muted); background: color-mix(in srgb, var(--panel) 86%, var(--gold-soft)); font-size: 10px; font-weight: 850; }
.news-trust-strip strong { color: var(--ink); }
.news-topic-rail { display: flex; gap: 7px; overflow-x: auto; padding: 2px 1px 7px; scrollbar-width: thin; }
.news-topic-rail span { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; color: var(--muted); background: var(--panel); font-size: 10px; font-weight: 850; }
.news-feed { display: grid; gap: 12px; }
.news-feed .news-card { grid-template-columns: 48px minmax(0, 1fr); gap: 13px; padding: 18px; border-radius: 16px; box-shadow: 0 10px 32px rgba(var(--ink-rgb), .07); }
.news-source-avatar { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid color-mix(in srgb, var(--gold) 52%, var(--line)); border-radius: 13px; color: var(--gold-2); background: var(--navy); font-size: 11px; font-weight: 950; letter-spacing: .04em; }
.news-thread-body { display: grid; gap: 11px; min-width: 0; }
.news-source-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); font-size: 10px; }
.news-source-row > strong { color: var(--ink); font-size: 12px; }
.news-source-row time { margin-left: auto; }
.verified-source { border-radius: 999px; padding: 4px 7px; color: #f8f6f0; background: #1f7a58; font-size: 9px; font-weight: 900; letter-spacing: .04em; }
.news-thread-link { display: grid; gap: 7px; border: 1px solid transparent; border-radius: 12px; margin: -5px; padding: 5px; color: inherit; text-decoration: none; transition: border-color 150ms ease, background 150ms ease, transform 150ms ease; }
.news-thread-link:hover, .news-thread-link:focus-visible { border-color: color-mix(in srgb, var(--gold) 44%, var(--line)); background: color-mix(in srgb, var(--panel-soft) 65%, transparent); transform: translateY(-1px); outline: none; }
.news-thread-link > span { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.news-thread-link h3 { font-size: clamp(22px, 3vw, 30px); line-height: 1.08; }
.news-thread-link p { max-width: 820px; }
.news-thread-link > b { color: var(--gold); font-size: 11px; }
.news-discussion-prompt { display: grid; gap: 4px; margin: 0; border: 0; border-left: 3px solid var(--gold); padding: 10px 12px; color: var(--ink); background: var(--panel-soft); font-size: 12px; line-height: 1.5; }
.news-discussion-prompt small { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.news-actions { flex-wrap: wrap; }
.news-actions button:first-child { color: var(--paper); background: var(--ink); }

/* 2026 interaction pass: calm defaults, compact hierarchy, progressive tools. */
.settings-shortcut {
  display: none;
}

.mobile-nav-toggle {
  display: none;
}

.nav-folder {
  border-radius: 12px;
  transition: border-color 160ms ease, background 160ms ease;
}

.nav-folder[open] {
  border-color: rgba(226, 189, 104, .28);
  background: rgba(255, 255, 255, .065);
}

.nav-folder summary {
  min-height: 26px;
  padding: 0 3px;
}

.nav-folder summary::after {
  content: "\203A";
  font-size: 20px;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.nav-folder[open] summary::after {
  content: "\203A";
  transform: rotate(90deg);
}

.nav-folder-items {
  animation: nav-folder-in 160ms ease both;
}

@keyframes nav-folder-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.topbar {
  background: var(--paper);
  grid-template-columns: minmax(250px, 330px) minmax(330px, 1fr);
  min-height: 0;
  padding-block: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 18%, var(--line));
  box-shadow: 0 8px 24px rgba(var(--ink-rgb), .055);
}

body .topbar.is-stuck {
  background: rgba(var(--paper-rgb), .4);
}

button.topbar-account {
  grid-template-columns: 31px minmax(0, 1fr);
  grid-template-areas:
    "loadout identity"
    "loadout bar"
    "loadout progress";
  min-height: 68px;
  padding: 9px 12px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(var(--ink-rgb), .07);
}

.streak-popover .streak-day.is-outside {
  border-color: color-mix(in srgb, var(--ink) 9%, transparent);
  color: color-mix(in srgb, var(--muted) 72%, #fff);
  background: color-mix(in srgb, var(--streak-empty-bg, #fff) 82%, var(--panel));
}

body[data-theme="dark"] .streak-popover {
  --streak-empty-bg: var(--panel-soft);
  --streak-fill-bg: #66521b;
  --streak-tile-ink: var(--ink);
}

.streak-popover .streak-day.is-outside.is-active {
  border-color: color-mix(in srgb, var(--green) 48%, var(--line));
  color: #fff;
  background: var(--green);
}

body[data-theme="dark"] .streak-popover .streak-day.is-active {
  color: var(--paper);
}

.topbar-account .account-identity {
  align-items: center;
}

.topbar-account #accountProgress {
  font-size: 12px;
}

.topbar .metrics div {
  min-height: 60px;
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(var(--ink-rgb), .055);
}

.chart-modes .drawing-toggle {
  border-style: dashed;
}

.chart-modes .drawing-toggle::before {
  content: "+";
  margin-right: 4px;
  font-size: 15px;
  line-height: 0;
}

.chart-modes .drawing-toggle.active::before {
  content: "\2212";
}

.drawing-rail[hidden] {
  display: none !important;
}

.chart-stage {
  grid-template-columns: minmax(0, 1fr);
}

.chart-stage:has(.drawing-rail:not([hidden])) {
  grid-template-columns: 72px minmax(0, 1fr);
}

.chart-stage:has(.drawing-rail[hidden]) canvas {
  border-left: 0;
}

.chart-panel,
.panel,
.mode-surface,
.lower > div {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.chart-panel:hover,
.panel:hover,
.lower > div:hover,
.metrics div:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--gold) 42%, var(--line));
  box-shadow: 0 14px 36px rgba(var(--ink-rgb), .09);
}

@media (max-width: 980px) {
  .rail {
    gap: 10px;
    padding: 14px;
  }

  .rail .brand {
    padding-bottom: 10px;
  }

  .rail .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    border: 1px solid rgba(226, 189, 104, .28);
    border-radius: 12px;
    padding: 0 13px;
    color: #fffdf8;
    background: rgba(255, 255, 255, .06);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
  }

  .rail .mobile-nav-toggle b {
    color: var(--gold-2);
    font-size: 20px;
  }

  body:not(.mobile-nav-open) .rail nav.nav-folders,
  body:not(.mobile-nav-open) .rail .theme-card {
    display: none;
  }

  .rail nav.nav-folders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-folder:first-of-type {
    grid-column: 1 / -1;
  }

  .chart-stage:has(.drawing-rail:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 14px;
  }

  .topbar .metrics div {
    min-height: 54px;
  }

  .rail nav.nav-folders {
    grid-template-columns: 1fr;
  }

  .nav-folder:first-of-type {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-folder-items {
    animation: none;
  }
}

.cache-status {
  max-width: 280px;
  border-radius: 999px;
  padding: 8px 12px;
  text-transform: none;
  letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(var(--ink-rgb), .12);
}

.free-randomizer {
  padding: 0;
  overflow: hidden;
}

.free-randomizer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  transition: background 160ms ease;
}

.free-randomizer > summary::-webkit-details-marker {
  display: none;
}

.free-randomizer[open] > summary {
  /* Inset the hover tint above Assets without changing the heading's height. */
  padding-bottom: 12px;
  border-bottom: 4px solid transparent;
}

.free-randomizer > summary:hover {
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  background-clip: padding-box;
}

.free-randomizer > summary span,
.free-asset-picker legend,
.free-instrument-picker legend {
  display: block;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.free-randomizer > summary strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: clamp(18px, 2.3vw, 25px);
  line-height: 1.08;
}

.free-randomizer > summary small {
  display: grid;
  max-width: 320px;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

.free-randomizer > summary small b {
  color: var(--teal);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.free-randomizer > summary .disclosure-label span:last-child,
.free-randomizer[open] > summary .disclosure-label span:first-child {
  display: none;
}

.free-randomizer[open] > summary .disclosure-label span:last-child {
  display: inline;
}

.free-randomizer-body {
  padding: 0 18px 18px;
  animation: nav-folder-in 180ms ease both;
}

.free-randomizer-body > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.free-randomizer-body > footer p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
}

.free-randomizer-body > footer button {
  flex: 0 0 auto;
  border: 1px solid var(--navy-2);
  border-radius: 11px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-2), var(--teal));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--navy-2) 75%, #000);
  font-weight: 900;
}

@media (max-width: 620px) {
  .free-randomizer > summary,
  .free-randomizer-body > footer {
    align-items: stretch;
    flex-direction: column;
  }

  .free-randomizer > summary small {
    max-width: none;
    text-align: left;
  }

  .free-randomizer-body > footer button {
    width: 100%;
  }
}

/* Correct Sideways: a randomized range-bound trace followed by support/resistance guides. */
.correct-sideways-flash {
  position: fixed;
  z-index: 12020;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 24%, rgba(33, 223, 125, .15), transparent 26%),
    radial-gradient(circle at 82% 74%, rgba(255, 54, 87, .2), transparent 28%),
    linear-gradient(155deg, #030812 0%, #091426 50%, #18060d 100%);
  pointer-events: none;
  animation: correct-sideways-flash-arrive 90ms ease-out both;
}

.correct-sideways-flash::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .22;
  background-image:
    linear-gradient(rgba(142, 166, 200, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 166, 200, .13) 1px, transparent 1px);
  background-size: clamp(46px, 7vw, 96px) clamp(42px, 9vh, 78px);
}

.correct-sideways-flash.is-leaving {
  animation: correct-sideways-flash-leave 340ms cubic-bezier(.7, 0, .84, 0) forwards;
}

.correct-sideways-flash-market {
  position: absolute;
  z-index: 1;
  inset: -2%;
  width: 104%;
  height: 104%;
  overflow: visible;
}

.correct-sideways-flash-trace {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  filter:
    drop-shadow(0 0 7px rgba(33, 223, 125, .42))
    drop-shadow(0 0 9px rgba(255, 54, 87, .5));
}

.correct-sideways-flash-head {
  fill: #fff;
  stroke: #dce8f7;
  stroke-width: 4;
  opacity: 0;
  vector-effect: non-scaling-stroke;
  filter:
    drop-shadow(0 0 5px rgba(255, 255, 255, .98))
    drop-shadow(0 0 18px rgba(131, 204, 255, .82));
  will-change: opacity;
}

.correct-sideways-guide-group {
  opacity: 0;
  transition: opacity 80ms ease-out;
}

.correct-sideways-guide {
  fill: none;
  stroke: rgba(244, 248, 255, .82);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 7 10;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(196, 223, 255, .5));
}

.correct-sideways-guide-arrow {
  fill: #f4f8ff;
  stroke: rgba(8, 21, 43, .72);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  filter:
    drop-shadow(0 0 5px rgba(255, 255, 255, .98))
    drop-shadow(0 0 13px rgba(131, 204, 255, .72));
}

@keyframes correct-sideways-flash-arrive {
  from { opacity: 0; transform: scale(1.018); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes correct-sideways-flash-leave {
  from { opacity: 1; filter: saturate(1.08); }
  to { opacity: 0; filter: saturate(.65) brightness(.55); }
}

@media (max-width: 600px) {
  .correct-sideways-flash-market {
    inset: -3% -10%;
    width: 120%;
    height: 106%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .correct-sideways-flash,
  .correct-sideways-guide-group {
    animation: none;
    transition: none;
  }

  .correct-sideways-flash-head {
    opacity: 0 !important;
  }

  .correct-sideways-flash.is-leaving {
    animation: correct-sideways-flash-leave 240ms ease forwards;
  }
}

/* Paper Trading already has one outer panel; remove its redundant inner frame. */
body.paper-mode #modeSurface {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Mode previews sit above every destination with a translucent, blurred veil. */
@media (max-width: 980px) {
  body.panel-staged #sideMenu {
    position: sticky;
    top: 0;
    z-index: 70;
    max-height: 100dvh;
    overflow-y: auto;
  }
  body.panel-staged #sideMenu > * { flex-shrink: 0; }
}

.round-modal {
  padding: clamp(18px, 4vw, 48px);
  background: rgba(var(--paper-rgb), .52);
  backdrop-filter: blur(22px) saturate(118%);
  -webkit-backdrop-filter: blur(22px) saturate(118%);
}

.round-card {
  position: relative;
  width: min(820px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: clamp(28px, 4vw, 44px);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.round-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.round-head-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

.round-head-actions #roundStart {
  min-height: 40px;
  white-space: nowrap;
}

.round-gallery {
  display: grid;
  gap: 12px;
  margin-top: clamp(24px, 4vw, 36px);
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, var(--line));
  padding-top: 18px;
}

.round-gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.round-gallery-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.round-gallery-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.round-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.round-gallery-slot {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--ink) 32%, var(--line));
  border-radius: 14px;
  color: color-mix(in srgb, var(--muted) 84%, var(--ink));
  background:
    linear-gradient(135deg, transparent 48%, color-mix(in srgb, var(--ink) 5%, transparent) 49% 51%, transparent 52%),
    color-mix(in srgb, var(--panel) 70%, transparent);
}

.round-gallery-slot::before {
  content: "+";
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ink) 24%, var(--line));
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
}

.round-gallery-slot span {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.round-pages-shell {
  min-width: 0;
}

.round-card-stage {
  display: contents;
}

.speed-preview-arrow[hidden],
.speed-preview-page[hidden] {
  display: none !important;
}

.round-modal.speed-preview-active .round-card {
  width: 100%;
  overflow: hidden;
}

.round-modal.speed-preview-active .round-card-stage {
  position: relative;
  display: block;
  width: min(820px, 100%);
  min-width: 0;
  max-width: 100%;
}

/* Dialogs share the same available content area as the page. Keep scrims
   full-screen and reserve sidebar space in the overlay's layout, not offsets. */
body { --content-inset: 0px; }
@media (min-width: 981px) {
  body { --content-inset: var(--side-menu-width); }
  body.rail-auto-hide:not(.rail-revealed) { --content-inset: 0px; }
}
body :is(.onboarding, .round-modal, .level-modal, .account-modal,
  .daily-calendar-modal, .game-mode-modal) {
  padding-inline: calc(var(--content-inset) + 16px) 16px;
}
body.auth-required .account-modal { padding-inline: 16px; }
body.game-mode-menu-open :is(.panel, #modeSurface) { transform: none !important; }

.round-modal.speed-preview-active .round-pages-shell {
  min-height: 0;
  margin-top: 12px;
}

.round-modal.speed-preview-active .round-pages-viewport {
  display: flex;
  width: 100%;
  height: min(490px, calc(100dvh - 190px));
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.round-modal.speed-preview-active .round-pages-viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.round-modal.speed-preview-active .round-pages-viewport:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 62%, transparent);
  outline-offset: -3px;
}

.round-modal.speed-preview-active .speed-preview-page,
.round-modal.speed-preview-active .round-standard-page {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.round-modal.speed-preview-active .speed-preview-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 68px 20px;
  text-align: center;
}

.round-modal.speed-preview-active .round-standard-page {
  overflow-y: auto;
  padding: 8px 68px 20px;
}

.speed-preview-page h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1;
}

.speed-preview-page p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 2vw, 17px);
  font-weight: 700;
  line-height: 1.45;
}

.speed-preview-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid #08152b;
  border-radius: 50%;
  padding: 0;
  color: #08152b;
  background: linear-gradient(145deg, var(--gold-2), var(--gold));
  box-shadow: 3px 3px 0 #08152b;
  cursor: pointer;
  transform: translateY(-50%);
}

.speed-preview-arrow-previous { left: -72px; }
.speed-preview-arrow-next { right: -72px; }

.speed-preview-arrow span {
  margin-top: -3px;
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
}

.speed-preview-arrow:hover:not(:disabled) {
  background: var(--gold-2);
  box-shadow: 4px 4px 0 #08152b;
  transform: translateY(calc(-50% - 2px));
}

.speed-preview-arrow:disabled {
  opacity: .58;
  cursor: not-allowed;
  filter: none;
}

.speed-alarm-clock {
  --gold: #c99a3d;
  --gold-2: #e2bd68;
  width: clamp(155px, 29vw, 220px);
  max-width: 100%;
  margin-bottom: clamp(10px, 2vh, 20px);
  color: #08152b;
}

.speed-alarm-clock-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.speed-clock-ring-arcs {
  fill: none;
  stroke: #08152b;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: .28;
  transform-box: fill-box;
  transform-origin: center;
  animation: speed-clock-ring-arcs 2.4s ease-in-out infinite;
}

.speed-clock-ringer {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: speed-clock-ring 2.4s cubic-bezier(.2, .75, .25, 1) infinite;
}

.speed-clock-bell {
  transform-box: fill-box;
}

.speed-clock-bell-left {
  transform-origin: right bottom;
  animation: speed-clock-bell-left 2.4s ease-in-out infinite;
}

.speed-clock-bell-right {
  transform-origin: left bottom;
  animation: speed-clock-bell-right 2.4s ease-in-out infinite;
}

.speed-clock-gold,
.speed-clock-case {
  fill: var(--gold);
  stroke: #08152b;
  stroke-width: 8;
  stroke-linejoin: round;
}

rect.speed-clock-gold {
  stroke-width: 5;
}

.speed-clock-highlight {
  fill: none;
  stroke: var(--gold-2);
  stroke-width: 6;
  stroke-linecap: round;
}

.speed-clock-frame,
.speed-clock-foot {
  fill: none;
  stroke: #08152b;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.speed-clock-foot { stroke-width: 11; }

.speed-clock-foot-accent {
  fill: none;
  stroke: var(--gold);
  stroke-width: 6;
  stroke-linecap: round;
}

.speed-clock-face {
  fill: #fffdfa;
  stroke: #08152b;
  stroke-width: 4;
}

.speed-clock-face-ring {
  fill: none;
  stroke: #ded6c7;
  stroke-width: 2;
}

.speed-clock-numbers {
  fill: #08152b;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
}

.speed-clock-hour-hand,
.speed-clock-minute-hand,
.speed-clock-second-hand {
  transform-box: view-box;
  transform-origin: 130px 140px;
}

.speed-clock-hour-hand {
  animation: speed-clock-hour-tick 864s linear infinite;
}

.speed-clock-minute-hand {
  animation: speed-clock-minute-tick 72s steps(60, end) infinite;
}

.speed-clock-second-hand {
  animation: speed-clock-second-tick 12s steps(60, end) infinite;
}

.speed-clock-hour-hand path,
.speed-clock-minute-hand path,
.speed-clock-second-hand path {
  fill: none;
  stroke: #08152b;
  stroke-linecap: round;
}

.speed-clock-hour-hand path { stroke-width: 8; }
.speed-clock-minute-hand path { stroke-width: 6; }
.speed-clock-second-hand path { stroke: var(--gold); stroke-width: 3; }

.speed-clock-pin {
  fill: var(--gold);
  stroke: #08152b;
  stroke-width: 4;
}

@keyframes speed-clock-ring {
  0%, 66%, 100% { transform: translate(0, 0) rotate(0deg); }
  70% { transform: translate(-3px, -5px) rotate(-2deg); }
  74% { transform: translate(3px, -12px) rotate(2deg); }
  78% { transform: translate(-3px, -8px) rotate(-2deg); }
  82% { transform: translate(3px, -3px) rotate(2deg); }
  87% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes speed-clock-bell-left {
  0%, 66%, 100% { transform: rotate(0deg); }
  71%, 79% { transform: rotate(-8deg); }
  75%, 83% { transform: rotate(5deg); }
}

@keyframes speed-clock-bell-right {
  0%, 66%, 100% { transform: rotate(0deg); }
  71%, 79% { transform: rotate(8deg); }
  75%, 83% { transform: rotate(-5deg); }
}

@keyframes speed-clock-ring-arcs {
  0%, 66%, 100% { opacity: .22; transform: scale(1); }
  72%, 80% { opacity: 1; transform: scale(1.06); }
  76%, 84% { opacity: .42; transform: scale(1.02); }
}

@keyframes speed-clock-hour-tick { to { transform: rotate(360deg); } }
@keyframes speed-clock-minute-tick { to { transform: rotate(360deg); } }
@keyframes speed-clock-second-tick { to { transform: rotate(360deg); } }

body.free-mode .mode-copy {
  display: none;
}

@media (max-width: 1263px) {
  .round-modal.speed-preview-active {
    padding-bottom: 82px;
  }

  .round-modal.speed-preview-active .round-card {
    max-height: calc(100dvh - 116px);
  }

  .speed-preview-arrow {
    top: auto;
    bottom: -60px;
    transform: none;
  }

  .speed-preview-arrow:hover:not(:disabled) {
    transform: translateY(-2px);
  }

  .speed-preview-arrow-previous { left: calc(50% - 56px); }
  .speed-preview-arrow-next { right: calc(50% - 56px); }
}

@media (max-width: 600px) {
  .round-modal {
    align-items: center;
    padding: 16px;
  }

  .round-card {
    max-height: calc(100dvh - 32px);
    padding: 22px;
  }

  .round-head {
    flex-direction: column;
    align-items: stretch;
  }

  .round-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .round-gallery-grid {
    grid-template-columns: 1fr;
  }

  .round-gallery-slot {
    aspect-ratio: 16 / 7;
  }

  .round-modal.speed-preview-active .round-card {
    max-height: calc(100dvh - 96px);
    padding: 22px 16px;
  }

  .round-modal.speed-preview-active .round-pages-viewport {
    height: min(430px, calc(100dvh - 215px));
  }

  .round-modal.speed-preview-active .speed-preview-page,
  .round-modal.speed-preview-active .round-standard-page {
    padding-inline: 48px;
  }

  .speed-preview-arrow {
    bottom: -52px;
    width: 40px;
    height: 40px;
  }

  .speed-preview-arrow-previous { left: calc(50% - 48px); }
  .speed-preview-arrow-next { right: calc(50% - 48px); }

  .speed-preview-arrow span { font-size: 30px; }
}

/* Leave the mobile navigation visible above the preview, including landscape. */
@media (max-width: 980px) {
  #roundModal { top: var(--preview-nav-height, 0px); }
  #roundModal .round-card {
    max-height: calc(100dvh - var(--preview-nav-height, 0px) - 32px);
  }
  #roundModal.speed-preview-active .round-card {
    max-height: calc(100dvh - var(--preview-nav-height, 0px) - 116px);
  }
  #roundModal.speed-preview-active .round-pages-viewport {
    height: min(430px, max(60px, calc(100dvh - var(--preview-nav-height, 0px) - 215px)));
  }
}

@media (max-width: 980px) and (max-height: 500px) {
  #roundModal.speed-preview-active .round-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - var(--preview-nav-height, 0px) - 116px);
    padding-block: 12px;
  }
  #roundModal.speed-preview-active .round-pages-viewport { height: 100%; }
  #roundModal.speed-preview-active .speed-preview-page {
    justify-content: flex-start;
    overflow-y: auto;
  }
  #roundModal.speed-preview-active .speed-preview-page > * { flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .round-modal.speed-preview-active .round-pages-viewport {
    scroll-behavior: auto;
  }

  .speed-clock-ring-arcs,
  .speed-clock-ringer,
  .speed-clock-bell-left,
  .speed-clock-bell-right,
  .speed-clock-hour-hand,
  .speed-clock-minute-hand,
  .speed-clock-second-hand {
    animation: none;
  }
}

/* Gamify shadow hierarchy: outer cards stay bold; nested cards step back. */
body[data-theme="gamify"] {
  --gamify-shadow-nested:
    4px 4px 0 #aa91e9,
    inset 0 1px 0 rgba(255, 255, 255, .88),
    0 10px 20px rgba(65, 35, 148, .13);
  --gamify-shadow-nested-hover:
    5px 5px 0 #9a7fe0,
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 12px 22px rgba(65, 35, 148, .15);
  --gamify-shadow-deep:
    2px 2px 0 #b6a4e8,
    inset 0 1px 0 rgba(255, 255, 255, .86),
    0 5px 12px rgba(65, 35, 148, .1);
  --gamify-shadow-deep-hover:
    3px 3px 0 #a58ee0,
    inset 0 1px 0 rgba(255, 255, 255, .88),
    0 7px 14px rgba(65, 35, 148, .12);
}

body[data-theme="gamify"] :is(
  .welcome-card,
  .round-card,
  .level-card,
  .account-auth-card,
  .daily-calendar-card,
  .chart-panel,
  .panel,
  .lower > div,
  .metrics div,
  .mode-surface,
  .result,
  .paper-hero,
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article,
  article,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card,
  .socials-safety-note,
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .terms-intro,
  .terms-note,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context,
  .terms-document article
) :is(
  .welcome-card,
  .round-card,
  .level-card,
  .account-auth-card,
  .daily-calendar-card,
  .chart-panel,
  .panel,
  .lower > div,
  .metrics div,
  .mode-surface,
  .result,
  .paper-hero,
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article,
  article,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card,
  .socials-safety-note,
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .terms-intro,
  .terms-note,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context,
  .terms-document article
)  {
  box-shadow: var(--gamify-shadow-nested);
}

body[data-theme="gamify"] :is(
  .welcome-card,
  .round-card,
  .level-card,
  .account-auth-card,
  .daily-calendar-card,
  .chart-panel,
  .panel,
  .lower > div,
  .mode-surface,
  .result,
  .paper-hero,
  .paper-card,
  .paper-ticket,
  article,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card,
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card) :is(
  .mode-surface,
  .result,
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article,
  article,
  .socials-safety-note,
  .terms-intro,
  .terms-note,
  .terms-document article,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context) :is(
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article,
  article,
  .socials-safety-note,
  .terms-intro,
  .terms-note,
  .terms-document article,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context
)  {
  box-shadow: var(--gamify-shadow-deep);
}

body[data-theme="gamify"] :is(
  .welcome-card,
  .round-card,
  .level-card,
  .account-auth-card,
  .daily-calendar-card,
  .chart-panel,
  .panel,
  .lower > div,
  .mode-surface,
  .result,
  .paper-hero,
  .paper-card,
  article,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card,
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card) :is(
  .mode-surface,
  .result,
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article,
  article,
  .socials-safety-note,
  .terms-intro,
  .terms-note,
  .terms-document article,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context):hover  {
  box-shadow: var(--gamify-shadow-nested-hover);
}

body[data-theme="gamify"] :is(
  .welcome-card,
  .round-card,
  .level-card,
  .account-auth-card,
  .daily-calendar-card,
  .chart-panel,
  .panel,
  .lower > div,
  .mode-surface,
  .result,
  .paper-hero,
  .paper-card,
  article,
  .support-form,
  .socials-profile-strip,
  .social-friend-card,
  .social-add-card,
  .socials-card,
  .about-hero,
  .about-stack > div,
  .terms-hero,
  .terms-contents,
  .socials-menu,
  .socials-empty,
  .account-profile-card,
  .account-security-card) :is(
  .mode-surface,
  .result,
  .paper-card,
  .paper-ticket,
  article,
  .terms-contents,
  .account-profile-card,
  .account-security-card) :is(
  .paper-card,
  .paper-ticket,
  .paper-summary-grid article,
  article,
  .socials-safety-note,
  .terms-intro,
  .terms-note,
  .terms-document article,
  .account-role-summary,
  .account-security-note,
  .screenshot-upload,
  .screenshot-preview,
  .support-empty,
  .support-context
):hover  {
  box-shadow: var(--gamify-shadow-deep-hover);
}

@media (max-width: 680px) {
  body[data-theme="gamify"] {
    --gamify-shadow-nested:
      3px 3px 0 #aa91e9,
      inset 0 1px 0 rgba(255, 255, 255, .88),
      0 8px 16px rgba(65, 35, 148, .12);
    --gamify-shadow-nested-hover:
      4px 4px 0 #9a7fe0,
      inset 0 1px 0 rgba(255, 255, 255, .9),
      0 10px 18px rgba(65, 35, 148, .14);
  }
}

/* A correct Down call draws a volatile market trace, breaks support, and shatters it off-screen. */
.correct-down-celebration {
  position: fixed;
  z-index: 12010;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 76% 62%, rgba(255, 62, 91, .22), transparent 22%),
    radial-gradient(circle at 22% 30%, rgba(31, 210, 123, .11), transparent 26%),
    linear-gradient(160deg, #050b16 0%, #091528 46%, #17080e 100%);
  color: #fff7f8;
  pointer-events: none;
  animation: correct-down-screen-arrive 240ms cubic-bezier(.16, 1, .3, 1) both;
}

.correct-down-celebration::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .34;
  background-image:
    linear-gradient(rgba(149, 170, 201, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(149, 170, 201, .12) 1px, transparent 1px);
  background-size: clamp(42px, 6vw, 92px) clamp(42px, 8vh, 76px);
  mask-image: linear-gradient(to bottom, transparent 3%, #000 18%, #000 82%, transparent 98%);
}

.correct-down-celebration::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: -20%;
  opacity: 0;
  background: radial-gradient(circle at 76% 62%, rgba(255, 242, 242, .92), rgba(239, 68, 68, .2) 3%, transparent 13%);
  animation: correct-down-impact-wash 620ms ease-out 2.55s both;
}

.correct-down-celebration.is-leaving {
  animation: correct-down-screen-leave 520ms cubic-bezier(.7, 0, .84, 0) forwards;
}

.correct-down-market {
  position: absolute;
  z-index: 1;
  inset: -2%;
  width: 104%;
  height: 104%;
  overflow: visible;
}

.correct-down-support,
.correct-down-trace,
.correct-down-trace-crash,
.correct-down-impact-flash {
  vector-effect: non-scaling-stroke;
}

.correct-down-support {
  fill: none;
  stroke: rgba(214, 225, 239, .82);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(191, 211, 239, .3));
  transform-box: fill-box;
  will-change: transform, opacity;
}

.correct-down-trace,
.correct-down-trace-crash {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1.12;
  stroke-dashoffset: 1.12;
  opacity: 0;
  will-change: stroke-dashoffset, opacity;
}

.correct-down-trace {
  stroke-width: 6;
  filter:
    drop-shadow(0 0 7px rgba(36, 214, 125, .34))
    drop-shadow(0 0 8px rgba(255, 63, 93, .38));
  animation: correct-down-trace-draw 2.5s cubic-bezier(.12, .72, .18, 1) 120ms forwards;
}

.correct-down-trace-crash {
  stroke: #ff3f5d;
  stroke-width: 8;
  filter:
    drop-shadow(0 0 7px rgba(255, 241, 243, .64))
    drop-shadow(0 0 16px rgba(255, 42, 76, .82));
  animation: correct-down-trace-draw 420ms cubic-bezier(.68, 0, 1, .5) 2.48s forwards;
}

.correct-down-glass-hole {
  fill: rgba(3, 8, 17, .96);
  stroke: rgba(236, 244, 255, .92);
  stroke-width: 3;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  filter:
    drop-shadow(0 0 6px rgba(235, 244, 255, .78))
    drop-shadow(0 0 18px rgba(255, 63, 93, .38));
  animation: correct-down-hole-punch 360ms cubic-bezier(.16, 1.35, .3, 1) 2.55s both;
}

.correct-down-glass-crack {
  fill: none;
  stroke: rgba(231, 241, 255, .88);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(229, 240, 255, .76));
  animation: correct-down-crack-spread 460ms cubic-bezier(.16, .84, .28, 1) 2.59s forwards;
}

.correct-down-impact-flash {
  fill: rgba(255, 248, 248, .9);
  stroke: #ff3f5d;
  stroke-width: 4;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: correct-down-impact-pulse 720ms ease-out 2.55s both;
}

.correct-down-shard-field {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: visible;
}

.correct-down-shard {
  position: absolute;
  top: 62%;
  left: 76%;
  width: var(--shard-length);
  height: var(--shard-thickness);
  border-radius: 999px;
  background: #eaf0f8;
  box-shadow:
    0 0 7px rgba(221, 235, 255, .8),
    0 0 16px rgba(255, 61, 91, .36);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--shard-start-rotation));
  animation: correct-down-shard-flight var(--shard-duration) cubic-bezier(.18, .62, .2, 1) var(--shard-delay) both;
  will-change: transform, opacity;
}

.correct-down-shard-1 { background: #ff667e; }
.correct-down-shard-2 { background: #f9c4cc; }
.correct-down-shard-3 { background: #aebed2; }

.correct-down-celebration-message {
  position: absolute;
  z-index: 5;
  left: clamp(22px, 7vw, 110px);
  bottom: clamp(24px, 8vh, 90px);
  display: grid;
  justify-items: start;
  padding: clamp(16px, 2.5vw, 28px) clamp(20px, 3.5vw, 40px);
  border-left: 4px solid #ff3f5d;
  background: linear-gradient(90deg, rgba(23, 5, 12, .84), rgba(9, 16, 30, .38));
  box-shadow: -10px 0 36px rgba(255, 34, 72, .2);
  text-align: left;
  text-transform: uppercase;
  opacity: 0;
  animation: correct-down-message-land 560ms cubic-bezier(.16, 1.2, .3, 1) 2.92s both;
}

.correct-down-celebration-message span {
  color: #f4c8cf;
  font-size: clamp(.72rem, 1.5vw, .95rem);
  font-weight: 850;
  letter-spacing: .22em;
}

.correct-down-celebration-message strong {
  color: #ff4562;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4rem, 14vw, 10rem);
  font-weight: 950;
  letter-spacing: -.035em;
  line-height: .82;
  text-shadow:
    0 5px 0 #720d21,
    0 0 30px rgba(255, 46, 82, .46);
}

.correct-down-celebration-message small {
  margin-top: clamp(10px, 2vh, 18px);
  color: #fff4f5;
  font-size: clamp(.76rem, 1.8vw, 1.05rem);
  font-weight: 800;
  letter-spacing: .12em;
}

@keyframes correct-down-screen-arrive {
  from { opacity: 0; transform: scale(1.035); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes correct-down-screen-leave {
  0% { opacity: 1; filter: saturate(1); }
  100% { opacity: 0; filter: saturate(.6) brightness(.55); }
}

@keyframes correct-down-trace-draw {
  0% { stroke-dashoffset: 1.12; opacity: .18; }
  18% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes correct-down-impact-pulse {
  0% { opacity: 0; transform: scale(.2); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: scale(12); }
}

@keyframes correct-down-hole-punch {
  0% { opacity: 0; transform: scale(.08) rotate(-8deg); }
  42% { opacity: 1; transform: scale(1.18) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes correct-down-crack-spread {
  0% { opacity: 0; stroke-dashoffset: 1; }
  18% { opacity: 1; }
  100% { opacity: .9; stroke-dashoffset: 0; }
}

@keyframes correct-down-impact-wash {
  0% { opacity: 0; transform: scale(.5); }
  12% { opacity: .8; }
  100% { opacity: 0; transform: scale(1.3); }
}

@keyframes correct-down-shard-flight {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--shard-start-rotation)) scale(.3);
  }
  10% { opacity: 1; }
  34% { opacity: 1; }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--shard-dx)), calc(-50% + var(--shard-dy)))
      rotate(var(--shard-end-rotation)) scale(.72);
  }
}

@keyframes correct-down-message-land {
  from { opacity: 0; transform: translate3d(-34px, 18px, 0) skewX(-5deg); }
  to { opacity: 1; transform: translate3d(0, 0, 0) skewX(0); }
}

@media (max-width: 600px) {
  .correct-down-market {
    inset: -4% -18%;
    width: 136%;
    height: 108%;
  }

  .correct-down-celebration-message {
    left: 18px;
    bottom: 24px;
    max-width: calc(100vw - 36px);
  }

  .correct-down-celebration-message strong {
    font-size: clamp(4rem, 24vw, 7rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .correct-down-celebration {
    animation-duration: 120ms;
  }

  .correct-down-celebration::after,
  .correct-down-support,
  .correct-down-trace,
  .correct-down-trace-crash,
  .correct-down-glass-hole,
  .correct-down-glass-crack,
  .correct-down-impact-flash,
  .correct-down-shard,
  .correct-down-celebration-message {
    animation: none;
  }

  .correct-down-trace,
  .correct-down-trace-crash {
    stroke-dashoffset: 0;
    opacity: 1;
  }

  .correct-down-glass-hole {
    opacity: 1;
    transform: scale(1);
  }

  .correct-down-glass-crack {
    opacity: .9;
    stroke-dashoffset: 0;
  }

  .correct-down-shard,
  .correct-down-impact-flash {
    display: none;
  }

  .correct-down-celebration-message {
    opacity: 1;
  }

  .correct-down-celebration.is-leaving {
    animation: correct-down-screen-leave 260ms ease forwards;
  }
}

/* Fast correct-Down flash: one randomized, continuous market path on every play. */
.correct-down-flash {
  position: fixed;
  z-index: 12010;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 78% 68%, rgba(255, 32, 72, .25), transparent 27%),
    radial-gradient(circle at 18% 22%, rgba(27, 223, 125, .1), transparent 23%),
    linear-gradient(155deg, #030812 0%, #091426 48%, #18060d 100%);
  pointer-events: none;
  animation: correct-down-flash-arrive 90ms ease-out both;
}

.correct-down-flash::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .22;
  background-image:
    linear-gradient(rgba(142, 166, 200, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 166, 200, .13) 1px, transparent 1px);
  background-size: clamp(46px, 7vw, 96px) clamp(42px, 9vh, 78px);
}

.correct-down-flash.is-leaving {
  animation: correct-down-flash-leave 340ms cubic-bezier(.7, 0, .84, 0) forwards;
}

.correct-down-flash-market {
  position: absolute;
  z-index: 1;
  inset: -2%;
  width: 104%;
  height: 104%;
  overflow: visible;
}

.correct-down-flash-trace {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  will-change: opacity;
}

.correct-down-flash-trace {
  opacity: 1;
  stroke-width: 7;
  filter:
    drop-shadow(0 0 7px rgba(33, 223, 125, .42))
    drop-shadow(0 0 9px rgba(255, 54, 87, .5));
}

.correct-down-flash-head {
  fill: #fff;
  stroke: #ff3657;
  stroke-width: 4;
  opacity: 0;
  vector-effect: non-scaling-stroke;
  filter:
    drop-shadow(0 0 5px rgba(255, 255, 255, .98))
    drop-shadow(0 0 18px rgba(255, 54, 87, .92));
  will-change: opacity;
}

@keyframes correct-down-flash-arrive {
  from { opacity: 0; transform: scale(1.018); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes correct-down-flash-leave {
  from { opacity: 1; filter: saturate(1.08); }
  to { opacity: 0; filter: saturate(.65) brightness(.55); }
}

@media (max-width: 600px) {
  .correct-down-flash-market {
    inset: -3% -10%;
    width: 120%;
    height: 106%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .correct-down-flash,
  .correct-down-flash-trace,
  .correct-down-flash-head {
    animation: none;
  }

  .correct-down-flash-trace {
    opacity: 1;
  }

  .correct-down-flash-head {
    opacity: 0;
  }

  .correct-down-flash.is-leaving {
    animation: correct-down-flash-leave 240ms ease forwards;
  }
}

/* Keep the stock-chart timeframe controls flat without hiding chart tools. */
.timeframes > button,
.timeframes > button:hover,
.timeframes > button:focus-visible,
.timeframes > button.active,
.advanced-intervals button,
.advanced-intervals button:hover,
.advanced-intervals button:focus-visible,
.advanced-intervals button.active {
  box-shadow: none !important;
}

/* Keep the restored chart tools lightly elevated instead of heavily shadowed. */
.chart-modes button,
.chart-modes button.active {
  box-shadow: 0 2px 5px rgba(var(--ink-rgb), .055) !important;
}

.chart-modes button:hover,
.chart-modes button:focus-visible {
  box-shadow: 0 4px 9px rgba(var(--ink-rgb), .08) !important;
}

/* Let every chart-header control sit above its background without clipping. */
.chart-topbar {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.chart-topbar > .timeframes,
.chart-topbar > .chart-modes {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  overflow: visible;
  padding: 2px;
}

.chart-topbar button {
  position: relative;
  z-index: 2;
}

/* Keep discrete UI boxes visually independent in every theme and viewport. */
:root {
  --box-separation: clamp(20px, 1.5vw, 24px);
  --control-separation: 12px;
  --isolated-box-radius: 11px;
}

.chart-shell {
  display: flex;
  flex-direction: column;
  gap: var(--box-separation);
}

/* Keep controls in normal flow, with breathing room before the chart. */
.chart-shell > .chart-toolbar {
  position: static;
  inset: auto;
  z-index: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--control-separation);
  margin: 0;
  padding: 2px 0 6px;
  min-width: 0;
}

.chart-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--control-separation);
}

.chart-shell > .chart-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  line-height: 1;
}

.chart-toolbar button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-delta-icon {
  font-size: 20px;
  font-weight: 700;
}

.gamify-cursor-icon {
  display: none;
}

body[data-theme="gamify"] .chart-toolbar button[data-tool="cursor"] svg {
  display: none;
}

body[data-theme="gamify"] .chart-toolbar .gamify-cursor-icon {
  display: block;
}

.chart-shell > .chart-toolbar button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fffdf8;
}

.chart-toolbar button[data-tool="delete"].active svg,
.chart-toolbar button[data-tool="cursor"].active svg {
  stroke: #fff;
}

body[data-theme="dark"] .chart-shell > .chart-toolbar button[data-tool="delete"].active,
body[data-theme="dark"] .chart-shell > .chart-toolbar button[data-tool="cursor"].active {
  background: var(--navy);
}

.chart-shell > .chart-toolbar button:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.chart-shell > .chart-toolbar button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.chart-stage {
  gap: var(--box-separation);
}

.chart-topbar,
.chart-stage canvas,
.chart-stage .drawing-rail {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
}

.timeframes,
.chart-toolbar,
.choices,
.mode-actions,
.mode-tabs,
.leader-tabs,
.lesson-actions,
.news-topic-rail {
  gap: var(--control-separation);
}

.streak-month-strip,
.streak-calendar-weekdays,
.streak-calendar-days {
  gap: var(--control-separation);
}

.panel,
.mode-surface,
.lessons,
.packs,
.pack-panel,
.review-section,
.review-records,
.paper-page,
.paper-position-list,
.paper-order-list,
.quant-page,
.news-page,
.news-thread-body,
.account-dashboard-grid,
.about-stack,
.socials-content  {
  gap: var(--box-separation);
}

.news-thread-link {
  margin: 0;
}

/* The randomizer can live inside the narrow practice panel even on a wide screen. */
.free-random-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: var(--box-separation);
}

.free-asset-picker,
.free-instrument-picker {
  max-width: 100%;
}

.home-destination > div {
  gap: var(--box-separation);
  border-top: 0;
}

.home-destination button,
.home-destination button:last-child {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  padding-inline: 12px;
  background: color-mix(in srgb, var(--panel) 86%, var(--paper));
}

.symbol-results-list {
  gap: 0;
  border-block: 0;
}

.symbol-result-row,
.symbol-result-row:last-child {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding-inline: 14px;
  background: var(--panel);
}

.course-syllabus {
  display: grid;
  gap: var(--box-separation);
  padding: var(--box-separation);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.course-syllabus-head {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  background: var(--panel);
}

.course-chapter-list {
  display: grid;
  gap: var(--box-separation);
}

.course-chapter-list button,
.course-chapter-list button:first-child,
.course-chapter-list button:last-child {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  background-color: var(--panel);
}

.terms-contents {
  gap: var(--box-separation);
}

.terms-contents a {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  padding: 9px 11px;
  background: var(--panel);
}

.terms-document {
  display: grid;
  gap: var(--box-separation);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.terms-document > :is(.terms-intro, article, .terms-note) {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  background-color: var(--panel);
  box-shadow: 0 10px 28px rgba(var(--ink-rgb), .055);
}

.socials-menu {
  gap: var(--box-separation);
}

.socials-menu > button {
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  padding: 9px 11px;
  background: var(--panel);
}

@media (max-width: 620px) {
  :root {
    --box-separation: 20px;
    --control-separation: 12px;
  }
}

/* Text must size its box, including inside narrow flex and grid columns. */
:where(.mode-surface, .round-card, .account-auth-card, .welcome-card,
  .daily-calendar-card, .game-mode-card, .symbol-results-page) {
  overflow-wrap: anywhere;
}

.mode-surface > *,
.round-head > *,
.round-head-actions > *,
.account-panel > * {
  min-width: 0;
  max-width: 100%;
}

.topbar-account .account-identity {
  flex-wrap: wrap;
  gap: 4px 8px;
}

.topbar-account :is(#accountTitle, #accountLevel, #accountProgress),
.about-social-link :is(strong, small),
.socials-menu-profile :is(strong, small),
.social-friend-card :is(strong, span) {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.topbar-account #accountLevel {
  flex-shrink: 1;
}

/* Nickname editing is available only in the expanded account menu. */
.account-profile-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-profile-name h3 { min-width: 0; overflow-wrap: anywhere; }
.account-profile-card .account-profile-rank { display: block; margin-block-start: 8px; }
.nickname-edit {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.nickname-edit:hover { background: var(--press); }
.nickname-edit:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.topbar .metrics > div,
.topbar .metrics strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mode-actions > button,
.welcome-actions > button,
.round-actions > button,
.auth-tabs > button {
  min-width: 0;
  max-width: 100%;
  height: auto;
  overflow-wrap: anywhere;
  white-space: normal;
}

.versus-actions button[data-action="versus-start"] {
  height: auto;
  min-height: 56px;
  line-height: 1.3;
  white-space: normal;
}

.versus-actions .game-mode-button {
  height: auto;
  min-height: 45px;
}

.game-mode-button-label {
  height: auto;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.round-head-actions #roundStart {
  white-space: normal;
  overflow-wrap: anywhere;
}

.pack-panel {
  grid-auto-rows: max-content;
  align-content: start;
}

@media (max-width: 620px) {
  .home-hero h1 {
    font-size: clamp(32px, 11vw, 44px);
  }

}

/* Leave visible space for borders, focus rings, and raised Gamify edges. */
body[data-theme="gamify"] {
  --control-separation: 16px;
}

.workspace,
.home-destination-grid,
.home-progress,
.home-launchpad,
.module-details,
.module-terms,
.module-videos,
.course-checklist,
.course-flashcards,
.paper-sidebar,
.paper-account-summary,
.paper-ticket,
.paper-summary-grid,
.paper-trade-grid,
.account-profile,
.quant-code-panel,
.quant-compiled-grid,
.quant-metrics,
.quant-signal-list,
.news-feed,
.social-friend-list,
.round-gallery-grid,
.free-random-modes,
.level-list  {
  gap: var(--box-separation);
}

body .panel {
  gap: var(--box-separation);
  padding: 20px;
}

body .mode-surface,
.paper-ticket-compact,
.paper-ticket-compact .paper-card {
  padding: 16px;
}

/* Full-page layouts already frame their cards. Theme rules must not add
   unpadded duplicate frames around those cards. */
body[data-theme]:is(.home-mode, .learn-mode, .about-mode, .privacy-mode, .terms-mode, .support-mode, .suggestions-mode, .account-mode, .socials-mode,
  .leaderboards-mode, .news-mode, .quant-mode)
  :is(.panel, #modeSurface) {
  gap: var(--box-separation);
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

/* Keep Review's spacing while removing its outer homepage frame. */
body[data-theme].review-mode.review-empty .panel {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 620px) {
  body[data-theme].review-mode.review-empty .panel {
    padding: 0;
  }

  .review-stat-card {
    min-height: 112px;
    grid-template-rows: 1fr auto auto;
    padding: 12px;
  }
}

.chart-topbar {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
}

/* Chart controls wrap at narrow widths so every option stays reachable. */
.chart-topbar > .primary-timeframes {
  display: flex;
  flex-wrap: wrap;
  flex: 0 1 auto;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: visible;
}

body .chart-topbar > .primary-timeframes[hidden] {
  display: none;
}

.chart-topbar > .chart-modes {
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: calc(var(--control-separation) / 2);
  align-self: stretch;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  overflow-x: visible;
  overflow-y: visible;
}

.primary-timeframes #advancedToggle {
  display: grid;
  place-items: center;
  min-width: 32px;
  padding-inline: 8px;
  background: linear-gradient(135deg, var(--navy), #112b55);
  color: white;
}
body[data-theme="dark"] .primary-timeframes #advancedToggle {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--navy);
}
body[data-theme="gamify"] .primary-timeframes #advancedToggle {
  background: linear-gradient(135deg, #7048e8, #1769b0);
}
.primary-timeframes #advancedToggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  transition: transform 160ms ease;
}
/* The selected time unit opens below the compact shortcuts on every screen. */
body.advanced-chart .chart-topbar > .primary-timeframes {
  flex-wrap: wrap;
  align-items: center;
  overflow: visible;
}
body .primary-timeframes > button {
  flex-shrink: 0;
}
body #advancedIntervals:not([hidden]) {
  display: flex;
  flex: 0 0 100%;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
body .primary-timeframes button[hidden] {
  display: none;
}
body.advanced-chart #advancedToggle {
  /* Preserve the disclosure button's size while its panel is open. */
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 12px;
}
body.advanced-chart[data-theme="gamify"] #advancedToggle {
  border-radius: 16px;
}
body #advancedToggle svg { transform: none; }
body #advancedToggle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* Phones keep one shortcut per unit and the disclosure on the primary row. */
@media (max-width: 620px), (max-width: 980px) and (max-height: 500px) and (pointer: coarse) {
  body .chart-topbar > .primary-timeframes {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 36px)) minmax(0, 32px);
    column-gap: clamp(2px, .65vw, 8px);
  }

  body .primary-timeframes > button,
  body .primary-timeframes #advancedToggle {
    min-width: 0;
    padding-inline: 0;
  }

}

.chart-modes,
.advanced-intervals,
.chart-toolbar-group,
.market-controls,
#tickerForm,
.theme-options,
.theme-card,
.account-actions,
.round-head-actions,
.paper-ticket-actions,
.paper-order-actions,
.paper-quote-actions,
.paper-position-actions,
.home-hero-actions,
.home-account-strip > div,
.learn-progress-actions,
.quant-actions,
.news-trust-strip,
.support-actions,
.review-list-controls,
.auth-tabs,
.privacy-actions  {
  gap: var(--control-separation);
}

/* Align the single-row chart header without changing its horizontal spacing. */
@media (min-width: 621px) {
  #tickerForm {
    row-gap: 5px;
  }
}

.topbar .metrics {
  gap: var(--box-separation);
}

@media (max-width: 360px) {
  .topbar .metrics {
    gap: 8px;
  }
}

.topbar {
  padding-block: 16px 24px;
}

.drawing-rail {
  /* A 72px rail leaves 56px for each label with the reference's 7px insets. */
  gap: 5px;
  padding: 7px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.drawing-rail::-webkit-scrollbar {
  display: none;
}

.advanced-intervals {
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  padding: 14px;
}

.account-auth-head {
  gap: var(--control-separation);
  margin-bottom: var(--box-separation);
}

.theme-options {
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
}

.theme-card {
  padding: 16px;
}

.streak-popover :is(.streak-month-picker, .streak-calendar) {
  gap: 12px;
  padding: 14px;
  min-height: 60px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, var(--line));
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 7px 18px rgba(var(--ink-rgb), .055);
}

body[data-theme="dark"] .streak-popover :is(.streak-month-picker, .streak-calendar) {
  background:
    radial-gradient(circle at 100% 0%, rgba(226, 189, 104, .08), transparent 20rem),
    color-mix(in srgb, var(--panel) 94%, white 6%);
}

body[data-theme="gamify"] .streak-popover :is(.streak-month-picker, .streak-calendar) {
  border: 2px solid #5c3ac7;
  border-radius: 24px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.streak-calendar-weekdays,
.streak-calendar-days {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.streak-month-strip {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 72px) / 7);
  gap: 12px;
}

.streak-popover .streak-day {
  min-width: 0;
  padding: 0;
}

.daily-calendar-weekdays,
.daily-calendar-grid {
  gap: 12px;
}

.daily-calendar-grid button {
  min-width: 0;
  border-radius: 8px;
}

@media (max-width: 620px) {
  .daily-calendar-card {
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
  }

  .daily-calendar-weekdays span {
    padding-inline: 0;
    font-size: 9px;
  }

  .daily-calendar-grid button {
    flex-direction: column;
    align-items: center;
    padding: 8px 2px;
    font-size: 12px;
  }
}

/* Keep the hit target stationary. Animate labels/effects inside it so a cursor
   at the border cannot repeatedly enter and leave a moving button. */
body.prediction-mode .panel,
.choices button.prediction-choice {
  transform: none !important;
  animation: none !important;
}
.choices button.prediction-choice > * { pointer-events: none; }

/* Competitive lobby uses the outer panel as its single surface. */
body.review-mode:not(.review-empty) .chart-head .market-controls,
body.daily-mode .chart-head .market-controls,
body.versus-mode .chart-head .market-controls {
  display: none;
}

body.review-mode #modeSurface {
  width: 100%;
}

body.versus-waiting #modeSurface,
body.review-mode #modeSurface {
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body.versus-waiting .versus-actions {
  width: min(100%, 260px);
  grid-template-columns: minmax(0, 1fr);
  margin-inline-start: auto;
}
body.versus-waiting .versus-actions > * {
  grid-column: 1;
  grid-row: auto;
}
body.versus-waiting .versus-actions .game-mode-button { width: 75%; }
body.versus-waiting .versus-actions button[data-action="versus-start"] { width: 100%; }

/* The landing lobby shares one viewport between its header, surface, and footer. */
body.versus-waiting .app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}
body.versus-waiting main {
  flex: 1;
  min-height: 0;
}
body.versus-waiting .topbar { flex: 0 0 auto; }
/* The account button in the header already provides the guest sign-up entry. */
body.versus-waiting .guest-account-banner { display: none; }
body.versus-waiting .workspace {
  flex: 1;
  min-height: 0;
}
body.versus-waiting .panel { min-height: 0; }
body.versus-waiting #modeSurface {
  flex: 1;
  width: 100%;
  min-height: 0;
}
body.versus-waiting .site-end-space {
  padding-top: clamp(12px, 2vh, 24px);
}
body.versus-mode .site-end-space { display: none; }

@media (max-width: 980px) {
  body.versus-waiting .app {
    display: flex;
    flex-direction: column;
  }
  body.versus-waiting .rail { flex: 0 0 auto; }
  body.versus-waiting.mobile-nav-open .rail {
    position: fixed;
    inset: 0;
    z-index: 40;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
  }
}

@media (max-height: 700px) {
  body.versus-waiting .topbar {
    padding-block: 8px;
    gap: 8px;
    margin-bottom: 8px;
  }
  body.versus-waiting .panel { padding: 12px; }
  body.versus-waiting #modeSurface { gap: 8px; }
  body.versus-waiting .site-end-space { padding-top: 8px; }
  body.versus-waiting .site-end-band { height: 56px; }
  body.versus-waiting .topbar-account {
    grid-template-rows: auto;
    min-height: 44px;
    padding-block: 8px;
  }
  body.versus-waiting .topbar-account .xp,
  body.versus-waiting .topbar-account #accountProgress { display: none; }
  body.versus-waiting .topbar .metrics { gap: 8px; }
  body.versus-waiting .streak-trigger {
    grid-template-areas: "count icon" "label label";
  }
  body.versus-waiting .topbar .metrics .streak-trigger > span {
    font-size: 11px;
    line-height: 1.2;
  }
}

@media (max-width: 980px) and (max-height: 700px) {
  body.versus-waiting .rail {
    gap: 6px;
    padding-block: 4px;
  }
  body.versus-waiting .rail .brand {
    margin: 0;
    padding-bottom: 0;
  }
  body.versus-waiting .rail .brand small { display: none; }
}

@media (min-width: 480px) and (max-width: 980px) and (max-height: 500px) {
  body.versus-waiting .rail {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  body.versus-waiting.mobile-nav-open .rail {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  body.versus-waiting .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  body.versus-waiting .versus-actions {
    width: min(100%, 480px);
    grid-template-columns: minmax(0, .75fr) minmax(0, 1fr);
    align-items: end;
  }
  body.versus-waiting .versus-actions > * { grid-column: auto; }
  body.versus-waiting .versus-actions .game-mode-button { width: 100%; }
}

@media (max-height: 400px) {
  body.versus-waiting .panel { padding: 8px; }
  body.versus-waiting #modeSurface { gap: 8px; }
  body.versus-waiting .site-end-band { height: 48px; }
  body.versus-waiting .site-end-space { padding-top: 4px; }
}

/* Room rosters can grow; keep their extra content inside the lobby surface. */
body.versus-waiting #modeSurface:has(.room-code-control) {
  overflow-y: auto;
  padding: 0 8px 8px 0;
}

/* Competitive landing content sits directly on the page; buttons retain their surfaces. */
body.versus-waiting main :is(.panel, #modeSurface, .topbar, .metrics > div,
  .site-end-band, .private-lobby) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: none;
}
body.versus-waiting .topbar { backdrop-filter: none; }
body.versus-waiting main .site-end-links .site-end-link {
  color: var(--ink);
  text-decoration-color: currentColor;
}
body.versus-waiting main .site-end-links .site-end-link:focus-visible {
  outline-color: var(--ink);
}

/* Every full chart shares the Free Play geometry, including Paper Trading.
   Keep chart sizing independent of the bitmap and of taller side-panel content. */
body:is(.prediction-mode, .paper-mode) .workspace {
  --chart-height: clamp(320px, 38vw, 960px);
  grid-template-columns: minmax(0, 1fr) 22.3125rem !important;
  gap: 1rem;
  min-width: 0;
  min-height: 0;
}
body:is(.prediction-mode, .paper-mode) .chart-panel {
  align-self: start;
  min-width: 0;
  min-height: 0;
}
/* Keep chart controls reachable while the chart scrolls with the page. */
body:is(.prediction-mode, .paper-mode) .workspace > .panel {
  position: sticky;
  top: calc(var(--prediction-header-height, 0px) + 1rem);
  align-self: start;
  min-height: 0;
  max-height: calc(100vh - var(--prediction-header-height, 0px) - 2rem);
  max-height: calc(100dvh - var(--prediction-header-height, 0px) - 2rem);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}
body:is(.prediction-mode, .paper-mode) .workspace > .panel > * {
  flex-shrink: 0;
}
body.prediction-mode .panel {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: stretch;
  width: auto;
  min-width: 0;
  gap: 14px;
  padding: 14px;
}
body.prediction-mode .mode-surface {
  gap: 10px;
  padding: 11px;
}
/* Put predictions before Free Play parameters on phones, including landscape. */
@media (max-width: 620px), (max-width: 980px) and (max-height: 500px) and (pointer: coarse) {
  body.free-mode .workspace > .panel > #choices {
    order: -1;
  }
}
body.prediction-mode .result {
  min-height: 100px;
  padding: 12px;
}
body:is(.prediction-mode, .paper-mode) .chart-stage {
  flex: 0 0 auto;
  min-height: 0;
  align-items: stretch;
  gap: 0;
}
body:is(.prediction-mode, .paper-mode) .chart-shell {
  flex: 0 0 auto;
}
body:is(.prediction-mode, .paper-mode) .chart-canvas-wrap {
  display: block;
}
body:is(.prediction-mode, .paper-mode) canvas#chart {
  display: block;
  width: 100%;
  height: var(--chart-height);
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}
body:is(.prediction-mode, .paper-mode) .drawing-rail {
  max-height: var(--chart-height);
  overflow: auto;
}
body:is(.prediction-mode, .paper-mode) .chart-stage :is(canvas, .drawing-rail) {
  border-radius: 0;
}
body:is(.prediction-mode, .paper-mode) .timeline {
  grid-template-columns: minmax(0, 1fr) auto;
}
body.prediction-mode .choices {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-items: stretch;
  gap: 12px;
  margin-block-start: 0;
}
body.prediction-mode .choices button {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0;
  height: 3.5rem;
  min-height: 3.5rem;
  justify-self: stretch;
  padding: 6px 4px;
  font-size: 1rem;
  line-height: 1.1;
  overflow-wrap: normal;
  word-break: normal;
}
body.prediction-mode #nextBtn {
  box-sizing: border-box;
  width: 100%;
}
.review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ranked-coins {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ranked-coins[hidden] { display: none !important; }
.ranked-coins-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.ranked-coins-heading > span { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.ranked-coins p { margin: 0; font-size: .8rem; line-height: 1.5; }
.ranked-coins form { display: grid; gap: 6px; min-width: 0; }
.ranked-coins label { font-size: .85rem; font-weight: 700; }
.ranked-bet-controls { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.ranked-bet-controls > * { flex: 1 1 6rem; width: 0; min-width: 0; }
.ranked-coins :is(input, button) { box-sizing: border-box; min-height: 44px; max-width: 100%; }
.ranked-coins button { white-space: normal; overflow-wrap: anywhere; }
.ranked-coins :is(input, button):focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.ranked-coins .ranked-coin-status { font-weight: 700; }
.review-actions[hidden],
#reviewHint[hidden] {
  display: none !important;
}
.review-actions button {
  min-width: 0;
  min-height: 44px;
  overflow-wrap: anywhere;
}
#reviewStatusBtn {
  background: var(--panel);
  opacity: 1;
  filter: none;
}
/* Match Gamify's shared button specificity so saved status colors stay visible. */
body[data-theme] button#reviewStatusBtn[data-review-state="correct"] {
  color: var(--green);
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, var(--panel));
}
body[data-theme] button#reviewStatusBtn[data-review-state="missed"] {
  color: var(--red);
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
}
body[data-theme] button#reviewStatusBtn[data-review-state="reviewed"] {
  color: color-mix(in srgb, var(--gold) 50%, var(--ink));
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 18%, var(--panel));
}
/* Keep labels readable while allowing long choice names to fit the narrow rail. */
body .choices button.prediction-choice .choice-label {
  font-size: calc(1em * var(--choice-text-scale, 1)) !important;
  font-weight: 1000 !important;
  min-width: 0 !important;
  white-space: nowrap;
}
body.prediction-mode .choices button.volatility-choice .volatility-choice-label {
  display: inline-block;
  width: auto;
  line-height: 1.05;
  text-align: center;
}
body.prediction-mode .choices .volatility-choice-label > :is(span, b) {
  display: inline;
  width: auto;
  min-width: 0;
  font: inherit;
  text-align: center;
}
@media (max-width: 1200px) {
  body:is(.prediction-mode, .paper-mode) .workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Trade history reads as one table-like stack: each row shares one divider
   with its neighbor instead of floating as a separate rounded card. */
.review-disclosure > .review-records {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-soft);
}

.review-disclosure.review-chart-records > .review-records {
  max-height: calc(64px * 5 + 2px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--panel-soft);
}

.review-record-heading {
  position: relative;
  min-height: 40px;
  margin-bottom: 0;
}

.review-filter-trigger-wrap {
  position: relative;
  z-index: 5;
  display: flex;
  gap: 6px;
  height: 40px;
}

.review-game-trigger {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.review-game-control {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
.review-visible-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.review-game-trigger svg { width: 22px; height: 22px; }
.review-game-trigger:hover,
.review-game-trigger.active { background: var(--gold-soft); }

.review-game-trigger:focus-visible,
.review-game-menu button:focus-visible,
.review-game-menu summary:focus-visible,
.review-game-menu-scroll:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
}
.review-game-menu {
  position: fixed;
  inset: 16px 16px 16px calc(var(--content-inset) + 16px);
  box-sizing: border-box;
  width: min(340px, calc(100vw - var(--content-inset) - 32px));
  height: min(560px, calc(100dvh - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  font-family: inherit;
}
.review-game-menu.is-anchored {
  inset: auto;
  left: var(--review-menu-left, 16px);
  top: var(--review-menu-top, 16px);
  width: min(340px, calc(100% - 32px));
  margin: 0;
}
.review-game-menu[open] { display: flex; flex-direction: column; }
.review-game-menu::backdrop { background: rgba(0, 0, 0, .25); }
.review-game-menu-head {
  display: flex;
  flex-shrink: 0;
  min-height: 65px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--line);
}
.review-game-menu-head h3 { margin: 0; font-family: inherit; font-size: 17px; font-weight: 800; }
.review-game-menu-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--panel-soft);
  padding-block: 8px;
}
.review-game-menu .review-game-mode {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 0;
  padding: 12px 20px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
.review-game-menu .review-game-mode:hover { background: var(--panel-soft); }
.review-game-menu .review-game-mode[aria-checked="true"] { background: var(--gold-soft); }
.review-game-icon { width: 24px; color: var(--gold); font-size: 25px; text-align: center; }
.review-game-switch {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 25px;
  margin-left: auto;
  border-radius: 20px;
  background: var(--red);
}
.review-game-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fffdfa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform 160ms ease;
}
.review-game-mode[aria-checked="true"] .review-game-switch { background: var(--green); }
.review-game-mode[aria-checked="true"] .review-game-switch::after { transform: translateX(17px); }
.review-competitive-modes { border-top: 1px solid var(--line); }
.review-competitive-modes[hidden] { display: none; }
.review-competitive-modes h4 {
  margin: 0;
  padding: 14px 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.versus-queue-widget {
  position: fixed;
  z-index: 44;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: stretch;
  width: min(288px, calc(100vw - 32px));
  min-width: 0;
  border: 2px solid #5c4bc5;
  border-radius: 16px;
  color: #fff;
  background: #2c2764;
  box-shadow: 0 16px 38px rgba(8, 21, 43, .22);
  transform: translateX(-50%);
}
.versus-queue-widget[hidden] { display: none; }
.versus-queue-open,
.versus-queue-cancel {
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.versus-queue-open {
  display: grid;
  flex: 1;
  grid-template-columns: auto 1fr;
  align-content: center;
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  text-align: center;
}
.versus-queue-open svg {
  flex: none;
  width: 25px;
  height: 25px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.versus-queue-copy {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  line-height: 1.2;
}
.versus-queue-copy strong { font-size: 14px; }
.versus-queue-copy strong,
.versus-queue-copy small { overflow-wrap: anywhere; }
.versus-queue-copy small { color: #d9d2ff; }
.versus-queue-time {
  grid-column: 2;
  grid-row: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 23px;
  font-weight: 900;
}
.versus-queue-cancel {
  flex: none;
  width: 44px;
  border-left: 1px solid rgba(255, 255, 255, .3);
  border-radius: 0 14px 14px 0;
  font-size: 25px;
}
.versus-queue-open:hover,
.versus-queue-cancel:hover { background: #443a8a; }
.versus-queue-open:focus-visible,
.versus-queue-cancel:focus-visible { outline: 3px solid #ffe36e; outline-offset: -3px; }
.versus-queue-lobby-status { flex: 1 1 240px; margin: 0; color: var(--muted); line-height: 1.5; }
.versus-queue-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.versus-queue-actions button { min-height: 44px; }
body.versus-queue-active:not(.versus-waiting) main { padding-bottom: max(112px, calc(96px + env(safe-area-inset-bottom))); }
body.versus-waiting .versus-queue-widget { display: none; }
body.versus-queue-active .site-end-space { margin-bottom: 0; }

@media (max-width: 390px) {
  .versus-queue-widget { width: calc(100vw - 20px); }
  .versus-queue-open { gap: 8px; padding-inline: 9px; }
  .versus-queue-open svg { width: 24px; height: 24px; }
}
@media (max-width: 600px) {
  body.versus-queue-active .settings-shortcut { bottom: max(92px, calc(76px + env(safe-area-inset-bottom))); }
}
.review-game-more > summary {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.review-game-more > summary::-webkit-details-marker { display: none; }
.review-game-more > summary::after { content: "⌄"; margin-left: 8px; }
.review-game-more[open] > summary::after { content: "⌃"; }
.review-game-more > div { padding-top: 8px; border-top: 1px solid var(--line); }
.review-game-menu-footer {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.review-game-menu-footer button {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  background: var(--panel-soft);
  cursor: pointer;
}
.review-game-menu-footer button:last-child { color: var(--panel); background: var(--ink); border-color: var(--ink); }
.review-game-filter-status { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-size: 12px; }
@media (max-width: 520px) {
  .review-game-control { grid-column: 2; grid-row: 1; }
  .review-game-menu:not(.is-anchored) { left: 16px !important; top: 16px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .review-game-switch::after { transition: none; }
}

.review-record-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 10px 12px;
  background: var(--panel);
}

.review-record-filters { display: flex; min-width: 0; }
.review-record-filters button {
  border: 0;
  border-right: 1px solid transparent;
  min-height: 44px;
  padding: 8px 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}
.review-record-filters button:last-child { border-right: 0; }
.review-record-filters button.active,
.review-record-filters button:hover,
.review-record-filters button:focus-visible { color: var(--paper); background: var(--ink); }
.review-record-filters button span {
  display: inline-block;
  min-width: 3ch;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.review-record-bulk-actions,
.review-record-actions { display: flex; gap: 6px; align-items: center; }
.review-record-actions { justify-content: flex-end; }
.review-select-all,
.review-record-select {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  cursor: pointer;
}
.review-select-all input,
.review-record-select input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}
.review-select-all:focus-within,
.review-record-select:focus-within { outline: 2px solid var(--ink); outline-offset: -2px; }
.review-favorite-all,
.review-record .review-record-favorite {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.review-favorite-all:hover:not(:disabled),
.review-favorite-all:focus-visible,
.review-favorite-all.active,
.review-record .review-record-favorite:hover,
.review-record .review-record-favorite:focus-visible,
.review-record .review-record-favorite.active {
  color: var(--red);
  box-shadow: none;
  transform: none;
}
.review-favorite-all:hover:not(:disabled),
.review-favorite-all:focus-visible,
.review-favorite-all.active {
  background: color-mix(in srgb, var(--red) 10%, transparent);
}
.review-favorite-all:disabled { cursor: not-allowed; opacity: .42; }
.review-record-favorite span,
.review-favorite-all span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}
.review-selected-count {
  margin-left: 4px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.review-disclosure > .review-records > .review-record.has-review-controls > summary {
  grid-template-columns: minmax(0, .55fr) minmax(0, 1fr) minmax(0, .85fr) auto 20px;
}

.review-disclosure > .review-records > .review-record {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--panel-soft);
}

.review-disclosure > .review-records > .review-record:nth-child(even) {
  background: var(--panel);
}

.review-disclosure > .review-records > .review-record + .review-record {
  border-top: 1px solid var(--line);
}

.review-disclosure > .review-records > .review-record > summary {
  grid-template-columns: minmax(0, .55fr) minmax(0, 1fr) minmax(0, .85fr) 20px;
  min-height: 64px;
  padding: 14px 16px;
}

.review-record-mode {
  font-weight: 800;
}

.review-record-instrument {
  display: grid;
  grid-template-columns: minmax(4.5rem, 7ch) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.review-record-instrument > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.review-record-instrument .review-record-ticker {
  grid-column: 1;
  color: var(--ink);
  font-size: 14px;
}
.review-record-instrument .review-record-company {
  grid-column: 2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
}
.review-record-instrument .review-record-company:empty { display: none; }
.review-record-instrument .review-record-timeframe { grid-column: 3; white-space: nowrap; }

.review-record-status-date {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  min-width: 0;
  gap: 7px;
  align-items: start;
}

.review-record-status-date > span,
.review-record-status-date > time {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.review-record-status-date > time {
  color: var(--muted);
}



.review-disclosure > .review-records > .review-record > summary:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.review-disclosure > .review-records > .review-record > summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}

.review-chart-records summary[data-action="review-open"]::after {
  content: "\2192";
  color: var(--gold);
}

.review-chart-records summary[data-action="review-open"][aria-current="true"] {
  background: color-mix(in srgb, var(--gold) 18%, transparent);
}

@media (max-width: 900px) {
  .review-disclosure > .review-records > .review-record.has-review-controls > summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .review-disclosure > .review-records > .review-record.has-review-controls > summary > .review-record-actions {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
  .review-disclosure > .review-records > .review-record.has-review-controls > summary::after { grid-column: 3; }
  .review-disclosure > .review-records > .review-record > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
  }

  .review-disclosure > .review-records > .review-record > summary > span {
    grid-column: 1;
    grid-row: 1;
  }

  .review-disclosure > .review-records > .review-record > summary > strong {
    grid-column: 1;
    grid-row: 2;
  }

  .review-disclosure > .review-records > .review-record > summary > small {
    grid-column: 1;
    grid-row: 3;
  }

  .review-disclosure > .review-records > .review-record > summary::after {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
}

@media (max-width: 520px) {
  .review-record-instrument { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .review-record-instrument .review-record-company { grid-column: 1 / -1; grid-row: 2; }
  .review-record-instrument .review-record-timeframe { grid-column: 2; grid-row: 1; }
  .review-record-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2px;
    row-gap: 4px;
    align-items: center;
    padding-inline: 6px;
  }
  .review-record-filters { grid-column: 1 / -1; grid-row: 1; }
  .review-record-filters button { padding-inline: 6px; font-size: 12px; }
  .review-record-filters button span { min-width: 0; }
  .review-record-bulk-actions { grid-column: 1 / -1; grid-row: 2; }
  .review-record-toolbar > .review-game-control { grid-column: 1 / -1; grid-row: 3; justify-content: flex-end; }
  .review-disclosure > .review-records > .review-record.has-review-controls > summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .review-disclosure > .review-records > .review-record.has-review-controls > summary > .review-record-actions {
    grid-column: 1 / -1;
    grid-row: 4;
  }
  .review-disclosure > .review-records > .review-record.has-review-controls > summary::after { grid-column: 2; }

  .review-disclosure > .review-records > .review-record > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-inline: 10px;
  }

  .review-disclosure > .review-records > .review-record > summary::after {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .review-disclosure > .review-records > .review-record > summary > .review-record-status-date {
    grid-column: 1 / -1;
    grid-row: 3;
    gap: 4px;
    font-size: 11px;
  }


}


/* The replay sidebar is narrow even on a wide screen. */
.review-disclosure.review-chart-records > .review-records > .review-record > summary {
  grid-template-columns: minmax(0, 1fr) 20px;
}
.review-chart-records > .review-records > .review-record > summary > :is(span, strong, small) {
  grid-column: 1;
}
.review-chart-records > .review-records > .review-record > summary::after {
  grid-column: 2;
  grid-row: 1 / span 3;
}
.review-disclosure > .review-records > .review-record > summary > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Expanded Review records use an inline decision replay, keeping the list
   compact until a trader asks for the saved chart context. */
.review-disclosure > .review-records > .review-record[open] {
  background: var(--panel);
  box-shadow: inset 4px 0 var(--gold);
}

/* Keep each saved trade's result visible at a glance without relying on the
   status copy alone. */
.review-disclosure > .review-records > .review-record.correct,
.review-disclosure > .review-records > .review-record.correct[open],
.review-round-list .review-round.correct {
  background: color-mix(in srgb, var(--green) 14%, var(--panel));
  box-shadow: inset 4px 0 var(--green);
}

.review-disclosure > .review-records > .review-record.missed,
.review-disclosure > .review-records > .review-record.missed[open],
.review-round-list .review-round.missed {
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
  box-shadow: inset 4px 0 var(--red);
}

.review-record.correct > summary [data-review-status],
.review-round.correct > summary > small {
  color: var(--green);
}

.review-record.missed > summary [data-review-status],
.review-round.missed > summary > small {
  color: var(--red);
}

.review-disclosure > .review-records > .review-record.reviewed,
.review-disclosure > .review-records > .review-record.reviewed[open],
.review-round-list .review-round.reviewed {
  background: color-mix(in srgb, var(--gold) 18%, var(--panel));
  box-shadow: inset 4px 0 var(--gold);
}

.review-record.reviewed > summary [data-review-status],
.review-round.reviewed > summary > small,
.review-preview-details [data-review-result].reviewed {
  color: color-mix(in srgb, var(--gold) 50%, var(--ink));
}

@media (max-width: 520px) {
  .review-record.reviewed > summary > .review-record-status-date {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.review-trade-preview {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: var(--panel-soft);
}

.review-preview-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.review-preview-head > div:first-child > span {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.review-preview-head > div:first-child > span::before {
  width: 18px;
  height: 2px;
  background: var(--gold);
  content: "";
}

.review-preview-head h4 {
  margin: 0;
  font-family: inherit;
  font-size: 15px;
}

.review-preview-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.review-preview-chart {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.review-preview-chart figcaption {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.review-preview-chart figcaption strong {
  font-size: 12px;
}

.review-preview-chart figcaption span {
  color: var(--muted);
}

.review-chart-preview-svg {
  display: block;
  width: 100%;
  height: auto;
}

.review-chart-grid {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.review-chart-decision {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.review-chart-prediction-label {
  fill: var(--ink);
}

.review-chart-prediction-text {
  fill: var(--paper);
  font-family: inherit;
  font-size: 10px;
  font-weight: 900;
}

.review-chart-outcome-text {
  font-family: inherit;
  font-size: 10px;
  font-weight: 900;
}

.review-chart-axis-text,
.review-chart-zone-text {
  fill: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.review-chart-loading,
.review-chart-load-error {
  display: grid;
  min-height: 132px;
  place-content: center;
  gap: 6px;
  padding: 14px;
  text-align: center;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 20% 25%;
}

.review-chart-loading strong,
.review-chart-load-error strong,
.review-chart-load-error span {
  width: fit-content;
  max-width: 360px;
  margin-inline: auto;
  padding: 3px 8px;
  background: var(--panel);
}

.review-chart-load-error span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.review-chart-loading > span {
  width: 18px;
  height: 18px;
  margin-inline: auto;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: review-preview-spin .75s linear infinite;
}

.review-chart-load-error button {
  width: fit-content;
  margin: 4px auto 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--ink);
  background: var(--panel);
  font-size: 11px;
  font-weight: 900;
}

@keyframes review-preview-spin {
  to { transform: rotate(360deg); }
}

.review-preview-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, auto);
  align-content: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.review-preview-details > div {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.review-preview-details > .review-preview-primary {
  grid-column: 2;
}

.review-preview-details > .review-preview-context {
  grid-column: 1;
  border-right: 1px solid var(--line);
}

.review-preview-details > .review-preview-row-1 {
  grid-row: 1;
}

.review-preview-details > .review-preview-row-2 {
  grid-row: 2;
}

.review-preview-details > .review-preview-row-3 {
  grid-row: 3;
}

.review-preview-details > .review-preview-profit {
  grid-column: 1 / -1;
  grid-row: 4;
  border-right: 0;
  background: color-mix(in srgb, var(--gold) 7%, var(--panel));
}

.review-profit-values {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.review-profit-values > span {
  display: grid;
  gap: 1px;
  min-width: 70px;
}

.review-profit-values small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1;
  text-transform: uppercase;
}

.review-profit-values b {
  color: var(--ink);
  font-size: 13px;
}

.review-profit-values b.positive {
  color: var(--green);
}

.review-profit-values b.negative {
  color: var(--red);
}

.review-preview-details span {
  color: var(--muted);
}

.review-preview-details strong {
  text-align: right;
}

.review-preview-details .positive {
  color: var(--green);
}

.review-preview-details .negative {
  color: var(--red);
}

.review-record .review-preview-details > button {
  grid-column: 2;
  grid-row: 5;
  width: min(104px, calc(100% - 20px));
  min-height: 34px;
  margin: 8px 10px 10px 0;
  align-self: end;
  justify-self: end;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--paper);
  background: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.review-record .review-preview-details > button:hover,
.review-record .review-preview-details > button:focus-visible {
  color: var(--paper);
  background: color-mix(in srgb, var(--ink) 88%, var(--gold));
}

.review-round-list .review-round {
  display: block;
  padding: 0;
}

.review-round > summary {
  display: grid;
  grid-template-columns: 92px minmax(150px, .7fr) minmax(190px, 1fr) 20px;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.review-round > summary::-webkit-details-marker {
  display: none;
}

.review-round > summary::after {
  content: none;
}

.review-round > .review-trade-preview {
  padding: 14px;
}

@media (max-width: 700px) {
  .review-preview-layout {
    grid-template-columns: 1fr;
  }

  .review-round > summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .review-round > summary > span,
  .review-round > summary > strong,
  .review-round > summary > small {
    grid-column: 1;
  }

  .review-round > summary::after {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

@media (max-width: 520px) {
  .review-trade-preview {
    padding: 14px;
  }

  .review-preview-head {
    display: block;
  }

  .review-preview-chart figcaption {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .review-preview-details > div {
    gap: 6px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .review-preview-details > .review-preview-profit {
    display: grid;
    gap: 6px;
    align-items: start;
  }

  .review-profit-values {
    width: 100%;
    gap: 8px;
    justify-content: space-between;
  }

  .review-profit-values > span:first-child {
    text-align: left;
  }

  .review-profit-values > span:last-child {
    text-align: right;
  }

  .review-chart-loading,
  .review-chart-load-error {
    min-height: 132px;
  }
}

@media (max-width: 360px) {
  .review-profit-values {
    display: grid;
    grid-template-columns: 1fr;
  }

  .review-profit-values > span:last-child {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-record summary::after,
  .review-round summary::after {
    transition: none;
  }

  .review-chart-loading > span {
    animation: none;
  }
}
/* Finance Labs 101 IQ: one focused reader, with a compact course outline. */
.iq-preview-active .round-gallery { display: none; }
body.learn-mode .mode-surface { max-width: 1440px; margin-inline: auto; }
.iq-course { width: 100%; min-width: 0; color: var(--ink); }
.iq-mobile-picker { display: none; }
.iq-header { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: .5rem 0 1.75rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.iq-eyebrow { font-size: .72rem; font-weight: 850; letter-spacing: .13em; color: var(--ink); }
.iq-header h2 { margin: .6rem 0; font-size: clamp(1.6rem, 2.5vw, 2.35rem); line-height: 1.15; letter-spacing: -.035em; }
.iq-header p { margin: 0; max-width: 55ch; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.iq-progress { display: grid; gap: .55rem; min-width: 12rem; font-size: .82rem; }
.iq-progress strong { font-size: 1.1rem; margin-right: .3rem; }
.iq-progress small { color: var(--muted); }
.iq-progress progress { display: block; appearance: none; width: 100%; height: .45rem; border: 0; border-radius: 1rem; overflow: hidden; background: var(--panel-soft); color: var(--gold); }

/* The Appearance menu shows Light and Dark as reversible color swatches. */
body[data-theme="dark"] .topbar .appearance-popover .theme-options button[data-theme-choice="light"] {
  background: #08152b;
  color: #fffdf8;
  border-color: #08152b;
}

body[data-theme="dark"] .topbar .appearance-popover .theme-options button[data-theme-choice="dark"] {
  background: #fffdf8;
  color: #08152b;
  border-color: #d7dfeb;
}

.topbar .appearance-popover .theme-options button.active {
  border-width: 2px;
  border-color: currentColor;
  font-weight: 900;
  transform: none;
  outline: none;
  box-shadow: none;
}

.topbar .appearance-popover .theme-options button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

body[data-theme="gamify"] .topbar .appearance-popover .theme-options button.active {
  border: 2px solid #ffd166;
  background: linear-gradient(135deg, #7048d8, #00a7a5);
  color: #fff;
}
.iq-progress progress::-webkit-progress-bar { background: var(--panel-soft); }
.iq-progress progress::-webkit-progress-value { background: var(--gold); }
.iq-progress progress::-moz-progress-bar { background: var(--gold); }
.iq-workspace { display: grid; grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); gap: clamp(1rem, 3vw, 3rem); align-items: start; }
.iq-syllabus { min-width: 0; }
.iq-syllabus-heading { display: grid; gap: .4rem; padding: .5rem .75rem 1.2rem; }
.iq-syllabus-heading small { color: var(--muted); font-size: .8rem; }
.iq-track { border-bottom: 1px solid var(--line); padding: .55rem 0; }
.iq-track summary { display: list-item; padding: .7rem .75rem; cursor: pointer; line-height: 1.5; }
.iq-track summary span { display: inline-grid; gap: .3rem; max-width: calc(100% - 1.5rem); vertical-align: middle; }
.iq-track summary small { color: var(--muted); font-size: .65rem; letter-spacing: .08em; }
.iq-track summary strong { font-size: .9rem; }
.iq-track > p { font-size: .8rem; line-height: 1.55; color: var(--muted); margin: .4rem .75rem .9rem; }
.iq-lesson-list { display: grid; gap: .55rem; padding: .25rem .3rem 1rem; }
body .iq-lesson-list button { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); align-items: start; gap: .5rem; width: 100%; text-align: left; padding: .85rem .65rem; min-height: 44px; border: 1px solid transparent; border-radius: .7rem; color: var(--ink); background: transparent; box-shadow: none; transform: none; }
body .iq-lesson-list button:hover { background: var(--panel-soft); border-color: var(--line); }
body .iq-lesson-list button[aria-current="step"] { background: var(--panel); border-color: var(--gold); box-shadow: inset 3px 0 var(--gold); }

/* Market search results stay flat under the late theme-specific button rules. */
body[data-theme] #suggestions > .suggestion {
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: none;
}
body[data-theme] #suggestions > .suggestion:is(:hover, .active) {
  color: var(--paper);
  background: var(--ink);
}
body[data-theme] #suggestions > .suggestion:is(:hover, .active) span,
body[data-theme] #suggestions > .suggestion:is(:hover, .active) small {
  color: var(--paper);
}
body[data-theme="light"] #suggestions > .suggestion:is(:hover, .active) > strong,
body[data-theme="dark"] #suggestions > .suggestion:is(:hover, .active) > strong,
body[data-theme="gamify"] #suggestions > .suggestion:is(:hover, .active) > strong {
  color: var(--paper);
}
body[data-theme="light"] #suggestions > .suggestion > strong,
body[data-theme="dark"] #suggestions > .suggestion > strong,
body[data-theme="gamify"] #suggestions > .suggestion > strong {
  color: var(--ink);
}
.iq-lesson-list strong { font-size: .85rem; line-height: 1.4; display: block; font-weight: 650; }
.iq-lesson-list small { display: block; font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.iq-lesson-number { font-size: .75rem; color: var(--muted); padding-top: .15rem; font-variant-numeric: tabular-nums; }
.iq-course .iq-lesson { min-width: 0; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); padding: clamp(1rem, 3vw, 2.75rem); scroll-margin-top: 6rem; box-shadow: none; }
.iq-lesson-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; font-size: .73rem; color: var(--muted); margin-bottom: 1.25rem; }
.iq-lesson h3 { font-size: clamp(1.4rem, 2.3vw, 2rem); line-height: 1.2; letter-spacing: -.025em; margin: 0 0 .85rem; max-width: 28ch; }
.iq-intro { font-size: 1rem; line-height: 1.65; color: var(--muted); margin: 0 0 2rem; max-width: 65ch; }
.iq-reading { display: grid; gap: 1.5rem; }
.iq-reading h4, .iq-example h4 { margin: 0 0 .6rem; font-size: 1rem; line-height: 1.4; }
.iq-reading p, .iq-example p, .iq-example li { font-size: .94rem; line-height: 1.8; margin: 0; max-width: 72ch; }
.iq-example { margin: 1.75rem 0 1.25rem; padding: clamp(1rem, 2vw, 1.6rem); border-left: 3px solid var(--gold); border-radius: 0 .7rem .7rem 0; background: var(--panel-soft); }
.iq-example .iq-eyebrow { display: block; margin-bottom: .65rem; font-size: .65rem; }
.iq-example ol { padding-left: 1.4rem; display: grid; gap: .65rem; margin: 1.1rem 0; }
.iq-example li { padding-left: .25rem; }
.iq-example .iq-takeaway { padding-top: 1rem; border-top: 1px solid var(--line); }
.iq-takeaway strong { display: block; margin-bottom: .3rem; font-size: .8rem; }
.iq-disclosure { border-top: 1px solid var(--line); padding: .3rem 0; }
.iq-disclosure summary { min-height: 44px; padding: .8rem .15rem; cursor: pointer; font-size: .85rem; font-weight: 700; }
.iq-disclosure p, .iq-disclosure dd { font-size: .82rem; line-height: 1.7; color: var(--muted); }
.iq-disclosure dl { display: grid; gap: 1rem; margin: .5rem 0 1.2rem; }
.iq-disclosure dt { font-size: .87rem; font-weight: 700; }
.iq-disclosure dd { margin: .25rem 0 0; }
.iq-sources ul { list-style: none; padding: 0; display: grid; gap: 1rem; }
.iq-sources li > span { display: block; color: var(--muted); font-size: .72rem; margin-bottom: .3rem; }
.iq-course a { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; overflow-wrap: anywhere; }
.iq-sources a { font-size: .82rem; line-height: 1.6; }
.iq-external { font-size: .7rem; color: var(--muted); }
.iq-checkpoint { margin: 1rem 0 1.6rem; scroll-margin-top: 6rem; }
.iq-course .quiz-launch { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.25rem; background: var(--panel-soft); border: 1px solid var(--line); border-radius: .7rem; }
.iq-course .quiz-launch > div { display: grid; gap: .4rem; flex: 1 1 14rem; }
.iq-course .quiz-launch small { color: var(--muted); line-height: 1.6; }
.iq-course .quiz-launch.complete { border-color: var(--green); }
.iq-course .module-quiz { margin: 0; padding: 1.2rem 0; background: transparent; border: 0; box-shadow: none; }
.iq-course .module-quiz fieldset { min-width: 0; margin: 1rem 0; padding: 0; border: 0; }
.iq-course .module-quiz legend { font-size: .95rem; line-height: 1.6; margin-bottom: .7rem; }
.iq-course .module-quiz label { min-height: 44px; padding: .8rem; margin: .5rem 0; font-size: .9rem; line-height: 1.5; }
.iq-course .module-quiz label span { white-space: normal; font-size: .9rem; line-height: 1.5; }
.iq-course .module-quiz input[type="radio"] { flex: 0 0 1.15rem; width: 1.15rem; height: 1.15rem; accent-color: var(--gold); }
.iq-course .quiz-review-panel { box-shadow: none; margin-top: 1rem; }
.iq-course .quiz-review-panel p, .iq-course .quiz-review-panel small { line-height: 1.65; }
.iq-course .quiz-launch button, .iq-course .module-quiz > button, .iq-practice button, .iq-lesson-nav button { min-height: 44px; padding: .75rem 1rem; width: auto; max-width: 100%; font-size: .82rem; }
.iq-lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-top: 1px solid var(--line); padding-top: 1.2rem; margin-top: 1.2rem; }
.iq-lesson-nav > span { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.iq-lesson-nav button:disabled { opacity: .45; }
.iq-practice { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.iq-practice p { flex: 1 1 16rem; font-size: .85rem; line-height: 1.65; color: var(--muted); margin: 0; }
.iq-footnote { font-size: .73rem; line-height: 1.6; color: var(--muted); margin: 1.5rem 0 0; }
.iq-finished { border-left: 3px solid var(--green); padding: 1rem; background: var(--panel-soft); line-height: 1.6; }
.iq-course :is(button, summary, a, input):focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (max-width: 1200px) {
  .iq-workspace { grid-template-columns: 1fr; }
  .iq-syllabus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; align-items: start; }
  .iq-syllabus-heading { grid-column: 1 / -1; padding-bottom: 0; }
  .iq-track { border: 1px solid var(--line); border-radius: .7rem; }
}
@media (max-width: 650px) {
  .iq-header { display: grid; gap: 1.1rem; padding-top: 0; }
  .iq-progress { min-width: 0; max-width: 22rem; }
  .iq-syllabus { display: none; }
  .iq-mobile-picker { display: grid; gap: .65rem; margin-bottom: 1rem; font-size: .8rem; font-weight: 650; }
  .iq-mobile-picker select { min-height: 44px; min-width: 0; width: 100%; max-width: 100%; padding: .7rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: .6rem; }
  .iq-track summary { padding-block: .45rem; }
  .iq-track summary span { display: inline; }
  .iq-track summary small { margin-right: .65rem; }
  .iq-track summary strong { font-size: .83rem; }
  .iq-lesson-nav { gap: .4rem; }
  .iq-lesson-nav button { padding-inline: .65rem; }
}

/* Account entry is a full page; the signed-in account dialog keeps its layout. */
body.auth-pending > :not(script) { visibility: hidden; }
body.auth-page { overflow: hidden; }
body.auth-page > :is(.market-backdrop, .site-crosshair, .scroll-progress,
  .mouse-wind-trail, .versus-queue-widget, .cache-status) { visibility: hidden; }
body .account-modal.account-entry {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: stretch;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  background: var(--paper);
  backdrop-filter: none;
}
body .account-modal.account-entry.hidden { display: none; }
.account-modal.account-entry .account-auth-card {
  width: 100%;
  min-width: 0;
  /* Let the entry page scroll instead of shrinking and clipping its form. */
  height: max-content;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: none;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: clamp(28px, 4vw, 72px);
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}
.account-entry .account-auth-scroll {
  width: min(100%, 560px);
  overflow: visible;
  padding: 0;
  scrollbar-gutter: auto;
}
.account-entry .account-auth-head { display: none; }
.account-entry .auth-entry-intro { text-align: left; margin-bottom: 24px; }
.account-entry .auth-wordmark { width: min(230px, 100%); margin: 0 0 32px; }
.account-entry .auth-entry-intro h1 {
  margin: 0 0 8px;
  font-size: clamp(25px, 4vw, 32px);
  line-height: 1.2;
  letter-spacing: -.035em;
}
.account-entry .auth-entry-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.account-entry .auth-tabs { gap: 6px; padding: 5px; margin-bottom: 24px; border-radius: 14px; background: var(--panel-soft); }
.account-entry .auth-tabs button { min-height: 44px; border-color: transparent; background: transparent; border-radius: 10px; }
.account-entry .auth-tabs button.active { border-color: var(--line); color: var(--ink); background: var(--panel); box-shadow: 0 2px 5px rgba(0, 0, 0, .06); }
.account-entry .auth-form { gap: 18px; }
.account-entry .auth-grid { gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-entry .auth-form label { min-width: 0; font-size: 13px; color: var(--ink); }
.account-entry .auth-form label:not(.terms-check) { align-content: start; }
.account-entry .auth-form label small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.4; }
.account-entry .auth-form input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--panel);
  font-size: 16px;
  font-weight: 400;
  color-scheme: light;
}
body[data-theme="dark"] .account-entry .auth-form input:not([type="checkbox"]) { color-scheme: dark; }
.account-entry .auth-form > button { min-height: 48px; border-radius: 10px; }
.account-entry :is(button, input):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.account-entry .password-meter { gap: 6px; }
.account-entry .password-meter > div { height: 4px; }
.account-entry .password-meter ul { font-size: 11px; font-weight: 500; line-height: 1.4; }
.account-entry .terms-check { align-items: start; font-size: 12px; font-weight: 400; }
.account-entry .terms-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--gold); }
.account-entry .auth-form-error { margin: 0; color: var(--red); font-size: 13px; line-height: 1.5; }
.account-entry .auth-entry-footer { margin-top: 22px; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.6; }
.account-entry .auth-entry-footer p { margin: 0 auto 10px; max-width: 46ch; }
.account-entry .auth-entry-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
.account-entry .auth-entry-footer button { min-height: 44px; border: 0; padding: 8px; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.account-entry .auth-entry-footer .auth-guest-link { display: block; margin-inline: auto; color: var(--ink); }
.auth-entry-visual { display: none; }
.account-entry .auth-entry-visual {
  display: block;
  position: sticky;
  top: 0;
  align-self: start;
  width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--navy);
}
.auth-entry-visual img { display: block; width: 100%; height: 100%; object-fit: cover; }
body[data-theme="gamify"] .account-modal.account-entry {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 8% 10%, rgba(255, 222, 148, .52), transparent 48%),
    radial-gradient(ellipse at 45% 80%, rgba(165, 131, 255, .28), transparent 55%),
    radial-gradient(ellipse at 22% 45%, rgba(98, 221, 243, .38), transparent 52%);
  background-size: 160% 160%;
  animation: auth-gamify-background 20s ease-in-out infinite alternate;
}
@keyframes auth-gamify-background {
  from { background-position: 0% 10%; }
  to { background-position: 80% 90%; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-theme="gamify"] .account-modal.account-entry { animation: none; }
}
@media (max-width: 899px) {
  body .account-modal.account-entry { grid-template-columns: minmax(0, 1fr); }
  .account-entry .auth-entry-visual { display: none; }
}
@media (max-width: 520px) {
  .account-modal.account-entry .account-auth-card { padding: 28px 22px; }
  .account-entry .auth-grid { grid-template-columns: minmax(0, 1fr); }
  .account-entry .password-meter ul { grid-template-columns: minmax(0, 1fr); }
}

/* Mobile chart focus reuses the live canvas and its data-coordinate drawings. */
body.mobile-chart-open { overflow: hidden; }
body .chart-toolbar .mobile-chart-control { display: none; }
.mobile-chart-dialog {
  box-sizing: border-box;
  width: calc(100% - 24px);
  max-width: none;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  max-height: none;
  margin: auto;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius);
  color: var(--ink);
  background: var(--panel);
}
.mobile-chart-dialog[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}
.mobile-chart-dialog::backdrop {
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.mobile-chart-dialog .drawing-rail button:focus-visible,
canvas#chart[role="button"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
body .mobile-chart-dialog .chart-shell {
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin: 0;
  gap: 8px;
}
body .mobile-chart-dialog .chart-topbar,
body .mobile-chart-dialog .advanced-intervals,
body .mobile-chart-dialog:not(.is-drawing) .chart-drawing-actions,
body .mobile-chart-dialog.is-drawing #mobileChartDraw { display: none !important; }
body .mobile-chart-dialog .mobile-chart-control { display: inline-flex; }
body .mobile-chart-dialog .chart-toolbar {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
}
.mobile-chart-dialog .chart-toolbar-group { flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
body .mobile-chart-dialog .chart-drawing-actions {
  order: 1;
  flex-basis: 100%;
  justify-content: flex-end;
}
body .mobile-chart-dialog .chart-toolbar button { min-height: 44px; min-width: 44px; }
body .mobile-chart-dialog .chart-stage {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
}
body .mobile-chart-dialog.is-drawing .chart-stage { grid-template-rows: auto minmax(0, 1fr); }
body .mobile-chart-dialog .drawing-rail {
  display: flex;
  max-height: none;
  padding: 4px;
  gap: 6px;
  overflow: auto;
}
.mobile-chart-dialog .drawing-rail button { flex: 0 0 auto; min-width: 62px; min-height: 44px; }
/* Right-align tools when they fit, while retaining the scroll start on narrow phones. */
.mobile-chart-dialog .drawing-rail button:first-child { margin-inline-start: auto; }
body .mobile-chart-dialog .chart-canvas-wrap { display: flex; min-height: 0; }
body .mobile-chart-dialog canvas#chart {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}

/* Event Packs discovery uses the full workspace before a drill is opened. */
body.packs-home .workspace { grid-template-columns: minmax(0, 1fr); }
body.packs-home :is(.chart-panel, .choices, #nextBtn, .result),
body.packs-mode .lower { display: none; }
body[data-theme].packs-home :is(.panel, #modeSurface) {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.event-packs-home {
  width: min(100%, 1440px);
  margin-inline: auto;
  display: grid;
  gap: clamp(20px, 3vw, 36px);
}
.event-packs-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding-block: clamp(12px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
}
.event-packs-intro h1 {
  margin: 12px 0;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.12;
  letter-spacing: -.035em;
}
.event-packs-intro p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.event-packs-steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 20px;
  border-inline-start: 1px solid var(--line);
  list-style: none;
  font-size: 13px;
  font-weight: 700;
}
.event-packs-steps li { display: flex; align-items: center; gap: 12px; }
.event-packs-steps span { color: var(--teal); font-variant-numeric: tabular-nums; }
.event-packs-home > .section-head { flex-wrap: wrap; gap: 8px; margin: 0; }
.event-packs-home h2 { margin: 0; font-size: 20px; }
.event-packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  align-items: start;
  gap: var(--box-separation, 20px);
}
.event-pack-entry {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--isolated-box-radius, 10px);
  background: var(--panel);
  overflow-wrap: anywhere;
}
.event-pack-entry > summary {
  display: grid;
  gap: 12px;
  padding: clamp(16px, 2vw, 24px);
  cursor: pointer;
  list-style: none;
}
.event-pack-entry > summary::-webkit-details-marker { display: none; }
.event-pack-entry > summary:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}
.event-pack-entry[open] { border-color: var(--teal); }
.event-pack-eyebrow, .event-pack-meta, .event-pack-explore { display: flex; align-items: center; gap: 12px; }
.event-pack-eyebrow { justify-content: space-between; color: var(--teal); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.event-pack-eyebrow > :last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-pack-entry h3 { margin: 0; font-size: 20px; line-height: 1.3; }
.event-pack-period { color: var(--muted); font-size: 12px; }
.event-pack-description { min-height: 4.5em; color: var(--muted); font-size: 14px; line-height: 1.5; }
.event-pack-meta { flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.event-pack-meta > span { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.event-pack-explore { justify-content: space-between; min-height: 44px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; font-weight: 800; }
.event-pack-explore > :last-child { font-size: 22px; line-height: 1; }
.event-pack-open-label { display: none; }
.event-pack-entry[open] .event-pack-closed-label { display: none; }
.event-pack-entry[open] .event-pack-open-label { display: inline; }
.event-pack-entry[open] .event-pack-explore > :last-child { transform: rotate(45deg); }
.event-pack-details { border-top: 1px solid var(--line); padding: clamp(16px, 2vw, 24px); }
.event-pack-details h4 { margin: 0 0 10px; font-size: 13px; }
.event-pack-details p, .event-pack-copy { color: var(--muted); font-size: 13px; line-height: 1.6; }
.event-pack-focus { margin: 0 0 20px; padding-inline-start: 20px; font-size: 13px; line-height: 1.7; }
.event-pack-focus li::first-letter { text-transform: uppercase; }
.event-pack-markets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.event-pack-markets li { padding: 4px 7px; border-radius: 4px; background: var(--panel-soft); font-size: 12px; }
.event-pack-details .mode-actions { margin: 16px 0 0; }
.event-pack-details .mode-actions button { min-height: 44px; width: 100%; }
.event-pack-details .event-pack-practice-label { margin-top: 16px; }
.event-pack-details .event-pack-practice-options { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 0; }
.event-pack-chart-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}
.event-pack-chart-header > .mode-row { min-height: 44px; }
.event-pack-home-action { grid-template-columns: auto; }
.event-pack-home-action .event-pack-home {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 10px;
}
.event-pack-subtitle { margin: 0; font-size: 14px; }
@media (max-width: 620px) {
  .event-packs-intro { grid-template-columns: minmax(0, 1fr); }
  .event-packs-steps { border-inline-start: 0; padding: 0; gap: 12px; }
  .event-pack-description { min-height: 0; }
}

/* Settings uses the same warm, flat fill as Review surfaces. */
body.account-mode:not([data-theme="dark"]) {
  --paper: #fffaf0;
  --paper-rgb: 255, 250, 240;
}

body.account-mode {
  background: var(--paper);
}

/* Coins and daily quests share the existing account status popup. */
#accountModal .coin-wallet {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px;
}
#accountModal .coin-wallet > span { display: flex; align-items: center; gap: 8px; color: var(--muted); }
#accountModal .coin-wallet > strong { font-size: 22px; font-variant-numeric: tabular-nums; }
#accountModal :is(.coin-wallet, .account-rewards)[hidden] { display: none; }
#accountModal .rank-road-heading, #accountModal .quest-heading {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px;
}
#accountModal .rank-road-heading > strong { font: 700 18px/1.3 Georgia, "Times New Roman", serif; }
#accountModal .rank-road-heading > small, #accountModal .quest-heading > small { color: var(--muted); font-size: 11px; }
#accountModal.account-entry .rank-road-heading { display: none; }
#accountModal .account-rewards { min-width: 0; margin: 8px 0 18px; }
#accountModal .quest-heading { margin-bottom: 12px; }
#accountModal .quest-heading h3 { margin: 0; font: 700 21px/1.3 Georgia, "Times New Roman", serif; }
#accountModal .account-quest-row {
  display: flex; gap: 8px; min-height: 218px; overflow-x: auto; overscroll-behavior-x: contain;
  /* Reserve room for the Gamify cards' existing offset shadow. */
  padding: 3px 12px 12px 3px; scroll-snap-type: x proximity; scrollbar-width: none; -ms-overflow-style: none;
}
#accountModal .account-quest-row::-webkit-scrollbar { display: none; width: 0; height: 0; }
#accountModal .account-quest-row:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 12px; }
#accountModal .account-quest-card {
  flex: 0 0 calc((100% - 16px) / 3); min-width: 0; max-width: 100%;
  display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(6px, 1.2vw, 12px); background: var(--panel-soft); scroll-snap-align: start;
}
#accountModal .quest-category { color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 800; }
#accountModal .account-quest-card h4 { min-height: 42px; margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
#accountModal .quest-progress-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#accountModal .account-quest-card progress { appearance: none; width: 100%; height: 5px; border: 0; border-radius: 99px; overflow: hidden; background: var(--line); accent-color: var(--gold); }
#accountModal .account-quest-card progress::-webkit-progress-bar { background: var(--line); }
#accountModal .account-quest-card progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
#accountModal .account-quest-card progress::-moz-progress-bar { background: var(--gold); }
#accountModal .quest-empty { display: grid; place-content: center; width: 100%; margin: 0; color: var(--muted); text-align: center; }
.gold-coin, #accountModal .gold-coin {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 20px;
  border-radius: 50%; border: 1px solid #a96b17;
  background: radial-gradient(ellipse at 30% 20%, #fff3af 0%, #ffe07a 24%, #f4ba36 48%, #d98d1c 78%, #ab6410 100%);
  color: #8c4f09; font: 900 12px/1 Georgia, serif; text-shadow: 0 1px #fff2aa;
  box-shadow: inset 0 0 0 2px #ffe295, 0 2px 0 #94520c;
}
#accountModal .coin-reward-button {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px;
  max-width: calc(100% - 6px); padding: 8px 10px; border: 1px solid var(--gold); border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #08152b;
  font: 800 12px/1.4 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
#accountModal .account-quest-card .coin-reward-button { max-width: 100%; width: 100%; }
#accountModal .rank-road-level .coin-reward-button { grid-row: 4; gap: 4px; font-size: 11px; padding: 6px 10px; }
#accountModal .rank-road-level .gold-coin { width: 16px; height: 16px; flex-basis: 16px; font-size: 10px; }
#accountModal .coin-reward-button:disabled { border-color: var(--line); background: var(--panel); color: var(--muted); cursor: default; box-shadow: none; transform: none; opacity: 1; }
#accountModal .coin-reward-button:disabled .gold-coin { filter: grayscale(1); opacity: .7; }
#accountModal .coin-reward-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
body[data-theme="gamify"] #accountModal .account-quest-card {
  border: 2px solid #5c3ac7; border-radius: 24px;
  background: radial-gradient(circle at 94% 6%, #ffe36e4d, transparent 9rem), linear-gradient(145deg, #fffdf8, #f4efff);
  box-shadow: 8px 8px 0 #aa91e9, inset 0 2px 0 #ffffffe6, 0 12px 24px #41239416;
}
body[data-theme="gamify"] #accountModal .coin-reward-button:not(:disabled) { border: 2px solid #5c3ac7; color: #27105f; }
body[data-theme="gamify"] #accountModal .coin-reward-button:disabled { border-color: #b7a4dc; background: #eee8f7; color: #706582; }
body[data-theme="gamify"] #accountModal .coin-reward-button:not(:disabled) {
  --coin-button-depth: 6px; --coin-button-base: #8f62cb;
  position: relative; transform: translateY(0); touch-action: manipulation;
  box-shadow: 0 var(--coin-button-depth) 0 var(--coin-button-base), 0 9px 12px #41239421, inset 0 2px 0 #ffffff99;
  transition: transform 180ms cubic-bezier(.34,1.56,.64,1), box-shadow 180ms ease;
}
body[data-theme="gamify"] #accountModal .coin-reward-button:not(:disabled):active {
  transform: translateY(calc(var(--coin-button-depth) - 1px));
  box-shadow: 0 1px 0 var(--coin-button-base), inset 0 2px 4px #27105f33; transition-duration: 60ms;
}
.coin-collection-field { position: fixed; z-index: 20020; inset: 0; overflow: hidden; pointer-events: none; perspective: 700px; }
.flying-gold-coin { position: absolute; top: 0; left: 0; will-change: transform; }
.flying-gold-coin .gold-coin { width: 28px; height: 28px; flex-basis: 28px; font-size: 17px; box-shadow: inset 0 0 0 2px #ffe295, inset 2px 3px 0 #fff2b1, 0 3px 0 #94520c, 0 5px 7px #08152b38; }
.coin-collection-status { position: fixed; z-index: 20021; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 8px 14px; border: 1px solid var(--gold); border-radius: 99px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); font-size: 12px; font-weight: 800; text-align: center; pointer-events: none; }
@media (max-width: 620px) {
  #accountModal .account-quest-card h4 { font-size: 12px; }
  #accountModal .account-quest-card .coin-reward-button { gap: 4px; padding-inline: 4px; }
  #accountModal .account-quest-card .gold-coin { width: 16px; height: 16px; flex-basis: 16px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-theme="gamify"] #accountModal .coin-reward-button { transition: none; }
}
