:root {
  --bg: #04050b;
  --bg-2: #080b17;
  --panel: rgba(11, 14, 28, 0.9);
  --panel-hi: rgba(20, 26, 48, 0.9);
  --line: rgba(130, 165, 255, 0.11);
  --line-hi: rgba(0, 240, 255, 0.32);
  --text: #e9f0ff;
  --muted: #8d98bb;
  --dim: #5b6588;
  --cyan: #00f0ff;
  --violet: #8b5cff;
  --magenta: #ff2bd6;
  --up: #2bff88;
  --down: #ff4d7d;
  --gold: #ffd166;
  --silver: #cfdcff;
  --bronze: #ff9f6b;
  --radius: 16px;
  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --display: 'Orbitron', 'Space Grotesk', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.75);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
a, button, input, select, textarea, label { touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
::selection { background: rgba(0, 240, 255, 0.3); }

/* ---------- Background ---------- */
.bg-glow {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(0, 240, 255, 0.13), transparent 60%),
    radial-gradient(800px 700px at 105% 15%, rgba(139, 92, 255, 0.14), transparent 60%),
    radial-gradient(900px 600px at 60% 120%, rgba(255, 43, 214, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.bg-grid {
  position: fixed; left: -50%; right: -50%; bottom: -10%; height: 55vh; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.09) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 85%);
  animation: grid-move 6s linear infinite;
}
@keyframes grid-move { to { background-position: 0 60px, 0 0; } }
@media (prefers-reduced-motion: reduce) { .bg-grid { animation: none; } .tape-track { animation: none !important; } }

/* ---------- Header (top bar + ticker tape stick together, clear of the notch) ---------- */
.head {
  position: sticky; top: 0; z-index: 40;
  background: rgba(4, 5, 11, 0.78);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: calc(12px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 12px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--display); font-weight: 900; letter-spacing: 0.12em; font-size: 18px;
  background: linear-gradient(90deg, var(--cyan), var(--violet) 55%, var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.35));
  white-space: nowrap; display: flex; align-items: center; gap: 10px;
}
.logo-mark { width: 26px; height: 26px; filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.6)); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; color: var(--muted);
  font-weight: 600; font-size: 14px; letter-spacing: 0.02em;
  transition: color 0.15s, background 0.15s;
}
.nav a svg { width: 18px; height: 18px; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav a.active { color: var(--cyan); background: rgba(0, 240, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.market-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; text-transform: uppercase;
}
.market-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.market-pill.open { color: var(--up); border-color: rgba(43, 255, 136, 0.3); background: rgba(43, 255, 136, 0.06); }
.market-pill.open .dot { background: var(--up); box-shadow: 0 0 10px var(--up); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.equity-chip {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15;
  padding: 4px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
.equity-chip b { font-family: var(--mono); font-size: 15px; }
.equity-chip small { font-family: var(--mono); font-size: 11px; }
.me-btn { border: 0; background: none; padding: 0; border-radius: 50%; }

/* ---------- Ticker tape ---------- */
.tape {
  overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.tape-track { display: inline-flex; animation: tape 70s linear infinite; }
.tape:hover .tape-track { animation-play-state: paused; }
@keyframes tape { to { transform: translateX(-50%); } }
.tape-item { display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 18px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); }
.tape-item b { color: var(--text); font-family: var(--font); font-weight: 700; letter-spacing: 0.04em; }

/* ---------- Layout ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 24px 24px 80px; }
.grid { display: grid; gap: 20px; }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- Panels ---------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  min-width: 0;
}
.panel::before {
  content: ''; position: absolute; top: -1px; left: 22px; width: 56px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  box-shadow: 0 0 12px var(--cyan);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 16px; }
.panel.flush .panel-head { padding: 18px 20px 0; }
.panel-title {
  font-family: var(--display); font-size: 11.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  margin: 0;
}
.panel-head a.more { margin-left: auto; font-size: 13px; color: var(--cyan); }

.label { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.big-num {
  font-family: var(--display); font-weight: 700; font-size: clamp(32px, 5vw, 48px); letter-spacing: 0.02em; line-height: 1.05;
  text-shadow: 0 0 24px rgba(0, 240, 255, 0.25);
  font-variant-numeric: tabular-nums;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.stat { background: rgba(8, 11, 22, 0.85); padding: 12px 14px; min-width: 0; }
.stat .v { font-family: var(--mono); font-size: 16px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Buttons and inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font-weight: 600; font-size: 14px;
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(0, 240, 255, 0.3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary {
  border: 0; color: #031018;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 24px -4px rgba(0, 240, 255, 0.55);
}
.btn-primary:hover { background: linear-gradient(90deg, #5ff6ff, #a283ff); box-shadow: 0 0 32px -2px rgba(0, 240, 255, 0.7); }
.btn-buy { border: 0; color: #02150b; background: linear-gradient(90deg, var(--up), #00e0c6); box-shadow: 0 0 24px -4px rgba(43, 255, 136, 0.55); }
.btn-buy:hover { background: linear-gradient(90deg, #6dffb0, #3ff0dc); }
.btn-sell { border: 0; color: #fff; background: linear-gradient(90deg, var(--down), var(--magenta)); box-shadow: 0 0 24px -4px rgba(255, 77, 125, 0.55); }
.btn-sell:hover { background: linear-gradient(90deg, #ff7598, #ff5ee0); }
.btn-lg { padding: 14px 18px; font-size: 15px; border-radius: 14px; letter-spacing: 0.04em; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--down); }

.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: rgba(3, 5, 12, 0.7); border: 1px solid var(--line); color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--line-hi); box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12); }
.input::placeholder { color: var(--dim); }
textarea.input { resize: vertical; min-height: 70px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: rgba(3, 5, 12, 0.7); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.seg button.on { background: rgba(0, 240, 255, 0.12); color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.25); }
.seg.buy-sell { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.seg.buy-sell button { padding: 10px; font-size: 14px; letter-spacing: 0.06em; }
.seg.buy-sell button.on.buy { background: rgba(43, 255, 136, 0.14); color: var(--up); box-shadow: inset 0 0 0 1px rgba(43, 255, 136, 0.35); }
.seg.buy-sell button.on.sell { background: rgba(255, 77, 125, 0.14); color: var(--down); box-shadow: inset 0 0 0 1px rgba(255, 77, 125, 0.35); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--cyan); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.crypto { color: #ffb84d; border-color: rgba(255, 184, 77, 0.3); }
.badge.option { color: var(--magenta); border-color: rgba(255, 43, 214, 0.3); }
.badge.etf { color: var(--violet); border-color: rgba(139, 92, 255, 0.35); }
.badge.stock { color: var(--cyan); border-color: rgba(0, 240, 255, 0.3); }
.badge.pending { color: var(--gold); border-color: rgba(255, 209, 102, 0.35); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.chip.up { background: rgba(43, 255, 136, 0.1); }
.chip.down { background: rgba(255, 77, 125, 0.1); }
.chip.flat { background: rgba(255, 255, 255, 0.05); }

/* ---------- Avatars ---------- */
.av {
  width: var(--s); height: var(--s); min-width: var(--s); border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 1.5px rgba(0, 240, 255, 0.35);
  background: #111;
}
.av-i {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: calc(var(--s) * 0.36); color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 90% 55%), hsl(calc(var(--h) + 60) 90% 45%));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.av.ring-1 { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(255, 209, 102, 0.55); }
.av.ring-2 { box-shadow: 0 0 0 2px var(--silver), 0 0 18px rgba(207, 220, 255, 0.4); }
.av.ring-3 { box-shadow: 0 0 0 2px var(--bronze), 0 0 18px rgba(255, 159, 107, 0.4); }
.player { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player .who { min-width: 0; }
.player .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.player .handle { color: var(--dim); font-size: 12px; }
.trophies { display: inline-flex; gap: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.t td { padding: 12px; border-bottom: 1px solid rgba(130, 165, 255, 0.06); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background 0.15s; }
table.t tbody tr.link { cursor: pointer; }
table.t tbody tr.link:hover { background: rgba(0, 240, 255, 0.04); }
table.t .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.me td { background: rgba(0, 240, 255, 0.05); }
table.t tr.me td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
.sym { font-weight: 700; letter-spacing: 0.03em; }
.sym-sub { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; display: block; }
.rank { font-family: var(--display); font-weight: 700; color: var(--muted); width: 36px; }
.rank.r1 { color: var(--gold); text-shadow: 0 0 12px rgba(255, 209, 102, 0.6); }
.rank.r2 { color: var(--silver); }
.rank.r3 { color: var(--bronze); }

.empty { padding: 28px 16px; text-align: center; color: var(--dim); }
.empty b { display: block; color: var(--muted); margin-bottom: 4px; font-size: 15px; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; height: 240px; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.chart-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 13px; border: 1px dashed var(--line); border-radius: 12px; }
.chart-tip {
  position: absolute; top: 0; pointer-events: none; transform: translateX(-50%);
  padding: 4px 8px; border-radius: 8px; background: rgba(4, 6, 14, 0.92); border: 1px solid var(--line-hi);
  font-family: var(--mono); font-size: 12px; white-space: nowrap; display: none;
}
.chart-tip small { color: var(--muted); margin-left: 6px; }
.range-tabs { display: flex; gap: 2px; }
.range-tabs button { border: 0; background: none; color: var(--dim); font-family: var(--mono); font-weight: 600; font-size: 12px; padding: 6px 9px; border-radius: 8px; }
.range-tabs button.on { color: var(--cyan); background: rgba(0, 240, 255, 0.1); }

/* ---------- Flashes and animation ---------- */
.flash-up { animation: flash-up 0.9s ease-out; }
.flash-down { animation: flash-down 0.9s ease-out; }
@keyframes flash-up { 0% { color: var(--up); text-shadow: 0 0 14px var(--up); } }
@keyframes flash-down { 0% { color: var(--down); text-shadow: 0 0 14px var(--down); } }
.fade-in { animation: fade-in 0.35s ease-out both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.08), rgba(255,255,255,0.03)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Home hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.hero-top { display: flex; align-items: flex-start; gap: 12px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.hero-chips > div { display: flex; align-items: center; gap: 7px; }
.hero-top .rank-badge {
  margin-left: auto; text-align: right;
  font-family: var(--display); font-size: 28px; font-weight: 900;
  background: linear-gradient(180deg, #fff, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-top .rank-badge small { display: block; font-family: var(--font); font-size: 11px; letter-spacing: 0.14em; color: var(--dim); -webkit-text-fill-color: var(--dim); text-transform: uppercase; font-weight: 600; }

/* ---------- Season card ---------- */
.countdown { display: flex; gap: 8px; }
.countdown .cd { flex: 1; text-align: center; padding: 10px 4px; border-radius: 12px; background: rgba(3, 5, 12, 0.7); border: 1px solid var(--line); }
.countdown .cd b { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--cyan); text-shadow: 0 0 14px rgba(0, 240, 255, 0.5); font-variant-numeric: tabular-nums; }
.countdown .cd span { font-size: 10px; letter-spacing: 0.16em; color: var(--dim); text-transform: uppercase; }
.countdown.big .cd b { font-size: clamp(26px, 4vw, 40px); }

/* ---------- Podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; margin: 8px 0 4px; }
.podium .spot { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.podium .block {
  width: 100%; border-radius: 14px 14px 6px 6px; padding: 14px 8px 12px;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.12), rgba(0, 240, 255, 0.02));
  border: 1px solid var(--line);
}
.podium .p1 .block { min-height: 130px; background: linear-gradient(180deg, rgba(255, 209, 102, 0.2), rgba(255, 209, 102, 0.02)); border-color: rgba(255, 209, 102, 0.35); }
.podium .p2 .block { min-height: 100px; }
.podium .p3 .block { min-height: 80px; background: linear-gradient(180deg, rgba(255, 159, 107, 0.15), rgba(255, 159, 107, 0.02)); }
.podium .place { font-family: var(--display); font-weight: 900; font-size: 26px; }
.podium .p1 .place { color: var(--gold); text-shadow: 0 0 18px rgba(255, 209, 102, 0.7); }
.podium .p2 .place { color: var(--silver); }
.podium .p3 .place { color: var(--bronze); }
.podium .pname { font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crown { font-size: 22px; margin-bottom: -6px; filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.8)); }

/* ---------- Feed ---------- */
.feed { display: flex; flex-direction: column; }
.trade { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid rgba(130, 165, 255, 0.07); }
.trade:last-child { border-bottom: 0; }
.trade .line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.trade .verb { font-weight: 800; font-size: 11px; letter-spacing: 0.14em; padding: 2px 7px; border-radius: 6px; }
.verb.buy { color: var(--up); background: rgba(43, 255, 136, 0.1); }
.verb.sell { color: var(--down); background: rgba(255, 77, 125, 0.1); }
.verb.expiry { color: var(--gold); background: rgba(255, 209, 102, 0.1); }
.trade .note { margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border-left: 2px solid var(--violet); font-size: 14px; }
.trade .meta { margin-top: 4px; font-size: 12.5px; color: var(--dim); }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.react {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); border-radius: 999px;
  padding: 2px 9px; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; transition: transform 0.1s;
}
.react b { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.react.mine { border-color: rgba(0, 240, 255, 0.45); background: rgba(0, 240, 255, 0.1); }
.react:active { transform: scale(0.9); }
.react-add { opacity: 0.55; }
.react-picker { display: none; gap: 4px; }
.reacts.open .react-picker { display: inline-flex; }
.reacts.open .react-add { display: none; }

/* ---------- Order ticket ---------- */
.ticket { position: sticky; top: 120px; scroll-margin-top: 110px; }
.ticket .line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: var(--muted); }
.ticket .line b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.ticket .qty-row { display: flex; gap: 8px; }
.ticket .qty-row .input { font-family: var(--mono); font-size: 18px; }
.notice { padding: 10px 12px; border-radius: 12px; font-size: 13px; background: rgba(255, 209, 102, 0.07); border: 1px solid rgba(255, 209, 102, 0.25); color: #ffe3a3; }
.notice.info { background: rgba(0, 240, 255, 0.06); border-color: rgba(0, 240, 255, 0.22); color: #bff9ff; }
.notice.err { background: rgba(255, 77, 125, 0.08); border-color: rgba(255, 77, 125, 0.3); color: #ffc2d2; }

/* ---------- Symbol page ---------- */
.sym-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sym-head h1 { margin: 0; font-family: var(--display); font-size: clamp(24px, 4vw, 34px); letter-spacing: 0.06em; }
.sym-head .px { font-family: var(--display); font-size: clamp(28px, 4.5vw, 40px); font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.kv div { min-width: 0; }
.kv span { display: block; font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; }
.kv b { font-family: var(--mono); font-weight: 500; font-size: 14px; white-space: nowrap; }

table.chain td, table.chain th { padding: 9px 10px; }
table.chain tr.itm td { background: rgba(0, 240, 255, 0.035); }
table.chain tr.sel td { background: rgba(139, 92, 255, 0.16) !important; }
table.chain tr.atm td { padding: 0; }
.atm-line { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 12px; color: var(--cyan); font-family: var(--mono); }
.atm-line::before, .atm-line::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); }

/* ---------- Search ---------- */
.search { position: relative; }
.search .input { padding-left: 46px; font-size: 17px; height: 56px; border-radius: 16px; }
.search svg.mag { position: absolute; left: 16px; top: 18px; width: 20px; height: 20px; color: var(--dim); }
.results {
  position: absolute; left: 0; right: 0; top: 62px; z-index: 20;
  background: rgba(8, 11, 22, 0.97); border: 1px solid var(--line-hi); border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.results a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.hl { background: rgba(0, 240, 255, 0.07); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card {
  display: block; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(8, 11, 22, 0.6); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--line-hi); transform: translateY(-2px); box-shadow: 0 10px 30px -10px rgba(0, 240, 255, 0.3); }
.card .p { font-family: var(--mono); font-size: 16px; margin-top: 8px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.profile-head h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); }
.profile-head .bio { color: var(--muted); margin-top: 6px; max-width: 560px; white-space: pre-wrap; overflow-wrap: anywhere; }
.shelf { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.shelf .t { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; background: rgba(255, 255, 255, 0.03); }
.shelf .t b { font-family: var(--mono); }
.award-list { display: flex; flex-direction: column; gap: 8px; }
.award { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); }
.award .ic { font-size: 20px; }

.winners-col h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-family: var(--display); }
.win { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(130, 165, 255, 0.07); }
.win:last-child { border-bottom: 0; }
.win .when { width: 74px; font-size: 12px; color: var(--dim); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(32px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); }
.auth-box { width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo .logo { justify-content: center; font-size: clamp(30px, 8vw, 42px); }
.auth-logo .logo-mark { width: 44px; height: 44px; }
.auth-logo p { color: var(--muted); margin: 12px auto 0; max-width: 360px; }
.auth-feats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.avatar-pick { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.avatar-pick label {
  width: 76px; height: 76px; border-radius: 50%; border: 1.5px dashed var(--line-hi); display: grid; place-items: center; cursor: pointer;
  overflow: hidden; background: rgba(0, 240, 255, 0.04); flex: none; transition: box-shadow 0.2s;
}
.avatar-pick label:hover { box-shadow: 0 0 20px rgba(0, 240, 255, 0.35); }
.avatar-pick label img { width: 100%; height: 100%; object-fit: cover; }
.avatar-pick label svg { width: 28px; height: 28px; color: var(--cyan); }
.avatar-pick input { display: none; }

/* ---------- Toasts, modal, menu ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 380px;
  padding: 12px 16px; border-radius: 14px; background: rgba(10, 14, 28, 0.95); border: 1px solid var(--line-hi);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 24px -8px rgba(0, 240, 255, 0.5);
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; font-size: 14px;
}
.toast.err { border-color: rgba(255, 77, 125, 0.5); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 24px -8px rgba(255, 77, 125, 0.6); }
.toast.gold { border-color: rgba(255, 209, 102, 0.6); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px -6px rgba(255, 209, 102, 0.7); }
.toast.out { animation: toast-out 0.3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(2, 3, 8, 0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade-in 0.2s both; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; }

.menu { position: fixed; right: max(24px, env(safe-area-inset-right)); top: calc(64px + env(safe-area-inset-top)); z-index: 60; min-width: 220px; padding: 8px; }
.menu a, .menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 0; background: none; text-align: left; font-size: 14px; color: var(--text); }
.menu a:hover, .menu button:hover { background: rgba(0, 240, 255, 0.07); }

.burst { position: fixed; pointer-events: none; z-index: 120; }
.burst i { position: absolute; width: 7px; height: 7px; border-radius: 2px; animation: burst 0.9s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

.celebrate { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; background: rgba(2, 3, 8, 0.6); backdrop-filter: blur(4px); animation: fade-in 0.3s both; cursor: pointer; }
.celebrate .panel { text-align: center; padding: 32px 36px; max-width: 380px; animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
.celebrate h2 { font-family: var(--display); letter-spacing: 0.14em; margin: 14px 0 6px; color: var(--gold); text-shadow: 0 0 24px rgba(255, 209, 102, 0.6); font-size: 22px; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

/* ---------- Bottom nav (phones) ---------- */
.bottom-nav { display: none; }
.trade-bar { display: none; }
.show-sm { display: none !important; }
.btabs-wrap { padding: 12px 20px 0; }

@media (max-width: 1180px) {
  .market-pill .txt-long { display: none; }
}
@media (max-width: 960px) {
  .nav a span { display: none; }
  .nav a { padding: 8px 10px; }
}
@media (max-width: 1080px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: static; }
  /* One column on phones, in the order that matters there (the .o-N classes). */
  .reorder { display: flex; flex-direction: column; align-items: stretch; }
  .reorder > .stack { display: contents; }
  .reorder > .stack > * { order: 50; }
  .reorder > .stack > .o-1 { order: 1; }
  .reorder > .stack > .o-2 { order: 2; }
  .reorder > .stack > .o-3 { order: 3; }
  .reorder > .stack > .o-4 { order: 4; }
  .reorder > .stack > .o-5 { order: 5; }
  .reorder > .stack > .o-6 { order: 6; }
  .reorder > .stack > .o-7 { order: 7; }
  .reorder > .stack > .o-8 { order: 8; }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); gap: 10px; }
  .topbar-right { gap: 8px; }
  .nav, .market-pill .txt-long { display: none; }
  .logo { font-size: 15px; }
  .logo .logo-text { display: none; }
  .market-pill { padding: 6px 10px; }
  .menu { right: 12px; top: calc(60px + env(safe-area-inset-top)); }
  /* 16px text in fields so iPhones don't zoom in when you tap them */
  .input, select.input, textarea.input { font-size: 16px; }
  .show-sm { display: block !important; }
  /* Thumb-sized controls */
  .seg button { padding: 10px 14px; min-height: 40px; }
  .seg-full { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .seg-full button { padding: 10px 4px; }
  .btabs-wrap { padding: 12px 16px 0; }
  .range-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .range-tabs button { padding: 11px 0; font-size: 13px; }
  .react { padding: 7px 12px; font-size: 15px; }
  .btn-sm { padding: 10px 12px; font-size: 13px; }
  .tabs button { padding: 12px 14px; }
  /* Symbol page: price and change on one line under the name */
  .sym-head { gap: 6px; }
  .sym-head > .spacer { display: none; }
  .sym-head > .right { width: 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .sym-head > .right > .tiny { flex-basis: 100%; margin-top: 0 !important; }
  .wrap { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .panel { padding: 16px; border-radius: 14px; }
  .panel.flush .panel-head { padding: 16px 16px 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none !important; }
  table.t td, table.t th { padding: 10px 8px; }
  table.t { font-size: 13.5px; }
  .podium { gap: 8px; }
  #toasts { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(4, 5, 11, 0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 10.5px; font-weight: 600; color: var(--dim); letter-spacing: 0.04em; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--cyan); }
  .bottom-nav a.active svg { filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.8)); }
  /* Sticky Buy / Sell on symbol pages, above the tab bar */
  .trade-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 45;
    padding: 18px 16px 10px;
    background: linear-gradient(180deg, transparent, rgba(4, 5, 11, 0.94) 38%);
    transition: transform 0.2s, opacity 0.2s;
  }
  .trade-bar.hidden { transform: translateY(16px); opacity: 0; pointer-events: none; }
  body.has-tradebar .wrap { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  body.has-tradebar #toasts { bottom: calc(140px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .market-pill .lbl { display: none; }
  .market-pill { padding: 8px; }
}

/* ---------- Race chart (every player's line) ---------- */
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; margin-bottom: 6px; }
.seg-sm button { padding: 5px 12px; font-size: 12.5px; }
.race-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.race-legend:empty { display: none; }
.race-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); font-size: 13px;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.race-chip i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.race-chip b { font-family: var(--mono); font-weight: 600; font-size: 12px; }
.race-chip.on { border-color: rgba(233, 240, 255, 0.45); background: rgba(255, 255, 255, 0.08); }
.race-chip.dim { opacity: 0.45; }
.race-tip {
  position: absolute; top: 6px; z-index: 2; display: none; pointer-events: none; min-width: 170px; max-width: 240px;
  padding: 8px 10px; border-radius: 10px; background: rgba(4, 6, 14, 0.95); border: 1px solid var(--line-hi);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.race-tip .rt-when { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.race-tip .rt { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 12.5px; }
.race-tip .rt em { width: 14px; font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.race-tip .rt i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.race-tip .rt span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-tip .rt b { font-family: var(--mono); font-weight: 600; }
@media (max-width: 760px) {
  .seg-sm button { min-height: 36px; padding: 6px 12px; font-size: 13px; }
  .race-chip { padding: 8px 12px; }
}
