/* =====================================================================
   TradeQuest — design system v2  ("Holo HUD")
   Deep space, glass panels, one luminous accent. Colour means something:
   cyan = interface / you, green & red = price only, gold = reward & PRO,
   violet = rarity. Everything else is graphite.
   ===================================================================== */
:root {
  --bg: #04060c;
  --bg-2: #070a14;
  --surface: rgba(12, 17, 31, 0.9);
  --surface-solid: #0c1120;
  --surface-2: rgba(20, 27, 47, 0.92);
  --surface-3: rgba(32, 42, 70, 0.94);
  --line: rgba(150, 180, 255, 0.09);
  --line-strong: rgba(150, 180, 255, 0.18);
  --hi: rgba(255, 255, 255, 0.05);
  --text: #eaf0ff;
  --text-2: #a3aed0;
  --text-3: #66729a;
  --accent: #5ce1ff;
  --accent-2: #8b7cff;
  --accent-soft: rgba(92, 225, 255, 0.12);
  --accent-glow: rgba(92, 225, 255, 0.45);
  --bull: #2be3a0;
  --bull-soft: rgba(43, 227, 160, 0.12);
  --bear: #ff5470;
  --bear-soft: rgba(255, 84, 112, 0.12);
  --gold: #ffc857;
  --gold-soft: rgba(255, 200, 87, 0.12);
  --info: #5ce1ff;
  --r-common: #a3aed0; --r-rare: #5ce1ff; --r-epic: #a78bff; --r-legendary: #ffc857;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.85);
  --font-head: 'Chakra Petch', 'IBM Plex Sans Thai', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Thai', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --sidebar-w: 236px;
  --glow-bull: 0 0 0 1px rgba(43, 227, 160, .35), 0 18px 50px -20px rgba(43, 227, 160, .55);
  --glow-accent: 0 0 0 1px rgba(92, 225, 255, .35), 0 18px 50px -20px rgba(92, 225, 255, .5);
  --ic-accent: var(--accent);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-body);
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: rgba(92, 225, 255, .3); }

/* ---------- world layers ---------- */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#bg-grid { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(92, 225, 255, .08), transparent 60%),
    radial-gradient(900px 600px at 0% 100%, rgba(139, 124, 255, .08), transparent 60%),
    linear-gradient(180deg, rgba(4, 6, 12, 0) 0%, rgba(4, 6, 12, .5) 55%, rgba(4, 6, 12, .88) 100%);
}
#bg-grid::after {
  content: ''; position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0 0 .4em; line-height: 1.2; letter-spacing: .2px; }
h1 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 700; }
h2 { font-size: clamp(21px, 2.2vw, 26px); }
h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.up, .bull { color: var(--bull); }
.down, .bear { color: var(--bear); }
.gold { color: var(--gold); }
.accent { color: var(--accent); }
.center { text-align: center; }
.hidden { display: none !important; }
.hud { font-family: var(--font-head); font-size: 11.5px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-3); }
.hud.accent { color: var(--accent); }

/* ---------- icons ---------- */
.ic { display: inline-block; vertical-align: middle; flex: none; }
.ic .ic-a { stroke: var(--ic-accent); }
.ic circle.ic-a[fill] { fill: var(--ic-accent); }
.glow .ic-a, .ic.glow .ic-a { filter: drop-shadow(0 0 4px var(--ic-accent)); }

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(8, 11, 22, .96), rgba(5, 7, 14, .97));
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 8px 8px 22px; cursor: pointer; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--text);
  background: linear-gradient(145deg, rgba(92, 225, 255, .18), rgba(139, 124, 255, .14)); border: 1px solid rgba(92, 225, 255, .3);
  box-shadow: 0 0 24px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .12); }
