/* Codename: Stormolow — Reload · 100% guide. Mobile first. */
:root {
  --night: #0b0718; --night2: #120c26; --panel: #161030; --panel2: #1b1438; --line: #2e2555; --line2: #4b3b8f;
  --violet: #8b5cf6; --violet-d: #6d28d9; --cyan: #22d3ee; --hot: #e0f7ff; --gold: #fbbf24;
  --text: #eef1f7; --soft: #b9c2d0; --muted: #949db0;
  --danger: #fb8a8a; --ok: #4ade80;
  --barb: #fb8a8a; --rogue: #4ade80; --sorc: #c9a0ff;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bar-h: 56px;
  --radius: 14px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 12px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px; color: var(--text); font: 16px/1.65 var(--sans);
  background:
    radial-gradient(900px 600px at 80% -10%, #2a1360 0%, transparent 60%),
    radial-gradient(700px 500px at -20% 30%, #0e2a44 0%, transparent 55%),
    var(--night);
  background-attachment: fixed;
  overflow-wrap: break-word;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--hot); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
code, kbd, pre, .mono { font-family: var(--mono); }
code { font-size: .9em; background: #1d1640; border: 1px solid var(--line); padding: .05em .35em; border-radius: 6px; color: var(--hot); overflow-wrap: anywhere; }
kbd { display: inline-block; min-width: 1.7em; padding: .05em .45em; border: 1px solid #43367a; border-bottom-width: 3px; border-radius: 6px; background: #1c1440; color: var(--hot); font-size: .85em; text-align: center; line-height: 1.5; }
strong { color: var(--hot); }
.gold { color: var(--gold); } .cyan { color: var(--cyan); } .ok { color: var(--ok); } .danger { color: var(--danger); }

.skip { position: absolute; left: 8px; top: -80px; z-index: 100; background: var(--gold); color: #0b0718; padding: 12px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--bar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: rgba(11, 7, 24, .88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .04em; min-width: 0; }
.brand img { width: 28px; height: 28px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.brand b { color: var(--cyan); }
.badge { flex: none; font: 700 .72rem/1 var(--mono); letter-spacing: .08em; color: #0b0718; background: linear-gradient(90deg, var(--gold), #fde68a); padding: .4em .6em; border-radius: 999px; }
.topbar .spacer { flex: 1; }
.toc-toggle {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 14px;
  font: 700 .9rem var(--sans); color: var(--text); background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; cursor: pointer;
}
.toc-toggle:hover { border-color: var(--cyan); }
.burger { width: 18px; height: 12px; position: relative; display: inline-block; }
.burger::before, .burger::after, .burger i { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor; border-radius: 2px; transition: transform .2s, opacity .2s, top .2s; }
.burger::before { top: 0; } .burger i { top: 5px; } .burger::after { top: 10px; }
.toc-toggle[aria-expanded="true"] .burger::before { top: 5px; transform: rotate(45deg); }
.toc-toggle[aria-expanded="true"] .burger::after { top: 5px; transform: rotate(-45deg); }
.toc-toggle[aria-expanded="true"] .burger i { opacity: 0; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--violet), var(--cyan), var(--gold)); transform-origin: left; transform: scaleX(0); }

/* ---------- table of contents ---------- */
.toc {
  position: fixed; z-index: 25; top: var(--bar-h); left: 0; right: 0;
  max-height: calc(100vh - var(--bar-h)); max-height: calc(100dvh - var(--bar-h)); overflow-y: auto; overscroll-behavior: contain;
  background: #0e0920; border-bottom: 1px solid var(--line2);
  padding: 8px 12px 16px; box-shadow: 0 30px 60px #000c;
}
.toc[hidden] { display: none; }
.no-js .toc { position: static; max-height: none; box-shadow: none; }
.no-js .toc-toggle { display: none; }
.toc h2 { font-size: .75rem; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin: 8px 8px 6px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 10px;
  color: var(--soft); text-decoration: none; font-size: .95rem; line-height: 1.3;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font: 700 .72rem var(--mono); color: var(--muted); flex: none; width: 1.8em; }
.toc a:hover { background: var(--panel2); color: var(--text); }
.toc a[aria-current="true"] { background: linear-gradient(90deg, #6d28d955, #22d3ee22); color: var(--hot); font-weight: 700; }
.toc a[aria-current="true"]::before { color: var(--cyan); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 40px 16px 44px; text-align: center; border-bottom: 1px solid var(--line); isolation: isolate; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.flash { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background: radial-gradient(600px 400px at var(--fx, 60%) 0%, #fde68a55, transparent 70%); transition: opacity .08s; }
.flash.on { opacity: 1; }
.bolt { position: absolute; top: 0; left: var(--bx, 70%); width: 60px; height: 55%; z-index: -1; opacity: 0; pointer-events: none; }
.bolt.on { opacity: .9; }
.mark-wrap { max-width: 100%; overflow: hidden; }
.mark {
  display: inline-block; margin: 0 auto; white-space: pre; letter-spacing: 0; text-align: left;
  font: 700 min(calc((100vw - 40px) / 50), 15px)/1.05 var(--mono);
  background: linear-gradient(100deg, #5b3bc0 0%, var(--violet) 30%, var(--cyan) 55%, var(--hot) 62%, var(--cyan) 70%, var(--violet) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sweep 6s ease-in-out infinite; filter: drop-shadow(0 0 14px #7c3aed66);
}
@keyframes sweep { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.kicker { margin: .9em 0 .5em; color: var(--soft); letter-spacing: .3em; text-transform: uppercase; font: 700 .78rem var(--mono); }
.kicker b { color: var(--cyan); }
.hero h1 { font-size: clamp(1.7rem, 7vw, 3.1rem); line-height: 1.12; margin: .5em 0 .3em; }
.hero h1 .grad { background: linear-gradient(90deg, var(--gold), #fde68a 40%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { max-width: 42rem; margin: 0 auto; color: var(--soft); font-size: 1.05rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 1.5em; }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px; padding: .7em 1.3em; border-radius: 999px; font-weight: 800; text-decoration: none; }
.cta.primary { background: linear-gradient(90deg, var(--violet), var(--cyan)); color: #0b0718; box-shadow: 0 10px 30px #22d3ee33; }
.cta.ghost { border: 1px solid var(--line2); color: var(--text); background: #120c26cc; }
.cta.primary:hover { color: #0b0718; filter: brightness(1.1); }
.stats { list-style: none; padding: 0; margin: 1.8em auto 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 46rem; }
.stats li { padding: .7em .6em; border: 1px solid var(--line); border-radius: 14px; background: #140e2ccc; font-size: .85rem; color: var(--soft); line-height: 1.35; }
.stats b { display: block; color: var(--gold); font: 800 1.2rem var(--mono); }

/* ---------- layout ---------- */
.layout { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main { min-width: 0; padding: 12px 0 60px; }
section.chapter { padding: 34px 0 8px; border-bottom: 1px dashed #2a2250; }
section.chapter:last-of-type { border-bottom: 0; }
.num { font: 700 .75rem var(--mono); letter-spacing: .28em; color: var(--cyan); text-transform: uppercase; margin: 0; }
h2 { font-size: clamp(1.45rem, 5.2vw, 2.1rem); line-height: 1.2; margin: .2em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 .5em; line-height: 1.3; color: var(--hot); }
h4 { font-size: 1.02rem; margin: 0 0 .4em; line-height: 1.3; }
p { margin: .6em 0; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
ul.clean { list-style: none; padding: 0; margin: .5em 0; }
ul.clean > li { position: relative; padding: .25em 0 .25em 1.35em; color: var(--soft); }
ul.clean > li::before { content: "◆"; position: absolute; left: 0; top: .5em; color: var(--cyan); font-size: .7em; }
ol.steps { padding-left: 1.4em; margin: .6em 0; color: var(--soft); }
ol.steps li { margin: .35em 0; padding-left: .2em; }
ol.steps li::marker { color: var(--gold); font-weight: 800; font-family: var(--mono); }

.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.card { position: relative; min-width: 0; background: linear-gradient(180deg, #1a1336, #140e2c); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px; box-shadow: 0 16px 40px #0005; }
.card p, .card li { color: var(--soft); }
.card > :last-child { margin-bottom: 0; }
.card.accent { border-color: #fbbf2466; }
.pill { display: inline-block; font: 700 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: .25em .6em; border-radius: 999px; border: 1px solid var(--line2); color: var(--soft); background: #1d1640; }
.pill.gold { border-color: #fbbf2488; color: var(--gold); }
.pill.cyan { border-color: #22d3ee88; color: var(--cyan); }

.tip { border-left: 3px solid var(--gold); padding: .7em 1em; margin: 1.1em 0; background: #fbbf2412; border-radius: 0 12px 12px 0; color: var(--soft); }
.tip > b:first-child { color: var(--gold); }
.tip.warn { border-left-color: var(--danger); background: #f8717112; }
.tip.warn > b:first-child { color: var(--danger); }
.tip.new { border-left-color: var(--cyan); background: #22d3ee10; }
.tip.new > b:first-child { color: var(--cyan); }

/* code / terminal */
.term { background: #07050f; border: 1px solid #2a2150; border-radius: 12px; overflow: hidden; margin: .8em 0; box-shadow: 0 18px 40px #000a; }
.term .top { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #120c26; border-bottom: 1px solid #221a44; }
.term .top i { width: 10px; height: 10px; border-radius: 50%; background: #3b2f6b; }
.term .top i:nth-child(1) { background: #f87171; } .term .top i:nth-child(2) { background: #fbbf24; } .term .top i:nth-child(3) { background: #4ade80; }
.term .top span { margin-left: auto; font: .72rem var(--mono); color: var(--muted); }
.term pre { margin: 0; padding: 12px 14px; font-size: .86rem; line-height: 1.6; color: var(--soft); overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.term .p { color: var(--cyan); user-select: none; }
.term .c { color: var(--muted); }
.term .crumb { color: var(--cyan); }
.term .hi { color: #0b0718; background: var(--cyan); padding: 0 .35em; border-radius: 4px; font-weight: 700; }
.term u { color: var(--cyan); }

/* tables */
.table-wrap { overflow-x: auto; margin: 1em 0; border: 1px solid var(--line); border-radius: 12px; background: #120c26; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
caption { text-align: left; padding: 10px 12px 4px; color: var(--muted); font-size: .82rem; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid #251d48; }
thead th { color: var(--gold); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; background: #171031; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { color: var(--hot); font-weight: 700; }
th code { white-space: nowrap; }
td { color: var(--soft); }
td.n, th.n { text-align: right; font-family: var(--mono); white-space: nowrap; }
table.wide { min-width: 560px; }

/* heroes */
.heroes .card { border-top: 3px solid var(--c); }
.heroes h3 { margin-top: 0; color: var(--c); }
.bars { margin: .8em 0; }
.bars .row { display: grid; grid-template-columns: 3em minmax(0, 1fr) 3em; gap: 10px; align-items: center; font: .8rem var(--mono); color: var(--muted); margin: 5px 0; }
.bars .track { height: 9px; background: #231c44; border-radius: 6px; overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 40%, #000), var(--c)); }
.bars .v { color: var(--text); text-align: right; }
.w37 { width: 37%; } .w40 { width: 40%; } .w42 { width: 42%; } .w56 { width: 56%; } .w65 { width: 65%; }
.w69 { width: 69%; } .w95 { width: 95%; } .w96 { width: 96%; } .w98 { width: 98%; } .w100 { width: 100%; }
.c-barb { --c: var(--barb); } .c-rogue { --c: var(--rogue); } .c-sorc { --c: var(--sorc); }
.card > h3 { margin-top: 0; }
.mt { margin-top: 1.2em; }

/* missions timeline */
.timeline { list-style: none; margin: 1em 0; padding: 0 0 0 40px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--violet), var(--cyan), var(--gold)); }
.timeline > li { position: relative; margin: 0 0 14px; }
.timeline > li::before {
  content: attr(data-l); position: absolute; left: -40px; top: 14px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font: 800 .8rem var(--mono); color: #0b0718;
  background: linear-gradient(135deg, var(--violet), var(--cyan)); box-shadow: 0 0 0 4px var(--night), 0 0 16px #22d3ee55;
}
.need { display: flex; flex-wrap: wrap; gap: 6px; margin: .5em 0; padding: 0; list-style: none; }
.chip { font: .78rem/1.3 var(--mono); padding: .3em .6em; border-radius: 999px; border: 1px solid var(--line2); background: #1d1640; color: var(--text); }
.chip.r { border-color: #fbbf2466; color: var(--gold); }
.card small, .small { color: var(--muted); font-size: .88rem; display: block; }
.when { font: 700 .75rem var(--mono); color: var(--cyan); float: right; margin-left: 8px; }

/* craft tree */
.tree { font: .86rem var(--mono); }
.tree ul { list-style: none; margin: 0; padding-left: 18px; }
.tree > ul { padding-left: 0; }
.tree li { position: relative; padding: 5px 0 5px 16px; }
.tree li::before { content: ""; position: absolute; left: 0; top: 0; height: 50%; width: 12px; border-left: 2px solid #43367a; border-bottom: 2px solid #43367a; border-radius: 0 0 0 8px; }
.tree > ul > li { padding-left: 0; }
.tree > ul > li::before { display: none; }
.node { display: inline-block; padding: .3em .7em; border-radius: 10px; background: #1d1640; border: 1px solid var(--line2); color: var(--text); }
.node .where { display: block; color: var(--muted); font-size: .85em; }
.node.goal { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 20px #fbbf2433; }
.node.drop { border-color: #fb8a8a77; }
.node.mine { border-color: #22d3ee77; }

/* details */
details { border: 1px solid var(--line); border-radius: 12px; background: #140e2c; margin: 10px 0; }
details > summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-weight: 700; color: var(--text); }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; margin-left: auto; font: 800 1.2rem var(--mono); color: var(--cyan); flex: none; }
details[open] > summary::after { content: "−"; }
details[open] > summary { border-bottom: 1px solid var(--line); }
details > .body { padding: 4px 14px 14px; }
details > .body > :first-child { margin-top: .6em; }

/* checklists */
.checklist { list-style: none; padding: 0; margin: .8em 0; display: grid; gap: 8px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #140e2c; cursor: pointer; }
.checklist label:hover { border-color: var(--line2); }
.checklist input { appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border-radius: 7px; border: 2px solid #6b5bb8; display: grid; place-items: center; background: #0e0a22; cursor: pointer; }
.checklist input:checked { background: linear-gradient(135deg, var(--violet), var(--cyan)); border-color: transparent; }
.checklist input:checked::after { content: "✓"; color: #0b0718; font-weight: 900; font-size: 15px; line-height: 1; }
.checklist input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.checklist .t { color: var(--soft); }
.checklist .t b { color: var(--text); }
.checklist label.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: #6b5bb8; }
.meter { height: 14px; border-radius: 9px; background: #231c44; overflow: hidden; border: 1px solid var(--line); margin: 1em 0 .4em; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan), var(--gold)); transition: width .5s ease; }
.meter-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.meter-text { font: 700 .95rem var(--mono); color: var(--soft); }
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: 600 .9rem var(--sans); cursor: pointer; }
.btn:hover { border-color: var(--cyan); }

/* boss */
.overseer { margin: 0 auto; font: 11px/1.1 var(--mono); white-space: pre; color: #34d399; text-shadow: 0 0 12px #34d39988; text-align: left; display: block; width: max-content; max-width: 100%; overflow: hidden; animation: hum 3s ease-in-out infinite; }
@keyframes hum { 50% { color: #a7f3d0; text-shadow: 0 0 22px #34d399; } }
.hp { height: 12px; border-radius: 7px; background: #231c44; overflow: hidden; margin: .5em 0 1em; }
.hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7f1d1d, #f87171); animation: drain 7s ease-in-out infinite; }
@keyframes drain { 0%, 10% { width: 100%; } 80%, 100% { width: 4%; } }

/* footer */
footer.site { border-top: 1px solid var(--line); background: #0a0616; color: var(--soft); padding: 34px 16px 40px; font-size: .92rem; }
footer .inner { max-width: 1000px; margin: 0 auto; display: grid; gap: 22px; }
footer h2 { font-size: .8rem; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5em; }
footer dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 16px; }
footer dt { color: var(--muted); font-size: .8rem; margin-top: .5em; }
footer dd { margin: 0; color: var(--text); }
.coffee { display: inline-flex; align-items: center; gap: .6em; min-height: 48px; padding: .6em 1.2em; border-radius: 999px; background: var(--gold); color: #1a1000; font-weight: 800; text-decoration: none; }
.coffee:hover { color: #1a1000; background: #fde68a; }
.copy { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 400px) {
  .brand span { font-size: .85rem; letter-spacing: 0; }
  .toc-toggle { padding: 0 12px; }
}

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.two, .grid.three, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 18px 20px; }
  footer dl { grid-template-columns: max-content minmax(0, 1fr); }
  footer dt { margin-top: 0; }
  .overseer { font-size: 13px; }
}
@media (min-width: 860px) {
  body { font-size: 17px; }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero { padding: 64px 24px 60px; }
  .layout { padding: 0 24px; }
  .boss { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; align-items: center; }
  footer .inner { grid-template-columns: 1.4fr 1fr; }
  .copy { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .toc-toggle { display: none; }
  .layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; align-items: start; }
  .toc, .toc[hidden] {
    display: block; position: sticky; top: calc(var(--bar-h) + 16px); left: auto; right: auto; z-index: 1;
    max-height: calc(100vh - var(--bar-h) - 32px); margin-top: 28px;
    background: #120c26b3; border: 1px solid var(--line); border-radius: 16px; box-shadow: none; padding: 8px;
  }
  .toc a { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero canvas, .flash, .bolt { display: none; }
}
@media print {
  .topbar, .toc, .hero canvas, .flash, .bolt, .cta-row { display: none !important; }
  body { background: #fff; color: #000; }
}

abbr[title] { text-decoration: none; cursor: help; }
th, td { padding-left: 10px; padding-right: 10px; }
