:root {
  --bg: #0d1015; --surface: #151a21; --surface-2: #1b212a; --line: #29313c; --line-2: #333d4a;
  --text: #e9e6df; --muted: #98a0aa; --faint: #6c7480;
  --accent: #59d8c6; --accent-ink: #062521; --accent-soft: rgba(89, 216, 198, .12);
  --warn: #f2b84b; --bad: #ff7a6b; --good: #7bdc8a;
  --r-poor: #9a9a9a; --r-common: #e9e6df; --r-uncommon: #73d66e; --r-rare: #5ba8ff; --r-epic: #b580ff; --r-legendary: #ffa643;
  --radius: 12px; --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f1ec; --surface: #ffffff; --surface-2: #f7f5f0; --line: #e1ddd3; --line-2: #d3cec2;
  --text: #1b1f25; --muted: #5d6570; --faint: #8a919a;
  --accent: #0f8f80; --accent-ink: #ffffff; --accent-soft: rgba(15, 143, 128, .1);
  --warn: #a86a00; --bad: #c2392b; --good: #23853a;
  --r-poor: #7a7a7a; --r-common: #3a3f47; --r-uncommon: #2f8f2a; --r-rare: #1f6fd1; --r-epic: #7a3fd6; --r-legendary: #c46a00;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f1ec; --surface: #ffffff; --surface-2: #f7f5f0; --line: #e1ddd3; --line-2: #d3cec2;
    --text: #1b1f25; --muted: #5d6570; --faint: #8a919a;
    --accent: #0f8f80; --accent-ink: #ffffff; --accent-soft: rgba(15, 143, 128, .1);
    --warn: #a86a00; --bad: #c2392b; --good: #23853a;
    --r-poor: #7a7a7a; --r-common: #3a3f47; --r-uncommon: #2f8f2a; --r-rare: #1f6fd1; --r-epic: #7a3fd6; --r-legendary: #c46a00;
    --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.05);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Inter", system-ui, -apple-system, Segoe UI, sans-serif; }
