:root {
  --bg: #f3f5f8;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #f6f8fb;
  --surface3: #eaeef4;
  --border: #e2e7ee;
  --border2: #cfd7e2;
  --text: #0f1a2a;
  --text2: #3d4a5c;
  --muted: #6b778a;
  --accent: #1d7cf2;
  --accent-ink: #ffffff;
  --accent2: #1d7cf2;
  --wax: #f7931e;
  --wax2: #e86a12;
  --gold: #c98a00;
  --up: #0d9f5a;
  --down: #e0323f;
  --warn: #e08a00;
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 10px 30px rgba(15, 26, 42, .12);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --common: #7b8799; --uncommon: #0d9f5a; --rare: #1d7cf2; --epic: #8b4dea; --legendary: #d99a00;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, sans-serif; -webkit-font-smoothing: antialiased; }
body { background: var(--bg); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); } .gold { color: var(--gold); }
.small { font-size: 13px; } .xs { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; } .right { text-align: right; } .center { text-align: center; }
.hide { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--border); background: #ffffff; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font: 800 13px var(--mono); color: var(--accent-ink); background: linear-gradient(135deg, #1d7cf2, #0a5bc4); box-shadow: 0 4px 12px rgba(29, 124, 242, .3); }
.logo-mark.big { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .7; } }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text2); font-weight: 600; }
.nav a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.nav a.active { background: #eaf3fe; color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 22px; text-align: center; font-size: 17px; }
.side .foot { margin-top: auto; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); }
.page { padding: 24px 28px 90px; max-width: 1280px; margin: 0 auto; }
.bottomnav { display: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.live .dot { background: var(--up); box-shadow: 0 0 0 3px rgba(13, 159, 90, .18); }
.pill.closed .dot { background: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: var(--surface3); color: var(--text2); text-transform: uppercase; }
.tag.ai { background: #f0e9fe; color: #6d35d6; }
.tag.you { background: #e3effe; color: #1666cc; }
.tag.order { background: #fff2dc; color: #a86400; }
.tag.long { background: #e2f6ec; color: var(--up); }
.tag.short { background: #fde6e8; color: var(--down); }

.userchip { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.userchip:hover { text-decoration: none; border-color: var(--border2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: var(--surface3); flex: none; }
.avatar.lg { width: 76px; height: 76px; font-size: 42px; border-radius: 22px; }
.avatar.md { width: 40px; height: 40px; font-size: 22px; }

select.season-select { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-weight: 600; max-width: 320px; }

/* ---------- cards */
.grid { display: grid; gap: 18px; }
.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)); }
.hero-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(15, 26, 42, .04); border-radius: var(--r); padding: 20px; min-width: 0; }
.card.tight { padding: 14px 16px; }
.card h3 { font-size: 15px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-title h2 { font-size: 20px; }
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.subtitle { color: var(--muted); margin-bottom: 22px; }

.big-value { font: 700 44px/1.05 var(--mono); letter-spacing: -.03em; }
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .v { font: 600 18px var(--mono); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stats-row .stat { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }

/* ---------- buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border2); background: var(--surface2); font-weight: 700; font-size: 14px; color: var(--text); transition: transform .06s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--surface3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 4px 14px rgba(29, 124, 242, .25); }
.btn.primary:hover { background: #1569d4; }
.btn.danger { background: #fdecee; color: var(--down); border-color: #f6c3c8; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn.ghost:hover { background: var(--surface2); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--text2); }
.input, select.input { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border2); background: var(--bg2); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 124, 242, .15); }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface3); color: var(--text); }
.seg.sides button.on[data-v=buy], .seg.sides button.on[data-v=cover] { background: #dcf4e8; color: var(--up); }
.seg.sides button.on[data-v=sell], .seg.sides button.on[data-v=short] { background: #fde3e5; color: var(--down); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text2); }
.chip.on { border-color: var(--accent); color: var(--accent); background: #eaf3fe; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid #edf0f4; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f6f9fd; }
tr.me td { background: #eaf3fe; }
th.r, td.r { text-align: right; }
.tk { font: 700 14px var(--mono); }
.rank { font: 700 14px var(--mono); color: var(--muted); width: 34px; }
.rank.r1 { color: var(--gold); } .rank.r2 { color: #7b8799; } .rank.r3 { color: #b8672b; }

/* ---------- charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: #ffffff; border: 1px solid var(--border2); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow); transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; z-index: 3; }
.chart .tip b { font-family: var(--mono); display: block; font-size: 13px; }
.alloc { display: flex; flex-direction: column; gap: 10px; }
.alloc-row { display: grid; grid-template-columns: 64px 1fr 58px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent2); }
.bar.short > i { background: var(--down); }
.bar.cash > i { background: var(--muted); }
.xpbar { height: 8px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.xpbar > i { display: block; height: 100%; background: linear-gradient(90deg, #1d7cf2, #4fa3ff); border-radius: 99px; }

/* ---------- agents */
.agent-card { position: relative; overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; }
.agent-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.agent-card.sel { border-color: var(--ac, var(--accent)); box-shadow: 0 0 0 1px var(--ac, var(--accent)) inset; }
.agent-card .glyph { font-size: 34px; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: color-mix(in srgb, var(--ac) 16%, transparent); }
.agent-live { background: linear-gradient(135deg, #eaf8f1, #eef5ff); border-color: #bfe6d2; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 rgba(13, 159, 90, .5); animation: ring 1.8s infinite; }
@keyframes ring { 70% { box-shadow: 0 0 0 10px rgba(13, 159, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(13, 159, 90, 0); } }
.log { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.log-item { display: grid; grid-template-columns: 74px 70px 1fr; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #edf0f4; font-size: 13px; align-items: baseline; }
.log-item .act { font: 700 12px var(--mono); }
.activate { font-size: 18px; padding: 16px 24px; border-radius: 14px; width: 100%; letter-spacing: .02em; }

/* ---------- collectibles */
.nft { position: relative; border-radius: 16px; padding: 2px; background: linear-gradient(145deg, var(--rc), transparent 55%, var(--rc)); }
.nft-inner { border-radius: 14px; background: linear-gradient(180deg, #ffffff, #f6f8fb); padding: 16px; height: 100%; display: flex; flex-direction: column; gap: 10px; }
.nft .icon { font-size: 38px; }
.nft .rar { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--rc); }
.nft dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; font-size: 12px; }
.nft dt { color: var(--muted); } .nft dd { margin: 0; font-family: var(--mono); text-align: right; }
.r-common { --rc: var(--common); } .r-uncommon { --rc: var(--uncommon); } .r-rare { --rc: var(--rare); } .r-epic { --rc: var(--epic); } .r-legendary { --rc: var(--legendary); }
.ach { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); }
.ach .i { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface3); flex: none; }
.ach.locked { opacity: .45; filter: grayscale(1); }

/* ---------- missions */
.mission { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.mission:last-child { border-bottom: 0; }
.mission .prog { width: 96px; flex: none; }

/* ---------- landing */
.landing { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.land-nav { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 30px; }
.land-hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 30px 0 50px; }
.land-hero h1 { font-size: 58px; font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
.land-hero h1 em { font-style: normal; background: linear-gradient(90deg, #1d7cf2, #0d9f5a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.land-hero p.lead { font-size: 18px; color: var(--text2); max-width: 540px; margin: 20px 0 26px; }
.tape { overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 0; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.tape-inner { display: inline-flex; gap: 32px; animation: tape 60s linear infinite; font: 600 13px var(--mono); }
@keyframes tape { to { transform: translateX(-50%); } }
.feature .ico { font-size: 28px; margin-bottom: 10px; }
.feature p { color: var(--text2); margin: 8px 0 0; font-size: 14px; }
.auth-card { padding: 26px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: s; }
.steps div { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.steps div::before { counter-increment: s; content: "0" counter(s); display: block; font: 700 12px var(--mono); color: var(--accent); margin-bottom: 6px; }

/* ---------- modal & toasts */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(15, 26, 42, .35); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(460px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--border2); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #ffffff; border: 1px solid var(--border2); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; font-size: 14px; animation: fade .2s; }
.toast.err { border-left-color: var(--down); }
.notice { padding: 10px 0; border-bottom: 1px solid #edf0f4; font-size: 13px; color: var(--text2); }
.notice:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 14px; }
.banner { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface2); font-size: 14px; color: var(--text2); }
.banner.warn { border-color: #f5d49a; background: #fff7e8; color: #8a5a00; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.vs .side-box { padding: 16px; border-radius: 12px; background: var(--surface2); text-align: center; }
.skel { background: linear-gradient(90deg, var(--surface2), var(--surface3), var(--surface2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; min-height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- responsive */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 16px; }
  .page { padding: 18px 16px 100px; }
  .bottomnav { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: blur(10px); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 700; color: var(--muted); padding: 4px 0; }
  .bottomnav a .ico { font-size: 19px; }
  .bottomnav a.active { color: var(--accent); }
  .bottomnav a:hover { text-decoration: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .big-value { font-size: 34px; }
  .land-hero { grid-template-columns: 1fr; gap: 24px; }
  .land-hero h1 { font-size: 40px; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .hide-sm { display: none !important; }
  .userchip .uname { display: none; }
  select.season-select { max-width: 190px; }
  .log-item { grid-template-columns: 60px 1fr; }
  .log-item .why { grid-column: 1 / -1; }
}
@media (max-width: 480px) { .g4 { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* ---------- WAX branding */
.hex { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -4px; }
.brand-sub { font: 700 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--wax2); }
.logo-mark { background: linear-gradient(135deg, #1d7cf2 0%, #1d7cf2 45%, var(--wax) 100%) !important; }
.wax-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 99px; background: #fff3e6; color: var(--wax2); border: 1px solid #ffd5a8; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.wax-chip { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; color: var(--wax2); }
.wax-chip .hex { width: 14px; height: 14px; }
.btn.wax { background: linear-gradient(135deg, var(--wax), var(--wax2)); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(232, 106, 18, .28); }
.btn.wax:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--wax), var(--wax2)); }
.btn.wax-ghost { background: #fff3e6; color: var(--wax2); border-color: #ffd5a8; }
.btn.wax-ghost:hover { background: #ffe8cf; }
.wax-card .btn.wax-ghost { background: #fff; border-color: #fff; }
.wax-card { border-radius: 14px; padding: 14px; color: #fff; background: linear-gradient(135deg, var(--wax) 0%, var(--wax2) 100%); box-shadow: 0 8px 24px rgba(232, 106, 18, .25); font-size: 13px; }
.wax-strip { margin: -22px calc(50% - 50vw) 18px; padding: 9px 16px; text-align: center; font-size: 13px; color: #fff; background: linear-gradient(90deg, var(--wax2), var(--wax)); }
.wax-strip .hex { width: 15px; height: 15px; vertical-align: -3px; }
.wax-section { margin-top: 34px; border-radius: 20px; padding: 28px; color: #fff; background: radial-gradient(600px 300px at 90% 0%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, #f7931e, #e2580f); box-shadow: 0 14px 40px rgba(226, 88, 15, .25); }
.wax-section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.wax-section-head .hex { width: 44px; height: 44px; }
.wax-section h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.wax-feature { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); border-radius: 14px; padding: 16px; }
.wax-feature b { display: block; margin: 8px 0 4px; }
.wax-feature p { margin: 0; font-size: 13px; opacity: .92; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
@media (max-width: 820px) { .wax-section { padding: 20px; } .wax-section h2 { font-size: 22px; } }

.signal { cursor: pointer; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; transition: border-color .15s, box-shadow .15s; }
.signal:hover { border-color: var(--border2); box-shadow: 0 4px 14px rgba(15, 26, 42, .06); }
.grid .signal { min-width: 0; }
