:root {
  color-scheme: dark;
  --bg: #0a0c11;
  --surface-1: #11141b;
  --surface-2: #151922;
  --surface-3: #1c2130;
  --surface-hover: #1f2535;
  --border: #242a37;
  --border-strong: #333b4d;
  --grid: #1f2431;
  --text-primary: #eeeae0;
  --text-secondary: #b0b4be;
  --text-muted: #777d8b;
  --gold: #e2b55c;
  --gold-soft: #c89b45;
  --gold-faint: rgba(226, 181, 92, 0.12);
  --gold-line: rgba(226, 181, 92, 0.35);
  /* chart marks (validated on the dark surface) */
  --alliance: #4d8ef0;
  --horde: #e5534b;
  --win: #2fa58a;
  --loss: #d0663c;
  --series-1: #b8892f;
  --series-2: #7581d9;
  --font-display: "Cinzel", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(226, 181, 92, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(77, 142, 240, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text-primary);
  font: 14px/1.45 var(--font-body);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; font-family: var(--font-display); color: var(--gold); letter-spacing: 0.08em; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 25, 34, 0.9), rgba(12, 14, 19, 0.9));
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 6px; }
.brand svg { flex: none; filter: drop-shadow(0 0 10px rgba(226, 181, 92, 0.35)); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: 0.04em;
  background: linear-gradient(180deg, #f6dca0, #c89b45); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.14em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  color: var(--text-secondary); font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav a.active { background: var(--gold-faint); color: var(--text-primary); box-shadow: inset 2px 0 0 var(--gold); }
.nav a.active svg { color: var(--gold); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--text-muted); padding: 0 8px; display: flex; flex-direction: column; gap: 10px; }

.main { min-width: 0; padding: 22px 28px 60px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px; }
.topbar .spacer { flex: 1; }

/* ---------- controls ---------- */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; color: var(--text-secondary); cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text-primary); }
.seg button.on { background: var(--surface-3); color: var(--text-primary); box-shadow: 0 0 0 1px var(--border-strong); }
.select { position: relative; }
.select select {
  appearance: none; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-primary);
  border-radius: 10px; padding: 7px 30px 7px 11px; font: 500 13px var(--font-body); cursor: pointer;
}
.select::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--gold-line); background: var(--gold-faint);
  color: var(--text-primary); padding: 7px 13px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.btn:hover { background: rgba(226, 181, 92, 0.2); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn.ghost { border-color: var(--border); background: var(--surface-1); font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-1); white-space: nowrap; }
