/* Polar Arena design system.
   Tactile UI: solid unblurred bottom shadows (surfaces sit on the page like tiles), one accent (Polar green, which
   means "interactive" or "money earned"), red only for losses, identity colours only on cubs. Pixel display type for
   headings and big numbers, Manrope for reading, IBM Plex Mono for figures. Radii: cards 18, controls 12, chips pill. */

@import url("/assets/fonts/fonts.css");

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1220; --bg-2: #0e1829; --side-bg: #0c1526;
  --panel: #121d32; --panel-2: #16233c; --panel-3: #1b2b49;
  --line: #22324f; --line-2: #2d4165; --shadow: #060b15; --shadow-2: #04080f;
  --ink: #edf3fc; --ink-2: #bccadf; --muted: #8a9dba; --faint: #7488a7;
  --accent: #08b40d; --accent-shadow: #06870a; --accent-soft: rgb(8 180 13 / 0.16); --accent-ink: #5ee363;
  --up: #45e08b; --up-soft: rgb(69 224 139 / 0.14); --down: #ff6f62; --down-soft: rgb(255 111 98 / 0.15);
  --sun: #ffc83a; --sun-soft: rgb(255 200 58 / 0.14); --sun-ink: #ffd36a;
  --blue-soft: rgb(91 155 240 / 0.16); --blue-ink: #8dbaff;
  --ice: #8cc8ff; --flake: rgb(255 255 255 / 0.4); --scrim: rgb(3 7 14 / 0.72);
  --on-accent: #06210a;
  --font-pixel: "Jersey 15", "Silkscreen", ui-monospace, monospace;
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-card: 18px;
  --r-ctl: 12px;
  --r-chip: 999px;
  --lift: 0 3px 0 var(--shadow);
  --lift-2: 0 5px 0 var(--shadow);
  --side: 248px;
  --maxw: 1240px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #eaf0f6; --bg-2: #dfe8f1; --side-bg: #f2f6fa;
  --panel: #ffffff; --panel-2: #f5f8fb; --panel-3: #edf2f7;
  --line: #d6e0ea; --line-2: #c3d0dd; --shadow: #c7d4e2; --shadow-2: #b3c3d4;
  --ink: #0f1f2b; --ink-2: #33485a; --muted: #56697c; --faint: #6a7f92;
  --accent: #08b40d; --accent-shadow: #06870a; --accent-soft: #e2f7e3; --accent-ink: #067a0a;
  --up: #067f40; --up-soft: #ddf5e8; --down: #c93a2d; --down-soft: #fde6e3;
  --sun: #ffc83a; --sun-soft: #fff3cc; --sun-ink: #7d5700;
  --blue-soft: #e6efff; --blue-ink: #2d56c4;
  --ice: #8cc8ff; --flake: rgb(120 146 184 / 0.45); --scrim: rgb(15 31 43 / 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--font-sans); }
.snowfall { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; pointer-events: none; z-index: 0; }
.shell, .home { position: relative; z-index: 1; }
.mono { font-family: var(--font-mono); font-size: 14px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--font-pixel); font-weight: 400; letter-spacing: 0.01em; line-height: 1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(44px, 6vw, 84px); }
h2 { font-size: clamp(30px, 3.4vw, 44px); }
h3 { font-size: 26px; }
p { margin: 0; text-wrap: pretty; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.pix { font-family: var(--font-pixel); font-weight: 400; letter-spacing: 0.01em; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.cub-img { image-rendering: pixelated; display: block; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--lift); }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.card-head h3 { font-size: 24px; }
.card-head .spacer { flex: 1; }
.well { background: var(--panel-2); border-radius: 12px; }

/* ------------------------------------------------------------------ controls */
.btn {
  --b: var(--accent); --bs: var(--accent-shadow); --t: var(--on-accent);  /* dark ink on Polar green is 6:1; white would be 2.8:1 */
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px;
  border: 0; border-radius: var(--r-ctl); background: var(--b); color: var(--t); font-weight: 700; font-size: 15px; white-space: nowrap;
  box-shadow: 0 4px 0 var(--bs), inset 0 2px 0 rgb(255 255 255 / 0.22); cursor: pointer;
  transition: transform 0.08s var(--ease), box-shadow 0.08s var(--ease), background-color 0.15s var(--ease);
}
.btn:hover { background: color-mix(in oklab, var(--b) 90%, white); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bs), inset 0 2px 0 rgb(255 255 255 / 0.18); }
.btn.ghost { --b: var(--panel); --bs: var(--shadow-2); --t: var(--ink); border: 1px solid var(--line-2); box-shadow: 0 4px 0 var(--bs); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.lg { height: 56px; padding: 0 26px; font-size: 17px; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel-3); border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 2px 0 var(--shadow); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--panel);
  box-shadow: inset 0 2px 0 var(--panel-3); font-weight: 500;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 6px; }

