/* =====================================================================
   脳隠れの里 — The Village Hidden in the Mind
   Register: cream paper + ink + Claude orange, with charcoal / deep-red
   cinematic beats. Everything behind the panels is painted live.
   ===================================================================== */

:root {
  --paper: #F3EAD3;
  --paper-2: #EADDBE;
  --ink: #141110;
  --ink-2: #3A322C;
  --orange: #D97757;
  --orange-2: #F0A070;
  --vermilion: #C82924;
  --deep-red: #592223;
  --charcoal: #121212;
  --leaf: #3E6B3A;
  --gold: #E0B15C;
  --display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --body: 'Zen Kaku Gothic New', 'Hiragino Sans', system-ui, sans-serif;
  --brush: 'Yuji Boku', 'Hiragino Mincho ProN', serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --maxw: 1160px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--charcoal);
  overflow-x: hidden;
  line-height: 1.55;
}
body.pre-enter { overflow: hidden; height: 100vh; }

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.jp { font-family: var(--brush); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

/* ---------- fixed layers ---------- */
#world { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
#flash { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; background: #fff; }
#flash.hit { animation: flash .5s steps(2, end) 1; }
@keyframes flash { 0% { opacity: 1; background: #fff; } 50% { opacity: 1; background: var(--ink); } 100% { opacity: 0; } }

.letterbox { position: fixed; left: 0; right: 0; height: 9vh; background: var(--ink); z-index: 40; pointer-events: none;
  transform: translateY(var(--lb, -100%)); transition: transform .6s var(--ease); }
.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; --lb: 100%; }
body.cinema .letterbox { transform: translateY(0); }

#titlecard { position: fixed; inset: 0; z-index: 35; display: grid; place-content: center; text-align: center;
  pointer-events: none; opacity: 0; color: var(--paper); background: radial-gradient(ellipse at center, rgba(20,17,16,.92) 0%, rgba(20,17,16,.78) 55%, rgba(20,17,16,.55) 100%); }
#titlecard .tc-num { font-family: var(--brush); font-size: clamp(16px, 2vw, 24px); letter-spacing: .4em; opacity: .8; }
#titlecard .tc-kanji { font-family: var(--brush); font-size: clamp(88px, 18vw, 240px); line-height: 1; margin: .05em 0;
  text-shadow: 0 0 40px rgba(0,0,0,.6); transform: translateY(var(--ty, 0)); }
#titlecard .tc-en { font-family: var(--display); font-size: clamp(26px, 4.5vw, 64px); letter-spacing: .12em; text-transform: uppercase; }
#titlecard .tc-rule { width: 120px; height: 4px; background: var(--orange); margin: 22px auto 0; }

/* ---------- THE GATE ---------- */
#gate { position: fixed; inset: 0; z-index: 80; perspective: 1200px; overflow: hidden; color: var(--paper); }
#gate .gate-sky { position: absolute; inset: 0; background: transparent; }
#gate .doors { position: absolute; inset: 0; display: flex; transform-style: preserve-3d; }
#gate .door { position: relative; flex: 1; background:
  repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 46px),
  linear-gradient(180deg, #5b2b22, #4a2019 55%, #3a1712);
  border-top: 26px solid #2a1410; border-bottom: 26px solid #2a1410; transform-origin: left center; transition: transform 1.7s cubic-bezier(.65,0,.35,1);
  box-shadow: inset 0 0 120px rgba(0,0,0,.55); display: grid; place-items: center; }
#gate .door.right { transform-origin: right center; }
#gate .door .plank { position: absolute; top: 0; bottom: 0; width: 6px; background: rgba(0,0,0,.28); }
#gate .door .plank:nth-child(1) { left: 20%; } #gate .door .plank:nth-child(2) { left: 40%; }
#gate .door .plank:nth-child(3) { left: 60%; } #gate .door .plank:nth-child(4) { left: 80%; }
#gate .door-kanji { font-family: var(--brush); font-size: clamp(120px, 26vw, 380px); color: rgba(243,234,211,.9); line-height: 1;
  text-shadow: 4px 6px 0 rgba(0,0,0,.35); user-select: none; }
#gate .knocker { position: absolute; bottom: 38%; width: 46px; height: 46px; border-radius: 50%; border: 7px solid #c99a4a; }
#gate .door.left .knocker { right: 8%; } #gate .door.right .knocker { left: 8%; }
#gate .gate-post { position: absolute; top: 0; bottom: 0; width: 5vw; min-width: 34px; background: linear-gradient(90deg, #1b0d09, #3a1712 45%, #1b0d09); z-index: 2; }
#gate .gate-post.left { left: 0; } #gate .gate-post.right { right: 0; }
#gate .gate-beam { position: absolute; top: 0; left: 0; right: 0; height: 15vh; min-height: 96px; background: linear-gradient(180deg, #2a1410, #1b0d09); z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-bottom: 10px solid var(--deep-red); }
#gate .beam-jp { font-family: var(--brush); font-size: clamp(28px, 5vw, 56px); letter-spacing: .3em; color: var(--paper); }
#gate .beam-en { font-family: var(--mono); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
#gate .gate-ui { position: absolute; left: 50%; bottom: 10vh; transform: translateX(-50%); z-index: 4; text-align: center; width: min(94vw, 900px);
  transition: opacity .5s; }
#gate .gate-line { font-family: var(--display); font-size: clamp(22px, 3.4vw, 40px); letter-spacing: .04em; line-height: 1.2; margin: 0 0 22px;
  text-shadow: 0 4px 24px rgba(0,0,0,.8); }
#gate .gate-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-enter { font-family: var(--display); font-size: clamp(18px, 2.2vw, 26px); letter-spacing: .12em; text-transform: uppercase; padding: 16px 30px;
  background: var(--orange); color: var(--ink); border: 3px solid var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.btn-enter .kanji { font-family: var(--brush); margin-right: 10px; }
.btn-enter:hover { transform: translate(-2px,-2px); box-shadow: 8px 8px 0 var(--ink); }
.btn-enter:active { transform: translate(3px,3px); box-shadow: 2px 2px 0 var(--ink); }
.btn-ghost { background: transparent; color: var(--paper); border: 2px solid rgba(243,234,211,.6); padding: 14px 20px; font-family: var(--mono); font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; }
.btn-ghost:hover { border-color: var(--paper); background: rgba(243,234,211,.08); }
#gate .gate-fine { font-family: var(--mono); font-size: 12px; opacity: .7; margin: 18px 0 0; }
body.entering #gate .door.left { transform: rotateY(-108deg); }
body.entering #gate .door.right { transform: rotateY(108deg); }
body.entering #gate .gate-ui { opacity: 0; pointer-events: none; }
body.entering #gate .gate-beam { transform: translateY(-110%); transition: transform 1.2s .5s var(--ease); }
body.entering #gate .gate-post { transition: transform 1.2s .5s var(--ease); }
body.entering #gate .gate-post.left { transform: translateX(-110%); }
body.entering #gate .gate-post.right { transform: translateX(110%); }
body.entered #gate { display: none; }

/* ---------- HUD ---------- */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
  pointer-events: none; opacity: 0; transform: translateY(-10px); transition: opacity .6s .2s, transform .6s .2s; }
body.entered .hud { opacity: 1; transform: none; }
.hud > * { pointer-events: auto; }
.hud-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; background: var(--paper); border: 2px solid var(--ink); padding: 6px 12px 6px 8px;
  box-shadow: var(--shadow-sm); color: var(--ink); }
.hud-brand .emblem { width: 30px; height: 30px; color: var(--vermilion); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text .jp { font-size: 15px; letter-spacing: .15em; }
.brand-text .en { font-family: var(--mono); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; opacity: .7; margin-top: 3px; }
.hud-right { display: flex; gap: 10px; align-items: center; }
.hud-loc { display: inline-flex; align-items: center; gap: 8px; background: var(--paper); border: 2px solid var(--ink); padding: 8px 12px; box-shadow: var(--shadow-sm);
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
.hud-loc .loc-kanji { font-family: var(--brush); font-size: 16px; color: var(--vermilion); }
.hud-loc .loc-time { opacity: .6; }
.hud-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); padding: 8px 12px;
  box-shadow: 3px 3px 0 var(--orange); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; }
.hud-btn .s-kanji { font-family: var(--brush); font-size: 16px; }
.hud-btn[aria-pressed="true"] { background: var(--orange); color: var(--ink); }
.hud-btn[aria-pressed="true"] .s-kanji { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }

.chapters { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transition: opacity .6s .4s; }
body.entered .chapters { opacity: 1; }
.chapters a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--paper); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }
.chapters a i { font-style: normal; font-family: var(--brush); width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--paper);
  background: rgba(20,17,16,.55); font-size: 14px; transition: background .2s, color .2s, transform .2s; }
.chapters a span { opacity: 0; transform: translateX(6px); transition: .2s; background: var(--ink); padding: 2px 6px; order: -1; }
.chapters a:hover span, .chapters a:focus-visible span { opacity: 1; transform: none; }
.chapters a.active i { background: var(--orange); color: var(--ink); border-color: var(--ink); transform: scale(1.1); }

/* dialogue box */
.dialogue { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); z-index: 50; width: min(92vw, 640px); background: var(--paper);
  border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 12px 44px 14px 16px; opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s var(--ease); }
