:root {
  --ink: rgb(12, 15, 17);
  --slate-950: rgb(18, 22, 25);
  --slate-900: rgb(23, 28, 31);
  --slate-800: rgb(31, 37, 41);
  --slate-700: rgb(42, 49, 54);
  --slate-600: rgb(57, 67, 74);
  --text: rgb(239, 232, 216);
  --text-bright: rgb(251, 244, 228);
  --text-dim: rgb(168, 161, 148);
  --gold: rgb(236, 200, 122);
  --gold-deep: rgb(169, 126, 52);
  --gold-ink: rgb(58, 42, 14);
  --band: rgb(138, 94, 58);
  --band-deep: rgb(88, 58, 36);
  --r-normal: rgb(242, 242, 242);
  --r-magic: rgb(115, 166, 255);
  --r-rare: rgb(189, 133, 255);
  --r-relic: rgb(77, 219, 179);
  --vague: rgb(230, 150, 255);
  --f-display: 'M PLUS Rounded 1c', 'Trebuchet MS', system-ui, sans-serif;
  --f-body: 'Fira Sans', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--slate-950); color: var(--text); font: 16px/1.6 var(--f-body); }
img { max-width: 100%; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.band { position: sticky; top: 0; z-index: 5; background: linear-gradient(180deg, var(--band) 0%, var(--band-deep) 100%); border-bottom: 2px solid var(--ink); }
.band::after { content: ''; position: absolute; left: 0; right: 0; bottom: -9px; height: 9px;
  background: radial-gradient(circle at 9px 0, var(--band-deep) 7px, transparent 7.5px) 0 0 / 18px 9px repeat-x; }
.band-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.logo { font: 800 24px/1 var(--f-display); color: var(--text-bright); letter-spacing: .02em; white-space: nowrap; text-shadow: 0 2px 0 var(--ink); }
.logo:hover { text-decoration: none; }
.logo small { font: 500 13px var(--f-body); color: rgb(240, 214, 180); margin-left: 8px; letter-spacing: 0; text-shadow: none; }
.search { margin-left: auto; position: relative; flex: 0 1 300px; min-width: 0; }
.search input { width: 100%; background: var(--slate-900); border: 1px solid var(--gold-deep); color: var(--text); border-radius: 6px; padding: 7px 12px; font: 15px var(--f-body); }
.results { position: absolute; right: 0; left: 0; top: calc(100% + 6px); background: var(--slate-800); border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.results a { display: flex; gap: 10px; align-items: center; padding: 6px 10px; color: var(--text); }
.results a:hover, .results a.on { background: var(--slate-700); text-decoration: none; }
.results img, .results .noimg { width: 28px; height: 28px; flex: none; }
.results .kind { margin-left: auto; color: var(--text-dim); font-size: 12px; white-space: nowrap; }

.shell { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px;
  padding: 28px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
nav.side { position: sticky; top: 80px; align-self: start; display: grid; gap: 14px; }
.panel { background: var(--slate-800); border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.panel h3 { margin: 0; font: 700 14px var(--f-display); color: var(--text-bright); background: var(--band-deep); padding: 6px 12px; letter-spacing: .03em; }
.panel ul { list-style: none; margin: 0; padding: 6px; }
.panel li a { display: block; padding: 4px 8px; border-radius: 5px; color: var(--text); font-size: 15px; }
.panel li a.here { background: var(--slate-700); color: var(--gold); }
.panel li a:hover { background: var(--slate-700); text-decoration: none; }

main { min-width: 0; }
.crumbs { color: var(--text-dim); font-size: 14px; margin-bottom: 4px; }
h1 { font: 800 clamp(28px, 4vw, 38px)/1.15 var(--f-display); color: var(--text-bright); margin: 0 0 6px; text-wrap: balance; }
h2 { font: 700 22px/1.3 var(--f-display); color: var(--text-bright); margin: 36px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--slate-600); text-wrap: balance; }
.lede { color: var(--text-dim); max-width: 66ch; margin: 0 0 20px; }
.prose { max-width: 68ch; }
.prose p { margin: 0 0 12px; }
.prose strong { color: var(--text-bright); }
.prose ul { padding-left: 20px; margin: 0 0 12px; }
.prose.vague, .tbl-wrap.vague, .facts.vague { border-left: 3px solid var(--vague); padding-left: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 8px; color: var(--text); text-align: center; font-size: 14px; line-height: 1.25; transition: background .12s; }
.tile img { width: 72px; height: 72px; transition: transform .15s; filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)); }
.tile:hover { background: var(--slate-800); text-decoration: none; }
.tile:hover img { transform: translateY(-3px) scale(1.06); }
.tile .sub { color: var(--text-dim); font-size: 12px; }
.tile.relic .name { color: var(--r-relic); }
@media (prefers-reduced-motion: reduce) { .tile, .tile img { transition: none; } .tile:hover img { transform: none; } }

.item-top { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; margin-top: 8px; }
.item-side { min-width: 0; }
.card-solo { max-width: 420px; margin: 8px 0 20px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; margin: 0 0 12px; }
.facts dt { color: var(--text-dim); }
.facts dd { margin: 0; }
.chip { display: inline-block; font-size: 13px; padding: 0 8px; border-radius: 10px; background: var(--slate-700); color: var(--text); }

.card { --r: var(--r-normal); --tint: 0; background: var(--slate-900); border: 2px solid var(--r); border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px var(--ink), 0 12px 30px rgba(0,0,0,.45); font-size: 15px; }
.card.magic { --r: var(--r-magic); --tint: 10%; }
.card.rare { --r: var(--r-rare); --tint: 14%; }
.card.relic { --r: var(--r-relic); --tint: 18%; }
.card .top { padding: 12px 14px 10px; background: color-mix(in srgb, var(--r) var(--tint), var(--slate-800)); }
.pill { display: inline-block; background: var(--r); color: var(--ink); font: 700 12px var(--f-display); padding: 1px 8px; border-radius: 4px; }
.card .name { font: 700 21px/1.25 var(--f-display); color: var(--text-bright); margin: 6px 0 8px; }
.card .row { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.card .ico { width: 64px; height: 64px; flex: none; border: 2px solid var(--r); border-radius: 6px; background: var(--slate-700); display: grid; place-items: center; }
.card .ico img { width: 52px; height: 52px; }
.card .base a { color: var(--text); }
.card .kind { color: var(--text-dim); font-size: 14px; }
.card .req { color: var(--text-dim); font-size: 14px; margin-top: 8px; }
.card .sec { text-align: center; color: var(--text-dim); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 6px; border-top: 1px solid var(--ink); background: var(--slate-900); }
.card .mod { display: flex; gap: 10px; align-items: baseline; padding: 7px 14px; }
.card .mod:nth-of-type(odd) { background: var(--slate-800); }
.card .mod::before { content: ''; width: 7px; height: 7px; transform: rotate(45deg) translateY(-2px); background: var(--r); flex: none; }
.card .mod.imp::before { background: rgb(168, 160, 148); }
.card .mod.rule { color: var(--r); }
.card .flav { font-style: italic; color: var(--text-dim); padding: 10px 14px; border-top: 1px solid var(--ink); font-size: 14px; }

.tbl-wrap { overflow-x: auto; border: 2px solid var(--ink); border-radius: 8px; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; background: var(--slate-800); font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--slate-700); vertical-align: top; }
th { font: 700 13px var(--f-display); color: var(--text-dim); letter-spacing: .04em; background: var(--slate-900); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.swatch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.swatch a { color: inherit; }
.swatch i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--ink); }

.foot { max-width: 1240px; margin: 0 auto; color: var(--text-dim); font-size: 13px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }

@media (max-width: 920px) {
  .item-top { grid-template-columns: minmax(0, 1fr); }
  .item-top .card { max-width: 420px; order: -1; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 20px; }
  nav.side { position: static; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .logo small { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .tile img { width: 60px; height: 60px; }
}