.brand b { font-family: var(--font-head); font-size: 17px; font-weight: 700; display: block; line-height: 1.1; letter-spacing: 1.6px; text-transform: uppercase; }
.brand b span { color: var(--accent); }
.brand small { color: var(--text-3); font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; font-family: var(--font-head); }
.nav-label { font-family: var(--font-head); font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px;
  color: var(--text-2); font-weight: 500; font-size: 14.5px; transition: color .2s, background .2s; position: relative;
  --ic-accent: var(--text-3);
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .03); --ic-accent: var(--accent); }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, rgba(92, 225, 255, .10), rgba(92, 225, 255, 0) 80%); --ic-accent: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav-item.active .ic .ic-a { filter: drop-shadow(0 0 4px var(--accent)); }
.nav-item .tag { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1px; padding: 1px 6px; border-radius: 5px; color: var(--accent); border: 1px solid rgba(92, 225, 255, .3); }
.sidebar-foot { margin-top: auto; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 12px 28px; background: rgba(5, 7, 14, .94);
  border-bottom: 1px solid var(--line);
}
.topbar .page-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; letter-spacing: .4px; display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.topbar .page-title .ic { --ic-accent: var(--accent); }
.topbar .spacer { flex: 1; }
.view { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; animation: viewIn .5s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.level-pill { display: flex; align-items: center; gap: 12px; padding: 5px 14px 5px 5px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s; }
.level-pill:hover { border-color: var(--line-strong); }
.level-pill .lv { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 13px; position: relative;
  background: conic-gradient(var(--rk, var(--accent)) var(--p, 0%), rgba(255, 255, 255, .07) 0); box-shadow: 0 0 16px -4px var(--rk, var(--accent)); transition: --p .8s; }
.level-pill .lv::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface-solid); }
.level-pill .lv span { position: relative; z-index: 1; }
.level-pill .meta { line-height: 1.25; min-width: 120px; }
.level-pill .meta b { font-family: var(--font-head); font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; display: block; }
.level-pill .meta small { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.stat-pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--text); }
.stat-pill .ic { --ic-accent: var(--gold); }
button.stat-pill { cursor: pointer; }
button.stat-pill:hover { border-color: var(--line-strong); }

.bottomnav { display: none; }