.chip.demo { border-color: var(--gold-line); color: var(--gold); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- layout ---------- */
.page-title { display: flex; align-items: flex-end; gap: 16px; margin: 0 0 18px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font: 600 28px/1.1 var(--font-display); letter-spacing: 0.02em; }
.page-title .sub { color: var(--text-muted); padding-bottom: 3px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin: 0; }
.card-note { font-size: 12px; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.num { font-variant-numeric: tabular-nums; }

/* ornament divider */
.ornament { display: flex; align-items: center; gap: 10px; color: var(--gold-soft); margin: 6px 0 2px; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line), transparent); }
.ornament i { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--gold-soft); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px;
  padding: 22px 24px;
  background:
    radial-gradient(600px 240px at 0% 0%, var(--hero-tint, rgba(63, 199, 235, 0.10)), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface-1));
}
.hero::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(226, 181, 92, 0.12); }
.hero-name { font: 700 30px/1.1 var(--font-display); letter-spacing: 0.02em; margin: 6px 0 4px; }
.hero-meta { color: var(--text-secondary); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.crest { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font: 700 22px var(--font-display);
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.18), transparent 60%), var(--crest, #3fc7eb); color: #0b0d12;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 24px -8px var(--crest, #3fc7eb); }
.big-number { font: 600 64px/1 var(--font-display); letter-spacing: -0.01em; }
.big-number small { font: 500 16px var(--font-body); color: var(--text-secondary); margin-left: 8px; letter-spacing: 0; }
.hero-right { display: flex; flex-direction: column; justify-content: center; gap: 12px; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; position: relative; }
.tile-label { font-size: 11.5px; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.tile-value { font: 600 24px/1.2 var(--font-body); margin-top: 4px; letter-spacing: -0.01em; }
.tile-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.tile svg.spark { position: absolute; right: 12px; bottom: 12px; opacity: 0.9; }

/* ---------- form strip ---------- */
.form { display: flex; gap: 3px; flex-wrap: wrap; }
.form span { width: 16px; height: 22px; border-radius: 4px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: rgba(10, 12, 17, 0.85); cursor: default; }
.form .w { background: var(--win); }
.form .l { background: var(--loss); }
.form .o { background: var(--surface-3); color: var(--text-muted); }

/* ---------- pills/badges ---------- */
.res { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.res::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }
.res.win { --c: var(--win); } .res.loss { --c: var(--loss); } .res.left, .res.draw, .res.unknown { --c: var(--text-muted); color: var(--text-secondary); }
.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 18px; padding: 0 5px; border-radius: 5px; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-secondary); margin-left: 6px; }
.rank.top { background: var(--gold-faint); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-line); }
.cls { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.cls i { width: 9px; height: 9px; border-radius: 3px; background: var(--cc); flex: none; box-shadow: 0 0 8px -1px var(--cc); }
.cls .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fac { display: inline-flex; align-items: center; gap: 6px; }
.fac::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fc); }
.fac.Alliance { --fc: var(--alliance); } .fac.Horde { --fc: var(--horde); }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-secondary); white-space: nowrap; }
.tag.gold { border-color: var(--gold-line); color: var(--gold); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: default; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--text-secondary); }
table.t th.sorted { color: var(--gold); }
table.t td { padding: 8px 8px; border-bottom: 1px solid rgba(36, 42, 55, 0.6); white-space: nowrap; }
table.t td.r, table.t th.r { text-align: right; }
table.t tbody tr { transition: background 0.12s; }
table.t tbody tr.link { cursor: pointer; }
table.t tbody tr:hover { background: var(--surface-hover); }
table.t tr.me td { background: rgba(226, 181, 92, 0.07); }
table.t tr.me td:first-child { box-shadow: inset 2px 0 0 var(--gold); }
table.t tr.gone td { opacity: 0.5; }
.team-row td { padding-top: 14px !important; border-bottom-color: var(--border) !important; }

/* ---------- comp bars ---------- */
.comp { display: flex; height: 8px; gap: 2px; width: 120px; }
.comp span { background: var(--cc); border-radius: 2px; min-width: 3px; }
.comp-stack { display: flex; flex-direction: column; gap: 3px; }