h1, h2, h3, .brand, .num, .tab { font-family: "Chakra Petch", "Inter", system-ui, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* header */
header.top { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: .3px; margin-right: auto; text-decoration: none; color: var(--text); }
.brand svg { width: 30px; height: 30px; }
.brand small { display: block; font: 500 12px/1.2 "Inter", sans-serif; color: var(--muted); letter-spacing: 0; }
.build-btn { display: flex; align-items: center; gap: 8px; max-width: 240px; }
.build-btn .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.build-btn span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 12px 12px; color: var(--muted); font-weight: 600; font-size: 15px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabbar { border-bottom: 1px solid var(--line); background: var(--surface); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn { width: 38px; padding: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* layout */
main { padding: 20px 0 40px; }
.view[hidden] { display: none; }
.grid-build { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-build { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.section-h { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.sticky { position: sticky; top: 76px; }
@media (max-width: 900px) { .sticky { position: static; } }

/* intro */
.intro { margin-bottom: 18px; }
.intro h1 { font-size: 26px; margin-bottom: 6px; }
.intro p { margin: 0; color: var(--muted); max-width: 70ch; }
.badge { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* gear slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.slot { padding: 12px; display: grid; gap: 8px; min-height: 120px; align-content: start; }
.slot-h { display: flex; align-items: center; gap: 8px; }
.slot-h .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 600; margin-right: auto; }
.slot.empty { border-style: dashed; background: transparent; box-shadow: none; min-height: 0; }
.only-mobile { display: none; }
@media (max-width: 900px) { .only-mobile { display: inline-flex; } }
.slot .pick { text-align: left; border: 0; background: none; padding: 0; cursor: pointer; font-weight: 700; font-size: 15px; }
.slot .pick:hover { text-decoration: underline; }
.slot.empty .pick { color: var(--accent); font-weight: 600; }
.lvl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lvl select { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 3px 6px; }
.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; }
.stats li { color: var(--muted); }
.stats li b { color: var(--text); font-weight: 600; }
.r-Poor { color: var(--r-poor); } .r-Common { color: var(--r-common); } .r-Uncommon { color: var(--r-uncommon); }
.r-Rare { color: var(--r-rare); } .r-Epic { color: var(--r-epic); } .r-Legendary { color: var(--r-legendary); }
.rdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: currentColor; flex: none; }
.setchip { font-size: 12px; color: var(--accent); }

/* summary */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.kpi .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.kpi .v { font-size: 20px; font-weight: 700; display: block; }
.kpi.zero .v { color: var(--faint); }
.sum-block { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sum-block h3 { margin-bottom: 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.weap { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 10px; padding: 10px 12px; }
.weap .big { font-size: 26px; font-weight: 700; }
.weap dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 6px 0 0; font-size: 13px; }
.weap dt { color: var(--muted); } .weap dd { margin: 0; text-align: right; }
.effects { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13px; }
.effects li { display: flex; gap: 8px; justify-content: space-between; }
.effects details summary { cursor: pointer; list-style: none; }
.effects details summary::-webkit-details-marker { display: none; }
.effects .src { color: var(--faint); font-size: 12px; padding-left: 10px; }
.setrow { display: grid; gap: 2px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow .on { color: var(--good); } .setrow .off { color: var(--faint); }

/* skills */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .skills { grid-template-columns: 1fr; } }
.skill { padding: 14px; display: grid; gap: 10px; border-top: 3px solid var(--sc, var(--accent)); }
.skill-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.skill-h h3 { margin-right: auto; font-size: 17px; }
.skill-lv { display: flex; align-items: center; gap: 8px; }
.skill-lv input[type="range"] { flex: 1; accent-color: var(--accent); }
.skill-lv input[type="number"] { width: 64px; }
.pts { font-size: 13px; color: var(--muted); } .pts b { color: var(--text); }
.pts.over b { color: var(--bad); }
.tier { display: grid; gap: 6px; }
.tier-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); }
.talent { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.talent.locked { opacity: .5; }
.talent .tn { font-weight: 600; font-size: 14px; }
.talent .te { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.step { display: flex; align-items: center; gap: 4px; }
.step button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 700; }
.step button:disabled { opacity: .35; cursor: not-allowed; }
.pips { display: flex; gap: 3px; margin: 0 4px; }
.pips i { width: 7px; height: 7px; border-radius: 2px; background: var(--line-2); }
.pips i.on { background: var(--accent); }

/* lists */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
input[type="search"], input[type="text"], input[type="number"], select, textarea { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; min-height: 38px; }
input[type="search"] { flex: 1 1 200px; min-width: 0; }
.toolbar select { flex: 0 1 auto; max-width: 100%; }
.rows { display: grid; gap: 8px; }
.row { padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; }
.row .nm { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .meta { font-size: 12px; color: var(--muted); }
.row .stats { grid-column: 1 / -1; }
.row .delta { grid-column: 1 / -1; font-size: 12px; }
.delta .up { color: var(--good); } .delta .down { color: var(--bad); }
.count { font-size: 13px; color: var(--muted); }
.more { margin-top: 12px; text-align: center; }

/* sets */
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.set { padding: 12px; display: grid; gap: 8px; align-content: start; }
.set ul { margin: 0; padding-left: 18px; font-size: 13px; }
.set .bon { font-size: 13px; display: grid; gap: 2px; }
.set .bon b { color: var(--accent); }

/* dialogs */
dialog { border: 1px solid var(--line-2); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(5, 8, 12, .62); }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-h h2 { margin-right: auto; }
.dlg-b { padding: 16px; display: grid; gap: 12px; }
.x-btn { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; }
.x-btn:hover { background: var(--surface-2); }
.plist { display: grid; gap: 8px; }
.pitem { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface-2); text-align: left; width: 100%; }
.pitem[aria-current="true"] { border-color: var(--accent); }
.pitem .dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.pitem .meta { margin-left: auto; font-size: 12px; color: var(--muted); }
textarea { width: 100%; min-height: 160px; font: 13px/1.4 ui-monospace, monospace; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

/* guide */
.prose { max-width: 75ch; }
.prose h2 { margin: 22px 0 8px; } .prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface); margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; }
code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* footer */
footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 13px; }
footer p { margin: 0 0 8px; }
.coffee { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px; margin: 0 0 20px; }
.coffee .t { flex: 1 1 240px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro h1 { font-size: 22px; }
  .brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