.dialogue.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.dialogue::before { content: ""; position: absolute; left: -3px; top: -3px; width: 10px; height: 10px; background: var(--orange); border: 3px solid var(--ink); }
.dlg-speaker { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--vermilion); }
.dlg-speaker .jp { font-size: 14px; letter-spacing: .1em; margin-right: 6px; }
.dlg-text { margin: 4px 0 0; font-size: 15px; min-height: 1.5em; }
.dlg-text::after { content: "▌"; color: var(--orange); animation: blink 1s steps(2) infinite; }
.dialogue.done .dlg-text::after { content: ""; }
@keyframes blink { 50% { opacity: 0; } }
.dlg-close { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 22px; line-height: 1; }

/* ---------- SCENES ---------- */
main { position: relative; z-index: 1; }
.scene { position: relative; padding: 14vh 20px 12vh; max-width: var(--maxw); margin: 0 auto; }
.travel { height: 130vh; position: relative; }
.travel.night { height: 160vh; }

.scene-head { margin: 0 0 40px; }
.sh-num { font-family: var(--brush); color: var(--paper); font-size: 18px; letter-spacing: .4em; text-shadow: 0 2px 0 var(--ink); }
.scene-head h2 { margin: 6px 0 14px; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; line-height: 1; }
.scene-head h2 .jp { font-size: clamp(56px, 9vw, 120px); color: var(--paper); text-shadow: 6px 6px 0 var(--ink); }
.scene-head h2 .en { font-family: var(--display); font-size: clamp(30px, 5vw, 64px); letter-spacing: .06em; text-transform: uppercase; color: var(--paper);
  text-shadow: 4px 4px 0 var(--ink); }
.sh-lead { max-width: 720px; font-size: clamp(16px, 1.3vw, 19px); background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 14px 18px; margin: 0; }
.scene-head.dark .sh-lead { background: var(--charcoal); color: var(--paper); border-color: var(--paper); box-shadow: 6px 6px 0 var(--vermilion); }

/* reveal */
.r { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.r.in { opacity: 1; transform: none; }

/* ---------- HERO ---------- */
.hero { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-top: 18vh; overflow: hidden; }
main { overflow-x: clip; }
.hero-inner { position: relative; }
.hero-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--paper); text-shadow: 0 2px 0 var(--ink);
  display: inline-block; background: var(--ink); padding: 6px 10px; }
.hero-kicker .jp { text-transform: none; letter-spacing: .1em; font-size: 14px; }
.hero-title { font-family: var(--display); font-size: clamp(64px, 15.5vw, 240px); line-height: .9; margin: 14px 0 22px; color: var(--paper); letter-spacing: .01em;
  text-shadow: 8px 8px 0 var(--ink); position: relative; z-index: 1; }
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line span { display: block; transform: translateY(110%); transition: transform 1s var(--ease); }
body.entered .hero-title .line:nth-child(1) span { transform: none; transition-delay: .9s; }
body.entered .hero-title .line:nth-child(2) span { transform: none; transition-delay: 1.05s; }
.hero-kanji { position: absolute; right: -2vw; top: -6vw; font-family: var(--brush); font-size: clamp(160px, 32vw, 520px); color: var(--vermilion); opacity: 0;
  line-height: 1; z-index: 0; mix-blend-mode: multiply; transition: opacity 1.4s 1.3s; pointer-events: none; }
body.entered .hero-kanji { opacity: .85; }
.hero-sub { max-width: 640px; font-size: clamp(16px, 1.4vw, 20px); background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 14px 18px;
  margin: 0; position: relative; z-index: 1; opacity: 0; transform: translateY(16px); transition: opacity .8s 1.5s, transform .8s 1.5s var(--ease); }
body.entered .hero-sub { opacity: 1; transform: none; }
.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; opacity: 0; transition: opacity .8s 1.8s; }
body.entered .hero-tags { opacity: 1; }
.hero-tags span { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; background: var(--orange); border: 2px solid var(--ink); padding: 6px 10px; box-shadow: var(--shadow-sm); }
.scroll-hint { position: absolute; left: 20px; bottom: 5vh; display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .25em;
  text-transform: uppercase; color: var(--paper); text-shadow: 0 1px 0 var(--ink); opacity: 0; transition: opacity 1s 2.4s; }
body.entered .scroll-hint { opacity: .9; }
.scroll-hint .jp { text-transform: none; letter-spacing: .1em; font-size: 14px; }
.scroll-hint i { width: 2px; height: 42px; background: var(--paper); position: relative; overflow: hidden; }
.scroll-hint i::after { content: ""; position: absolute; left: 0; top: -100%; width: 100%; height: 100%; background: var(--orange); animation: drop 1.6s ease-in-out infinite; }
@keyframes drop { to { top: 100%; } }

/* ---------- REGISTER · Bingo book ---------- */
.book { display: grid; grid-template-columns: 1fr 22px 1.25fr; background: var(--deep-red); border: 3px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); padding: 14px; }
.page { background: var(--paper); padding: 28px 26px; position: relative; min-height: 420px;
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,17,16,.06) 31px 32px); }
.page-left { border-right: 1px dashed rgba(20,17,16,.25); }
.spine { background: linear-gradient(90deg, #2a0f10, #7a3033 50%, #2a0f10); }
.stamp { position: absolute; right: 18px; top: 18px; font-family: var(--brush); font-size: 26px; color: var(--vermilion); border: 3px solid var(--vermilion); padding: 2px 8px;
  transform: rotate(-9deg); opacity: .85; mix-blend-mode: multiply; }
.portrait { position: relative; width: 240px; margin: 0 0 14px; }
.portrait img { width: 100%; height: auto; display: block; filter: drop-shadow(6px 6px 0 var(--ink));
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%); mask-image: linear-gradient(180deg, #000 82%, transparent 100%); }
.ident-name { font-family: var(--display); font-size: clamp(30px, 3.4vw, 42px); line-height: 1; letter-spacing: .02em; }
.ident-motto { font-family: var(--brush); font-size: 18px; color: var(--deep-red); margin: 6px 0 16px; }
.ident-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.ident-dl dt { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--vermilion); padding-top: 3px; }
.ident-dl dd { margin: 0; }
.page-label { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--vermilion); margin-bottom: 14px; }
.bio-lead { font-size: clamp(17px, 1.5vw, 20px); font-weight: 700; line-height: 1.45; margin: 0 0 14px; }
.bio { margin: 0 0 22px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { border: 2px solid var(--ink); background: var(--paper-2); padding: 10px 10px 8px; box-shadow: var(--shadow-sm); }
.stat b { font-family: var(--display); font-size: 30px; line-height: 1; display: block; color: var(--deep-red); }
.stat b small { font-size: 16px; }
.stat span { display: block; font-size: 11px; line-height: 1.3; margin-top: 4px; font-family: var(--mono); letter-spacing: .02em; }

/* ---------- MISSIONS ---------- */
.board { display: grid; gap: 18px; background: rgba(20,17,16,.2); padding: 18px; border: 3px solid var(--ink); backdrop-filter: blur(2px); }
.mission { background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); }
.mission summary { list-style: none; display: grid; grid-template-columns: 74px 1fr 56px; gap: 16px; align-items: center; padding: 14px 16px; cursor: pointer; }
.mission summary::-webkit-details-marker { display: none; }
.rank { display: grid; place-items: center; width: 74px; height: 74px; border: 3px solid var(--ink); font-family: var(--display); line-height: 1; box-shadow: var(--shadow-sm); }
.rank b { font-size: 40px; } .rank small { font-family: var(--mono); font-size: 9px; letter-spacing: .3em; }
.rank-s .rank { background: var(--vermilion); color: var(--paper); }
.rank-a .rank { background: var(--orange); }
.rank-c .rank { background: var(--leaf); color: var(--paper); }
.m-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-title { font-family: var(--display); font-size: clamp(20px, 2.2vw, 28px); letter-spacing: .02em; line-height: 1.1; }
.m-org { font-weight: 700; font-size: 14px; }
.m-when { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; opacity: .8; }
.m-when em { font-style: normal; color: var(--vermilion); }
.wax { width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e04a3d, var(--deep-red) 70%); color: var(--paper);
  font-family: var(--brush); font-size: 22px; display: grid; place-items: center; box-shadow: 2px 2px 0 rgba(0,0,0,.35); transform: rotate(-8deg); transition: transform .3s; }
.mission[open] .wax { transform: rotate(8deg) scale(.9); opacity: .75; }
.m-body { padding: 0 18px 18px 18px; border-top: 2px dashed rgba(20,17,16,.25); }
.m-brief { font-family: var(--brush); font-size: 18px; color: var(--deep-red); margin: 14px 0 8px; }
.m-body ul { margin: 0; padding-left: 20px; font-size: 15px; }
.m-body li { margin: 6px 0; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tags span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; border: 2px solid var(--ink); padding: 3px 8px; background: var(--paper-2); }
.hokage-note { background: var(--ink); color: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--orange); padding: 16px 18px; font-size: 14.5px; }
.note-head { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--orange-2); margin-bottom: 6px; }
.note-head .jp { font-size: 15px; letter-spacing: .1em; text-transform: none; margin-right: 8px; }
.hokage-note p { margin: 0; }

