:root {
  --bg: #EEF0F3;
  --surface: #FFFFFF;
  --sunk: #E3E7EC;
  --ink: #1C2230;
  --muted: #5B6475;
  --line: #D3D9E1;
  --brand: #0F5C5A;
  --brand-ink: #FFFFFF;
  --gold: #B88A1E;
  --lv1: #2E8B57;
  --lv2: #2F6FB3;
  --lv3: #7A4BB5;
  --ok-bg: #E4F2EA;
  --warn-bg: #FBF1D9;
  --display: "Bitter", Georgia, serif;
  --text: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --r-sm: 4px;
  --r-md: 8px;
  --side: 272px;
  --top: 60px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141A22;
  --surface: #1C2430;
  --sunk: #232D3B;
  --ink: #E6EAF0;
  --muted: #9AA5B5;
  --line: #2F3A4A;
  --brand: #4FB3A9;
  --brand-ink: #0D1A1A;
  --gold: #E8C35A;
  --lv1: #5BC28A;
  --lv2: #6EA6E6;
  --lv3: #B08BE6;
  --ok-bg: #1D3229;
  --warn-bg: #3A3220;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141A22; --surface: #1C2430; --sunk: #232D3B; --ink: #E6EAF0; --muted: #9AA5B5; --line: #2F3A4A;
    --brand: #4FB3A9; --brand-ink: #0D1A1A; --gold: #E8C35A; --lv1: #5BC28A; --lv2: #6EA6E6; --lv3: #B08BE6;
    --ok-bg: #1D3229; --warn-bg: #3A3220; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; }
h1 { font-size: 2.35rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; font-weight: 700; margin: 2.2rem 0 .7rem; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 1.6rem 0 .5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: .35rem; }
small, .small { font-size: .88rem; }
.muted { color: var(--muted); }
kbd { font: 600 .75rem var(--text); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r-sm); padding: 0 .4em; color: var(--muted); background: var(--surface); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* topo */
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.12rem var(--display); white-space: nowrap; }
.brand svg { width: 28px; height: 28px; color: var(--brand); }
.search { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.search input { width: 100%; height: 40px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); color: var(--ink); font: inherit; font-size: .98rem; }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.search kbd { position: absolute; right: 10px; top: 10px; }
.results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(10, 20, 30, .18); max-height: 70vh; overflow: auto; padding: 6px; }
.res { display: block; padding: 10px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.res:hover, .res.on { background: var(--sunk); }
.res b { font-family: var(--display); font-weight: 700; }
.res .where { color: var(--muted); font-size: .82rem; margin-left: 6px; }
.res .snip { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.res mark { background: color-mix(in srgb, var(--gold) 35%, transparent); color: inherit; border-radius: 2px; }
.res-empty { padding: 12px; color: var(--muted); }
.theme-btn, .menu-btn { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.theme-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; gap: 4px; align-content: center; }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; }

/* estrutura */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 22px 14px 40px 20px; border-right: 1px solid var(--line); }
.side h4 { font: 700 .95rem var(--display); margin: 20px 0 6px 10px; color: var(--ink); }
.side h4:first-child { margin-top: 0; }
.side a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-size: .95rem; }
.side a:hover { color: var(--ink); background: var(--sunk); }
.side a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 3px 0 0 var(--brand); font-weight: 600; }
.side .legend { margin: 26px 10px 0; font-size: .82rem; color: var(--muted); }
.side .legend span { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; }

/* gema de nível: a marca da wiki */
.gem { flex: none; width: 10px; height: 10px; transform: rotate(45deg); border-radius: 2px; background: var(--g); }
.gem.l1 { --g: var(--lv1); } .gem.l2 { --g: var(--lv2); } .gem.l3 { --g: var(--lv3); }
.lvl { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; color: var(--g); }
.lvl.l1 { --g: var(--lv1); } .lvl.l2 { --g: var(--lv2); } .lvl.l3 { --g: var(--lv3); }
.lvl .gem { width: 9px; height: 9px; }

main { min-width: 0; padding: 34px 48px 80px; }
main:focus { outline: none; }
.page { display: grid; grid-template-columns: minmax(0, 76ch) 200px; gap: 48px; }
.page.wide { grid-template-columns: minmax(0, 1fr); }
.crumb { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 12px 0 22px; color: var(--muted); font-size: .9rem; }
.lead { font-size: 1.14rem; color: var(--muted); margin: 0 0 1.4rem; max-width: 64ch; }

.tldr { background: var(--ok-bg); border-left: 4px solid var(--lv1); border-radius: 0 var(--r-md) var(--r-md) 0; padding: 14px 18px 4px; margin: 0 0 1.6rem; }
.tldr strong.t { display: block; font-family: var(--display); margin-bottom: 6px; }
.tip { background: var(--warn-bg); border-radius: var(--r-md); padding: 12px 16px; margin: 1rem 0; }
.tip > :last-child { margin-bottom: 0; }

details.adv { margin: 2rem 0 1rem; border: 1px solid var(--line); border-top: 3px solid var(--lv3); border-radius: var(--r-md); background: var(--surface); }
details.adv > summary { cursor: pointer; padding: 12px 16px; font: 700 1rem var(--display); color: var(--ink); list-style: none; display: flex; align-items: center; gap: 10px; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::after { content: "+"; margin-left: auto; font: 400 1.3rem var(--text); color: var(--muted); }
details.adv[open] > summary::after { content: "−"; }
details.adv > .in { padding: 0 18px 8px; }

.toc { position: sticky; top: calc(var(--top) + 34px); align-self: start; font-size: .88rem; }
.toc strong { display: block; font-family: var(--display); margin-bottom: 8px; }
.toc a { display: block; padding: 3px 0 3px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); border-color: var(--brand); }

