:root {
  --night: #0b0a10;
  --night-2: #111017;
  --tip-bg: #140f19;
  --line: #2a2733;
  --text: #f1ece0;
  --mute: #aaa69a;
  --dim: #6f6b62;
  --jade: #5fd39a;
  --jade-btn: #2f8a5e;
  --gold: #e0b84f;
  --imperial: #d9a531;
  --vermilion: #a82a20;
  --mc-yellow: #ffff55;
  --cinnabar: #c33a2e;
  --dirt: #5b3d27;
  --max: 1120px;
  --read: 680px;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  --body: "Nunito", system-ui, sans-serif;
  --cjk: "Shippori Mincho B1", "Noto Serif TC", serif;
  --notch: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: var(--text); font: 17px/1.65 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
code { font-family: ui-monospace, "Cascadia Code", monospace; font-size: .88em; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-family: var(--pixel); font-weight: 700; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.cjk { font-family: var(--cjk); font-weight: 800; }

/* ------------------------------------------------ seal */
.seal {
  display: inline-grid; place-items: center; font-family: var(--cjk); font-style: normal; font-weight: 800; line-height: 1.05; text-align: center;
  color: #f6e6d2; background: var(--cinnabar);
  box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgba(246, 230, 210, .6), 3px 3px 0 #000;
}
.seal-sm { width: 32px; height: 32px; font-size: 11px; writing-mode: vertical-rl; letter-spacing: -1px; box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgba(246, 230, 210, .6); }
.seal-lg { width: 68px; height: 68px; font-size: 19px; transform: rotate(-5deg); }
.seal-xl { width: 92px; height: 92px; font-size: 26px; transform: rotate(-4deg); margin: 14px 0 20px; }

/* ------------------------------------------------ buttons */
.mc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 18px var(--pixel); color: #fff; text-decoration: none; cursor: pointer;
  padding: 12px 24px; background: var(--jade-btn); border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #7fe3b0, inset -2px -4px 0 #1b5a3c; text-shadow: 2px 2px 0 #123d29;
}
.mc-btn:hover { background: #38a370; }
.mc-btn:active { box-shadow: inset 2px 2px 0 #1b5a3c, inset -2px -2px 0 #7fe3b0; }
.mc-btn-stone { background: #6f6f6f; box-shadow: inset 2px 2px 0 #aaa, inset -2px -4px 0 #444; text-shadow: 2px 2px 0 #333; }
.mc-btn-stone:hover { background: #7f86b0; box-shadow: inset 2px 2px 0 #b9bfe3, inset -2px -4px 0 #4a4f72; }
.mc-btn-sm { font-size: 15px; padding: 6px 14px; }
.mc-btn-lg { font-size: 21px; padding: 15px 30px; }
.mc-btn.done { background: #38a370; }

/* ------------------------------------------------ slots + tooltips */
.slot { display: grid; place-items: center; width: 52px; height: 52px; flex: none; background: #1f1d24; box-shadow: inset 3px 3px 0 #08070b, inset -3px -3px 0 #3d3a46; }
.slot img { width: 36px; height: 36px; object-fit: contain; }
.tip { position: relative; background: var(--tip-bg); clip-path: var(--notch); padding: 24px; }
.tip::before { content: ""; position: absolute; inset: 4px; pointer-events: none; border: 2px solid; border-image: linear-gradient(180deg, #5fd39a, #1d4a36) 1; }
.tip-name { color: var(--jade); font-size: 20px; font-weight: 500; text-shadow: 2px 2px 0 #0e2a1d; margin: 16px 0 8px; }
.tip-gold { color: var(--gold); text-shadow: 2px 2px 0 #3a2c0c; }
.tip p { margin: 0; color: var(--mute); font-size: 16px; }

/* ------------------------------------------------ the gate intro */
.gate { display: none; }
.gate-on body { overflow: hidden; }
.gate-on .gate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 100; }
.door {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  background:
    radial-gradient(circle, #f2cf6a 0 5px, #8a6a1f 5px 7px, transparent 7px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(0,0,0,.25), transparent 12%, transparent 88%, rgba(0,0,0,.3)),
    var(--vermilion);
  box-shadow: inset 0 0 0 10px #6a1a13, inset 0 0 0 14px var(--imperial);
  transition: transform 1.6s cubic-bezier(.7, 0, .25, 1);
}
.door-l { left: 0; background-position: 32px 32px, 0 0, 0 0; }
.door-r { right: 0; background-position: 0 32px, 0 0, 0 0; }
.knocker { position: absolute; top: 50%; width: 64px; height: 64px; margin-top: -32px; border-radius: 50%; border: 8px solid var(--imperial); box-shadow: 0 0 0 4px #000, inset 0 0 0 4px #000; }
.door-l .knocker { right: 40px; }
.door-r .knocker { left: 40px; }
.gate-plaque {
  position: relative; z-index: 2; width: min(520px, calc(100vw - 32px)); padding: 34px 30px 26px; text-align: center;
  background: #0d0b0a; border: 4px solid #000; box-shadow: inset 0 0 0 3px var(--imperial), inset 0 0 0 6px #0d0b0a, inset 0 0 0 7px #7a5c1c, 0 30px 80px rgba(0,0,0,.7);
  transition: opacity .5s, transform .5s;
}
.gate-decree { margin: 0; font-size: 30px; color: var(--imperial); letter-spacing: .3em; }
.gate-small { margin: 4px 0 0; font: 500 13px var(--pixel); color: var(--dim); letter-spacing: .12em; text-transform: uppercase; }
.gate-plaque h2 { font-size: 26px; text-shadow: 3px 3px 0 #000; }
.gate-text { color: var(--mute); margin: 10px 0 24px; }
.gate-quiet { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--dim); font: 400 14px var(--pixel); cursor: pointer; text-decoration: underline; }
.gate-quiet:hover { color: var(--text); }
.gate-opening .door-l { transform: translateX(-102%); }
.gate-opening .door-r { transform: translateX(102%); }
.gate-opening .gate-plaque { opacity: 0; transform: scale(.94); }
.gate-opening .gate { pointer-events: none; }

/* ------------------------------------------------ nav */
.nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(16px, calc((100vw - var(--max)) / 2));
  background: rgba(11, 10, 16, .9); backdrop-filter: blur(8px); border-bottom: 2px solid #000; box-shadow: 0 2px 0 #26232d;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-name { font: 700 20px var(--pixel); }
.nav-links { display: flex; gap: 24px; align-items: center; font: 400 17px var(--pixel); }
.nav-links a:not(.mc-btn) { text-decoration: none; color: var(--mute); }
.nav-links a:not(.mc-btn):hover, .nav-links a[aria-current] { color: var(--mc-yellow); }

/* ------------------------------------------------ chapter rail */
.rail { position: fixed; left: 22px; top: 50%; transform: translateY(-50%); z-index: 15; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rail::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: #2a2733; }
.rail a { position: relative; display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 0; }
.rail .cjk { display: grid; place-items: center; width: 36px; height: 36px; font-size: 16px; color: var(--dim); background: var(--night); border: 2px solid #2a2733; transition: all .2s; }
.rail em { font: normal 400 14px var(--pixel); color: var(--mute); opacity: 0; transform: translateX(-6px); transition: all .2s; white-space: nowrap; background: rgba(11,10,16,.85); padding: 2px 8px; }
.rail a:hover em, .rail a.on em { opacity: 1; transform: none; }
.rail a.on .cjk { color: #fff; background: var(--cinnabar); border-color: #000; box-shadow: 0 0 18px rgba(242, 138, 74, .6); }
.rail a:hover .cjk { color: var(--imperial); border-color: var(--imperial); }

/* ------------------------------------------------ hero */
.hero {
  position: relative; overflow: hidden; min-height: 860px; padding: 96px 16px 240px;
  background: var(--night) url(assets/px/hero.png) 70% bottom / max(100%, 1800px) auto no-repeat; image-rendering: pixelated;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,10,16,.92) 0%, rgba(11,10,16,.7) 38%, rgba(11,10,16,.1) 62%, transparent 75%); }
.hero-inner { position: relative; z-index: 2; max-width: var(--max); margin: 0 auto; image-rendering: auto; }
.petals { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.petals i { position: absolute; top: -20px; width: 8px; height: 8px; background: #e7a6c8; animation: fall linear infinite; box-shadow: 8px 0 0 #c97aa3; }
.petals i.light { background: #f6d2e3; box-shadow: none; }
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate(var(--drift, 80px), 900px) rotate(240deg); opacity: .2; }
}

.kicker { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 18px; }
.kicker img { width: 16px; height: 22px; }
.logo-wrap { position: relative; display: inline-block; }
.logo { display: flex; flex-direction: column; gap: 12px; }
.logo-main {
  font-size: clamp(60px, 10vw, 128px); font-weight: 700; line-height: .95; color: #fbf3dc;
  text-shadow: 0 4px 0 #d9a531, 0 8px 0 #a8781f, 0 12px 0 #7a2a20, 0 16px 0 #4a1812, 0 24px 26px rgba(0,0,0,.7);
}
.logo-main-sm { font-size: clamp(48px, 7vw, 90px); }
.logo-sub { font-size: clamp(20px, 2.4vw, 28px); font-weight: 500; color: var(--gold); text-shadow: 2px 2px 0 #3a2c0c; margin-top: 12px; }
.logo-sub .cjk { color: var(--jade); text-shadow: none; margin-right: 8px; }
.splash {
  position: absolute; right: -230px; top: -14px; margin: 0; font: 500 22px var(--pixel); color: var(--mc-yellow); text-shadow: 2px 2px 0 #3f3f15; white-space: nowrap;
  transform: rotate(-16deg); animation: splash .45s ease-in-out infinite alternate;
}
@keyframes splash { to { transform: rotate(-16deg) scale(1.09); } }
.lede { max-width: 48ch; color: #ddd7c8; font-size: 20px; margin: 30px 0 32px; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.lede b { color: var(--text); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

.ip { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 100%; padding: 8px 8px 8px 16px; background: rgba(0,0,0,.7); border: 2px solid #000; box-shadow: inset 0 0 0 2px #3d3a46; }
.ip-dot { width: 10px; height: 10px; background: #55ff55; box-shadow: 0 0 10px #55ff55; }
.ip code { font-size: 16px; color: var(--text); word-break: break-all; }

/* imperial roof eaves divider */
.eaves {
  position: relative; z-index: 3; height: 40px; margin-top: -20px;
  background:
    radial-gradient(circle at 12px 30px, #f2cf6a 0 5px, #a8781f 5px 7px, transparent 7px) 0 0 / 24px 40px repeat-x,
    linear-gradient(#f2cf6a 0 4px, transparent 4px) 0 0 / 100% 40px no-repeat,
    repeating-linear-gradient(90deg, #d9a531 0 12px, #b8862a 12px 24px) 0 4px / 100% 22px no-repeat;
  filter: drop-shadow(0 6px 0 #4a1812);
}
.eaves::after { content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 8px; background: radial-gradient(circle, #f2cf6a 0 2px, transparent 2.5px) 0 0 / 20px 8px, var(--vermilion); }

/* hotbar */
.hotbar { list-style: none; max-width: var(--max); margin: 60px auto 0; padding: 6px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; background: #000; box-shadow: inset 0 0 0 2px #3d3a46; width: calc(100% - 32px); }
.hotbar .slot { width: auto; height: auto; display: flex; gap: 14px; padding: 12px 16px; justify-content: flex-start; }
.hotbar .slot img { width: 32px; height: 32px; }
.hotbar span { display: flex; flex-direction: column; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; line-height: 1.3; }
.hotbar b { font: 500 19px var(--pixel); color: var(--text); letter-spacing: 0; text-transform: none; }

/* ------------------------------------------------ chapters */
.tale { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.chapter { padding-top: 130px; }
.ch-head { text-align: center; margin: 0 auto 50px; max-width: 760px; }
.ch-num {
  display: inline-grid; place-items: center; width: 84px; height: 84px; font-size: 44px; color: var(--imperial);
  border: 2px solid #4d4128; box-shadow: inset 0 0 0 6px var(--night), inset 0 0 0 8px #4d4128; margin-bottom: 18px;
}
.ch-label { margin: 0 0 10px; font: 500 14px var(--pixel); color: var(--jade); letter-spacing: .3em; text-transform: uppercase; }
.ch-label::before, .ch-label::after { content: "◆"; font-size: 9px; color: var(--gold); margin: 0 12px; vertical-align: 2px; }
h2 { font-size: clamp(30px, 4.2vw, 48px); text-shadow: 3px 3px 0 #000; }

/* story prose */
.story { max-width: var(--read); margin: 0 auto; font-size: 20px; line-height: 1.8; color: #ddd7c8; position: relative; }
.story p { margin: 0 0 22px; }
.story b { color: var(--text); }
.story .aside { font-style: italic; color: var(--gold); text-align: center; margin-top: 34px; font-size: 21px; }
.story .aside::before { content: "◆"; display: block; font-style: normal; font-size: 10px; margin-bottom: 14px; color: var(--cinnabar); }
.story-link { text-align: center; margin-top: 28px !important; }
.story-link a { font: 500 18px var(--pixel); color: var(--mc-yellow); text-decoration: none; }
.story-link a:hover { text-decoration: underline; }
.vignette { display: block; width: 56px; height: 56px; object-fit: contain; margin: 0 auto 30px; filter: drop-shadow(0 0 14px rgba(242, 207, 106, .35)); }
.story-split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center; }
.story-split .story { margin: 0; }

/* book page */
.book {
  max-width: 640px; margin: 0 auto; padding: 30px 40px 36px; background: #ecdfb9; color: #3b2a17;
  border: 4px solid #000; box-shadow: inset 0 0 0 4px #c9b483, 8px 8px 0 #000; font: 400 20px/1.6 var(--pixel); transform: rotate(-.6deg);
}
.js .book.reveal { transform: translateY(24px) rotate(-.6deg); }
.js .book.reveal.shown { transform: rotate(-.6deg); }
.book-top { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; color: #7a6440; margin-bottom: 18px; }
.book-top .cjk { font-size: 14px; }
.book p { margin: 0 0 16px; }
.book .dropcap::first-letter { float: left; font-size: 58px; line-height: .9; margin: 6px 10px 0 0; color: var(--vermilion); }
.book .book-law { color: #1d6b45; font-weight: 700; font-size: 24px; text-align: center; margin: 22px 0 26px; }
.book p:last-child { margin: 0; color: #6a5537; }

/* map art */
.capital-art { padding: 28px; }
.map-grid { position: relative; aspect-ratio: 1; background: linear-gradient(#25222d 2px, transparent 2px) 0 0 / 24px 24px, linear-gradient(90deg, #25222d 2px, transparent 2px) 0 0 / 24px 24px, #4a7a3c; }
.ring { position: absolute; display: flex; justify-content: center; align-items: flex-start; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.ring span { font: 500 13px var(--pixel); margin-top: 8px; color: #fff; text-shadow: 2px 2px 0 #000; }
.ring-wild { width: 100%; height: 100%; background: repeating-linear-gradient(45deg, rgba(0,0,0,.12) 0 12px, transparent 12px 24px); }
.ring-city { width: 66%; height: 66%; background: #6e241c; border: 4px solid #4a1812; box-shadow: inset 0 0 0 4px var(--imperial); }
.ring-core { width: 32%; height: 32%; background: #1d4a36; border: 4px solid #000; box-shadow: inset 0 0 0 3px var(--jade), 0 0 30px rgba(95,211,154,.5); flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ring-core img { width: 40%; }
.ring-core span { margin: 0; font-family: var(--cjk); font-size: 18px; color: var(--jade); }

.final { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 50px; text-align: center; }
.final .hero-actions { justify-content: center; }

/* ------------------------------------------------ codex page */
.codex-hero {
  position: relative; padding: 90px 16px 110px; text-align: center; overflow: hidden;
  background: var(--night) url(assets/px/hero.png) 70% 85% / cover no-repeat; image-rendering: pixelated;
}
.codex-hero::before { content: ""; position: absolute; inset: 0; background: rgba(11, 10, 16, .78); }
.codex-hero-inner { position: relative; max-width: 720px; margin: 0 auto; image-rendering: auto; }
.codex-hero .kicker { justify-content: center; }
.codex-hero .logo { align-items: center; }
.codex-hero .lede { margin: 26px auto 0; }
.codex-intro { max-width: var(--read); margin: 0 auto 30px; text-align: center; color: var(--mute); font-size: 18px; }
.codex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* the yellow silk decree */
.edict-scroll { max-width: 900px; margin: 0 auto; }
.rod {
  height: 26px; margin: 0 -28px; position: relative;
  background: linear-gradient(#7a5230 0 4px, #5b3d27 4px 18px, #3a2416 18px); border: 2px solid #000;
}
.rod::before, .rod::after { content: ""; position: absolute; top: -6px; width: 22px; height: 34px; background: linear-gradient(#f2cf6a 0 6px, var(--imperial) 6px 26px, #a8781f 26px); border: 2px solid #000; }
.rod::before { left: -16px; }
.rod::after { right: -16px; }
.silk-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 1.8s cubic-bezier(.5, 0, .2, 1); }
.js .edict-scroll:not(.shown) .silk-wrap { grid-template-rows: 0fr; }
.no-io .edict-scroll .silk-wrap { grid-template-rows: 1fr !important; }
.silk {
  overflow: hidden; min-height: 0; color: #3a2410;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 240, 180, .35), transparent 70%),
    repeating-linear-gradient(0deg, rgba(120, 80, 20, .06) 0 2px, transparent 2px 6px),
    #e6c25a;
  border-left: 2px solid #000; border-right: 2px solid #000;
  box-shadow: inset 0 0 0 10px #e6c25a, inset 0 0 0 12px #a8781f;
}
.decree-open { margin: 0; padding: 40px 50px 10px; text-align: center; font: 500 19px var(--pixel); color: #7a1f16; }
.decree-open .cjk { display: block; font-size: 30px; letter-spacing: .2em; margin-bottom: 8px; color: #3a2410; }
.laws { list-style: none; margin: 0; padding: 20px 50px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 40px; }
.laws li { display: grid; grid-template-columns: 34px 36px 1fr; gap: 12px; align-items: start; padding: 16px 0; border-bottom: 2px dashed rgba(122, 31, 22, .25); }
.law-n { font-size: 26px; color: #7a1f16; line-height: 1.1; text-align: center; }
.laws img { width: 32px; height: 32px; object-fit: contain; margin-top: 2px; }
.laws h3 { font-size: 19px; font-weight: 700; color: #3a2410; margin-bottom: 4px; }
.laws p { margin: 0; font-size: 15px; line-height: 1.5; color: #5a3d1c; font-weight: 600; }
.decree-close { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 18px 50px 40px; }
.decree-close p { margin: 0; font: 400 17px var(--pixel); color: #5a3d1c; text-align: right; }
.decree-close .cjk { font-size: 19px; color: #7a1f16; }

.rings-list { list-style: none; padding: 0; margin: 0 auto 22px; max-width: 860px; border-top: 2px solid var(--line); }
.rings-list li { display: grid; grid-template-columns: 210px 1fr; column-gap: 18px; padding: 16px 0; border-bottom: 2px solid var(--line); }
.rings-list b { font-weight: 800; }
.rings-list b .cjk { color: var(--gold); margin-left: 4px; font-size: 15px; }
.rings-list em { grid-column: 1; color: var(--jade); font-size: 14px; font-style: normal; font-family: var(--pixel); }
.rings-list > li > span { grid-column: 2; grid-row: 1 / span 2; color: var(--mute); font-size: 16px; }
.note { max-width: 860px; margin: 0 auto; font-size: 16px; color: var(--text); padding: 10px 14px; background: rgba(195, 58, 46, .12); border-left: 4px solid var(--cinnabar); }

.table-tip { padding: 10px; }
.ledger-title { padding: 14px 20px 4px; font: 500 16px var(--pixel) !important; color: var(--gold) !important; }
.ledger-title .cjk { margin-right: 8px; }
.scroll-x { overflow-x: auto; }
.prices { width: 100%; border-collapse: collapse; min-width: 560px; }
.prices th, .prices td { padding: 14px 20px; text-align: left; border-bottom: 2px solid #221d29; }
.prices tbody tr:last-child th, .prices tbody tr:last-child td { border-bottom: 0; }
.prices thead th { font: 500 15px var(--pixel); color: var(--mute); vertical-align: bottom; }
.prices thead img { width: 28px; height: 28px; display: block; margin-bottom: 6px; }
.prices tbody th { font: 500 17px var(--pixel); color: var(--text); }
.prices td { font: 700 21px var(--pixel); color: #fff; white-space: nowrap; }
.prices td small { font-size: 14px; color: var(--dim); font-weight: 400; margin-left: 6px; }
.prices td.na { color: #3b3644; }
.prices tbody tr:last-child { background: rgba(224, 184, 79, .08); }
.prices tbody tr:last-child th { color: var(--gold); }
.em { display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -2px; background: url(assets/px/emerald.png) center / contain no-repeat; image-rendering: pixelated; }
.table-cap { padding: 10px 20px 12px; font-size: 14px !important; color: var(--dim) !important; border-top: 2px solid #221d29; }
.fine { font-size: 15px; color: var(--dim); margin: 16px 0 0; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li { display: flex; flex-direction: column; padding: 28px; }
.step-n { font: 700 24px var(--pixel); color: #fff; text-shadow: 2px 2px 0 #000; }
.steps p { flex: 1; margin-bottom: 18px !important; }
.steps code { color: var(--text); }
.link { color: var(--mc-yellow); text-decoration: none; font: 500 16px var(--pixel); }
.link:hover { text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.link-btn.done { color: #55ff55; }

.pack { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pack .tip p { color: var(--text); font-size: 15px; }

.faq { max-width: 780px; margin: 0 auto; }
.faq details { margin-bottom: 8px; background: var(--night-2); border: 2px solid #000; box-shadow: inset 0 0 0 2px #26232d; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 20px; font: 500 19px var(--pixel); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 12px; font: 700 24px var(--pixel); color: var(--mc-yellow); }
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--mc-yellow); }
.faq details p { margin: 0; padding: 0 20px 18px; color: var(--mute); }

/* ------------------------------------------------ reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s ease, transform .9s ease; }
.js .reveal.shown, .no-io .reveal { opacity: 1; transform: none; }

/* ------------------------------------------------ footer */
.footer { margin-top: 140px; background: var(--dirt); }
.grass-edge { height: 16px; background: repeating-linear-gradient(90deg, #4f9a4a 0 16px, #67b45c 16px 24px, #4f9a4a 24px 40px, #3f7d3b 40px 48px); border-bottom: 8px solid #3f7d3b; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 34px 16px 44px; display: grid; gap: 6px;
  background-image: radial-gradient(#46301f 2px, transparent 2px), radial-gradient(#6e4b31 2px, transparent 2px); background-size: 24px 24px, 32px 32px; background-position: 0 0, 12px 16px; }
.footer-end { font: 500 20px var(--pixel) !important; color: #f6e6d2 !important; margin-bottom: 14px !important; }
.footer-brand { display: flex; align-items: center; gap: 10px; font: 700 18px var(--pixel); margin-bottom: 6px; text-shadow: 2px 2px 0 #2a1a0e; }
.footer p { margin: 0; color: #e6d4bd; font-size: 15px; text-shadow: 1px 1px 0 #2a1a0e; }
.footer p a { color: #fff; }
.footer .fine { font-size: 13px; color: #c9b297; }

:focus-visible { outline: 3px solid var(--mc-yellow); outline-offset: 2px; }

/* ------------------------------------------------ responsive */
@media (max-width: 1260px) { .rail { display: none; } }
@media (max-width: 960px) {
  .hero { background-size: cover; background-position: 85% bottom; }
  .splash { right: -20px; top: -30px; }
  .hotbar { grid-template-columns: repeat(3, 1fr); }
  .story-split { grid-template-columns: 1fr; gap: 36px; }
  .capital-art { max-width: 460px; width: 100%; margin: 0 auto; }
  .codex-grid, .pack { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
  .laws { grid-template-columns: 1fr; padding: 16px 30px; }
  .decree-open { padding: 34px 30px 6px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav-links { gap: 14px; font-size: 15px; }
  .nav-links .mc-btn { display: none; }
  .hero { min-height: 0; padding: 56px 16px 340px; background-size: auto 380px; background-position: 96% bottom; }
  .hero::before { background: linear-gradient(180deg, rgba(11,10,16,.6) 0%, rgba(11,10,16,.3) 60%, transparent 70%); }
  .splash { right: -100px; top: -16px; font-size: 13px; }
  .hotbar { grid-template-columns: 1fr 1fr; }
  .hotbar .slot:last-child { grid-column: span 2; }
  .codex-grid, .pack { grid-template-columns: 1fr; }
  .chapter { padding-top: 96px; }
  .story { font-size: 18px; }
  .book, .js .book.reveal, .js .book.reveal.shown { transform: none; }
  .book { padding: 24px 22px 28px; font-size: 18px; }
  .ch-num { width: 68px; height: 68px; font-size: 34px; }
  .rod { margin: 0 -8px; }
  .laws { padding: 12px 20px; }
  .laws li { grid-template-columns: 28px 30px 1fr; gap: 10px; }
  .decree-close { flex-direction: column; padding: 14px 20px 34px; }
  .decree-close p { text-align: center; }
  .rings-list li { grid-template-columns: 1fr; }
  .rings-list > li > span { grid-column: 1; grid-row: auto; margin-top: 4px; }
  .door { background-size: 44px 44px, auto, auto; }
  .knocker { width: 44px; height: 44px; margin-top: -22px; border-width: 6px; }
  .door-l .knocker { right: 16px; }
  .door-r .knocker { left: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .splash { animation: none; }
  .door, .gate-plaque, .silk-wrap, .js .reveal { transition: none; }
}

/* chapter five: the dragon */
.chapter-dragon .ch-num { color: var(--jade); border-color: #1f6b3a; box-shadow: inset 0 0 0 6px var(--night), inset 0 0 0 8px #1f6b3a, 0 0 40px rgba(95, 211, 154, .25); }
.vignette-dragon { width: 96px; height: 76px; filter: drop-shadow(0 0 22px rgba(95, 211, 154, .55)); }
.book b { color: #1d6b45; }

/* ------------------------------------------------ first-visit cinematic */
.cine { display: none; }
.cine-on .cine { display: block; position: fixed; inset: 0; z-index: 200; background: #0a0910; overflow: hidden; transition: opacity 1.2s ease; }
.cine-on body { overflow: hidden; }
.cine.ending { opacity: 0; pointer-events: none; }
#cine-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.cine-bar { position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 2; transition: height 1.4s cubic-bezier(.6, 0, .2, 1); }
.cine-bar-top { top: 0; }
.cine-bar-bottom { bottom: 0; }
.cine.playing .cine-bar { height: 11vh; }
.cine-cap {
  position: absolute; z-index: 3; left: 50%; bottom: 15vh; width: min(92vw, 900px); margin: 0; transform: translate(-50%, 10px);
  text-align: center; font: 500 clamp(18px, 2.6vw, 30px)/1.4 var(--pixel); color: #f6eedb; letter-spacing: .02em;
  text-shadow: 2px 2px 0 #000, 0 0 18px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .9s ease, transform .9s ease;
}
.cine-cap.on { opacity: 1; transform: translate(-50%, 0); }
.cine-cap .cjk { color: var(--jade); margin-right: 10px; text-shadow: 0 0 16px rgba(95, 211, 154, .7), 2px 2px 0 #000; }
.cine-skip {
  position: absolute; z-index: 4; right: 20px; bottom: calc(11vh + 16px); font: 500 15px var(--pixel); color: #cfc9ba;
  background: rgba(0, 0, 0, .55); border: 2px solid #3d3a46; padding: 6px 14px; cursor: pointer; opacity: 0; transition: opacity .6s .8s;
}
.cine.playing .cine-skip { opacity: 1; }
.cine-skip:hover { color: var(--mc-yellow); border-color: var(--mc-yellow); }
.cine-start {
  position: absolute; z-index: 5; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(10, 9, 16, .35), rgba(10, 9, 16, .85)); transition: opacity .8s ease;
}
.cine.playing .cine-start { opacity: 0; pointer-events: none; }
.cine-kicker { margin: 0 0 14px; font: 500 14px var(--pixel); color: var(--gold); letter-spacing: .3em; text-transform: uppercase; }
.cine-title { font-size: clamp(56px, 10vw, 120px); color: #fbf3dc; text-shadow: 0 4px 0 #d9a531, 0 8px 0 #a8781f, 0 12px 0 #7a2a20, 0 16px 0 #4a1812, 0 26px 30px rgba(0, 0, 0, .8); }
.cine-sub { margin: 22px 0 34px; font: 500 20px var(--pixel); color: var(--gold); }
.cine-sub .cjk { color: var(--jade); }
.cine-hint { margin: 18px 0 0; font: 400 14px var(--pixel); color: #8f8a7c; }
.cine-hint button { background: none; border: 0; padding: 0; font: inherit; color: #b9b3a3; text-decoration: underline; cursor: pointer; }
.cine-hint button:hover { color: var(--mc-yellow); }

/* ------------------------------------------------ music switch */
.music-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 60; display: inline-flex; align-items: center; gap: 10px;
  font: 500 14px var(--pixel); color: var(--text); cursor: pointer; padding: 8px 14px 8px 12px;
  background: #1f1d24; border: 2px solid #000; box-shadow: inset 2px 2px 0 #3d3a46, inset -2px -2px 0 #08070b, 3px 3px 0 #000;
}
.music-btn:hover { color: var(--mc-yellow); }
.music-btn[aria-pressed="false"] { color: var(--dim); }
.music-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.music-bars i { display: block; width: 3px; height: 4px; background: var(--jade); }
.music-btn[aria-pressed="false"] .music-bars i { background: #4a4655; }
.music-btn.is-playing .music-bars i { animation: eq .9s ease-in-out infinite alternate; }
.music-btn.is-playing .music-bars i:nth-child(2) { animation-delay: -.3s; }
.music-btn.is-playing .music-bars i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0% { height: 3px; } 100% { height: 14px; } }
.cine-on .music-btn { display: none; }
@media (prefers-reduced-motion: reduce) { .music-btn.is-playing .music-bars i { animation: none; height: 10px; } }

/* language switch */
.nav-links .lang-switch { color: var(--gold); border: 2px solid #4d4128; padding: 1px 8px; font-size: 14px; }
.nav-links .lang-switch:hover { color: var(--mc-yellow); border-color: var(--mc-yellow); }

/* ------------------------------------------------ codex: vision + rarity */
.vision-lead { max-width: var(--read); margin: 0 auto 40px; text-align: center; font-size: 19px; line-height: 1.75; color: #ddd7c8; }
.vision-lead p { margin: 0 0 16px; }
.vision-lead b { color: var(--text); }
.vision-note { margin-top: 26px; max-width: none; }
.codex-grid-3 { margin-top: 14px; }
.odds { max-width: 860px; margin: 0 auto 14px; padding: 26px 28px 8px; }
.odds-row { display: grid; grid-template-columns: 130px 1fr 210px; gap: 18px; align-items: center; padding: 10px 0; }
.odds-name { font: 500 17px var(--pixel); color: var(--text); }
.odds-bar { height: 18px; background: #0b0910; box-shadow: inset 2px 2px 0 #000, inset -2px -2px 0 #2a2733; padding: 3px; }
.odds-bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, #5fd38a 0 10px, #3f9f68 10px 12px); }
.odds-ultra .odds-name, .odds-ultra b { color: var(--gold); }
.odds-ultra .odds-bar i { background: repeating-linear-gradient(90deg, #f2cf3a 0 10px, #b8901f 10px 12px); }
.odds-alpha .odds-name, .odds-alpha b { color: #ff7a6a; }
.odds-alpha .odds-bar i { background: repeating-linear-gradient(90deg, #e0412f 0 10px, #9a2a1f 10px 12px); }
.odds-val { font-size: 15px; color: var(--mute); }
.odds-val b { font: 700 19px var(--pixel); color: var(--text); margin-right: 8px; }
.odds .table-cap { margin: 10px -28px 0; }
@media (max-width: 640px) {
  .odds { padding: 18px 16px 6px; }
  .odds-row { grid-template-columns: 1fr; gap: 6px; }
  .odds .table-cap { margin: 10px -16px 0; }
  .vision-lead { font-size: 17px; }
}