/* ---------- grid ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.stack > * + * { margin-top: 14px; }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }

/* ---------- glass panel ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow), inset 0 1px 0 var(--hi); position: relative;
}
.card.pad-lg { padding: 28px; }
.card.tight { padding: 14px; }
.card.hover { transition: transform .35s var(--ease), border-color .25s, box-shadow .35s var(--ease); cursor: pointer; }
.card.hover:hover { transform: translateY(-3px); border-color: rgba(92, 225, 255, .28); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9), 0 20px 50px -25px rgba(92, 225, 255, .35), inset 0 1px 0 var(--hi); }
.card.glow-bull { border-color: rgba(43, 227, 160, .3); box-shadow: var(--glow-bull); }
.card-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; letter-spacing: .3px; margin-bottom: 12px; display: flex; align-items: center; gap: 9px; }
.card-title .ic { --ic-accent: var(--accent); color: var(--text-2); }
.frame::before, .frame::after { content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none; border-color: rgba(92, 225, 255, .6); border-style: solid; }
.frame::before { top: 10px; left: 10px; border-width: 1.5px 0 0 1.5px; }
.frame::after { bottom: 10px; right: 10px; border-width: 0 1.5px 1.5px 0; }

.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 40px;
  background: linear-gradient(135deg, rgba(92, 225, 255, .07), rgba(139, 124, 255, .06) 60%, rgba(4, 6, 12, .3));
  border: 1px solid var(--line-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow);
}
.hero::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(92, 225, 255, .05), transparent); transform: translateX(-100%); animation: sweep 7s var(--ease) infinite 1.5s; }
@keyframes sweep { 0% { transform: translateX(-100%); } 30%, 100% { transform: translateX(100%); } }
.hero h1 { max-width: 680px; }
.hero .glowtext { color: var(--accent); text-shadow: 0 0 30px rgba(92, 225, 255, .35); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; position: relative; overflow: hidden;
  min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .03); color: var(--text); font-weight: 600; cursor: pointer;
  font-family: var(--font-head); font-size: 14.5px; letter-spacing: .4px;
  transition: transform .18s var(--ease), border-color .2s, background .2s, box-shadow .25s; user-select: none; white-space: nowrap;
  --ic-accent: currentColor;
}
.btn:hover { border-color: rgba(92, 225, 255, .4); background: rgba(92, 225, 255, .06); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: translateX(-150%) skewX(-20deg); opacity: 0;
}
.btn.primary::after, .btn.gold::after { opacity: 1; animation: btnSweep 5s var(--ease) infinite 2s; }
@keyframes btnSweep { 0% { transform: translateX(-150%) skewX(-20deg); } 22%, 100% { transform: translateX(330%) skewX(-20deg); } }
.btn.primary { background: linear-gradient(180deg, #7fe9ff, #3fc7f0); color: #031018; border-color: transparent; box-shadow: 0 0 0 1px rgba(92, 225, 255, .5), 0 10px 30px -10px rgba(92, 225, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary:hover { background: linear-gradient(180deg, #9cefff, #52d1f5); }
.btn.buy { background: linear-gradient(180deg, #4ff0b6, #1fc98b); color: #021710; border-color: transparent; box-shadow: 0 10px 30px -10px rgba(43, 227, 160, .7), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn.sell { background: linear-gradient(180deg, #ff7088, #e83d5b); color: #fff; border-color: transparent; box-shadow: 0 10px 30px -10px rgba(255, 84, 112, .7), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.gold { background: linear-gradient(180deg, #ffdb8a, #f5b23f); color: #241600; border-color: transparent; box-shadow: 0 10px 30px -10px rgba(255, 200, 87, .7), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 52px; padding: 0 28px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: 7px; font-size: 11.5px; font-weight: 600; letter-spacing: .3px; background: rgba(255, 255, 255, .04); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; --ic-accent: currentColor; }
.chip.bull { background: var(--bull-soft); color: var(--bull); border-color: rgba(43, 227, 160, .2); }
.chip.bear { background: var(--bear-soft); color: var(--bear); border-color: rgba(255, 84, 112, .2); }
.chip.gold { background: var(--gold-soft); color: var(--gold); border-color: rgba(255, 200, 87, .22); }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(92, 225, 255, .22); }

/* ---------- readouts ---------- */
.stat { padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); }
.stat .k { font-family: var(--font-head); font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 600; line-height: 1.35; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--text-3); }
.big-num { font-family: var(--font-mono); font-weight: 700; font-size: 46px; line-height: 1; letter-spacing: -1px; }