/* tabelas */
.tw { overflow-x: auto; margin: 0 0 1.2rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--sunk); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }

/* blocos de herói, conjuntos etc. */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 0 0 1.4rem; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; color: var(--ink); text-decoration: none; }
a.tile:hover { border-color: var(--brand); }
.tile b { font-family: var(--display); font-size: 1.08rem; }
.tile .sub { display: block; color: var(--muted); font-size: .9rem; }
.tile.role { border-top: 4px solid var(--rc); }
.ab { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ab:last-child { border-bottom: 0; }
.ab b { font-family: var(--display); }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); margin-left: 6px; vertical-align: 2px; }
.tag.def { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); vertical-align: -1px; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }

/* passos do guia: é uma sequência de verdade */
ol.steps { counter-reset: s; list-style: none; padding: 0; }
ol.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 52px; margin: 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font: 800 1rem var(--display); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
ol.steps > li::after { content: ""; position: absolute; left: 16px; top: 36px; bottom: 2px; width: 2px; background: var(--line); }
ol.steps > li:last-child::after { display: none; }
ol.steps h3 { margin: 0 0 4px; font-size: 1.08rem; }

dl.gloss dt { font: 700 1.02rem var(--display); margin-top: 14px; }
dl.gloss dd { margin: 2px 0 0; }
.faq h3 { margin-top: 1.8rem; }

/* página inicial */
.home-hero { padding: 26px 0 30px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.home-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); max-width: 16ch; }
.home-hero p { font-size: 1.15rem; color: var(--muted); max-width: 60ch; margin: 12px 0 22px; }
.big-search { position: relative; max-width: 640px; }
.big-search input { width: 100%; height: 54px; padding: 0 18px; font: inherit; font-size: 1.1rem; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); }
.big-search input:focus { outline: none; border-color: var(--brand); }
.big-search .results { top: 60px; }
.quick { margin-top: 12px; font-size: .92rem; color: var(--muted); }
.quick a { margin-right: 12px; }
.tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 36px; }
.track { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--g); border-radius: var(--r-md); padding: 18px 20px 10px; }
.track.l1 { --g: var(--lv1); } .track.l2 { --g: var(--lv2); } .track.l3 { --g: var(--lv3); }
.track h2 { margin: 0 0 4px; font-size: 1.25rem; }
.track p { color: var(--muted); font-size: .95rem; }
.track ol { padding-left: 1.2rem; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 30px; }
.cats h3 { margin: 0 0 6px; }
.cats ul { list-style: none; padding: 0; }
.cats li { margin: 0; }
.cats li a { display: flex; align-items: center; gap: 9px; padding: 3px 0; }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.pager a { display: block; max-width: 48%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--brand); }
.pager small { display: block; color: var(--muted); }
.pager .nx { margin-left: auto; text-align: right; }
.foot { margin-top: 2.4rem; font-size: .85rem; color: var(--muted); }

.scrim { position: fixed; inset: var(--top) 0 0; background: rgba(10, 15, 25, .45); z-index: 14; }

@media (max-width: 1180px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: grid; }
  .side { position: fixed; left: 0; top: var(--top); bottom: 0; width: min(300px, 86vw); height: auto; z-index: 15; background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; }
  main { padding: 24px 18px 60px; }
  .tracks { grid-template-columns: minmax(0, 1fr); }
  .brand span { display: none; }
  .search kbd { display: none; }
  h1 { font-size: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .top, .side, .toc, .pager { display: none; } .shell { display: block; } details.adv > .in { display: block; } }

/* imagens do jogo */
img { max-width: 100%; }
.px { image-rendering: pixelated; }
.ic { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin-right: 6px; }
.hero-tile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.hero-tile .port { width: 56px; height: 56px; border-radius: var(--r-sm); flex: none; }
.hero-port { float: right; width: 168px; height: 168px; margin: -6px 0 16px 24px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--sunk); }
.ab.has-ic { display: flex; gap: 14px; align-items: flex-start; }
.abil-ic { width: 44px; height: 44px; flex: none; border-radius: var(--r-sm); margin-top: 2px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 0 0 1.2rem; }
.item { margin: 0; padding: 10px 6px 8px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.item img { width: 48px; height: 48px; display: block; margin: 0 auto 6px; }
.item figcaption { font-size: .82rem; line-height: 1.25; color: var(--muted); }
.chests { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 1.6rem; }
.chests figure { margin: 0; flex: 1 1 110px; text-align: center; padding: 14px 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.chests img { width: 87px; height: auto; display: block; margin: 0 auto 6px; }
.chests figcaption { font: 700 .95rem var(--display); }
.roster { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 4px; }
.roster a { display: block; width: 72px; text-align: center; color: var(--muted); text-decoration: none; font-size: .82rem; }
.roster img { display: block; width: 72px; height: 72px; border-radius: var(--r-md); border: 2px solid transparent; margin-bottom: 4px; }
.roster a:hover img, .roster a:focus-visible img { border-color: var(--brand); }
.roster a:hover { color: var(--ink); }
td .ic { margin-right: 8px; }
@media (max-width: 900px) {
  .hero-port { width: 112px; height: 112px; margin-left: 14px; }
  .roster a, .roster img { width: 56px; }
  .roster img { height: 56px; }
}