/* ---------- bar list ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.bar-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.03); position: relative; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; background: var(--bc, var(--series-1)); }
.bar-row .val { text-align: right; min-width: 64px; color: var(--text-primary); }
.bar-row .val small { color: var(--text-muted); margin-left: 6px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .axis text, .chart text.axis { fill: var(--text-muted); font-size: 11px; font-family: var(--font-body); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 3px; border-radius: 2px; background: var(--lc); }
.legend i.sq { width: 9px; height: 9px; border-radius: 2px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0; transition: opacity 0.1s;
  background: rgba(17, 20, 27, 0.97); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px;
  font-size: 12.5px; color: var(--text-primary); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.9); max-width: 280px;
}
.tip .tt { font-weight: 600; margin-bottom: 4px; }
.tip .tr { display: flex; align-items: center; gap: 8px; justify-content: space-between; color: var(--text-secondary); }
.tip .tr b { color: var(--text-primary); font-weight: 600; }
.tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* ---------- map canvases ---------- */
.map-frame { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #07090d; aspect-ratio: 3 / 2; }
.map-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-frame .poi { position: absolute; transform: translate(-50%, -50%); font-size: 11px; color: var(--text-primary); white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 3px #000, 0 0 8px #000; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.map-frame .poi::before { content: ""; width: 7px; height: 7px; transform: rotate(45deg); border: 1.5px solid var(--gold); background: rgba(10, 12, 17, 0.7); }
.map-frame .map-note { position: absolute; left: 12px; bottom: 10px; font-size: 11px; color: var(--text-muted); }
.ramp { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.ramp b { display: block; width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #2a1e08, #6b4a12, #b07a22, #e3ac45, #ffe2a6); }
.slider { width: 100%; accent-color: var(--gold); }

/* ---------- misc ---------- */
.empty { padding: 40px; text-align: center; color: var(--text-muted); }
.events { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow: auto; font-size: 13px; }
.ev { display: grid; grid-template-columns: 52px 16px 1fr; gap: 8px; align-items: baseline; padding: 5px 4px; border-radius: 6px; }
.ev:hover { background: var(--surface-hover); }
.ev .time { color: var(--text-muted); text-align: right; font-size: 12px; }
.ev .mk { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--ec, var(--text-muted)); align-self: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; text-align: right; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); margin-bottom: 10px; font-size: 13px; }
.back:hover { color: var(--gold); }
.banner { border: 1px solid var(--gold-line); background: var(--gold-faint); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner b { color: var(--gold); }
.small-mult { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.sm-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 6px; }
.sm-title { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; max-width: 420px; font-size: 12.5px; white-space: pre-wrap; box-shadow: 0 16px 40px -12px #000; }

@media (max-width: 1100px) {
  .cols-12 > [class*="span-"] { grid-column: span 12; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; gap: 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; }
  .nav a span { display: none; }
  .brand-sub, .sidebar-foot { display: none; }
  .main { padding: 16px 16px 40px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .big-number { font-size: 48px; }
}

/* class edge: diverging bars around a centre line */
.edge-list { display: flex; flex-direction: column; gap: 4px; }
.edge-row { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 12px; padding: 5px 4px; border-radius: 6px; }
.edge-row:hover { background: var(--surface-2, rgba(255,255,255,0.03)); }
.edge-track { position: relative; height: 14px; }
.edge-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--border-strong, rgba(255,255,255,0.2)); }
.edge-bar { position: absolute; top: 0; height: 14px; border-radius: 4px; }
@media (max-width: 640px) { .edge-row { grid-template-columns: 96px 1fr 76px; gap: 8px; } }

.role-icon { display: inline-flex; vertical-align: -2px; margin-left: 6px; }

/* spec learning */
.spec-ev { display: flex; flex-wrap: wrap; gap: 4px; max-width: 420px; }
.spec-ev .chip { font-size: 11.5px; padding: 2px 8px; }
.chip.sig { border-color: var(--gold-line); color: var(--gold); }
.spec-pick button { padding: 4px 9px; font-size: 12px; }
.spec-pick button.guess { box-shadow: inset 0 0 0 1px var(--gold-line); outline: 1px dashed var(--gold); outline-offset: -3px; }
.spec-pick button:disabled { cursor: wait; }
.verdict { font-weight: 700; font-size: 15px; }
.verdict.ok { color: var(--win); }
.verdict.bad { color: var(--loss); }
.spec-table td { vertical-align: middle; }

/* your talents, per spec tree */
.talent-trees { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.talent-tree { border: 1px solid var(--border, rgba(255,255,255,0.08)); border-radius: 10px; padding: 10px 12px; }
.talent-tree.empty { opacity: 0.5; }
@media (max-width: 760px) { .talent-trees { grid-template-columns: 1fr; } }
.tag.lvl-up { border-color: color-mix(in srgb, var(--win) 55%, transparent); color: var(--win); }
.tag.lvl-down { border-color: color-mix(in srgb, var(--loss) 55%, transparent); color: var(--loss); }
