/* SUGOROKU Adventurer's Guide — GitBook-style player guide. Light by default, dark via OS setting or the toggle.
   Six languages through assets/i18n.js; each language picks its fonts below (loaded by i18n.js). */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f5f0e8;
  --text: #221d18;
  --muted: #6d6458;
  --faint: #9a9083;
  --border: #ebe3d6;
  --accent: #e0531a;
  --accent-ink: #b8400e;
  --accent-soft: #fdebe1;
  --gold: #c58a12;
  --gold-soft: #fbf1d8;
  --link: #c2410c;
  --bronze: #b06a35;
  --silver: #7d8a99;
  --goldt: #cf9a12;
  --jackpot: #8b4fd8;
  --fwd: #2f74d0;
  --back: #d13a35;
  --ok: #1f8f55;
  --info: #2f6fd0;
  --warn: #c27a00;
  --danger: #c93030;
  --info-bg: #eef4fd;
  --ok-bg: #eaf7f0;
  --warn-bg: #fdf5e4;
  --danger-bg: #fdeeee;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .07);
  --radius: 14px;
  --header-h: 60px;
  --side-w: 288px;
  --toc-w: 230px;
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Nunito", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root:lang(ja) {
  --font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-head: "M PLUS Rounded 1c", "Noto Sans JP", "Hiragino Maru Gothic ProN", "Yu Gothic UI", system-ui, sans-serif;
}
:root:lang(ko) {
  --font: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-head: "Nunito", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
:root:lang(zh) {
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-head: "Nunito", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
:root:lang(th) {
  --font: "Sarabun", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --font-head: "Kanit", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131015; --surface: #1c181f; --surface-2: #241f28; --text: #efe8de; --muted: #b3a89a; --faint: #857b70;
    --border: #2f2933; --accent: #ff7a3d; --accent-ink: #ff9a66; --accent-soft: #3a2218; --gold: #f0b93a; --gold-soft: #33280f;
    --link: #ff9a66; --info-bg: #17233a; --ok-bg: #132a1f; --warn-bg: #2f240e; --danger-bg: #331616;
    --info: #79a8ff; --ok: #5fd39a; --warn: #f3b445; --danger: #ff7b7b; --fwd: #6aa6ff; --back: #ff6f6a; --silver: #a9b5c3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131015; --surface: #1c181f; --surface-2: #241f28; --text: #efe8de; --muted: #b3a89a; --faint: #857b70;
  --border: #2f2933; --accent: #ff7a3d; --accent-ink: #ff9a66; --accent-soft: #3a2218; --gold: #f0b93a; --gold-soft: #33280f;
  --link: #ff9a66; --info-bg: #17233a; --ok-bg: #132a1f; --warn-bg: #2f240e; --danger-bg: #331616;
  --info: #79a8ff; --ok: #5fd39a; --warn: #f3b445; --danger: #ff7b7b; --fwd: #6aa6ff; --back: #ff6f6a; --silver: #a9b5c3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.85; letter-spacing: .01em; }
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-head); font-weight: 800; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .08em; line-height: 1.2; }
.brand b { display: block; font-size: 17px; line-height: 1.2; }
.searchbtn { flex: 1; max-width: 420px; margin-left: auto; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 14px; }
.searchbtn kbd { margin-left: auto; font-family: inherit; font-size: 11px; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.iconbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; flex: none; }
.iconbtn svg { width: 18px; height: 18px; }
.playbtn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 10px; background: linear-gradient(135deg, #ff7a3d, #e0391a); color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; box-shadow: 0 4px 14px rgba(224, 83, 26, .35); flex: none; }
.playbtn:hover { text-decoration: none; filter: brightness(1.06); }

/* Language switcher (same behaviour as the LP's: ?lang=, then the saved "sugoroku-lang", then the browser) */
html.i18n-pending body { visibility: hidden; }
.lang { position: relative; flex: none; }
.lang summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 12.5px; font-weight: 800; letter-spacing: .04em; line-height: 1; white-space: nowrap; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary svg { width: 17px; height: 17px; flex: none; }
.lang summary:hover, .lang[open] summary { border-color: var(--accent); }
.lang-panel { position: absolute; right: 0; top: 46px; z-index: 60; display: grid; gap: 2px; min-width: 180px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
button[data-lang] { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 14.5px; line-height: 1.3; color: var(--muted); text-align: left; }
button[data-lang]:hover { background: var(--surface-2); color: var(--text); }
button[data-lang][aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
button[data-lang][aria-pressed="true"]::after { content: ""; flex: none; width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }
.menubtn { display: none; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); max-width: 1480px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 22px 14px 40px 18px; border-right: 1px solid var(--border); }
.sidebar .grp { margin: 18px 0 6px; padding: 0 10px; font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--faint); }
.sidebar .grp:first-child { margin-top: 0; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.sidebar a .ico { width: 22px; text-align: center; flex: none; font-size: 15px; }
.side-foot { margin-top: 26px; padding: 12px; border: 1px dashed var(--border); border-radius: 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }

main { min-width: 0; padding: 34px 48px 80px; }
.page { display: none; max-width: 820px; margin: 0 auto; animation: pagein .35s ease; }
.page.on { display: block; }
@keyframes pagein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } * { transition: none !important; animation: none !important; } }

.toc { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 34px 18px 40px 10px; font-size: 13px; }
.toc h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .1em; color: var(--faint); }
.toc a { display: block; padding: 4px 10px; border-left: 2px solid var(--border); color: var(--muted); line-height: 1.5; }
.toc a.lv3 { padding-left: 22px; font-size: 12.5px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.on { border-left-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* ---------- Typography ---------- */
.crumb { font-size: 13px; font-weight: 700; color: var(--accent-ink); letter-spacing: .06em; margin-bottom: 6px; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.4; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 4.2vw, 38px); margin: 0 0 12px; font-weight: 800; }
h2 { font-size: 24px; margin: 52px 0 14px; padding-top: 10px; font-weight: 800; position: relative; }
h2::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--gold)); margin-bottom: 12px; }
h3 { font-size: 19px; margin: 32px 0 10px; font-weight: 800; }
h4 { font-size: 16px; margin: 22px 0 6px; }
p { margin: 0 0 14px; }
.lead { font-size: 18px; color: var(--muted); line-height: 1.8; margin-bottom: 22px; }
ul, ol { padding-left: 1.4em; margin: 0 0 16px; }
li { margin: 4px 0; }
strong { font-weight: 800; }
.mark { background: linear-gradient(transparent 60%, color-mix(in srgb, var(--gold) 35%, transparent) 60%); font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
code, .addr { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .86em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; word-break: break-all; }
.ui { display: inline-block; font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 700; font-size: .85em; line-height: 1.5; padding: 1px 9px; border-radius: 999px; background: linear-gradient(180deg, #2b2530, #19151c); color: #ffe9c7; border: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255,255,255,.12); max-width: 100%; vertical-align: 1px; }
.small { font-size: 13.5px; color: var(--muted); }
.center { text-align: center; }

/* ---------- Hero ---------- */
.hero { position: relative; border-radius: 22px; overflow: hidden; min-height: 380px; display: flex; align-items: flex-end; margin-bottom: 30px; box-shadow: var(--shadow); background: #1b0f0a; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,4,2,0) 30%, rgba(10,4,2,.82) 100%), linear-gradient(90deg, rgba(10,4,2,.55), rgba(10,4,2,0) 60%); }
.hero-body { position: relative; z-index: 1; padding: 30px 32px; color: #fff; }
.hero-body .eyebrow { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .14em; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); margin-bottom: 12px; }
.hero-body h1 { color: #fff; font-size: clamp(30px, 5vw, 46px); text-shadow: 0 3px 16px rgba(0,0,0,.5); margin-bottom: 6px; }
.hero-body p { color: #ffe6cf; font-size: 17px; margin-bottom: 18px; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 12px; font-weight: 800; font-size: 15px; border: 0; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn.primary { background: linear-gradient(135deg, #ffb340, #ff6a2b); color: #2a1206; box-shadow: 0 6px 18px rgba(255, 106, 43, .4); }
.btn.ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn.solid { background: var(--accent); color: #fff; }

/* Page banner (illustration under the title) */
.banner { margin: 6px 0 26px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); position: relative; background: #1b0f0a; }
.banner img { width: 100%; aspect-ratio: 16 / 7.2; object-fit: cover; }
.banner figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 18px 10px; font-size: 13px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }

/* ---------- Blocks ---------- */
.hint { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; margin: 18px 0; background: var(--info-bg); border-left: 4px solid var(--info); font-size: 15px; line-height: 1.75; }
.hint .hi { flex: none; font-size: 20px; line-height: 1.3; }
.hint > div > :last-child { margin-bottom: 0; }
.hint b.ttl { display: block; margin-bottom: 2px; }
.hint.ok { background: var(--ok-bg); border-color: var(--ok); }
.hint.warn { background: var(--warn-bg); border-color: var(--warn); }
.hint.danger { background: var(--danger-bg); border-color: var(--danger); }
.hint.tip { background: var(--gold-soft); border-color: var(--gold); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 18px 0 24px; }
.card { display: block; padding: 16px 16px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.card .ci { font-size: 26px; line-height: 1; margin-bottom: 8px; }
.card b { display: block; font-family: var(--font-head); font-size: 16px; margin-bottom: 4px; }
.card span { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.65; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0 26px; }
.stat { padding: 14px 14px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); text-align: center; }
.stat b { display: block; font-family: var(--font-head); font-size: 28px; line-height: 1.2; background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; }

.steps { list-style: none; padding: 0; margin: 20px 0 28px; counter-reset: st; }
.steps > li { position: relative; padding: 4px 0 22px 62px; margin: 0; counter-increment: st; }
.steps > li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 19px; color: #fff; background: linear-gradient(135deg, #ff9a3d, #e0391a); box-shadow: 0 4px 12px rgba(224, 57, 26, .35); }
.steps > li::after { content: ""; position: absolute; left: 21px; top: 50px; bottom: 4px; width: 2px; background: repeating-linear-gradient(var(--border) 0 6px, transparent 6px 10px); }
.steps > li:last-child::after { display: none; }
.steps > li > b:first-child { display: block; font-family: var(--font-head); font-size: 17.5px; margin-bottom: 2px; }

.tblwrap { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.6; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 800; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

details.acc { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 10px 0; box-shadow: var(--shadow); }
details.acc > summary { cursor: pointer; list-style: none; padding: 13px 44px 13px 16px; font-weight: 800; position: relative; line-height: 1.6; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "＋"; position: absolute; right: 16px; top: 12px; color: var(--accent); font-weight: 800; }
details.acc[open] > summary::after { content: "－"; }
details.acc > div { padding: 0 16px 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
details.acc > div > :last-child { margin-bottom: 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 14px; }
.tab img { width: 30px; height: 30px; object-fit: contain; }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(224, 83, 26, .3); }

figure.fig { margin: 20px 0 26px; }
figure.fig img { border-radius: 14px; box-shadow: var(--shadow); }
figure.fig figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; text-align: center; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two > * { min-width: 0; }

/* Scene strip on the welcome page */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 26px; }
.scene { position: relative; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: #1b0f0a; color: #fff; }
.scene img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; transition: transform .4s ease; }
.scene:hover img { transform: scale(1.04); }
.scene div { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 12px 10px; background: linear-gradient(transparent, rgba(0,0,0,.78)); font-size: 13px; line-height: 1.5; }
.scene div b { display: block; font-family: var(--font-head); font-size: 15px; }
.scene i { position: absolute; top: 8px; left: 8px; font-style: normal; font-weight: 800; font-size: 12px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 1px 9px; }

/* Arena cards */
.arena-card { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); margin: 18px 0; }
.arena-card .art { position: relative; background: #1b0f0a; min-height: 220px; }
.arena-card .art img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.arena-card .art .tag { position: absolute; left: 12px; top: 12px; font-weight: 800; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #ffd79a; border: 1px solid rgba(255,215,154,.4); }
.arena-card .body { padding: 16px 18px 14px; }
.arena-card h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.arena-card h3 small { font-size: 13px; color: var(--muted); font-weight: 700; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.kv div { background: var(--surface-2); border-radius: 10px; padding: 7px 10px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.kv div b { display: block; font-size: 16px; color: var(--text); font-family: var(--font-head); }
.split { display: flex; height: 12px; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.split i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

/* Tile legend */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.tilecard { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 12px; text-align: center; box-shadow: var(--shadow); }
.tilecard img { width: 92px; height: 92px; margin: 0 auto 6px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.tilecard b { display: block; font-family: var(--font-head); }
.tilecard span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* Board map */
.board { display: grid; grid-template-columns: repeat(var(--cols, 13), minmax(0, 1fr)); gap: 4px; padding: 12px; border-radius: 16px; background: radial-gradient(120% 100% at 50% 0%, #3b1d12, #140b08); box-shadow: inset 0 0 40px rgba(255, 90, 20, .18), var(--shadow); }
.cell { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; }
.cell img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.cell .n { position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); font-size: 10px; font-weight: 800; line-height: 1.2; padding: 0 4px; border-radius: 4px; background: rgba(0,0,0,.72); color: #fff; font-family: ui-sans-serif, system-ui, sans-serif; }
.cell .e { position: absolute; right: 2%; top: 2%; font-size: 10px; font-weight: 800; line-height: 1.2; padding: 0 4px; border-radius: 4px; color: #fff; }
.cell .e.f { background: var(--fwd); }
.cell .e.b { background: var(--back); }
.cell.sel { outline: 3px solid #ffd166; outline-offset: 1px; }
.board-info { margin-top: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); min-height: 54px; font-size: 14.5px; }
.board-count { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 2px 10px 2px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.pill img { width: 22px; height: 22px; }

/* Widgets */
.widget { border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); padding: 18px; box-shadow: var(--shadow); margin: 18px 0 26px; }
.widget h4 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.widget h4 .badge { font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; letter-spacing: .06em; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.form input, .form select { width: 100%; margin-top: 4px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; }
.out { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.out div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.out div b { display: block; font-family: var(--font-head); font-size: 20px; color: var(--text); }
.out div.win b { color: var(--ok); }
.out div.lose b { color: var(--danger); }
.fight { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fight-res { flex: 1; min-width: 220px; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--border); font-weight: 700; }
.fight-res.win { border-style: solid; border-color: var(--ok); background: var(--ok-bg); }
.fight-res.lose { border-style: solid; border-color: var(--danger); background: var(--danger-bg); }
.fight-res .big { font-size: 26px; }
.shake { animation: shake .45s ease; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-6px) rotate(-1deg); } 40% { transform: translateX(6px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* Dice toy */
.dice-toy { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.die { width: 64px; height: 64px; border-radius: 14px; background: linear-gradient(145deg, #fff, #ebe6df); box-shadow: inset 0 -4px 0 rgba(0,0,0,.08), 0 6px 16px rgba(0,0,0,.25); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 9px; gap: 2px; flex: none; }
.die i { width: 11px; height: 11px; border-radius: 50%; background: #1d1714; place-self: center; visibility: hidden; }
.die.r1 i:nth-child(5), .die.r2 i:nth-child(1), .die.r2 i:nth-child(9), .die.r3 i:nth-child(1), .die.r3 i:nth-child(5), .die.r3 i:nth-child(9),
.die.r4 i:nth-child(1), .die.r4 i:nth-child(3), .die.r4 i:nth-child(7), .die.r4 i:nth-child(9),
.die.r5 i:nth-child(1), .die.r5 i:nth-child(3), .die.r5 i:nth-child(5), .die.r5 i:nth-child(7), .die.r5 i:nth-child(9),
.die.r6 i:nth-child(1), .die.r6 i:nth-child(3), .die.r6 i:nth-child(4), .die.r6 i:nth-child(6), .die.r6 i:nth-child(7), .die.r6 i:nth-child(9) { visibility: visible; }
.die.r1 i:nth-child(5) { background: #d62d20; width: 15px; height: 15px; }
.die.spin { animation: spin .6s ease; }
@keyframes spin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(200deg) scale(.85); } 100% { transform: rotate(360deg) scale(1); } }

/* Flow diagram */
.flow { display: grid; gap: 10px; margin: 18px 0 26px; }
.flow-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.node { flex: 1; min-width: 150px; padding: 12px 12px 10px; border-radius: 14px; border: 2px solid var(--c, var(--border)); background: color-mix(in srgb, var(--c, var(--surface)) 9%, var(--surface)); font-size: 13.5px; line-height: 1.55; }
.node b { display: block; font-family: var(--font-head); font-size: 15px; margin-bottom: 2px; }
.arrow { display: grid; place-items: center; color: var(--faint); font-weight: 800; font-size: 20px; padding: 0 2px; }
.arrow.down { width: 100%; padding: 0; line-height: 1; }

.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 12px; }
.chart .grid line { stroke: var(--border); }
.chart .axis { stroke: var(--faint); }

/* Hero roster */
.ranks { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 16px 0 24px; }
.rank { text-align: center; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); padding: 10px 8px; box-shadow: var(--shadow); }
.rank img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.rank b { display: block; font-family: var(--font-head); font-size: 14px; }
.rank span { display: block; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* Glossary */
dl.gloss { display: grid; grid-template-columns: 190px 1fr; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
dl.gloss dt, dl.gloss dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14.5px; line-height: 1.65; }
dl.gloss dt { font-weight: 800; background: var(--surface-2); }
dl.gloss dt:last-of-type, dl.gloss dd:last-of-type { border-bottom: 0; }

/* Prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 54px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a small { display: block; color: var(--muted); font-size: 12.5px; }
.pager a b { font-family: var(--font-head); }
.pager a.next { text-align: right; grid-column: 2; }
.pagefoot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }

/* Search dialog */
.search { position: fixed; inset: 0; z-index: 60; display: none; background: rgba(15, 8, 4, .5); backdrop-filter: blur(3px); padding: 9vh 16px 16px; }
.search.on { display: block; }
.search-box { max-width: 640px; margin: 0 auto; background: var(--surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; }
.search-box input { width: 100%; height: 56px; border: 0; border-bottom: 1px solid var(--border); padding: 0 18px; font: inherit; font-size: 17px; background: transparent; color: var(--text); outline: none; }
.search-res { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-res a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.search-res a:hover, .search-res a.on { background: var(--accent-soft); text-decoration: none; }
.search-res a b { display: block; font-size: 14.5px; }
.search-res a span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.search-res mark { background: color-mix(in srgb, var(--gold) 40%, transparent); color: inherit; border-radius: 3px; }
.search-empty { padding: 18px; color: var(--muted); font-size: 14px; }

.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menubtn { display: grid; }
  .sidebar { position: fixed; z-index: 50; top: var(--header-h); left: 0; width: min(86vw, 320px); background: var(--surface); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 10px 0 40px rgba(0,0,0,.2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 45; background: rgba(0,0,0,.35); }
  main { padding: 22px 16px 60px; }
  .arena-card { grid-template-columns: 1fr; }
  .arena-card .art { min-height: 200px; }
  .two { grid-template-columns: 1fr; }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .searchbtn span.lbl, .searchbtn kbd { display: none; }
  .searchbtn { flex: none; width: 38px; padding: 0; justify-content: center; margin-left: auto; }
  .playbtn span { display: none; }
  .playbtn { padding: 0 12px; }
  .brand small { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .brand > span { min-width: 0; overflow: hidden; }
  .brand b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .brand img { width: 32px; height: 32px; }
}
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  /* With the language button the bar has no room for the guide's name; the emblem stands in for it. */
  .brand > span { display: none; }
  .brand { flex: 0 1 auto; }
  .hero { min-height: 340px; }
  .hero-body { padding: 22px 18px; }
  .strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .scene div { font-size: 11.5px; padding: 24px 8px 8px; }
  .scene div b { font-size: 13px; }
  dl.gloss { grid-template-columns: 1fr; }
  dl.gloss dt { border-bottom: 0; padding-bottom: 2px; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .steps > li { padding-left: 54px; }
  .steps > li::before { width: 38px; height: 38px; font-size: 16px; }
  .steps > li::after { left: 18px; top: 44px; }
  .board { gap: 2px; padding: 8px; }
  .cell .n { font-size: 8.5px; padding: 0 2px; }
  .cell .e { font-size: 8px; padding: 0 2px; }
}

/* Battle tier comparison bars */
.cmp { margin: 6px 0 24px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.cmp-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.cmp-row > b { font-family: var(--font-head); font-size: 14px; }
.cmp-row > div { display: grid; gap: 3px; }
/* A bar is never narrower than its label (longer languages), so short bars stretch a little past their value. */
.cmp-row i { display: block; font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 1.7; padding: 0 8px; border-radius: 6px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: max-content; max-width: 100%; }
.cmp-row i.w { background: var(--ok); }
.cmp-row i.p { background: var(--gold); }
.cmp-row i.l { background: var(--danger); }