.progress { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .06); overflow: hidden; position: relative; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #3fc7f0, var(--accent)); box-shadow: 0 0 12px var(--accent-glow); transition: width .9s var(--spring); position: relative; overflow: hidden; }
.progress > i::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 60px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); transform: translateX(-60px); animation: energy 3s linear infinite; will-change: transform; }
@keyframes energy { to { transform: translateX(600px); } }
.progress.gold > i { background: linear-gradient(90deg, #f5b23f, var(--gold)); box-shadow: 0 0 12px rgba(255, 200, 87, .5); }

/* ---------- quiz / options ---------- */
.options { display: grid; gap: 10px; }
.option {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .025); cursor: pointer; transition: border-color .2s, background .2s, transform .2s var(--ease);
  display: flex; gap: 14px; align-items: center; font-size: 15px; position: relative;
}
.option:hover:not(:disabled) { border-color: rgba(92, 225, 255, .45); background: rgba(92, 225, 255, .05); transform: translateX(2px); }
.option .key { flex: 0 0 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-strong); font-weight: 700; font-size: 12px; font-family: var(--font-mono); color: var(--text-2); }
.option.correct { border-color: var(--bull); background: var(--bull-soft); box-shadow: 0 0 0 1px rgba(43, 227, 160, .25), 0 0 30px -10px rgba(43, 227, 160, .5); }
.option.correct .key { background: var(--bull); color: #021710; border-color: transparent; }
.option.wrong { border-color: var(--bear); background: var(--bear-soft); animation: shake .35s; }
.option.wrong .key { background: var(--bear); color: #fff; border-color: transparent; }
.option:disabled { cursor: default; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.explain { padding: 14px 16px; border-radius: 14px; background: rgba(92, 225, 255, .05); border: 1px solid rgba(92, 225, 255, .14); font-size: 14.5px; }
.explain.good { background: var(--bull-soft); border-color: rgba(43, 227, 160, .25); }
.explain.bad { background: var(--bear-soft); border-color: rgba(255, 84, 112, .25); }
.tip { padding: 12px 14px; border-radius: 12px; background: rgba(255, 200, 87, .05); border: 1px solid rgba(255, 200, 87, .14); font-size: 14px; color: var(--text-2); }

/* ---------- segmented ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); gap: 3px; flex-wrap: wrap; }
.seg button { min-height: 32px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-weight: 600; font-size: 13px; font-family: var(--font-head); letter-spacing: .3px; transition: color .2s, background .2s; display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(92, 225, 255, .12); color: var(--text); box-shadow: inset 0 0 0 1px rgba(92, 225, 255, .35); }

/* ---------- form ---------- */
.input, select.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .3); color: var(--text); font: inherit; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92, 225, 255, .15); }
label.lbl { font-family: var(--font-head); font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-3); display: block; margin-bottom: 8px; font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------- chart ---------- */
.chart-box { position: relative; width: 100%; height: 420px; border-radius: 16px; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, rgba(92, 225, 255, .04), transparent 60%), rgba(3, 5, 10, .72); border: 1px solid var(--line); }
.chart-box.sm { height: 260px; }
.chart-box.lg { height: 520px; }
.chart-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.chart-legend { position: absolute; left: 12px; top: 10px; z-index: 2; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); pointer-events: none; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(2, 3, 8, .86); animation: fadeIn .25s; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; position: relative; background: linear-gradient(180deg, rgba(16, 22, 40, .96), rgba(9, 12, 24, .96)); border: 1px solid var(--line-strong); border-radius: 22px; padding: 30px; box-shadow: 0 50px 120px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .07); animation: popIn .45s var(--spring); }
.modal.wide { width: min(880px, 100%); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(12px); } }

/* ---------- system notifications ---------- */
.toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 420px; padding: 9px 18px 9px 9px; border-radius: 99px; background: rgba(10, 14, 26, .97); border: 1px solid var(--line-strong); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9); display: flex; gap: 12px; align-items: center; animation: toastIn .55s var(--spring); font-size: 13.5px; }
.toast .ic-wrap { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(92, 225, 255, .1); color: var(--accent); --ic-accent: var(--accent); }
.toast b { display: block; font-family: var(--font-head); font-weight: 600; letter-spacing: .2px; font-size: 14px; }
.toast .t-body { color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.toast.xp .ic-wrap { background: var(--gold-soft); color: var(--gold); --ic-accent: var(--gold); }
.toast.bad .ic-wrap { background: var(--bear-soft); color: var(--bear); --ic-accent: var(--bear); }
.toast.out { animation: toastOut .35s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(.96); } }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 150; }

/* ---------- mode cards ---------- */
.mode-card { overflow: hidden; min-height: 200px; display: flex; flex-direction: column; }
.mode-card .emoji { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; margin-bottom: 16px; color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid var(--line-strong); --ic-accent: var(--c, var(--accent)); box-shadow: 0 0 30px -12px var(--c, var(--accent)); }
.mode-card p { color: var(--text-2); font-size: 14px; flex: 1; }
.mode-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.mode-card::after { content: ''; position: absolute; width: 220px; height: 220px; right: -90px; top: -90px; border-radius: 50%; background: var(--c, var(--accent)); opacity: .08; filter: blur(40px); transition: opacity .4s; pointer-events: none; }
.mode-card:hover::after { opacity: .18; }

