:root {
  --background: #111216;
  --foreground: #f4f4f5;
  --card: #181a21;
  --card-foreground: #f4f4f5;
  --popover: #181a21;
  --popover-foreground: #f4f4f5;
  --primary: oklch(0.852 0.199 91.936);
  --primary-foreground: oklch(0.421 0.095 57.708);
  --secondary: #1d1e26;
  --secondary-foreground: #f4f4f5;
  --muted: #1d1e26;
  --muted-foreground: #8f929b;
  --accent: #242630;
  --accent-foreground: #f4f4f5;
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(1 0 0);
  --border: #272a34;
  --input: #343743;
  --ring: #5fcbaa;
  --chart-1: oklch(0.905 0.182 98.111);
  --chart-2: oklch(0.795 0.184 86.047);
  --chart-3: oklch(0.681 0.162 75.834);
  --chart-4: oklch(0.554 0.135 66.442);
  --chart-5: oklch(0.476 0.114 61.907);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.681 0.162 75.834);
  --sidebar-primary-foreground: oklch(0.987 0.026 102.212);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
  --header: #111216;
  --header-foreground: #f4f4f5;
  --footer: #111216;
  --footer-foreground: #8f929b;
  --code: oklch(1 0 0);
  --code-foreground: oklch(0.708 0 0);
  --code-highlight: oklch(0.27 0 0);
  --code-number: oklch(0.72 0 0);
  --code-selection: oklch(0.922 0 0);
  --code-border: oklch(0.922 0 0);
  --radius: 0.625rem;
  --bg: var(--background);
  --panel: var(--background);
  --ink: var(--foreground);
  --line: var(--border);
  --yellow: var(--primary);
  --accent-2: var(--chart-4);
  --sky: oklch(0.9 0.08 220);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.795 0.184 86.047);
  --primary-foreground: oklch(0.421 0.095 57.708);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.905 0.182 98.111);
  --chart-2: oklch(0.795 0.184 86.047);
  --chart-3: oklch(0.681 0.162 75.834);
  --chart-4: oklch(0.554 0.135 66.442);
  --chart-5: oklch(0.476 0.114 61.907);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.795 0.184 86.047);
  --sidebar-primary-foreground: oklch(0.987 0.026 102.212);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
  --header: oklch(0.145 0 0);
  --header-foreground: oklch(0.985 0 0);
  --footer: oklch(0.145 0 0);
  --footer-foreground: oklch(0.985 0 0);
  --code: oklch(0.2 0 0);
  --code-foreground: oklch(0.708 0 0);
  --code-highlight: oklch(0.27 0 0);
  --code-number: oklch(0.72 0 0);
  --code-selection: oklch(0.922 0 0);
  --code-border: oklch(1 0 0 / 10%);
  --radius: 0.625rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, rgba(241, 189, 61, 0.09), transparent 34%),
    var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-view="symbol"] {
  color: oklch(0.985 0 0);
  background: #111216;
}

body[data-view="symbol"] .site-header,
body[data-view="game"] .site-header,
body[data-view="symbol"] .site-footer,
body[data-view="game"] .site-footer {
  display: none;
}