/* ---------- TRAINING ---------- */
.stations { display: grid; gap: 28px; }
.station { background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 18px; }
.st-label { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 14px; color: var(--ink-2); }
.st-label .jp { font-size: 18px; color: var(--vermilion); margin-right: 4px; }
.st-label b { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 900; font-size: 17px; color: var(--ink); }
.st-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
.station.flip .st-grid > .st-canvas-wrap { order: 2; }
.st-canvas-wrap { display: grid; gap: 8px; min-width: 0; }
canvas.sim { width: 100%; height: 300px; display: block; background: var(--charcoal); border: 3px solid var(--ink); }
canvas.sim.tall { height: 420px; }
canvas.trace { width: 100%; height: 120px; display: block; background: var(--paper-2); border: 3px solid var(--ink); }
.st-side p { margin: 0 0 14px; font-size: 15px; }
.ctl { display: grid; gap: 6px; margin: 12px 0; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
.ctl input[type=range] { width: 100%; accent-color: var(--vermilion); }
.ctl output { color: var(--vermilion); font-weight: 600; }
.ctl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { background: var(--orange); border: 2px solid var(--ink); padding: 8px 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.ghost { background: var(--paper); }
.btn.ghost.light { background: transparent; color: var(--paper); border-color: var(--paper); box-shadow: 3px 3px 0 var(--vermilion); }
.chk { font-family: var(--mono); font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.readout { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; margin-top: 14px; border-top: 2px dashed rgba(20,17,16,.25); padding-top: 10px; }
.readout b { color: var(--deep-red); }
.ledger { border: 2px solid var(--ink); background: var(--paper-2); font-family: var(--mono); font-size: 12px; margin-top: 8px; }
.ledger-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid rgba(20,17,16,.2); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .l-k { display: flex; flex-direction: column; }
.ledger-row small { opacity: .65; font-size: 10px; }
.ledger-row b { font-size: 18px; white-space: nowrap; }
.ledger-row.spk b { color: var(--leaf); }
.ledger-row.dense b { color: var(--vermilion); }
.ledger-row.ratio { background: var(--ink); color: var(--paper); }
.ledger-row.ratio b { color: var(--orange-2); }
.fine { font-size: 12px !important; opacity: .75; margin-top: 10px !important; }
.solves { margin-top: 28px; background: var(--ink); color: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--orange); padding: 18px; }
.solves-head { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--orange-2); margin-bottom: 10px; }
.solves-head .jp { font-size: 18px; text-transform: none; margin-right: 8px; }
.solves-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; font-size: 14px; }
.solves-grid b { display: block; font-family: var(--display); font-size: 20px; letter-spacing: .03em; color: var(--paper); margin-bottom: 4px; }

/* ---------- SCROLLS ---------- */
.library { display: grid; gap: 22px; }
.scroll { position: relative; }
.scroll summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 22px 1fr 22px; align-items: stretch; }
.scroll summary::-webkit-details-marker { display: none; }
.rod { background: linear-gradient(180deg, #3a1712, #7a3a2b 50%, #3a1712); border: 2px solid var(--ink); border-radius: 6px; position: relative; }
.rod::before, .rod::after { content: ""; position: absolute; left: -6px; right: -6px; height: 10px; background: var(--gold); border: 2px solid var(--ink); border-radius: 3px; }
.rod::before { top: -8px; } .rod::after { bottom: -8px; }
.sc-title { background: var(--paper); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); padding: 16px 20px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px;
  align-items: center; box-shadow: var(--shadow); }
.sc-title .jp { grid-row: span 2; font-size: 40px; color: var(--vermilion); line-height: 1; }
.sc-title b { font-family: var(--display); font-size: clamp(20px, 2.3vw, 30px); letter-spacing: .02em; line-height: 1.05; }
.sc-title small { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; opacity: .8; }
.sc-body { margin: 0 22px; background: var(--paper); border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); box-shadow: var(--shadow);
  padding: 8px 20px 18px; background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,17,16,.06) 31px 32px); }