/* ---------- achievements ---------- */
.badge-tile { text-align: center; padding: 18px 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, .02); border: 1px solid var(--line); position: relative; }
.badge-tile .e { display: grid; place-items: center; height: 72px; filter: grayscale(1) brightness(.6); opacity: .45; }
.badge-tile.got .e { filter: none; opacity: 1; }
.badge-tile.got { border-color: color-mix(in srgb, var(--rc, var(--gold)) 35%, transparent); background: radial-gradient(100% 70% at 50% 0%, color-mix(in srgb, var(--rc, var(--gold)) 12%, transparent), rgba(255, 255, 255, .02)); }
.badge-tile b { display: block; font-size: 13px; margin-top: 8px; font-family: var(--font-head); font-weight: 600; }
.badge-tile small { color: var(--text-3); font-size: 11.5px; line-height: 1.35; display: block; }

.kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: rgba(255, 255, 255, .03); font-family: var(--font-mono); font-size: 11px; color: var(--text-2); text-align: center; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.pop { animation: popIn .45s var(--spring); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-family: var(--font-head); font-size: 10.5px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- reward ceremonies (core/reward.js) ---------- */
.rw-wrap { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; background: radial-gradient(60% 60% at 50% 45%, rgba(12, 16, 34, .92), rgba(2, 3, 8, .97)); animation: fadeIn .3s; cursor: pointer; overflow: hidden; }
.rw-wrap.out { animation: fadeOut .35s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.rw-stage { position: relative; text-align: center; width: min(460px, 92vw); }
.rw-rays { position: absolute; left: 50%; top: 120px; width: 620px; height: 620px; margin: -310px 0 0 -310px; pointer-events: none; opacity: .5;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 30%, transparent) 0deg 5deg, transparent 5deg 20deg);
  mask-image: radial-gradient(circle, black 12%, transparent 62%); -webkit-mask-image: radial-gradient(circle, black 12%, transparent 62%); animation: spin 24s linear infinite; will-change: transform; }