body[data-view="game"] {
  overflow: hidden;
  color: #f4f4f5;
  background: #111216;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 54px);
  color: var(--header-foreground);
  background: color-mix(in srgb, var(--header) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #151515;
  background: var(--yellow);
  border-radius: 6px;
  font-size: 13px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  color: #a4a7af;
  font-size: 14px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(520px, 1.18fr);
  gap: clamp(24px, 4vw, 52px);
  min-height: calc(100svh - 67px);
  padding: clamp(28px, 5vw, 72px) clamp(18px, 4vw, 54px) 34px;
  background:
    linear-gradient(180deg, rgba(241, 189, 61, 0.10), transparent 42%),
    var(--background);
}

body[data-view="home"] .hero {
  display: block;
  min-height: auto;
  padding-top: clamp(22px, 4vw, 42px);
  padding-bottom: 10px;
  text-align: center;
}

body[data-view="home"] .hero-copy {
  margin: 0 auto;
}

body[data-view="home"] h1 {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 14px;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1;
}

body[data-view="home"] .lede {
  margin-left: auto;
  margin-right: auto;
  font-size: 18px;
}

body[data-view="symbol"] .hero {
  display: block;
  min-height: 100svh;
  padding: 22px clamp(18px, 6vw, 104px) 42px;
  background: #111216;
}

body[data-view="symbol"] .hero-copy {
  max-width: 660px;
  margin: 0 auto;
}

body[data-view="symbol"] .hero-copy > .eyebrow,
body[data-view="symbol"] #page-title,
body[data-view="symbol"] #page-lede,
body[data-view="symbol"] .ticker-form {
  display: none;
}

.hero-copy {
  align-self: center;
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 0.96;
  letter-spacing: 0;
}

.lede {
  max-width: 540px;
  color: var(--muted-foreground);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.45;
}

.ticker-form {
  margin-top: 24px;
  max-width: 480px;
}

body[data-view="home"] .ticker-form {
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
}

.ticker-form label,
.meta-label {
  display: block;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ticker-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 8px;
}

.ticker-row input {
  min-width: 0;
  height: 54px;
  padding: 0 16px;
  color: var(--foreground);
  background: #0d0e12;
  border: 2px solid var(--input);
  border-radius: 8px;
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-input {
  text-transform: none;
}

.ticker-row input:focus {
  border-color: #5fcbaa;
  outline: 3px solid rgba(95, 203, 170, 0.18);
}

.ticker-row button,
.cta,
.controls button,
.ticker-strip button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.ticker-row button {
  color: #151515;
  background: var(--yellow);
}

.route-panel {
  margin-top: 26px;
}

body[data-view="symbol"] .route-panel {
  margin-top: 0;
}

.back-home {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 30px;
  padding: 0 14px;
  color: #5ed1b0;
  background: #1b1d25;
  border: 1px solid #2a2d38;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.symbol-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.symbol-heading h2 {
  display: inline;
  margin: 0 10px 0 0;
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

#quote-company {
  color: #676a72;
  font-weight: 700;
}

.symbol-move {
  display: flex;
  align-items: center;
  gap: 10px;
}

.symbol-move strong {
  font-size: 14px;
}

#quote-difficulty {
  padding: 3px 8px;
  color: #f6a400;
  background: #503a00;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: lowercase;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.range-tabs button,
.smooth-pill {
  min-height: 28px;
  padding: 0 14px;
  color: #a4a6ad;
  background: #24252d;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.range-tabs button.is-active {
  color: #101214;
  background: #5fcbaa;
}

.chart-stage {
  overflow: hidden;
  padding: 0;
  background: #07080b;
  border: 1px solid #242630;
  border-radius: 10px;
}

.quote-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quote-card > div {
  padding: 16px;
  background: var(--card);
}

.quote-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

#preview-canvas {
  width: 100%;
  max-width: none;
  aspect-ratio: 980 / 380;
  border: 0;
  border-radius: 0;
  background: #07080b;
  cursor: pointer;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.stats-row div {
  min-height: 60px;
  padding: 13px 14px;
  text-align: center;
  background: #1d1e26;
  border-radius: 8px;
}

.stats-row span {
  display: block;
  margin-bottom: 5px;
  color: #6e7179;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stats-row strong {
  color: #fff;
  font-size: 16px;
}

.market-home {
  padding: 8px clamp(18px, 4vw, 54px) clamp(46px, 7vw, 80px);
  background: var(--background);
}

.compact-heading {
  max-width: 1040px;
  margin: 0 auto 14px;
  text-align: center;
}

.compact-heading h2 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 34px);
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
}

.market-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  color: var(--card-foreground);
  text-align: left;
  background: #181a21;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.market-card:hover {
  transform: translateY(-2px);
  border-color: rgba(95, 203, 170, 0.55);
  box-shadow: 0 24px 62px rgba(0, 0, 0, 0.34);
}

.market-card-top,
.market-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.market-card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
}

.market-card strong {
  font-size: 20px;
}

.market-card small {
  grid-column: 1;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
}

.market-card [data-card-change] {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.market-card span {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 800;
}

.market-card [data-card-change].is-up,
#quote-change.is-up {
  color: var(--chart-4);
}

.market-card [data-card-change].is-down,
#quote-change.is-down {
  color: var(--destructive);
}

.market-card canvas {
  width: 100%;
  aspect-ratio: 360 / 170;
  border: 1px solid #242733;
  border-radius: calc(var(--radius) - 2px);
  background: #07080b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.quote-source {
  margin: 10px 0 16px;
  color: var(--muted-foreground);
  font-size: 13px;
}

