/* Spiritfate DB — styled after meowdb's item database. Rarity colours stay the game's own. */
:root {
  --bg: #110f16;
  --surface: #1a1e2a;
  --surface-hover: #232838;
  --inset: #12151e;
  --border: #343a4c;
  --border-soft: rgba(52, 58, 76, 0.5);
  --text: #eeeae2;
  --muted: #b0aca2;
  --dim: #7f7b73;
  --accent: #ff8a3d;
  --accent-bg: rgba(255, 138, 61, 0.15);
  --accent-border: rgba(255, 138, 61, 0.25);
  --accent-nav: rgba(255, 138, 61, 0.10);
  --good: #7ee787;
  --bad: #ff6b6b;
  /* game rarity colours (ItemView.RarityColorOf) — rarity pills only */
  --rarity-magic: #5fb4ff;
  --rarity-rare: #ffd641;
  --rarity-unique: #ff9a3d;
  --discord: #5865f2;
  --sidebar-w: 210px;
  --topbar-h: 64px;
  /* One centred reading column shared by the topbar and the page (Jimmy, 2026-09-03). */
  --col-w: 1400px;
  --col-pad: 32px;
  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: "Baloo 2", "Montserrat", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font); }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
b, strong { font-weight: 600; }
button, select, input { font: inherit; color: inherit; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; color: var(--muted); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; }
h1 { font-size: 24px; line-height: 1.2; }
.micro { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.rarity-unique { color: var(--rarity-unique) !important; }
.rarity-rare { color: var(--rarity-rare); }
.rarity-magic { color: var(--rarity-magic); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 16px 12px 12px; z-index: 40;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 8px 10px; font-family: var(--display); font-weight: 800; font-size: 19px; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-logo { display: block; width: 170px; max-width: 100%; height: auto; }
.brand em { font-style: normal; color: var(--muted); font-size: 10px; margin-left: 2px; letter-spacing: 0.14em; text-transform: uppercase; }
.nav-section { margin-top: 18px; }
.nav-section .micro { padding: 0 10px 6px; display: block; }
.nav-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--text); font-weight: 500; }
.nav-row:hover { background: var(--surface-hover); color: var(--text); }
.nav-row.active { background: var(--accent-nav); color: var(--accent); }
.nav-row .glyph { width: 16px; text-align: center; font-size: 13px; opacity: 0.8; flex: 0 0 auto; }
.nav-row .count { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 500; }
.nav-row.active .count { color: var(--accent); opacity: 0.8; }
/* ---------- Join Discord ---------- */
.discord-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; padding: 9px 12px;
  border-radius: 8px; border: 1px solid rgba(88, 101, 242, 0.4); background: rgba(88, 101, 242, 0.14);
  color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
}
.discord-btn:hover { background: rgba(88, 101, 242, 0.26); border-color: var(--discord); color: var(--text); }
.discord-btn .discord-mark { width: 18px; height: 14px; flex: 0 0 auto; color: var(--discord); }
.discord-btn:hover .discord-mark { color: #8b95f7; }
.sidebar-footer { margin-top: auto; padding: 14px 10px 0; font-size: 10px; color: var(--dim); line-height: 1.5; border-top: 1px solid var(--border-soft); }
.sidebar-footer code { color: var(--muted); font-size: 10px; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 35; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column;
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px); background-size: 22px 22px; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  background: rgba(17, 15, 22, 0.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border-soft); }
/* The bar rides the same centred column as the page, so search and content share an edge. */
.topbar-inner { width: 100%; max-width: var(--col-w); height: 100%; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 0 var(--col-pad); }
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; width: 40px; height: 40px; cursor: pointer; font-size: 18px; line-height: 1; flex: 0 0 auto; }
.search { position: relative; flex: 1; }
.search .mag { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 40px; padding: 0 44px 0 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none; font-size: 14px; }
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--accent); }
.search input::-webkit-search-cancel-button { appearance: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 500 11px var(--font); color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 7px; pointer-events: none; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; max-height: 440px; overflow: auto; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 14px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.active { background: var(--surface-hover); color: var(--accent); }
.search-results .sub { color: var(--muted); font-size: 12px; }
.search-results .kind { margin-left: auto; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.search-results img { width: 28px; height: 28px; border-radius: 6px; background: var(--inset); object-fit: contain; flex: 0 0 auto; }
.sha-pill { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9999px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--muted); white-space: nowrap; }
.sha-pill code { color: var(--text); font-size: 12px; }

.content { width: 100%; max-width: var(--col-w); margin: 0 auto; padding: 28px var(--col-pad) 80px; }
.loading { color: var(--muted); padding: 60px; text-align: center; }

/* ---------- page heads ---------- */
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.crumb .sep { margin: 0 6px; color: var(--dim); }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { margin: 0; color: var(--muted); font-size: 15px; }
.page-head p a { color: var(--text); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; margin-bottom: 18px; }
.panel.tight { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { font-family: var(--font); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text); }
.panel-head .cap { font-size: 12px; color: var(--muted); text-align: right; }
.panel-head .cap a { color: var(--muted); }
.panel-head .cap a:hover { color: var(--accent); }
.panel.tight .panel-head { padding: 18px 22px 0; }
.prose { font-size: 15px; line-height: 1.75; color: var(--text); max-width: 76ch; }
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--accent); }
.prose .flavor { color: var(--muted); font-style: italic; }
.empty { color: var(--muted); font-style: italic; font-size: 14px; }