/* ------------------------------------------------------------------ chips and tags */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-chip); background: var(--panel-3); color: var(--ink-2); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.sun { background: var(--sun-soft); color: var(--sun-ink); }
.chip.down { background: var(--down-soft); color: var(--down); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag { font: 600 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ------------------------------------------------------------------ app shell: collapsible sidebar on desktop, top bar on phones */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns 0.2s var(--ease); }
.side-collapsed { --side: 76px; }
.side { position: sticky; top: 0; height: 100dvh; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); background: var(--side-bg); overflow: hidden; z-index: 5; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 2px 8px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; min-width: 0; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand b { font: 400 32px/1 var(--font-pixel); }
.side-toggle { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.side-toggle:hover { background: var(--panel-3); color: var(--ink); }
.side-toggle .ic { width: 18px; height: 18px; transition: rotate 0.2s var(--ease); }
.login { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); box-shadow: 0 3px 0 var(--shadow); text-align: left; cursor: pointer; min-width: 0; }
.login:hover { background: var(--panel-2); }
.login-ic { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--panel-3); color: var(--ink-2); }
.login-ic .ic { width: 18px; height: 18px; }
.login .t { min-width: 0; }
.login b { display: block; font-size: 15px; font-weight: 800; }
.login small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); font-weight: 700; font-size: 15px; border: 1px solid transparent; white-space: nowrap; transition: background-color 0.15s var(--ease); }
.nav a:hover { background: var(--panel-3); }
.nav a[aria-current="page"] { background: var(--panel); color: var(--ink); box-shadow: 0 3px 0 var(--shadow); border-color: var(--accent); }
.nav .ic, .side-links .ic { width: 20px; height: 20px; flex: none; }
.side .make { margin-top: 12px; width: 100%; height: 48px; }
.side .grow { flex: 1; }
.side-links { display: flex; flex-direction: column; gap: 2px; border-top: 1px dashed var(--line-2); padding-top: 10px; }
.side-links > a, .side-links > button { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; text-align: left; }
.side-links > a:hover, .side-links > button:hover { background: var(--panel-3); color: var(--ink); }
.side-links .ext { width: 14px; height: 14px; margin-left: auto; color: var(--muted); }
.theme { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 2px 12px; color: var(--ink-2); font-weight: 700; font-size: 14px; }
.theme .tl { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.seg-mini { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-3); }
.seg-mini button { width: 32px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-mini button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 2px 0 var(--shadow); }
.seg-mini .ic { width: 16px; height: 16px; }
.side-collapsed .side { padding: 14px 10px; align-items: center; }
.side-collapsed .side-top { flex-direction: column; padding-bottom: 4px; }
.side-collapsed .brand b, .side-collapsed .login .t, .side-collapsed .nav span, .side-collapsed .make span, .side-collapsed .side-links span, .side-collapsed .side-links .ext, .side-collapsed .theme .tl { display: none; }
.side-collapsed .side-toggle .ic { rotate: 180deg; }
.side-collapsed .login { width: auto; padding: 6px; justify-content: center; }
.side-collapsed .nav a, .side-collapsed .side-links > a, .side-collapsed .side-links > button { width: 48px; justify-content: center; padding: 0; }
.side-collapsed .make { width: 48px; padding: 0; }
.side-collapsed .theme { padding: 6px 0 0; }
.side-collapsed .seg-mini { flex-direction: column; }
.main { min-width: 0; padding: 28px 32px 64px; }
.page { max-width: var(--maxw); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 6px 0 22px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.page-head p { color: var(--muted); max-width: 60ch; margin-top: 8px; }
@media (max-width: 900px) {
  .shell, .side-collapsed .shell { grid-template-columns: 1fr; }
  .side, .side-collapsed .side { position: sticky; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; gap: 4px; }
  .side-top, .side-collapsed .side-top { flex-direction: row; padding: 0; }
  .brand b { font-size: 24px; }
  .side-toggle, .login .t, .side .grow, .side-links, .nav span, .make span { display: none; }
  .brand b { display: none; }
  .login { width: auto; margin: 0; padding: 4px; box-shadow: none; }
  .side > *, .side-top > * { flex: none; }
  .login-ic { width: 34px; height: 34px; }
  .nav { flex-direction: row; }
  .nav a { height: 40px; width: 40px; padding: 0; justify-content: center; }
  .side .make { margin: 0 0 0 auto; width: 40px; height: 40px; padding: 0; flex: none; }
  .main { padding: 18px 14px 48px; }
}

/* ------------------------------------------------------------------ modals */
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 26px 26px 22px; border: 1px solid var(--line-2); border-radius: 26px; background: var(--panel); color: var(--ink); box-shadow: 0 8px 0 var(--shadow); overflow: auto; }
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.modal-x { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; background: var(--panel-2); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--shadow); }
.modal-x .ic { width: 18px; height: 18px; }
.modal-title { text-align: center; font-size: 40px; margin: 4px 0 18px; }
.modal .well { padding: 18px; border: 1px solid var(--line-2); display: grid; gap: 10px; }
.modal .well p { color: var(--ink-2); font-size: 14.5px; }
.modal code { font: 600 13px var(--font-mono); background: var(--panel-3); padding: 1px 5px; border-radius: 6px; }
.modal .err { color: var(--down); font-size: 13.5px; font-weight: 700; }
.modal .err:empty { display: none; }
.modal-note { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 14px; }
.linkish { display: flex; align-items: center; gap: 8px; margin: 12px auto 0; border: 0; background: none; color: var(--accent-ink); font-weight: 800; font-size: 16px; cursor: pointer; }
.trio { display: flex; justify-content: center; margin: -4px 0 14px; }
.trio img { width: 118px; height: 118px; margin: 0 -14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel-2); margin-bottom: 20px; }
.tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 800; font-size: 15.5px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); box-shadow: 0 3px 0 var(--accent-shadow); }
.eyebrow { font: 400 16px/1 var(--font-pixel); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.modal h2 { font-size: 40px; margin: 8px 0 10px; }
.modal .lede { color: var(--ink-2); font-size: 15.5px; }
.steps { list-style: none; margin: 16px 0 18px; padding: 0; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-2); }
.steps .n { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font: 700 16px var(--font-mono); }
.steps b { display: block; font-weight: 800; font-size: 15.5px; }
.steps small { display: block; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.btn.wide { width: 100%; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ data */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font: 600 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 12px; white-space: nowrap; }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr.row { cursor: pointer; transition: background-color 0.12s var(--ease); }
.table tr.row:hover td { background: var(--panel-2); }
.table .r { text-align: right; }
.rank { font: 400 26px/1 var(--font-pixel); color: var(--muted); width: 36px; }
.rank.top { color: var(--sun-ink); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who img { width: 48px; height: 48px; flex: none; }
.who b { display: block; font-weight: 800; font-size: 15.5px; }
.who small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat b { display: block; font: 400 34px/1 var(--font-pixel); }
.stat span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.spark { width: 110px; height: 30px; display: block; }

/* range strip: the band against the price */
.strip { position: relative; height: 12px; border-radius: 6px; background: var(--panel-3); overflow: hidden; min-width: 90px; }
.strip i { position: absolute; top: 0; bottom: 0; background: color-mix(in oklab, var(--accent) 50%, var(--panel-3)); border-radius: 6px; }
.strip i.out { background: color-mix(in oklab, var(--down) 45%, var(--panel-3)); }
.strip b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); border-radius: 1px; }

/* feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: 0; }
.feed-item img { width: 44px; height: 44px; }
.feed-item .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feed-item .top b { font-weight: 800; }
.feed-item .top time { color: var(--faint); font-size: 12.5px; font-weight: 600; }
.feed-item p { margin-top: 4px; color: var(--ink-2); font-size: 14.5px; }
.feed-item .meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.kind { font: 700 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 5px 7px; border-radius: 7px; background: var(--panel-3); color: var(--ink-2); }
.kind.open { background: var(--accent-soft); color: var(--accent-ink); }
.kind.rebalance { background: var(--blue-soft); color: var(--blue-ink); }
.kind.close { background: var(--sun-soft); color: var(--sun-ink); }
.kind.think, .kind.note { background: var(--panel-3); color: var(--muted); }

/* skeleton for first load only */
.skel { background: linear-gradient(90deg, var(--panel-3), var(--panel-2), var(--panel-3)); background-size: 200% 100%; border-radius: 10px; min-height: 18px; animation: sk 1.4s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 4px 0 #000a; z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* icons */
.ic { width: 1.1em; height: 1.1em; flex: none; }
.chip .ic { width: 14px; height: 14px; }
.btn .ic { width: 18px; height: 18px; }

/* arena page */
.stats4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats4 .card { padding: 16px 18px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.pod { position: relative; padding: 16px 18px 18px; display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; overflow: hidden; }
.pod img { width: 112px; height: 112px; }
.pod .place { position: absolute; top: 12px; right: 14px; font: 400 30px/1 var(--font-pixel); color: var(--faint); }
.pod.first .place { color: var(--sun-ink); }
.pod h3 { font-size: 30px; }
.pod .edge { font: 400 34px/1 var(--font-pixel); margin-top: 8px; }
.pod small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--sun-soft); color: var(--sun-ink); font-weight: 600; font-size: 14px; margin-bottom: 16px; }
.pos-cell { display: grid; gap: 6px; min-width: 150px; }
.pos-cell small { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
@media (max-width: 1100px) { .hide-lg { display: none; } }
@media (max-width: 900px) {
  .stats4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .podium { grid-template-columns: 1fr; }
  .hide-md { display: none; }
  .table td, .table th { padding: 10px 8px; }
  .who img { width: 40px; height: 40px; }
}