body[data-view="symbol"] .quote-source {
  display: none;
}

.cta {
  min-width: 220px;
  color: #151515;
  background: var(--yellow);
}

body[data-view="symbol"] .cta {
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  color: #101214;
  background: #5fcbaa;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 500;
}

.game-shell.is-hidden {
  display: none;
}

#ticker-help {
  margin-top: 10px;
  color: var(--muted-foreground);
  font-size: 14px;
}

.game-shell {
  align-self: center;
  overflow: hidden;
  background: #181818;
  border: 1px solid rgba(23, 23, 23, 0.2);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 23, 23, 0.24);
}

body[data-view="game"] .hero {
  display: block;
  min-height: 100svh;
  padding: 0;
  background: #111216;
}

body[data-view="game"] .hero-copy,
body[data-view="game"] .market-home {
  display: none;
}

body[data-view="game"] .game-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: block;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background: #111216;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.game-toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 16px;
  color: #fff;
  background: #101010;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body[data-view="game"] .game-toolbar {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 180px;
  padding: 0;
  color: #f4f4f5;
  background: transparent;
  border: 0;
}

body[data-view="game"] .game-toolbar div {
  display: contents;
}

body[data-view="game"] .game-toolbar div:first-child {
  display: block;
  color: #858891;
  font-size: 13px;
  font-weight: 800;
}

body[data-view="game"] .game-toolbar div:first-child::after {
  content: " · ALL";
}

body[data-view="game"] .game-toolbar div:nth-child(2) {
  display: block;
}

body[data-view="game"] .game-toolbar div:nth-child(2) .meta-label {
  display: none;
}

body[data-view="game"] .game-toolbar div:nth-child(2) strong {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 28px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body[data-view="game"] .game-toolbar div:nth-child(2) strong::after {
  content: "pts";
  color: #858891;
  font-size: 11px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

body[data-view="game"] .game-toolbar div:nth-child(3) {
  display: block;
  color: #858891;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body[data-view="game"] .game-toolbar div:nth-child(3) .meta-label {
  display: inline;
  color: #858891;
  font-size: 14px;
  text-transform: none;
}

body[data-view="game"] .game-toolbar div:nth-child(3) strong {
  display: inline;
  color: #5fcbaa;
  font-size: 14px;
}

.game-toolbar strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #8fd0df;
}

body[data-view="game"] #game-canvas {
  width: 100vw;
  height: 100svh;
  aspect-ratio: auto;
  background: #111216;
}

canvas:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(241, 189, 61, 0.7);
  outline-offset: 3px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  background: #101010;
}

body[data-view="game"] .controls {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 2;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 220px;
  padding: 10px;
  background: rgba(24, 25, 32, 0.86);
  border: 1px solid #2c2f3a;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
}

body[data-view="game"] .controls button {
  min-height: 24px;
  padding: 0 8px;
  color: #858891;
  background: #20222b;
  border: 1px solid #343743;
  border-radius: 4px;
  font-size: 12px;
  text-align: left;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

body[data-view="game"] .controls button[data-control="jump"],
body[data-view="game"] .controls button[data-control="reset"] {
  grid-column: span 1;
}

.controls button {
  color: #f7f1e8;
  background: #2b2b2b;
}

.controls button:active,
.controls button.is-active {
  color: #111;
  background: var(--yellow);
}

.ticker-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 18px clamp(18px, 4vw, 54px);
  background: #151515;
}

.ticker-strip button {
  color: #fff;
  background: #2f2f2f;
}

.ticker-strip button:hover {
  background: var(--accent);
}

.section-heading {
  max-width: 760px;
}

.section-heading h2 {
  margin-bottom: 28px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1;
}

.site-footer {
  color: var(--muted-foreground);
  line-height: 1.55;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(18px, 4vw, 54px);
  color: var(--footer-foreground);
  background: var(--footer);
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: #f4f4f5;
  font-weight: 800;
}

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

  .game-shell {
    align-self: stretch;
  }

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

@media (max-width: 680px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .ticker-row {
    grid-template-columns: 1fr;
  }

  .quote-card {
    grid-template-columns: 1fr;
  }

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

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

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

  .game-toolbar {
    grid-template-columns: 1fr;
  }

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