/* ---------- filter panel ---------- */
.filter-panel .in-search { position: relative; margin-bottom: 14px; }
.filter-panel .in-search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; font-size: 14px; }
.filter-panel .in-search input:focus { border-color: var(--accent); }
.filter-panel .in-search .mag { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.frow { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.frow + .frow { border-top: 1px solid var(--border-soft); }
.frow .flabel { flex: 0 0 76px; padding-top: 7px; }
.frow .fbody { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; min-width: 0; }
.frow .fbody.controls { gap: 8px 18px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 9999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.2; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip b { font-weight: 400; color: var(--muted); }
.chip.active { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); }
.chip.active b { color: var(--accent); opacity: 0.8; }
.chip.on-dark { background: var(--bg); }
.ctl { display: inline-flex; align-items: center; gap: 8px; }
.ctl select { height: 30px; padding: 0 26px 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b0aca2' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; color: var(--text); font-size: 12px; appearance: none; cursor: pointer; }
.ctl select:focus { outline: none; border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.check.on { color: var(--text); }
.frow .clear { margin-left: auto; align-self: center; background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 6px 0; }
.frow .clear:hover { color: var(--accent); }
.adv-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 10px 0 0; cursor: pointer; }
.adv-toggle:hover .micro { color: var(--accent); }
.adv-toggle .tri { font-size: 10px; color: var(--muted); transition: transform 0.15s; }
.adv-toggle[aria-expanded="true"] .tri { transform: rotate(180deg); }
.advanced { padding-top: 6px; }
.advanced[hidden] { display: none; }

/* ---------- results table ---------- */
.table-wrap { overflow-x: auto; }
table.results { width: 100%; border-collapse: collapse; font-size: 14px; }
table.results th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.results td { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.results tbody tr { height: 68px; }
table.results tbody tr:last-child td { border-bottom: none; }
table.results tbody tr:hover td { background: var(--surface-hover); }
table.results tbody tr:hover td.empty-cell { background: transparent; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.name-cell { display: flex; align-items: center; gap: 14px; min-width: 220px; }
.name-cell .icon { flex: 0 0 auto; }
.name-cell .nm { font-weight: 500; font-size: 14px; color: var(--text); line-height: 1.3; }
.name-cell .nm.rarity-unique { color: var(--rarity-unique); }
tr:hover .name-cell .nm { color: var(--accent); }
.name-cell .sub { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.name-cell .sub a { color: var(--muted); }
.name-cell .sub a:hover { color: var(--accent); }
.icon { width: 36px; height: 36px; border-radius: 8px; background: var(--inset); border: 1px solid var(--border-soft); object-fit: contain; display: inline-block; }
.icon.sm { width: 28px; height: 28px; border-radius: 6px; }
.icon.xs { width: 22px; height: 22px; border-radius: 5px; }
.stat-lines { font-size: 12.5px; line-height: 1.7; color: var(--text); }
.stat-lines div { white-space: nowrap; }
.stat-lines .v { font-weight: 500; }
.stat-lines .t { color: var(--muted); font-size: 11px; margin-left: 4px; }
.stat-lines .upg { color: var(--muted); white-space: normal; }
.cell-sub { color: var(--muted); font-size: 12px; line-height: 1.45; }
/* A stacked cell: the value, then its qualifiers, each on its own line with room to breathe. */
td .cell-sub { margin-top: 4px; white-space: nowrap; }
.cell-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.cell-stack .tag { margin: 0; }
.cell-stack .cell-sub { margin-top: 0; }
td.num .cell-sub { font-size: 11px; }
.desc-cell { font-size: 13px; color: var(--muted); white-space: normal; max-width: 380px; line-height: 1.45; }
/* long generated copy stays inside the 68px row rhythm */
.desc-cell.clamp { max-width: 460px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }

/* tags */
.tag { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; margin: 1px 4px 1px 0; white-space: nowrap; line-height: 1.3; }
.tag.src-demon { background: rgba(255, 107, 107, 0.15); color: #ff8f8f; }
.tag.src-nightmare { background: rgba(184, 115, 255, 0.15); color: #c9a0ff; }
.tag.src-mortal { background: rgba(255, 214, 65, 0.14); color: #ffd641; }
.tag.starter { background: rgba(126, 231, 135, 0.14); color: var(--good); }
.tag.retired { background: rgba(255, 255, 255, 0.06); color: var(--muted); text-decoration: line-through; }
.tag.twoh, .tag.slot, .tag.plain { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.tag.tier { background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid var(--border-soft); }
.tag.exceptional { background: rgba(255, 154, 61, 0.16); color: var(--rarity-unique); }
.tag.lesser { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.tag.unique { background: rgba(255, 154, 61, 0.16); color: var(--rarity-unique); }
.tag.kind { background: rgba(111, 243, 230, 0.12); color: #8ff0e6; }
.tag.prefix { background: rgba(95, 180, 255, 0.14); color: #8fc9ff; }
.tag.suffix { background: rgba(255, 214, 65, 0.14); color: #ffd641; }
.tag.affinity { color: #111; }
.tag.miniboss { background: rgba(255, 154, 61, 0.16); color: var(--rarity-unique); }

/* pagination — real <a href="?page=N"> links, so a crawler walks the same path a reader clicks */
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; padding: 16px; border-top: 1px solid var(--border-soft); font-size: 13px; color: var(--muted); }
.pager .pg { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 14px; font-size: 13px; color: var(--text); white-space: nowrap; }
.pager a.pg:hover { background: var(--surface-hover); border-color: var(--accent-border); color: var(--accent); }
.pager .pg.disabled { opacity: 0.4; }
.pager .pg-nums { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pager .pg.num { min-width: 38px; padding: 7px 10px; text-align: center; font-variant-numeric: tabular-nums; }
.pager .pg.num.on { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); }
.pager .pg.gap { background: none; border: none; padding: 0 2px; color: var(--dim); }
.pager .info { min-width: 100px; text-align: center; }
.results-count { padding: 14px 20px 0; font-size: 12px; color: var(--muted); }

/* an empty result gets a face rather than a shrug */
td.empty-cell { padding: 0 !important; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 46px 24px 52px; text-align: center; }
.empty-state img { width: 112px; height: 112px; object-fit: contain; opacity: 0.85; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; max-width: 40ch; }

/* ---------- detail pages ---------- */
.detail { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.detail-card { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; }
.detail-card h1 { color: var(--accent); font-size: 22px; line-height: 1.2; }
.detail-card .caption { color: var(--muted); font-size: 12px; margin: 4px 0 14px; }
.detail-card .tile { width: 100%; height: 160px; border-radius: 10px; background: var(--inset); border: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.45); }
.detail-card .tile img { width: 128px; height: 128px; object-fit: contain; }
.detail-card .tile .glyph { font-size: 64px; line-height: 1; color: var(--muted); }
.detail-card .tile .glyph.accent { color: var(--accent); }
.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.kv-row:first-child { border-top: none; }
.kv-row .k { flex: 0 0 auto; }
.kv-row .v { text-align: right; font-size: 13px; font-weight: 500; color: var(--good); }
.kv-row .v.plain { color: var(--text); }
.kv-row .v.muted { color: var(--muted); font-weight: 400; }
.kv-row .v a { color: var(--good); }
.kv-row .v a:hover { color: var(--accent); }
.detail-card .tags { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.detail-col { min-width: 0; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.mini th span { font-weight: 400; text-transform: none; letter-spacing: 0; }
table.mini td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.mini tbody tr:last-child td { border-bottom: none; }
table.mini tbody tr:hover td { background: var(--surface-hover); }
table.mini tr.hl td { background: var(--accent-bg); }
table.mini .icon-cell { width: 40px; }
table.mini .nm { font-weight: 500; }
.share { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.share-bar { height: 6px; background: var(--inset); border-radius: 3px; overflow: hidden; width: 90px; flex: 0 0 auto; }
.share-bar i { display: block; height: 100%; background: var(--muted); }
.share-bar.ex i { background: var(--accent); }

/* compare strip */
.strip { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 4px 0; }
.strip .arrow { font-size: 12px; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.strip .dot { color: var(--dim); flex: 0 0 auto; }
.strip .stop { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; white-space: nowrap; font-size: 13px; color: var(--text); flex: 0 0 auto; }
.strip .stop:hover { background: var(--surface-hover); }
.strip .stop.current { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); }
.strip .stop .lv { color: var(--muted); font-size: 12px; }
.strip .stop.current .lv { color: var(--accent); opacity: 0.8; }
.strip .stop.retired { opacity: 0.55; }

/* cards inside panels */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mini-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border-soft); color: var(--text); }
.mini-card:hover { border-color: var(--accent-border); color: var(--text); }
.mini-card .nm { font-weight: 500; font-size: 14px; }
.mini-card:hover .nm { color: var(--accent); }
.mini-card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a.chip { color: var(--text); }
.chips a.chip:hover { color: var(--accent); }

/* prev / next */
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.prevnext a { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.prevnext a:hover { border-color: var(--accent-border); }
.prevnext a:hover .nm { color: var(--accent); }
.prevnext a.next { text-align: right; align-items: flex-end; }
.prevnext .nm { font-weight: 500; font-size: 14px; }
.prevnext span.spacer { flex: 1; }

/* ---------- home: the hero ---------- */
/* One biome scenic sits behind the imp at low opacity so the page reads as a place, not a grid. */
.hero {
  position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--border);
  background: radial-gradient(120% 140% at 18% 30%, #241d2b 0%, var(--surface) 45%, var(--inset) 100%);
  margin: 0 0 26px; isolation: isolate;
}
.hero-scenic {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%;
  opacity: 0.2; z-index: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(100deg, transparent 6%, #000 55%);
  mask-image: linear-gradient(100deg, transparent 6%, #000 55%);
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(95deg, rgba(17, 15, 22, 0.94) 22%, rgba(17, 15, 22, 0.5) 62%, rgba(17, 15, 22, 0.72) 100%); }
.hero-inner { position: relative; z-index: 2; display: flex; align-items: center; gap: 30px; padding: 34px 38px 38px; }
/* the mascot: a soft pool of light under it, and the gentlest idle float */
.hero-mascot { position: relative; flex: 0 0 auto; width: 300px; max-width: 34vw; }
.hero-mascot::before {
  content: ""; position: absolute; left: 50%; bottom: 6%; width: 62%; height: 26px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 138, 61, 0.5), transparent 78%); filter: blur(7px);
}
.hero-mascot img {
  display: block; width: 100%; height: auto; position: relative;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.62)) drop-shadow(0 0 34px rgba(255, 138, 61, 0.22));
  animation: imp-float 5.5s ease-in-out infinite;
}
@keyframes imp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.hero-copy { min-width: 0; flex: 1; }
.hero-copy h1 { font-size: 38px; letter-spacing: -0.015em; margin-bottom: 10px; }
.hero-copy p { margin: 0; color: var(--text); opacity: 0.86; font-size: 17px; line-height: 1.55; max-width: 46ch; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-btn {
  display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 9999px;
  border: 1px solid var(--border); background: rgba(26, 30, 42, 0.8); color: var(--text); font-size: 14px; font-weight: 500;
}
.hero-btn:hover { border-color: var(--accent-border); background: var(--surface-hover); color: var(--accent); }
.hero-btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1208; font-weight: 600; }
.hero-btn.primary:hover { background: #ffa063; border-color: #ffa063; color: #1b1208; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 20px; }
.hero-stat { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hero-stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- home: the boss row and the Gate strip ---------- */
.portrait-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin-bottom: 28px; }
.portrait-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px 12px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.portrait-tile:hover { border-color: var(--accent-border); color: var(--text); background: var(--surface-hover); }
.portrait-tile .pt-art {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 116px; margin-bottom: 6px;
  background: radial-gradient(closest-side, rgba(255, 138, 61, 0.16), transparent 74%);
}
.portrait-tile .pt-art img { width: 116px; height: 116px; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55)); }
.portrait-tile .pt-art .glyph { font-size: 46px; color: var(--muted); }
.portrait-tile:hover .pt-art img { transform: translateY(-2px); }
.portrait-tile .pt-art img { transition: transform 0.15s ease; }
.portrait-tile .pt-nm { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.25; }
.portrait-tile:hover .pt-nm { color: var(--accent); }
.portrait-tile .pt-sub { font-size: 11.5px; color: var(--muted); }

.gate-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 28px; }
.gate-tile {
  --tint: var(--accent);
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; color: var(--text);
  background: var(--surface); /* fallback where color-mix() is not understood */
  background: linear-gradient(90deg, color-mix(in srgb, var(--tint) 14%, var(--surface)), var(--surface) 62%);
  border: 1px solid var(--border); border-left: 3px solid var(--tint); border-radius: 12px;
}
.gate-tile:hover { border-color: var(--accent-border); border-left-color: var(--tint); background: var(--surface-hover); color: var(--text); }
.gate-tile .gate-face { width: 76px; height: 76px; flex: 0 0 auto; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.gate-tile span.gate-face { display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--muted); }
.gate-tile .gate-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gate-tile .gate-nm { font-family: var(--display); font-weight: 700; font-size: 16px; }
.gate-tile:hover .gate-nm { color: var(--accent); }
.gate-tile .gate-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---------- the dead end ---------- */
.notfound { display: flex; align-items: center; gap: 34px; padding: 28px 0 12px; flex-wrap: wrap; }
.nf-art { width: 240px; height: 240px; max-width: 46vw; object-fit: contain; flex: 0 0 auto;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.6)); animation: imp-float 5.5s ease-in-out infinite; }
.nf-copy { min-width: 0; flex: 1; }
.nf-copy h1 { font-size: 32px; margin-bottom: 10px; }
.nf-copy p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 52ch; }
.nf-copy .nf-tip { margin-top: 16px; font-size: 13px; }
.nf-copy kbd { font: 500 11px var(--font); color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 7px; }

@media (prefers-reduced-motion: reduce) {
  .hero-mascot img, .nf-art { animation: none; }
  .portrait-tile .pt-art img { transition: none; }
}

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 28px; }
.cat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.cat-card:hover { border-color: var(--accent-border); color: var(--text); }
.cat-card .top { display: flex; align-items: center; gap: 10px; }
.cat-card .glyph { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-bg); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.cat-card .nm { font-family: var(--display); font-weight: 700; font-size: 18px; }
.cat-card .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.cat-card .desc { color: var(--muted); font-size: 13px; line-height: 1.45; flex: 1; }
.cat-card .go { font-size: 12px; color: var(--accent); font-weight: 500; margin-top: 4px; }
.explore-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.explore-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; color: var(--text); display: block; }
.explore-card:hover { border-color: var(--accent-border); color: var(--text); }
.explore-card .nm { font-weight: 600; font-size: 14px; }
.explore-card:hover .nm { color: var(--accent); }
.explore-card .desc { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.section-title { margin: 8px 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title .cell-sub a { color: var(--muted); }
.section-title .cell-sub a:hover { color: var(--accent); }

/* The design-doc notes on the economy page: kept, but folded away — they are the team talking. */
.dev-notes { border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg); }
.dev-notes > summary { cursor: pointer; padding: 12px 16px; font-size: 12px; color: var(--muted); list-style: none; }
.dev-notes > summary::-webkit-details-marker { display: none; }
.dev-notes > summary::before { content: "▸ "; color: var(--dim); }
.dev-notes[open] > summary::before { content: "▾ "; }
.dev-notes > summary:hover { color: var(--accent); }
.dev-notes > div { padding: 0 16px 14px; font-size: 13px; color: var(--muted); }

/* reference pages */
.aff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.aff-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; border-top-width: 3px; }
.aff-card h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.aff-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); }
  .sidebar.open { transform: translateX(0); }
  .backdrop.open { display: block; }
  .topbar { padding: 0 12px; gap: 8px; }
  .sha-pill { display: none; }
  .content { padding: 16px 14px 60px; }
  .topbar-inner { padding: 0 14px; }
  .detail { grid-template-columns: 1fr; }
  .detail-card { position: static; }
  .frow { flex-direction: column; gap: 6px; }
  .frow .flabel { flex: none; padding-top: 0; }
  .frow .clear { margin-left: 0; }
  .prevnext { flex-direction: column; }
  .prevnext a.next { align-items: flex-start; text-align: left; }
  /* the hero stacks: imp above the words, scenic washed further back so the copy stays readable */
  .hero { border-radius: 14px; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 20px 26px; text-align: left; }
  .hero-mascot { width: 168px; max-width: 46vw; align-self: center; }
  .hero-scenic { opacity: 0.14; -webkit-mask-image: none; mask-image: none; }
  .hero::after { background: linear-gradient(180deg, rgba(17, 15, 22, 0.72), rgba(17, 15, 22, 0.9)); }
  .hero-copy h1 { font-size: 27px; }
  .hero-copy p { font-size: 15.5px; }
  .hero-btn { padding: 9px 15px; font-size: 13.5px; }
  .portrait-strip { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
  .portrait-tile .pt-art { height: 92px; }
  .portrait-tile .pt-art img { width: 92px; height: 92px; }
  .gate-strip { grid-template-columns: 1fr; }
  .notfound { gap: 18px; padding: 12px 0; }
  .nf-art { width: 160px; height: 160px; align-self: center; }
  .pager { gap: 8px; }
  .pager .pg { padding: 7px 11px; }
}

/* readable stat blocks on detail pages, and the unique's upgrade note */
.stat-lines.lg { font-size: 13.5px; line-height: 1.85; }
.upgrade-block { margin-bottom: 14px; }
.upgrade-block:last-child { margin-bottom: 0; }
.upgrade-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 4px 0; max-width: 76ch; }

/* ---------- icons: renders, glyph boxes and swatches ---------- */
.icon.lg { width: 56px; height: 56px; border-radius: 10px; }
.icon.shot { object-fit: cover; }
.glyph-box { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); }
.swatch-box { border: 1px solid var(--border-soft); }
.detail-card .tile img.shot { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.name-cell.tight { min-width: 0; gap: 10px; }
.sub-head { margin: 16px 0 8px; }
.sub-head:first-child { margin-top: 0; }

/* the biome scenic, and the portrait rows that link one actor */
.banner { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 18px; line-height: 0; }
.banner img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.banner .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 18px 12px; line-height: 1.4;
  background: linear-gradient(transparent, rgba(17, 15, 22, 0.9)); }
.portrait-row { display: flex; gap: 16px; align-items: center; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border-soft); color: var(--text); }
.portrait-row:hover { border-color: var(--accent-border); color: var(--text); }
.portrait-row > img.shot { width: 120px; height: 120px; object-fit: contain; flex: 0 0 auto; border-radius: 8px; background: var(--inset); }
.portrait-row > img.shot.wide { width: 180px; height: 101px; object-fit: cover; }
.portrait-row > .glyph { width: 120px; text-align: center; font-size: 44px; color: var(--muted); flex: 0 0 auto; }
.portrait-row > div { min-width: 0; flex: 1; }
.portrait-row .nm { font-family: var(--display); font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.portrait-row:hover .nm { color: var(--accent); }
.portrait-row .kv { margin-top: 8px; }

/* ---------- the Renown board ---------- */
.tree-wrap { overflow-x: auto; }
svg.tree { display: block; min-width: 720px; }
svg.tree .tnode { cursor: pointer; }
svg.tree .tnode circle:first-child { transition: opacity 0.12s; }
svg.tree .tnode.off { opacity: 0.22; }
svg.tree .tnode:hover circle:first-child { stroke-width: 4; }
svg.tree .tnode.picked circle:first-child { stroke: var(--accent); stroke-width: 4; }
.legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; justify-content: flex-end; }
.legend .lg, .panel-head .cap .lg { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.legend .lg.on { color: var(--accent); }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.cluster-tag { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.picked-node { display: flex; gap: 16px; align-items: flex-start; }
.picked-node h4 { font-family: var(--display); font-weight: 700; font-size: 18px; margin: 0 0 2px; }
.picked-node p { margin: 8px 0; font-size: 14px; line-height: 1.6; }
.opt-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border-soft); }
.opt .chips { margin-top: 6px; }
.opt b { font-size: 13px; }

/* ---------- the spirit ladder ---------- */
.ladder { display: flex; flex-direction: column; gap: 2px; }
.rung { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--border-soft); }
.rung:first-child { border-top: none; }
.rung.infusion { background: linear-gradient(90deg, var(--accent-nav), transparent); border-radius: 8px; padding-left: 10px; }
.rung .lv { display: flex; align-items: center; gap: 8px; }
.rung .proc { margin-top: 6px; font-size: 13px; line-height: 1.5; }
.rung .proc .cell-sub { display: block; white-space: normal; }
.rung .num { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.rung .num .chip { cursor: default; }

/* ---------- bench services ---------- */
.svc-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.svc-head .nm { font-size: 15px; font-weight: 600; }
.svc-head .cell-sub { white-space: normal; margin-top: 4px; max-width: 76ch; }

/* rarity and draft-type pills reuse the game's own rarity colours */
.tag.rar-common { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.tag.rar-magic { background: rgba(95, 180, 255, 0.14); color: var(--rarity-magic); }
.tag.rar-rare { background: rgba(255, 214, 65, 0.14); color: var(--rarity-rare); }
.tag.rar-legendary, .tag.rar-unique { background: rgba(255, 154, 61, 0.16); color: var(--rarity-unique); }
.tag.draft-major { background: var(--accent-bg); color: var(--accent); }
.tag.draft-minor { background: rgba(255, 255, 255, 0.06); color: var(--muted); }

@media (max-width: 900px) {
  .rung { grid-template-columns: 1fr; gap: 6px; }
  .rung .num { justify-content: flex-start; }
  .portrait-row { flex-direction: column; align-items: flex-start; }
  .picked-node { flex-direction: column; }
}

/* ---------- site footer ---------- */
.main > .content { flex: 1 0 auto; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.site-footer-inner {
  width: 100%; max-width: var(--col-w); margin: 0 auto; padding: 28px var(--col-pad) 34px;
  display: flex; gap: 40px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
}
.foot-about { max-width: 38ch; }
.foot-brand { padding: 0 0 8px; font-size: 17px; }
.foot-about p { margin: 0; color: var(--dim); font-size: 12.5px; line-height: 1.6; }
.foot-links { display: grid; grid-template-columns: repeat(2, minmax(96px, auto)); gap: 6px 28px; }
.foot-links a { font-size: 13px; color: var(--muted); }
.foot-links a:hover { color: var(--accent); }
.site-footer .discord-btn { margin-top: 0; margin-left: auto; } /* stays right-hand when the row wraps */

@media (max-width: 900px) {
  .site-footer-inner { padding: 22px 14px 28px; gap: 22px; }
  .foot-links { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .site-footer .discord-btn { width: 100%; }
}