@keyframes spin { to { transform: rotate(360deg); } }
.rw-emblem { position: relative; width: 240px; height: 240px; margin: 0 auto; animation: rwIn 1s var(--spring) both; will-change: transform, opacity; }
/* glow as a gradient layer, not a blur filter: same look, no expensive first paint */
.rw-emblem::before { content: ''; position: absolute; inset: -30px; border-radius: 50%; z-index: -1; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 38%, transparent), transparent 62%); }
@keyframes rwIn { from { opacity: 0; transform: scale(.35) rotate(-14deg); } }
.rw-kicker { font-family: var(--font-head); letter-spacing: 5px; text-transform: uppercase; font-size: 12px; font-weight: 600; color: var(--rc); margin-top: 8px; animation: rise .6s .35s var(--ease) both; }
.rw-title { font-family: var(--font-head); font-size: 34px; font-weight: 700; margin: 6px 0 4px; animation: rise .6s .45s var(--ease) both; text-shadow: 0 0 40px color-mix(in srgb, var(--rc) 45%, transparent); }
.rw-sub { color: var(--text-2); animation: rise .6s .55s var(--ease) both; max-width: 380px; margin: 0 auto; }
.rw-loot { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; animation: rise .6s .7s var(--ease) both; }
.rw-hint { margin-top: 26px; font-family: var(--font-head); font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--text-3); animation: rise .6s 1.1s var(--ease) both; }
.rw-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; animation: rise .6s .9s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.cache-box { width: 190px; height: 190px; margin: 10px auto 0; position: relative; cursor: pointer; animation: cacheIdle 2.4s ease-in-out infinite; }
.cache-box.shake { animation: cacheShake .14s linear infinite; }
@keyframes cacheIdle { 50% { transform: translateY(-8px); } }
@keyframes cacheShake { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-2px, 1px) rotate(-2deg); } 75% { transform: translate(2px, -1px) rotate(2deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: 10px 14px; }
  .view { padding: 18px 16px 24px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 26px 22px; border-radius: 22px; }
  .chart-box { height: 340px; }
  .chart-box.lg { height: 400px; }
  .topbar .page-title { display: none; }
  .bottomnav {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50; height: 64px;
    padding: 6px; border-radius: 22px; background: rgba(8, 11, 22, .97); border: 1px solid var(--line-strong); justify-content: space-around; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; color: var(--text-3); border-radius: 16px; flex: 1; font-family: var(--font-head); letter-spacing: .3px; --ic-accent: var(--text-3); transition: color .2s, background .2s; }
  .bottomnav a.active { color: var(--text); background: rgba(92, 225, 255, .1); --ic-accent: var(--accent); }
  .bottomnav a.active .ic-a { filter: drop-shadow(0 0 4px var(--accent)); }
  .level-pill .meta { min-width: 0; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-pill.hide-sm { display: none; }
  .level-pill .meta { display: none; }
  .level-pill { padding: 3px; }
  .toast { max-width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- LearnTrader integration ---------- */
.lt-back { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); padding: 7px 10px; margin: -4px 0 4px; border-radius: 10px; font-family: var(--font-head); letter-spacing: .3px; --ic-accent: var(--text-3); }
.lt-back:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.lt-back-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 4px; }
.lt-back-row .lt-back { margin: 0; flex: 1; }
.lt-lang { font-size: 12px; color: var(--text-3); padding: 6px 9px; border-radius: 9px; border: 1px solid var(--line, rgba(255, 255, 255, .08)); font-family: var(--font-head); letter-spacing: .3px; }
.lt-lang:hover { color: var(--text); border-color: rgba(92, 225, 255, .35); }
.lt-back-top { display: none; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; font-family: var(--font-head); }
.lt-tier-pro { border-color: rgba(255, 200, 87, .28); background: radial-gradient(120% 80% at 0% 0%, rgba(255, 200, 87, .1), rgba(255, 255, 255, .02)); }
.lt-tier-up .btn.block + .btn.block { margin-top: 6px; }
.lt-lockcard { text-align: center; max-width: 560px; margin: 0 auto; border-color: rgba(255, 200, 87, .22); background: radial-gradient(100% 70% at 50% 0%, rgba(255, 200, 87, .08), var(--surface) 60%); }
.lt-lockcard h3 { font-size: 20px; margin-top: 4px; }
.lt-lock-ic { width: 68px; height: 68px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 20px; color: var(--gold); --ic-accent: var(--gold); background: rgba(255, 200, 87, .08); border: 1px solid rgba(255, 200, 87, .25); box-shadow: 0 0 40px -10px rgba(255, 200, 87, .5); }
.lt-lockcard.tight .lt-lock-ic { width: 50px; height: 50px; border-radius: 15px; }
.lt-perks { text-align: left; display: inline-block; margin: 4px 0 12px; padding-left: 20px; color: var(--text-2); font-size: 14px; line-height: 1.9; }
.lt-lock { font-size: 10.5px; min-height: 22px; padding: 0 8px; --ic-accent: var(--gold); }
.modal .lt-lockcard { border: 0; box-shadow: none; background: transparent; padding: 0; }
.lt-foot { margin-top: auto; padding: 18px 28px 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; font-size: 12px; color: var(--text-3); position: relative; z-index: 1; }
.lt-foot-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.lt-foot-links a { color: var(--text-3); }
.lt-foot-links a:hover { color: var(--text); }
@media (max-width: 860px) {
  .lt-back-top { display: inline-flex; }
  .lt-foot { padding: 16px 16px 100px; }
}
@media (max-width: 520px) { .lt-up span { display: none; } }

/* HUD feedback */
.level-pill.bump .lv { animation: lvBump .7s var(--spring); }
@keyframes lvBump { 30% { transform: scale(1.18); box-shadow: 0 0 26px 2px var(--rk, var(--accent)); } }
.tq-cachebtn { color: var(--gold); border-color: rgba(255, 200, 87, .35); animation: cacheGlow 1.8s ease-in-out infinite; }
.tq-cachebtn .ic { --ic-accent: var(--gold); }
@keyframes cacheGlow { 50% { box-shadow: 0 0 22px -4px rgba(255, 200, 87, .7); } }
button.cache-box { display: block; padding: 0; border: 0; background: none; color: inherit; border-radius: 24px; }
button.cache-box:focus-visible { outline: 2px solid var(--rc, var(--accent)); outline-offset: 6px; }