.sc-body ul { margin: 8px 0 0; padding-left: 20px; font-size: 15px; }
.sc-body li { margin: 6px 0; }
.scroll[open] .sc-body { animation: unroll .55s var(--ease); transform-origin: top; }
@keyframes unroll { from { transform: scaleY(0); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- JUTSU ---------- */
.arsenal { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; align-items: center; }
.wheel-wrap { background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 14px; }
#wheel { width: 100%; height: auto; display: block; }
#wheel .node { cursor: pointer; }
#wheel .node circle { fill: var(--paper-2); stroke: var(--ink); stroke-width: 3; transition: fill .2s, transform .2s; transform-box: fill-box; transform-origin: center; }
#wheel .node text.k { font-family: var(--brush); font-size: 34px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
#wheel .node text.n { font-family: var(--mono); font-size: 10px; letter-spacing: .15em; fill: var(--ink-2); text-anchor: middle; pointer-events: none; text-transform: uppercase; }
#wheel .node:hover circle { transform: scale(1.06); }
#wheel .node.active circle { fill: var(--orange); }
#wheel .edge { stroke: var(--ink); stroke-width: 2.5; fill: none; opacity: .5; }
#wheel .edge.active { stroke: var(--vermilion); opacity: 1; stroke-width: 4; }
#wheel .ring { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 4 8; opacity: .5; }
.jutsu-list { background: var(--ink); color: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--orange); padding: 20px; min-height: 320px; }
.jl-head { display: grid; grid-template-columns: auto 1fr; gap: 0 14px; align-items: center; margin-bottom: 16px; }
.jl-kanji { grid-row: span 2; font-family: var(--brush); font-size: 64px; line-height: 1; color: var(--orange-2); }
.jl-name { font-family: var(--display); font-size: clamp(24px, 2.6vw, 34px); letter-spacing: .04em; line-height: 1; }
.jl-sub { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.jl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.jl-chips span { border: 2px solid var(--paper); padding: 6px 10px; font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; animation: chip .4s var(--ease) both; }
.jl-chips span i { font-style: normal; font-family: var(--brush); color: var(--orange-2); margin-right: 6px; }
@keyframes chip { from { opacity: 0; transform: translateY(8px); } }

/* ---------- SUMMON ---------- */
.summon { max-width: none; padding: 16vh 0 10vh; background: linear-gradient(180deg, transparent 0, rgba(18,18,18,.85) 12%, var(--charcoal) 40%); color: var(--paper); }
.summon .scene-head { max-width: var(--maxw); margin: 0 auto 30px; padding: 0 20px; }
.summon .scene-head h2 .jp, .summon .scene-head h2 .en { text-shadow: 6px 6px 0 var(--deep-red); }
.summon .sh-num { color: var(--orange-2); }
.ritual { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; min-height: 560px; }
#seal-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ritual-ui { position: relative; z-index: 1; display: grid; gap: 22px; justify-items: center; transition: opacity .5s; }
.ritual.done .ritual-ui { opacity: 0; pointer-events: none; }
.ritual-ui[hidden] { display: none; }
.seq { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; font-family: var(--mono); font-size: 11px; letter-spacing: .15em; text-transform: uppercase; }
.seq span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; border: 2px dashed rgba(243,234,211,.35); min-width: 74px; transition: .3s; }
.seq span i { font-style: normal; font-family: var(--brush); font-size: 26px; line-height: 1; }
.seq span.done { border-style: solid; border-color: var(--orange); color: var(--orange-2); background: rgba(217,119,87,.12); }
.seq span.next { border-color: var(--paper); }
.seals { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; width: min(100%, 720px); }
.seals button { background: var(--deep-red); color: var(--paper); border: 3px solid var(--paper); padding: 12px 6px 8px; display: grid; justify-items: center; gap: 2px;
  box-shadow: 4px 4px 0 var(--vermilion); transition: transform .12s, background .2s; }
.seals button i { font-style: normal; font-family: var(--brush); font-size: 34px; line-height: 1; }
.seals button span { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.seals button:hover { background: var(--vermilion); transform: translate(-1px,-1px); }
.seals button.ok { background: var(--orange); color: var(--ink); border-color: var(--ink); }
.seals button.bad { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.skip { background: none; border: 0; color: var(--paper); opacity: .6; text-decoration: underline; font-family: var(--mono); font-size: 12px; }
.skip:hover { opacity: 1; }
.summoned { position: relative; z-index: 2; display: grid; gap: 22px; justify-items: center; padding: 20px 0 0; animation: rise .8s var(--ease) both; }
.summoned[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.sm-title { font-family: var(--display); font-size: clamp(26px, 4vw, 48px); letter-spacing: .06em; text-transform: uppercase; text-align: center; text-shadow: 4px 4px 0 var(--deep-red); }
.sm-title .jp { display: block; font-size: clamp(20px, 2.4vw, 28px); letter-spacing: .3em; color: var(--orange-2); text-shadow: none; text-transform: none; }
.contacts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: 100%; }
.contact { background: var(--paper); color: var(--ink); text-decoration: none; border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--vermilion); padding: 18px 16px;
  display: grid; gap: 4px; justify-items: start; transition: transform .15s, box-shadow .15s; }
.contact:hover { transform: translate(-2px,-2px); box-shadow: 8px 8px 0 var(--orange); }
.contact i { font-style: normal; font-family: var(--brush); font-size: 34px; line-height: 1; color: var(--vermilion); }
.contact b { font-family: var(--display); font-size: 22px; letter-spacing: .03em; line-height: 1; }
.contact small { font-family: var(--mono); font-size: 11px; opacity: .75; word-break: break-all; }

.foot { position: relative; z-index: 1; background: var(--charcoal); color: var(--paper); padding: 22px 20px 30px; display: flex; gap: 14px 24px; flex-wrap: wrap; justify-content: space-between;
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; border-top: 2px solid var(--deep-red); }
.foot-links { display: flex; gap: 16px; }
.foot-links a { color: var(--orange-2); }
.foot-fine { opacity: .55; width: 100%; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: var(--shadow-sm);
  padding: 8px 14px; font-family: var(--mono); font-size: 12px; z-index: 70; animation: rise .3s var(--ease), fade .4s 1.8s forwards; }
@keyframes fade { to { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .st-grid { grid-template-columns: 1fr; }
  .station.flip .st-grid > .st-canvas-wrap { order: 0; }
  .arsenal { grid-template-columns: 1fr; }
  .contacts { grid-template-columns: repeat(2, 1fr); }
  .solves-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .scene { padding: 12vh 14px 10vh; }
  .travel { height: 110vh; }
  .hud { padding: 10px 12px; }
  .hud-loc { display: none; }
  .brand-text .en { display: none; }
  .chapters { top: 58px; right: auto; left: 50%; transform: translateX(-50%); flex-direction: row; gap: 5px; }
  .chapters a i { width: 26px; height: 26px; font-size: 12px; }
  .chapters a span { display: none; }
  .dialogue { padding: 10px 40px 12px 14px; }
  .dlg-text { font-size: 14px; }
  #gate .beam-en { font-size: 10px; letter-spacing: .16em; }
  #gate .gate-beam { height: 12vh; min-height: 84px; }
  .book { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .spine { display: none; }
  .page { padding: 22px 18px; min-height: 0; }
  .page-left { border-right: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .mission summary { grid-template-columns: 56px 1fr 40px; gap: 10px; padding: 12px; }
  .rank { width: 56px; height: 56px; } .rank b { font-size: 28px; }
  .wax { width: 38px; height: 38px; font-size: 17px; }
  canvas.sim { height: 240px; } canvas.sim.tall { height: 320px; }
  .seals { grid-template-columns: repeat(4, 1fr); }
  .seals button i { font-size: 28px; }
  .contacts { grid-template-columns: 1fr; }
  .solves-grid { grid-template-columns: 1fr; }
  .hero-kanji { right: -10vw; top: 0; }
  .sc-title { padding: 12px 12px; }
  .dialogue { bottom: 12px; width: calc(100vw - 20px); }
  #gate .gate-ui { bottom: 6vh; }
  #gate .door-kanji { font-size: 34vw; }
  .letterbox { height: 6vh; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .r { opacity: 1; transform: none; }
  .hero-title .line span, .hero-sub, .hero-tags, .hero-kanji, .scroll-hint { transform: none; opacity: 1; }
  .letterbox { display: none; }
  .scroll-hint i::after { display: none; }
}

/* ---------- sealed résumé scroll ---------- */
.sealed { border: 3px solid var(--ink); background: var(--paper); color: var(--ink); padding: 26px 26px 22px; width: min(92vw, 560px);
  box-shadow: 10px 10px 0 var(--ink); background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,17,16,.06) 31px 32px); position: relative; }
.sealed::backdrop { background: rgba(18,18,18,.72); backdrop-filter: blur(2px); }
.sealed[open] { animation: rise .35s var(--ease); }
.sealed-close-form { position: absolute; right: 8px; top: 6px; margin: 0; }
.sealed-close { background: none; border: 0; font-size: 26px; line-height: 1; padding: 4px 8px; }
.sealed-seal { position: absolute; left: -18px; top: -18px; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e04a3d, var(--deep-red) 70%);
  color: var(--paper); display: grid; place-items: center; font-size: 26px; box-shadow: 2px 2px 0 rgba(0,0,0,.35); transform: rotate(-10deg); }
.sealed-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--vermilion); }
.sealed-kicker .jp { font-size: 15px; letter-spacing: .1em; text-transform: none; }
.sealed h3 { font-family: var(--display); font-size: clamp(26px, 3.4vw, 36px); letter-spacing: .02em; line-height: 1; margin: 8px 0 10px; }
.sealed-head p { margin: 0 0 16px; font-size: 15px; }
.sealed-form { display: grid; gap: 10px; }
.sealed-form label { display: grid; gap: 4px; font-family: var(--mono); font-size: 11px; letter-spacing: .15em; text-transform: uppercase; }
.sealed-form label em { font-style: normal; opacity: .55; text-transform: none; letter-spacing: 0; }
.sealed-form input, .sealed-form textarea { font: 15px var(--body); padding: 9px 10px; border: 2px solid var(--ink); background: #FBF6EA; color: var(--ink); width: 100%; box-sizing: border-box; }
.sealed-form input:focus, .sealed-form textarea:focus { outline: 3px solid var(--orange); outline-offset: 1px; }
.sealed-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sealed-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.sealed-fine { font-family: var(--mono); font-size: 11px; opacity: .65; }
.sealed-status { margin: 4px 0 0; font-size: 14px; min-height: 1.4em; font-weight: 700; }
.sealed-status.ok { color: var(--leaf); }
.sealed-status.err { color: var(--vermilion); }
.sealed.done .sealed-form label, .sealed.done .sealed-actions { display: none; }
@media (max-width: 760px) { .sealed { padding: 22px 16px 18px; } .sealed-seal { left: -10px; top: -14px; width: 46px; height: 46px; font-size: 22px; } }

/* ---------- visitors + the back room ---------- */
.hud-btn.visitors { background: var(--paper); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.hud-btn.visitors b { font-family: var(--display); font-size: 16px; letter-spacing: .04em; }
.hud-btn.visitors .s-kanji { color: var(--vermilion); }
@media (max-width: 760px) { .hud-btn.visitors .s-label { display: none; } .hud-btn.visitors { padding: 8px 10px; } }
.backroom { width: min(94vw, 720px); }
.backroom.listing .sealed-form, .backroom.listing .backroom-intro { display: none; }
.backroom-stats { display: flex; gap: 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 12px; }
.backroom-stats b { font-family: var(--display); font-size: 22px; letter-spacing: .02em; color: var(--deep-red); margin-right: 4px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 52vh; overflow: auto; }
.notes li { border: 2px solid var(--ink); background: #FBF6EA; padding: 10px 12px; box-shadow: 3px 3px 0 var(--ink); display: grid; gap: 4px; }
.notes .n-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.notes .n-name { font-family: var(--display); font-size: 20px; letter-spacing: .02em; }
.notes .n-when { font-family: var(--mono); font-size: 11px; opacity: .65; }
.notes .n-mail a { color: var(--vermilion); font-family: var(--mono); font-size: 13px; }
.notes .n-co { font-size: 13px; font-weight: 700; }
.notes .n-msg { font-size: 14px; white-space: pre-wrap; }
.notes .empty { text-align: center; opacity: .7; font-family: var(--mono); font-size: 13px; padding: 20px; box-shadow: none; border-style: dashed; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pager-label { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; }
.pager button[disabled] { opacity: .4; cursor: default; transform: none; }

/* ---------- the visitors' book at the gate ---------- */
.guest-book { width: min(100%, 560px); margin: 0 auto 16px; background: rgba(243,234,211,.96); color: var(--ink); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 12px 14px; text-align: left; }
.gb-head { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--vermilion); margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.gb-head .jp { font-size: 16px; letter-spacing: .1em; text-transform: none; }
.gb-head em { font-style: normal; opacity: .55; text-transform: none; letter-spacing: 0; margin-left: auto; }
.gb-fields { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; }
.gb-fields input { font: 15px var(--body); padding: 9px 10px; border: 2px solid var(--ink); background: #FBF6EA; color: var(--ink); width: 100%; box-sizing: border-box; }
.gb-fields input:focus { outline: 3px solid var(--orange); outline-offset: 1px; }
.gb-fields input.bad { border-color: var(--vermilion); }
.gb-opt { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin-top: 8px; line-height: 1.4; }
.gb-opt input { margin-top: 3px; accent-color: var(--vermilion); }
.guest-book .hp { position: absolute; left: -9999px; }
.gb-status { margin: 6px 0 0; font-family: var(--mono); font-size: 11px; min-height: 1.2em; color: var(--vermilion); }
.guest-back { width: min(100%, 560px); margin: 0 auto 16px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 12px 14px; font-size: 15px; text-align: left; }
.guest-back[hidden] { display: none; }
.guest-back .jp { color: var(--vermilion); margin-right: 6px; }
.gb-notyou { background: none; border: 0; text-decoration: underline; font-family: var(--mono); font-size: 11px; margin-left: 8px; opacity: .7; }
@media (max-width: 760px) { .gb-fields { grid-template-columns: 1fr; } .guest-book, .guest-back { padding: 10px 12px; } #gate .gate-line { font-size: 20px; margin-bottom: 12px; } }
/* back room tabs */
.bk-tabs { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.bk-tab { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; background: var(--paper-2); border: 2px solid var(--ink); padding: 7px 12px; }
.bk-tab.active { background: var(--ink); color: var(--paper); }
.bk-copy { margin-left: auto; }
.notes .n-flags { display: flex; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; }
.notes .n-flags span { border: 1.5px solid var(--ink); padding: 2px 6px; }
.notes .n-flags .yes { background: var(--leaf); color: var(--paper); border-color: var(--leaf); }

/* ---------- trusted devices ---------- */
.pk-unlock .jp, .devices summary .jp { color: var(--vermilion); margin-right: 6px; }
.devices { margin: 0 0 12px; border: 2px dashed rgba(20,17,16,.3); padding: 8px 12px; }
.devices summary { cursor: pointer; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; list-style: none; }
.devices summary::-webkit-details-marker { display: none; }
.devices summary .dev-count { color: var(--vermilion); margin-left: 6px; }
.dev-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.dev-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; border-bottom: 1px solid rgba(20,17,16,.15); padding-bottom: 6px; }
.dev-list li small { font-family: var(--mono); font-size: 11px; opacity: .65; }
.dev-list .dev-rm { background: none; border: 0; color: var(--vermilion); font-family: var(--mono); font-size: 11px; text-decoration: underline; }
.dev-list .empty { border: 0; opacity: .7; font-family: var(--mono); font-size: 12px; }
.dev-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.dev-note { font-family: var(--mono); font-size: 11px; opacity: .75; }

/* ---------- dialog fallback for browsers without <dialog>.showModal ---------- */
dialog.dlg-fallback { display: block; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 90; max-height: 90vh; overflow: auto; margin: 0; }
body.dlg-open::after { content: ""; position: fixed; inset: 0; background: rgba(18,18,18,.72); z-index: 85; }
body.dlg-open { overflow: hidden; }

/* =====================================================================
   PHONE — one compact header row, chapters as a bottom bar, smaller
   narrator, no iOS focus-zoom, safe-area aware.
   ===================================================================== */
@media (max-width: 760px) {
  /* header: brand mark, visitors, sound — one row */
  .hud { padding: 8px 10px; gap: 8px; }
  .hud-brand { padding: 6px 8px; }
  .hud-brand .brand-text { display: none; }
  .hud-right { gap: 8px; }
  .hud-btn { padding: 8px 10px; }
  .hud-btn .s-label { display: none; }
  .hud-btn.visitors b { font-size: 15px; }
  /* chapters: a bottom bar with real tap targets */
  .chapters { top: auto; bottom: 0; left: 0; right: 0; transform: none; flex-direction: row; justify-content: space-around; gap: 0;
    background: rgba(20,17,16,.92); border-top: 2px solid var(--paper); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .chapters a { flex: 1; justify-content: center; }
  .chapters a i { width: 40px; height: 36px; font-size: 16px; background: transparent; border-color: transparent; }
  .chapters a.active i { background: var(--orange); color: var(--ink); border-color: var(--ink); transform: none; }
  /* narrator: compact, above the bar */
  .dialogue { bottom: calc(58px + env(safe-area-inset-bottom)); width: calc(100vw - 16px); padding: 8px 34px 9px 12px; border-width: 2px; box-shadow: 3px 3px 0 var(--ink); }
  .dlg-speaker { font-size: 10px; }
  .dlg-speaker .jp { font-size: 12px; }
  .dlg-text { font-size: 13px; line-height: 1.4; }
  .dlg-close { right: 4px; top: 2px; font-size: 20px; }
  /* room for the bar */
  .foot { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .scroll-hint { bottom: calc(76px + env(safe-area-inset-bottom)); }
  /* hero */
  .hero { padding-top: 14vh; }
  .hero-kicker { font-size: 10px; letter-spacing: .18em; padding: 5px 8px; }
  .hero-kicker .kicker-loc { display: none; }
  .hero-title { font-size: 19vw; text-shadow: 5px 5px 0 var(--ink); }
  .hero-kanji { right: -2vw; top: 4vh; font-size: 48vw; }
  body.entered .hero-kanji { opacity: .55; }
  .hero-sub { font-size: 15px; padding: 12px 14px; }
  .hero-tags { gap: 8px; }
  .hero-tags span { font-size: 11px; padding: 5px 8px; }
  /* scene heads */
  .scene-head h2 { gap: 10px; }
  .scene-head h2 .jp { font-size: 17vw; text-shadow: 4px 4px 0 var(--ink); }
  .scene-head h2 .en { font-size: 8.5vw; text-shadow: 3px 3px 0 var(--ink); }
  .sh-lead { font-size: 15px; padding: 12px 14px; }
  /* register */
  .portrait { width: 200px; margin: 0 auto 12px; }
  .ident { text-align: center; }
  .ident-dl { text-align: left; }
  .stamp { right: 10px; top: 10px; font-size: 22px; }
  /* missions */
  .board { padding: 12px; backdrop-filter: none; }
  .mission summary { grid-template-columns: 48px 1fr 34px; gap: 10px; padding: 12px; }
  .rank { width: 48px; height: 48px; } .rank b { font-size: 24px; } .rank small { font-size: 8px; }
  .wax { width: 34px; height: 34px; font-size: 15px; }
  .m-title { font-size: 19px; }
  .m-body { padding: 0 12px 14px; }
  .m-body ul { padding-left: 16px; font-size: 14.5px; }
  /* training */
  .station { padding: 14px 12px; }
  .st-side p, .solves-grid { font-size: 14.5px; }
  /* scrolls */
  .sc-title .jp { font-size: 30px; }
  .sc-title b { font-size: 19px; }
  /* summon */
  .summon .scene-head { padding: 0 14px; }
  .ritual { padding: 0 14px; min-height: 0; }
  .seals { gap: 8px; }
  .seals button { padding: 10px 4px 6px; }
  .seals button i { font-size: 26px; }
  .seq span { min-width: 64px; padding: 6px 8px; }
  .contact { padding: 14px; }
  /* dialogs and inputs: no iOS zoom, fit the screen */
  .sealed { width: 94vw; max-height: 88vh; overflow: auto; padding: 20px 14px 16px; }
  .sealed h3 { font-size: 24px; }
  .sealed-head { padding-right: 34px; }
  .sealed-form input, .sealed-form textarea, .gb-fields input { font-size: 16px; }
  .notes { max-height: 44vh; }
  .backroom-stats b { font-size: 18px; }
  /* gate */
  #gate .gate-ui { bottom: calc(4vh + env(safe-area-inset-bottom)); width: 94vw; }
  .guest-book { padding: 10px 12px; margin-bottom: 12px; }
  .gb-opt { font-size: 12px; }
  .btn-enter { padding: 14px 22px; font-size: 18px; }
  .btn-ghost { padding: 12px 16px; font-size: 12px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  #gate .gate-line { display: none; }
  #gate .door-kanji { font-size: 26vw; }
}

/* =====================================================================
   POCKET — the phone experience. Decks of swipeable cards per chapter,
   bottom sheets for long text, the world visible at the card edges.
   Only applies when js/pocket.js added html.pocket (≤760px at load).
   ===================================================================== */
html.pocket .scene { padding: 10vh 0 6vh; scroll-margin-top: 64px; }
html.pocket .scene-head { padding: 0 14px; margin-bottom: 14px; }
html.pocket .scene-head h2 { margin: 4px 0 10px; }
html.pocket .sh-lead { font-size: 14.5px; padding: 10px 12px; }
html.pocket #register .sh-lead, html.pocket #missions .sh-lead, html.pocket #scrolls .sh-lead, html.pocket #jutsu .sh-lead { display: none; }
html.pocket .travel { height: 82vh; }
html.pocket .travel.night { height: 100vh; }

/* the Gatekeeper speaks from the chapter header */
.pocket-caption { display: none; margin-top: 10px; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--orange); padding: 8px 10px; font-size: 13px; line-height: 1.4; }
.pocket-caption.show { display: flex; gap: 8px; align-items: flex-start; }
.pocket-caption .jp { color: var(--orange-2); font-size: 14px; flex: none; }
html.pocket .summon .pocket-caption { box-shadow: 3px 3px 0 var(--vermilion); }

/* deck */
.deck-wrap { position: relative; }
.deck { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; padding: 4px 6vw 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.deck::-webkit-scrollbar { display: none; }
.card { flex: 0 0 88vw; max-width: 88vw; scroll-snap-align: center; background: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 16px 14px; box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; min-height: 60svh; position: relative; color: var(--ink); }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.dots i { width: 8px; height: 8px; background: rgba(243,234,211,.45); border: 1.5px solid var(--ink); transform: rotate(45deg); transition: background .2s; }
.dots i.on { background: var(--orange); }
.swipe-hint { position: absolute; right: 12px; top: -26px; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--paper); text-shadow: 0 1px 0 var(--ink); animation: nudge 1.4s ease-in-out infinite; transition: opacity .3s; }
.swipe-hint.gone { opacity: 0; }
@keyframes nudge { 50% { transform: translateX(6px); } }
.c-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--vermilion); }
.more { align-self: flex-start; margin-top: auto; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); padding: 10px 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; box-shadow: 3px 3px 0 var(--orange); min-height: 44px; }
.more::after { content: " ↗"; color: var(--orange-2); }

/* register cards */
.c-portrait { justify-content: flex-end; min-height: 68svh; background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,17,16,.06) 31px 32px); }
.c-portrait .portrait { width: min(70vw, 300px); margin: 0 auto; }
.c-portrait .portrait img { mask-image: linear-gradient(180deg, #000 78%, transparent 100%); -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%); }
.c-portrait .c-ident { text-align: center; }
.c-portrait .ident-name { font-size: 34px; }
.c-portrait .ident-motto { margin: 4px 0 0; font-size: 17px; }
.c-portrait .stamp { right: 12px; top: 12px; font-size: 24px; }
.c-facts .ident-dl { grid-template-columns: 1fr; gap: 12px; margin-top: 6px; }
.c-facts .ident-dl dt { font-size: 11px; }
.c-facts .ident-dl dd { font-size: 20px; font-weight: 700; line-height: 1.25; margin-top: -8px; }
.c-bio .bio-lead { font-size: 20px; line-height: 1.4; }
.c-stats .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
.c-stats .stat b { font-size: 34px; }
.c-stats .stat span { font-size: 12px; }

/* mission cards */
.cm-top { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start; }
.cm-top .rank { width: 56px; height: 56px; } .cm-top .rank b { font-size: 28px; } .cm-top .rank small { font-size: 9px; }
.cm-head { display: flex; flex-direction: column; gap: 2px; }
.cm-head .m-title { font-size: 22px; }
.c-mission .m-brief { margin: 4px 0 0; font-size: 17px; }
.cm-points { margin: 0; padding-left: 18px; font-size: 15px; }
.cm-points li { margin: 6px 0; }
.c-mission .tags { margin-top: 4px; }
.sheet-report ul { margin: 0; padding-left: 18px; font-size: 15px; } .sheet-report li { margin: 8px 0; }
.c-note .hokage-note { box-shadow: none; border: 0; padding: 0; background: transparent; color: var(--ink); font-size: 16px; }
.c-note .note-head { color: var(--vermilion); }

/* training cards: result and control share the screen */
.c-intro { justify-content: center; align-items: flex-start; background: var(--ink); color: var(--paper); border-color: var(--ink); box-shadow: 6px 6px 0 var(--orange); }
.c-big { font-family: var(--display); font-size: 40vw; line-height: .9; color: var(--orange); letter-spacing: -.02em; }
.c-big small { font-size: 12vw; color: var(--paper); margin-left: 4px; }
.c-intro-text { font-size: 18px; line-height: 1.45; margin: 8px 0 0; }
.c-intro-sub { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--orange-2); margin: 0; }
.c-station { gap: 8px; padding: 12px 12px 14px; }
.c-station .st-label { margin-bottom: 0; font-size: 11px; }
.c-station .st-label b { font-size: 15px; }
.cs-sim { display: grid; gap: 6px; }
.c-station canvas.sim { height: 34svh; min-height: 200px; border-width: 2px; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.c-station canvas.sim.tall { height: 30svh; }
.c-station canvas.trace { height: 62px; border-width: 2px; touch-action: pan-y; }
.cs-line { margin: 0; font-size: 14px; line-height: 1.4; }
.cs-controls { display: grid; gap: 6px; margin-top: auto; }
.cs-controls .readout { margin-top: 0; padding-top: 0; border-top: 0; font-size: 12px; }
.cs-controls .ctl { margin: 0; gap: 4px; }
.cs-controls .ctl input[type=range] { height: 32px; touch-action: none; }
.cs-controls .ctl-row .btn { min-height: 44px; flex: 1; }
.cs-controls .ledger { font-size: 11px; }
.cs-controls .ledger-row { padding: 6px 8px; }
.cs-controls .ledger-row b { font-size: 15px; }
.c-station .more { margin-top: 0; align-self: stretch; text-align: center; }
.c-solves .solves { margin: 0; box-shadow: none; border: 0; padding: 0; background: transparent; color: var(--ink); }
.c-solves .solves-head { color: var(--vermilion); }
.c-solves .solves-grid { grid-template-columns: 1fr; gap: 16px; }
.c-solves .solves-grid b { color: var(--ink); font-size: 26px; }
.c-solves .solves-grid div { font-size: 15px; }

/* scroll cards */
.c-scroll .cs-title { box-shadow: none; border: 0; padding: 0; grid-template-columns: auto 1fr; }
.c-scroll .cs-title .jp { font-size: 36px; }
.c-scroll .cs-title b { font-size: 22px; }
.c-scroll .sc-body { margin: 0; border: 0; box-shadow: none; padding: 0; background-image: none; }
.c-scroll .sc-body ul { padding-left: 18px; font-size: 15px; }

/* jutsu card */
.c-jutsu { min-height: 0; padding: 0; background: transparent; border: 0; box-shadow: none; gap: 14px; }
.c-jutsu .wheel-wrap { padding: 10px; }
.c-jutsu .jutsu-list { min-height: 0; }
html.pocket #wheel .node text.n { font-size: 13px; }

/* bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 95; background: rgba(18,18,18,.6); display: none; align-items: flex-end; }
.sheet.open { display: flex; }
.sheet-panel { width: 100%; max-height: 82svh; overflow: auto; background: var(--paper); color: var(--ink); border-top: 3px solid var(--ink); padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); position: relative; animation: sheetUp .3s var(--ease); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 44px; height: 4px; background: var(--ink); opacity: .35; margin: 4px auto 12px; border-radius: 2px; }
.sheet-close { position: absolute; right: 8px; top: 6px; width: 44px; height: 44px; background: none; border: 0; font-size: 28px; line-height: 1; }
.sheet-title { font-family: var(--display); font-size: 24px; letter-spacing: .02em; line-height: 1.05; margin: 0 44px 10px 0; }
.sheet-body { font-size: 15.5px; line-height: 1.55; }
.sheet-body p { margin: 0 0 12px; }
.sheet-body .fine { font-size: 13px !important; }
body.sheet-open { overflow: hidden; }

/* the visitors' book folded to one line */
.guest-book.folded { padding: 0; background: rgba(243,234,211,.96); }
.guest-book.folded .gb-head { padding: 12px 14px; margin: 0; cursor: pointer; min-height: 44px; align-items: center; }
.guest-book.folded .gb-head::after { content: "▾"; margin-left: 6px; }
.guest-book.folded .gb-fields, .guest-book.folded .gb-opt, .guest-book.folded .gb-status { display: none; }
.guest-book .gb-head { flex-wrap: wrap; row-gap: 2px; }
.guest-book .gb-head .jp { white-space: nowrap; }

/* audit fixes: targets and text floors */
@media (max-width: 760px) {
  .chapters a i { height: 44px; }
  .chapters { padding-top: 2px; }
  .dialogue { bottom: calc(66px + env(safe-area-inset-bottom)); }
  .scroll-hint { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .foot { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .sealed-close { width: 44px; height: 44px; padding: 0; }
  .sealed-close-form { right: 4px; top: 4px; }
  .foot-links a { display: inline-block; padding: 10px 4px; }
  .chk input { width: 20px; height: 20px; }
  .rank small { font-size: 10px; }
  .hero-kicker { font-size: 11px; }
  .stat span, .ledger-row small, .sealed-fine, .gb-status, .dev-note { font-size: 12px; }
  .ctl sub { font-size: 11px; }
  .hud-btn[aria-pressed="false"] .s-kanji { opacity: .55; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--vermilion); }
  .hud-btn[aria-pressed="true"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); margin-left: 2px; }
}

/* pocket: decks settle under the header; station cards fit one screen */
html.pocket { scroll-snap-type: y proximity; }
html.pocket .deck-wrap { scroll-snap-align: start; scroll-margin-top: 62px; }
html.pocket .hero, html.pocket .travel, html.pocket .summon .ritual { scroll-snap-align: none; }
.c-station { min-height: 0; height: calc(100svh - 134px); max-height: 760px; overflow: hidden; }
.c-station canvas.sim { height: auto; flex: 1 1 0; min-height: 170px; max-height: 34svh; }
.c-station canvas.sim.tall { max-height: 28svh; }
.c-station canvas.trace { height: 54px; }
.cs-sim { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.c-station .more { min-height: 36px; padding: 6px 10px; font-size: 11px; box-shadow: 2px 2px 0 var(--orange); }
.c-station .st-label { line-height: 1.3; }
.c-portrait { min-height: 0; height: calc(100svh - 134px); max-height: 720px; }
.c-portrait .portrait { width: min(64vw, 280px); flex: 0 1 auto; min-height: 0; }
.c-portrait .portrait img { max-height: 46svh; object-fit: contain; }
.swipe-hint { top: 10px; right: 8vw; background: var(--ink); color: var(--paper); padding: 5px 9px; border: 2px solid var(--paper); text-shadow: none; z-index: 2; }
html.pocket #wheel .node text.n { font-size: 11px; }
@media (max-width: 760px) {
  #gate .door-kanji { font-size: 30vw; transform: translateY(-18vh); }
  #gate .gate-line { font-size: 19px; line-height: 1.25; margin-bottom: 14px; }
  #gate .knocker { display: none; }
}
/* short phones: drop the one-liner so canvas + controls still share the screen */
@media (max-height: 720px) {
  .c-station .cs-line { display: none; }
  .c-station canvas.sim { flex: none; height: 176px; max-height: none; }
  .c-station canvas.trace { height: 48px; }
  .c-station { height: auto; max-height: none; overflow: visible; }
}
.deck-wrap.has-hint { margin-top: 30px; }
.swipe-hint { top: -30px; right: 6vw; }
/* pocket: no floating narrator (captions live in the headers); portrait fills its card */
html.pocket .dialogue { display: none; }
html.pocket .c-portrait { justify-content: space-between; }
html.pocket .c-portrait .portrait { flex: 1 1 auto; display: flex; align-items: flex-end; justify-content: center; }
html.pocket .c-portrait .portrait img { max-height: 100%; height: 100%; width: auto; max-width: 100%; }
@media (max-height: 720px) { .cs-sim { flex: none; } .c-station .cs-controls { margin-top: 6px; } }

/* ---------- pocket · Register: the page, the file, the chakra sheet ---------- */
html.pocket #register .scene-head h2 { align-items: baseline; gap: 8px; margin-bottom: 6px; }
html.pocket #register .scene-head h2 .jp { font-size: 13vw; }
html.pocket #register .scene-head h2 .en { font-size: 6.5vw; }
html.pocket #register .card { height: calc(100svh - 190px); min-height: 520px; max-height: 760px; overflow: hidden; padding: 0; }
/* card 1 */
.c-page { perspective: 1400px; background: transparent; border: 0; box-shadow: none; }
.page-flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.4,.1,.2,1); cursor: pointer; }
.page-flip.flipped { transform: rotateY(180deg); }
.page-front, .page-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); background: var(--paper); overflow: hidden; }
.page-front { background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,17,16,.06) 31px 32px); }
.page-back { transform: rotateY(180deg); background: #E9E2D0; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.pf-photo { position: absolute; left: 0; right: 0; top: 0; height: 74%; display: flex; justify-content: center; align-items: flex-start; }
.pf-photo img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: top; filter: drop-shadow(5px 5px 0 var(--ink)); mask-image: linear-gradient(180deg, #000 72%, transparent 100%); -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%); }
.pf-stamp { position: absolute; right: 12px; top: 14px; font-size: 26px; color: var(--vermilion); border: 3px solid var(--vermilion); padding: 2px 8px; transform: rotate(-9deg) scale(3); opacity: 0; mix-blend-mode: multiply; transition: transform .35s cubic-bezier(.3,1.6,.5,1) .6s, opacity .2s .6s; }
.c-page.in .pf-stamp { transform: rotate(-9deg) scale(1); opacity: .9; }
.pf-tap { position: absolute; left: 12px; top: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink); opacity: .55; }
.pf-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 16px 16px; text-align: center; }
.pf-name { font-family: var(--display); font-size: 12vw; line-height: .95; letter-spacing: .01em; }
.pf-motto { font-size: 18px; color: var(--deep-red); margin: 6px 0 12px; }
.pf-strip { display: inline-flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: 7px 12px; }
.pf-strip i { color: var(--orange-2); font-style: normal; }
.pb-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--vermilion); border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.pb-head .jp { font-size: 15px; letter-spacing: .1em; text-transform: none; }
.pb-photo { width: 120px; height: 140px; border: 3px solid var(--ink); background: #D9D1BE; overflow: hidden; align-self: flex-start; }
.pb-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; filter: grayscale(1) contrast(1.15) sepia(.2); mask: none; -webkit-mask: none; }
.pb-dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.pb-dl dt { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--vermilion); padding-top: 3px; }
.pb-dl dd { margin: 0; font-weight: 700; }
.pb-dl .pb-active { color: var(--leaf); }
.pb-bar { margin-top: auto; display: flex; gap: 2px; height: 34px; align-items: stretch; }
.pb-bar i { background: var(--ink); display: block; }
.pb-tap { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; opacity: .55; text-align: right; }
/* card 2 */
.c-file { padding: 18px 16px 16px !important; gap: 10px; background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,17,16,.06) 31px 32px); overflow: auto !important; }
.cf-pull { font-family: var(--display); font-size: 8.4vw; line-height: 1; letter-spacing: .01em; margin: 0; }
.cf-body { margin: 0; font-size: 15.5px; line-height: 1.55; }
.cf-lead { margin: 0; font-family: var(--brush); font-size: 15px; color: var(--deep-red); line-height: 1.5; border-left: 3px solid var(--vermilion); padding-left: 10px; }
.cf-ledger { margin-top: auto; border-top: 2px dashed rgba(20,17,16,.3); padding-top: 8px; display: grid; gap: 4px; }
.cf-ledger div { display: grid; grid-template-columns: 74px 1fr; gap: 10px; font-size: 13.5px; align-items: baseline; }
.cf-ledger dt { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--vermilion); }
.cf-ledger dd { margin: 0; font-weight: 700; }
.cf-ledger a { color: var(--vermilion); }
/* card 3 */
.c-sheet { padding: 18px 16px 16px !important; gap: 12px; background: var(--ink) !important; color: var(--paper); border-color: var(--ink) !important; box-shadow: 6px 6px 0 var(--orange) !important; }
.c-sheet .c-kicker { color: var(--orange-2); }
.cs-rows { display: grid; gap: 14px; }
.cs-row { display: grid; grid-template-columns: 1fr; gap: 2px; position: relative; padding-bottom: 10px; }
.cs-row b { font-family: var(--display); font-size: 13vw; line-height: .9; color: var(--paper); }
.cs-row b small { font-size: 55%; color: var(--orange-2); }
.cs-row span { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; opacity: .85; }
.cs-row i { position: absolute; left: 0; bottom: 0; height: 5px; width: 100%; background: rgba(243,234,211,.12); }
.cs-row i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--orange); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.c-sheet.live .cs-row i::after { width: calc(var(--fill) * 100%); }
.c-sheet.live .cs-row:nth-child(2) i::after { transition-delay: .12s; } .c-sheet.live .cs-row:nth-child(3) i::after { transition-delay: .24s; } .c-sheet.live .cs-row:nth-child(4) i::after { transition-delay: .36s; }
.cs-ref-k { margin-top: auto; }
.cs-ref { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cs-ref b { font-family: var(--display); font-size: 9vw; line-height: .9; color: var(--orange-2); display: block; }
.cs-ref b small { font-size: 55%; }
.cs-ref span { font-family: var(--mono); font-size: 11px; opacity: .8; display: block; margin-top: 4px; line-height: 1.3; }
html.pocket #register .swipe-hint { top: -30px; }
@media (max-height: 720px) {
  html.pocket #register .card { min-height: 460px; }
  .pf-name { font-size: 11vw; } .pf-motto { font-size: 16px; margin: 4px 0 8px; }
  .cs-rows { gap: 8px; } .cs-row b { font-size: 11vw; }
}
.pf-strip span { white-space: nowrap; }
.pf-strip { font-size: 10.5px; letter-spacing: .1em; padding: 7px 10px; gap: 6px; max-width: 100%; }
.pf-photo { height: 80%; }
.pf-photo img { mask-image: linear-gradient(180deg, #000 78%, transparent 100%); -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%); }
.pf-meta { background: linear-gradient(180deg, rgba(243,234,211,0), rgba(243,234,211,.92) 30%); padding-top: 26px; }
@media (max-height: 720px) { .pf-strip { font-size: 9.5px; letter-spacing: .06em; padding: 6px 8px; } .pf-photo { height: 78%; } }
.pb-natures { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.pb-natures .jp { width: 38px; height: 38px; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 20px; background: var(--paper); }
.pb-natures em { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; opacity: .65; width: 100%; }
.pb-stamp { position: absolute; right: 18px; top: 44%; font-size: 30px; color: var(--vermilion); border: 3px solid var(--vermilion); padding: 2px 10px; transform: rotate(12deg); opacity: .55; mix-blend-mode: multiply; }

/* ---------- 転生 · The Transfer ---------- */
.transfer { max-width: none; padding: 16vh 0 14vh; background: linear-gradient(180deg, transparent 0, rgba(18,18,18,.5) 10%, rgba(18,18,18,.9) 30%, var(--charcoal) 55%, rgba(18,18,18,.9) 85%, transparent 100%); color: var(--paper); }
.transfer .scene-head { max-width: var(--maxw); margin: 0 auto 36px; padding: 0 20px; }
.transfer .scene-head h2 .jp, .transfer .scene-head h2 .en { text-shadow: 6px 6px 0 var(--deep-red); }
.transfer .sh-num { color: var(--orange-2); }
.transfer-body { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; display: grid; gap: 28px; }
.tf-big { font-family: var(--display); font-size: clamp(56px, 9vw, 150px); line-height: .95; margin: 0 0 18px; letter-spacing: .01em; color: var(--paper); text-shadow: 8px 8px 0 var(--deep-red); }
.tf-text { font-size: clamp(17px, 1.5vw, 22px); line-height: 1.55; max-width: 860px; margin: 0; }
.tf-text em { color: var(--orange-2); font-style: normal; font-weight: 700; }
.tf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tf-card { background: rgba(243,234,211,.06); border: 2px solid rgba(243,234,211,.35); padding: 18px; display: grid; gap: 8px; }
.tf-card .jp { font-size: 34px; color: var(--orange-2); line-height: 1; }
.tf-card b { font-family: var(--display); font-size: 22px; letter-spacing: .03em; }
.tf-card p { margin: 0; font-size: 15px; line-height: 1.5; opacity: .9; }
.tf-honest { border-left: 4px solid var(--orange); padding: 10px 16px; font-size: 15.5px; max-width: 760px; background: rgba(243,234,211,.05); }
.tf-honest .jp { color: var(--orange-2); margin-right: 8px; }
.tf-cta { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--vermilion); padding: 22px 24px; display: grid; gap: 16px; max-width: 860px; }
.tf-cta p { margin: 0; font-size: clamp(16px, 1.3vw, 19px); }
.tf-btn { justify-self: start; font-size: 15px; padding: 14px 20px; min-height: 48px; }
.tf-btn .jp { margin-right: 8px; color: var(--deep-red); }
.bio-link { color: var(--vermilion); font-weight: 700; }
.n-tag { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; background: var(--deep-red); color: var(--paper); padding: 2px 6px; vertical-align: middle; margin-right: 4px; }
@media (max-width: 980px) { .tf-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .transfer .scene-head { padding: 0 14px; } .transfer-body { padding: 0 14px; } .tf-big { font-size: 13vw; text-shadow: 5px 5px 0 var(--deep-red); } }
/* pocket cards */
html.pocket #transfer .sh-lead { display: none; }
.c-tf-1 { background: var(--ink) !important; color: var(--paper); border-color: var(--ink) !important; box-shadow: 6px 6px 0 var(--deep-red) !important; gap: 14px; }
.c-tf-1 .tf-big { font-size: 15vw; margin: 0; }
.c-tf-1 .tf-text { font-size: 15px; }
.c-tf-1 .tf-honest { margin-top: auto; font-size: 13.5px; }
.c-tf-2 { background: var(--ink) !important; color: var(--paper); border-color: var(--ink) !important; box-shadow: 6px 6px 0 var(--deep-red) !important; gap: 10px; }
.c-tf-2 .tf-grid { gap: 8px; }
.c-tf-2 .tf-card { padding: 10px 12px; gap: 4px; grid-template-columns: 34px 1fr; }
.c-tf-2 .tf-card .jp { font-size: 22px; grid-row: span 2; }
.c-tf-2 .tf-card b { font-size: 16px; } .c-tf-2 .tf-card p { font-size: 13px; }
.c-tf-2 .tf-cta { margin-top: auto; padding: 14px; gap: 10px; box-shadow: 4px 4px 0 var(--vermilion); }
.c-tf-2 .tf-cta p { font-size: 13.5px; }
.c-tf-2 .tf-btn { justify-self: stretch; }
.c-tf-2 .tf-card .jp { writing-mode: horizontal-tb; white-space: nowrap; font-size: 20px; width: 34px; }
.c-tf-2 .tf-card { grid-template-columns: 40px 1fr; }
.c-tf-2 .tf-btn { white-space: nowrap; font-size: 13px; padding: 12px; }
.c-tf-1 .tf-text { font-size: 15.5px; line-height: 1.55; }

/* ---------- 掲示板 · The Notice Board ---------- */
.board-wrap { display: grid; gap: 22px; }
.board-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.bf { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border: 2px solid var(--ink); padding: 8px 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; box-shadow: var(--shadow-sm); min-height: 40px; }
.bf i { font-style: normal; font-family: var(--brush); font-size: 15px; color: var(--vermilion); }
.bf .bf-n { font-size: 10px; opacity: .6; margin-left: 2px; }
.bf.active { background: var(--ink); color: var(--paper); }
.bf.active i { color: var(--orange-2); }
.bf.bf-empty { opacity: .45; }
.board-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.board-empty { grid-column: 1 / -1; background: rgba(243,234,211,.9); border: 3px dashed var(--ink); padding: 26px; text-align: center; font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }
.board-empty .jp { display: block; font-size: 28px; color: var(--vermilion); margin-bottom: 6px; }
.bp { position: relative; background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 14px 14px 16px; display: grid; gap: 10px; transform: rotate(var(--tilt, 0deg)); transition: transform .2s; }
.bp:nth-child(3n+1) { --tilt: -.6deg; } .bp:nth-child(3n+2) { --tilt: .4deg; } .bp:nth-child(3n) { --tilt: -.3deg; }
.bp:hover { transform: rotate(0deg) translateY(-2px); }
.bp-pin { position: absolute; left: 50%; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e04a3d, var(--deep-red) 70%); border: 2px solid var(--ink); transform: translateX(-50%); box-shadow: 1px 2px 0 rgba(0,0,0,.35); }
.bp-pinned { border-color: var(--vermilion); }
.bp-pinned .bp-pin { background: radial-gradient(circle at 35% 35%, #ffd27a, var(--orange) 70%); }
.bp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.bp-type { display: inline-flex; align-items: center; gap: 6px; color: var(--vermilion); }
.bp-type i { font-style: normal; font-family: var(--brush); font-size: 16px; }
.bp-when { opacity: .65; } .bp-when b { color: var(--vermilion); opacity: 1; }
.bp-img { display: block; border: 2px solid var(--ink); overflow: hidden; aspect-ratio: 16 / 10; background: var(--paper-2); }
.bp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bp-embed { position: relative; border: 2px solid var(--ink); background: #fff; overflow: hidden; padding-top: calc(var(--ratio, 1) * 100%); }
.bp-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bp-title { margin: 0; font-family: var(--display); font-size: 22px; line-height: 1.1; letter-spacing: .02em; }
.bp-title a { text-decoration: none; } .bp-title a:hover { color: var(--vermilion); }
.bp-body { margin: 0; font-size: 14.5px; line-height: 1.5; }
.bp-link { font-family: var(--mono); font-size: 12px; color: var(--vermilion); text-decoration: none; justify-self: start; }
.bp-instagram .bp-type, .bp-linkedin .bp-type, .bp-video .bp-type { color: var(--deep-red); }
.board-more { text-align: center; }
.request-box { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; background: var(--ink); color: var(--paper); border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--orange); padding: 20px 24px; }
.rq-kanji { font-size: 56px; line-height: 1; color: var(--orange-2); }
.rq-text b { font-family: var(--display); font-size: 26px; letter-spacing: .03em; display: block; margin-bottom: 4px; }
.rq-text p { margin: 0; font-size: 15px; line-height: 1.5; opacity: .92; }
.rq-btn { white-space: nowrap; min-height: 48px; font-size: 14px; }
.rq-btn .jp { margin-right: 6px; color: var(--deep-red); }
.n-tag.rq { background: var(--orange); color: var(--ink); }
/* back room compose */
.compose { display: grid; gap: 8px; border: 2px dashed rgba(20,17,16,.3); padding: 12px; margin-bottom: 12px; }
.compose .c-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--vermilion); }
.compose .c-kicker .jp { font-size: 15px; margin-right: 6px; }
.compose-row { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: center; }
.compose input, .compose textarea, .compose select { font: 14px var(--body); padding: 8px 10px; border: 2px solid var(--ink); background: #FBF6EA; color: var(--ink); width: 100%; box-sizing: border-box; }
.compose .chk { white-space: nowrap; }
.bk-post-actions { display: flex; gap: 14px; font-family: var(--mono); font-size: 11px; align-items: center; }
.bk-post-actions a { color: var(--vermilion); }
@media (max-width: 980px) { .board-grid { grid-template-columns: 1fr 1fr; } .request-box { grid-template-columns: auto 1fr; } .rq-btn { grid-column: 1 / -1; justify-self: start; } }
@media (max-width: 760px) {
  .board-wrap { gap: 14px; }
  .board-filters { flex-wrap: nowrap; overflow-x: auto; padding: 4px 14px 8px; margin: 0 -14px; scrollbar-width: none; }
  .board-filters::-webkit-scrollbar { display: none; }
  .bf { flex: none; }
  .board-grid { grid-template-columns: 1fr; gap: 14px; }
  .bp { transform: none; }
  .request-box { grid-template-columns: 1fr; gap: 12px; padding: 16px; box-shadow: 5px 5px 0 var(--orange); }
  .rq-kanji { font-size: 40px; }
  .rq-btn { justify-self: stretch; }
  .compose-row { grid-template-columns: 1fr; }
}
/* pocket: the board as a horizontal deck of pins */
html.pocket #board .sh-lead { display: none; }
html.pocket .board-wrap { padding: 0; }
html.pocket .board-filters { padding: 4px 14px 8px; margin: 0; }
html.pocket .board-deck { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 6vw 10px; scrollbar-width: none; }
html.pocket .board-deck::-webkit-scrollbar { display: none; }
html.pocket .board-deck .bp { flex: 0 0 84vw; scroll-snap-align: center; }
html.pocket .board-deck .board-empty { flex: 0 0 88vw; }
html.pocket .board-more { padding: 0 14px; }
html.pocket .rq-card { margin: 8px 14px 0; }
html.pocket #board .scene-head { margin-bottom: 8px; }

/* ---------- feature flag: the Notice Board stays unpublished until body[data-board="on"] ---------- */
body[data-board="off"] .board-only { display: none !important; }
