:root {
  --yoru: #111C2E;
  --yoru-deep: #0B1220;
  --tsuki: #ECE7D8;
  --paper: #FFF9EA;
  --washi: #F3EDDF;
  --sumi: #2A2622;
  --chochin: #E8A33D;
  --ai: #4C7DB0;
  --shu: #D4544A;
  --kin: #D9B45C;
  --take: #8FB878;
  --rank-kin: #D9B45C;
  --rank-kin-text: #D9B45C;
  --rank-kin-bg: linear-gradient(100deg, #17120A, var(--yoru-deep));
  --rank-hakkin: #DCE3EA;
  --rank-hakkin-text: #DCE3EA;
  --rank-hakkin-bg: linear-gradient(100deg, #0D1420, var(--yoru-deep));
  --rank-gekko: #ECE7D8;
  --rank-murasaki: #A98CD9;
  --rank-gekko-text: #ECE7D8;
  --rank-gekko-border: var(--rank-hakkin);
  --rank-gekko-inner: var(--rank-murasaki);
  --rank-gekko-band-start: var(--rank-hakkin);
  --rank-gekko-band-end: var(--rank-murasaki);
  --rank-gekko-bg: radial-gradient(120% 100% at 82% 50%, #1A1430 0%, #070B12 62%);
  --rank-gekko-name-shadow: 0 0 18px rgba(236, 231, 216, 0.45);
  --line: rgba(236, 231, 216, 0.16);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --hover-ring-shadow: 0 0 0 3px rgba(232, 163, 61, 0.22);
  --focus-ring-shadow: 0 0 0 3px rgba(232, 163, 61, 0.35);
  --current-ring-shadow: 0 0 0 3px rgba(232, 163, 61, 0.35), 0 0 24px rgba(232, 163, 61, 0.22);
  --next-key-shadow: 0 0 0 3px rgba(232, 163, 61, 0.35);
  --surface: #0F192A;
  --muted: #B9BDC4;
  --paper-muted: #635A4B;
  --paper-link: #1E4A73;
  --path-line: rgba(236, 231, 216, 0.42);
  --button-edge: rgba(232, 163, 61, 0.72);
  --action-bg: #E8A33D;
  --action-text: #0B1220;
  --metal-bg: #0B1220;
  --tier-copper: #B87333;
  --tier-silver: #C6C6C6;
  --tier-platinum: #DCE3EA;
  --rank-kin-muted: #BDA16A;
  --rank-hakkin-muted: #AFBCCA;
  --rank-gekko-muted: #BFC0CA;
  color-scheme: dark;
}

body[data-theme="light"] {
  --yoru: #F3EDDF;
  --yoru-deep: #E3DAC4;
  --tsuki: #2A2622;
  --chochin: #B06E12;
  --ai: #1E4A73;
  --shu: #C0392F;
  --kin: #8F6B23;
  --take: #4C6B39;
  --rank-kin: #8F6B23;
  --rank-kin-text: #8B6720;
  --rank-kin-bg: #F7F0DC;
  --rank-hakkin: #43607A;
  --rank-hakkin-text: #43607A;
  --rank-hakkin-bg: #EDF2F7;
  --rank-gekko: #2A2622;
  --rank-gekko-text: #2A2622;
  --rank-gekko-border: #6B5A8E;
  --rank-gekko-inner: #6B5A8E;
  --rank-gekko-band-start: #8A94A0;
  --rank-gekko-band-end: #6B5A8E;
  --rank-gekko-bg: #ECE9F2;
  --rank-gekko-name-shadow: none;
  --line: rgba(42, 38, 34, 0.2);
  --shadow: 0 10px 30px rgba(42, 38, 34, 0.13);
  --hover-ring-shadow: 0 0 0 2px var(--chochin), var(--shadow);
  --focus-ring-shadow: 0 0 0 2px var(--chochin), var(--shadow);
  --current-ring-shadow: 0 0 0 2px var(--chochin), var(--shadow);
  --next-key-shadow: 0 0 0 2px var(--chochin);
  --surface: #EEE7D7;
  --muted: #615C53;
  --path-line: rgba(42, 38, 34, 0.42);
  --button-edge: rgba(176, 110, 18, 0.72);
  --action-bg: #8B550A;
  --action-text: #FFFFFF;
  --rank-kin-muted: #72551C;
  --rank-hakkin-muted: #3A536A;
  --rank-gekko-muted: #4D475A;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; background: var(--yoru); color: var(--tsuki); }

body {
  font-family: "Noto Sans JP", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", system-ui, sans-serif;
  letter-spacing: 0;
}

button, input, textarea { font: inherit; }

button {
  min-height: 42px;
  border: 2px solid var(--button-edge);
  border-radius: 8px;
  background: var(--yoru-deep);
  color: var(--tsuki);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: var(--chochin);
  box-shadow: var(--hover-ring-shadow);
}
button:disabled { color: var(--muted); cursor: not-allowed; box-shadow: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring-shadow);
}

.screen {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.title-screen {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 22px;
  text-align: center;
  position: relative;
}

.title-screen::before {
  content: "";
  position: absolute;
  top: clamp(28px, 8vw, 72px);
  right: clamp(28px, 9vw, 120px);
  width: clamp(72px, 10vw, 128px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--tsuki);
  box-shadow: 0 0 34px rgba(236, 231, 216, 0.28);
  opacity: 0.94;
}

.logo-mount, .catch, .entry-panel, .keyboard-note { position: relative; z-index: 1; }
.logo-mount svg { width: min(520px, 90vw); height: auto; }
.catch { font-size: clamp(18px, 2.1vw, 28px); line-height: 1.7; margin: 0; font-weight: 700; }

.entry-panel, .settings-panel, .license-card, .result-panel {
  background: var(--paper);
  color: var(--sumi);
  border: 2px solid rgba(236, 231, 216, 0.24);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-panel {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 22px;
  display: grid;
  gap: 12px;
}

.entry-panel input {
  min-height: 48px;
  border: 2px solid rgba(42, 38, 34, 0.22);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--sumi);
}

.hint, .keyboard-note, .eyebrow { margin: 0; color: var(--muted); }
.entry-panel .hint, .settings-panel .hint, .license-card .hint, .result-panel .hint,
.license-card .eyebrow { color: var(--paper-muted); }
.button-row, .top-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.button-stack { display: grid; gap: 12px; }
.button-stack button { min-height: 50px; line-height: 1.35; }
.button-stack ruby { ruby-position: over; white-space: nowrap; }
.button-stack rt { font-size: 45%; line-height: 1; }

.topbar, .play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.play-header {
  background: var(--yoru-deep);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.topbar h1, .play-header h1 { margin: 0; font-size: 26px; }
body[data-teacher-mode="true"] .topbar::after,
body[data-teacher-mode="true"] .play-header::after {
  content: "先生モード";
  border: 2px solid var(--chochin);
  border-radius: 999px;
  color: var(--chochin);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: var(--focus-ring-shadow);
}
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: stretch; }

.map-panel {
  min-height: 560px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--yoru-deep);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

.map-panel::before {
  content: "";
  position: absolute;
  top: 28px;
  right: 34px;
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--tsuki);
  box-shadow: 0 0 30px rgba(236, 231, 216, 0.26);
  opacity: 0.9;
}

.mountain-map { min-height: 560px; padding: 28px; position: relative; }
.map-section + .map-section { margin-top: 26px; }
.map-section-title {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 0 0 -42px;
  color: var(--tsuki);
  font-size: 18px;
}
.map-path {
  position: relative;
  display: grid;
  gap: 14px;
  align-items: stretch;
  padding: 70px 0 8px;
}
.map-path.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.map-path.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-path.cols-1 { grid-template-columns: minmax(0, 1fr); }
.map-path::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 38px;
  border-top: 3px dashed var(--path-line);
}
.map-node {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: var(--surface);
  color: var(--tsuki);
  border-color: var(--line);
}
.map-node small { display: block; margin-top: 4px; color: var(--muted); font-weight: 600; }
.map-node svg { width: 48px; height: 48px; }
.map-node.current {
  border-color: var(--chochin);
  box-shadow: var(--current-ring-shadow);
}
.map-node.cleared { border-color: rgba(232, 163, 61, 0.62); }
.map-node.teacher-open {
  border-color: var(--chochin);
  border-style: dashed;
}
.map-node.dan { cursor: default; }
button.map-node.dan { cursor: pointer; }
.map-node.dan-lower {
  min-height: 120px;
  grid-template-columns: 56px minmax(0, 1fr);
}
.map-node.dan-upper {
  min-height: 132px;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  padding-right: 28px;
}
.map-node.dan-lower .node-icon svg { width: 56px; height: 56px; }
.map-node.dan-upper .node-icon svg { width: 64px; height: 64px; }
.dan-copy { min-width: 0; }
.map-node.dan-upper:not(.secret-dan) {
  border-color: var(--line);
  background: var(--rank-card-bg);
}
.map-node.dan-upper:not(.secret-dan)::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 2;
  width: 8px;
  background: linear-gradient(180deg, var(--rank-accent), transparent);
}
.map-node.dan-upper:not(.secret-dan)::after {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 2;
  border: 1px solid color-mix(in srgb, var(--rank-accent) 35%, transparent);
  pointer-events: none;
}
.map-node.dan-upper:not(.secret-dan) > *:not(.rank-watermark) { position: relative; z-index: 3; }
.map-node.dan-upper:not(.secret-dan) .dan-copy b {
  color: var(--rank-text);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.map-node.dan-upper:not(.secret-dan) .dan-copy small,
.map-node.dan-upper:not(.secret-dan) .dan-rank-meta {
  color: var(--rank-muted);
}
.map-node.dan-lower .dan-copy small { color: var(--muted); }
.dan-rank-meta {
  margin: 0 22px 0 12px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}
.map-node.dan-lower[data-accent="ai"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--ai);
}
.map-node.dan[data-accent="ai"] { --rank-accent: var(--ai); }
.map-node.dan[data-accent="kin"] {
  --rank-accent: var(--rank-kin);
  --rank-text: var(--rank-kin-text);
  --rank-card-bg: var(--rank-kin-bg);
  --rank-muted: var(--rank-kin-muted);
}
.map-node.dan[data-accent="hakkin"] {
  --rank-accent: var(--rank-hakkin);
  --rank-text: var(--rank-hakkin-text);
  --rank-card-bg: var(--rank-hakkin-bg);
  --rank-muted: var(--rank-hakkin-muted);
}
.map-node.dan[data-accent="gekko"] {
  --rank-accent: var(--rank-gekko);
  --rank-text: var(--rank-gekko-text);
  --rank-card-bg: var(--rank-gekko-bg);
  --rank-muted: var(--rank-gekko-muted);
}
.map-node.dan-upper[data-accent="gekko"]:not(.secret-dan)::before {
  background: linear-gradient(180deg, var(--rank-gekko-band-start), var(--rank-gekko-band-end));
}
.map-node.dan-upper[data-accent="gekko"]:not(.secret-dan)::after {
  border-color: color-mix(in srgb, var(--rank-gekko-inner) 55%, transparent);
}
.map-node.dan[data-accent="gekko"] .dan-copy b { text-shadow: var(--rank-gekko-name-shadow); }
.rank-icon { color: var(--rank-accent); opacity: 0.85; }
.rank-watermark {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: -34px;
  width: 198px;
  height: 198px;
  color: var(--rank-accent);
  opacity: 0.06;
  transform: translateY(-50%);
  pointer-events: none;
}
.map-node.dan[data-accent="gekko"] .rank-watermark { opacity: 0.1; }
.rank-watermark svg { width: 100% !important; height: 100% !important; }
.map-node.secret-dan {
  grid-template-columns: 64px minmax(0, 1fr);
  border-color: var(--line);
  border-style: dashed;
  background: var(--yoru-deep);
  color: var(--muted);
}
.map-node.secret-dan small { color: var(--muted); }
.map-node.secret-dan .shadow-node-svg { color: var(--line); }
.map-node.dan.cleared,
.map-node.dan.teacher-open:not(.current) { border-color: var(--line); }
.map-node.dan.teacher-open:not(.current) { border-style: dashed; }
.map-node.dan.current {
  border-color: var(--chochin);
  border-style: solid;
  box-shadow: var(--current-ring-shadow);
}
.map-node.dan[data-accent="gekko"]:not(.secret-dan) { border-color: var(--rank-gekko-border); }

.next-panel {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 16px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.next-panel h2 { margin-top: 0; }

.play-screen { width: min(1240px, calc(100vw - 24px)); padding: 16px 0; }
.stat-line { min-height: 30px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.dojo { min-height: 610px; display: grid; align-content: start; gap: 10px; padding: 16px 0; text-align: center; position: relative; }
.shingan-mode .dojo {
  background: var(--yoru-deep);
  border-radius: 8px;
  padding-inline: 12px;
}
.prompt-kana {
  min-height: 92px;
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 3px solid rgba(42, 38, 34, 0.28);
  background: var(--paper);
  color: var(--sumi);
  box-shadow: var(--shadow);
  font-size: calc(var(--prompt-size, clamp(48px, 6vw, 72px)) * var(--reading-scale, 1));
  font-weight: 800;
  line-height: var(--prompt-leading, 1.3);
  padding: 12px 18px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.prompt-progress { display: block; width: 100%; text-align: center; }
.prompt-kana.has-kanji { gap: 8px; padding-top: 16px; }
.prompt-kanji {
  display: block;
  width: 100%;
  color: rgba(42, 38, 34, 0.85);
  font-size: calc(var(--kanji-size, 28px) * var(--reading-scale, 1));
  font-weight: 700;
  line-height: 1.55;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: normal;
}
.prompt-kanji ruby { ruby-position: over; white-space: nowrap; }
.prompt-kanji rt { font-size: 45%; line-height: 1; color: rgba(42, 38, 34, 0.72); }
.prompt-unit { display: inline; border-radius: 4px; }
.prompt-unit.done { color: var(--paper-muted); }
.prompt-unit.current {
  color: var(--sumi);
  background: rgba(232, 163, 61, 0.24);
  box-shadow: inset 0 -3px 0 var(--chochin);
}
.prompt-separator { white-space: pre; }
.prompt-furigana, .phase-label { min-height: 24px; color: var(--muted); }
.prompt-furigana:empty, .phase-label:empty, .romaji-guide:empty, .guide-area:empty { display: none; }
.romaji-guide {
  min-height: 38px;
  max-width: min(760px, 100%);
  margin: 0 auto;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.romaji-ellipsis { color: var(--muted); }
.typed { color: var(--muted); }
.rest { color: var(--chochin); font-weight: 800; }
.guide-area { min-height: 250px; display: grid; gap: 14px; align-items: start; }
.progress-line { min-height: 34px; font-weight: 700; color: var(--tsuki); }
.combo-count {
  color: var(--chochin);
  border: 2px solid rgba(232, 163, 61, 0.58);
  border-radius: 999px;
  padding: 0 9px;
  font-weight: 900;
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.16);
}
.combo-count.fading { animation: comboFade 520ms ease forwards; }
.combo-fx {
  position: absolute;
  right: clamp(10px, 4vw, 72px);
  bottom: 68px;
  width: 124px;
  height: 124px;
  pointer-events: none;
}
.combo-target {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 84px;
  height: 84px;
}
.target-ring {
  position: absolute;
  inset: 16px;
  border: 3px solid var(--chochin);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.24);
}
.target-ring::before {
  content: "";
  position: absolute;
  inset: 13px;
  border: 2px solid var(--line);
  border-radius: 50%;
}
.shuriken-stack {
  position: absolute;
  inset: 0;
}
.shuriken-hit {
  position: absolute;
  width: 28px;
  height: 28px;
  color: var(--tsuki);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.38));
  animation: shurikenFly 260ms cubic-bezier(.18, .9, .28, 1) both;
}
.shuriken-hit:nth-child(1) { right: 29px; bottom: 30px; }
.shuriken-hit:nth-child(2) { right: 43px; bottom: 39px; }
.shuriken-hit:nth-child(3) { right: 20px; bottom: 45px; }
.shuriken-hit:nth-child(4) { right: 37px; bottom: 19px; }
.shuriken-hit:nth-child(5) { right: 18px; bottom: 22px; }
.shuriken-hit svg { width: 100%; height: 100%; }
.combo-target-flash .shuriken-hit { animation: shurikenGlow 280ms ease both; }

.keyboard { display: grid; gap: 8px; justify-content: center; }
.key-row { display: flex; gap: 6px; justify-content: center; }
.key {
  width: 44px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: var(--yoru-deep);
  color: var(--tsuki);
  font-weight: 800;
  text-transform: uppercase;
}
.key.next { border-color: var(--chochin) !important; box-shadow: var(--next-key-shadow); color: var(--chochin); }
.hand-guide svg { width: min(420px, 100%); height: auto; }
.rescue-flash { animation: missFlash 180ms ease-out; }

.collection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.banzuke-grid {
  grid-template-columns: minmax(0, 1fr);
  width: min(920px, 100%);
  margin-inline: auto;
}
.banzuke-record-card {
  min-height: 142px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 172px;
  gap: 20px;
  align-items: center;
  border: 2px solid rgba(42, 38, 34, 0.2);
  border-radius: 8px;
  background: var(--paper);
  color: var(--sumi);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.banzuke-record-card.locked { border-style: dashed; box-shadow: none; }
.banzuke-record-main { min-width: 0; }
.banzuke-record-main h2 { margin: 0 0 5px; font-size: 23px; }
.banzuke-record-main p { margin: 4px 0; line-height: 1.55; }
.banzuke-best-line,
.banzuke-next-tier,
.banzuke-lock-reason { font-size: 14px; font-weight: 800; }
.banzuke-next-tier { color: rgba(42, 38, 34, 0.68); }
.banzuke-lock-reason { display: flex; align-items: center; gap: 7px; color: rgba(42, 38, 34, 0.68); }
.banzuke-lock-reason .lock-svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.banzuke-tier {
  min-height: 104px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  background: var(--yoru-deep);
  color: var(--tsuki);
  padding: 12px;
}
.banzuke-tier .tier-badge { width: 64px; height: 64px; }
.banzuke-tier strong { font-size: 18px; text-align: center; }
.banzuke-tier.tier-copper { --tier-color: var(--tier-copper); }
.banzuke-tier.tier-silver { --tier-color: var(--tier-silver); }
.banzuke-tier.tier-gold { color: var(--kin); }
.banzuke-tier.tier-platinum { --tier-color: var(--tier-platinum); }
.banzuke-tier.tier-gekko {
  color: var(--tsuki);
  filter: drop-shadow(0 0 8px rgba(236, 231, 216, 0.3));
}
.banzuke-tier.tier-none { color: var(--muted); }
.crest-svg { width: 100%; height: 100%; display: block; }
.crest-ring, .crest-line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crest-ring { stroke-width: 4; }
.crest-line { stroke-width: 6; }
.crest-line.thin { stroke-width: 4; }
.crest-dot { fill: currentColor; stroke: none; }
.scroll-card {
  position: relative;
  min-height: 220px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--yoru-deep);
  color: var(--tsuki);
  padding: 18px 12px 12px;
  overflow: hidden;
}
.preview-label {
  position: absolute;
  top: 16px;
  right: 14px;
  z-index: 2;
  border: 1px solid var(--chochin);
  border-radius: 999px;
  color: var(--chochin);
  background: var(--yoru-deep);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 900;
}
.scroll-card:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring-shadow);
  border-color: var(--chochin);
}
.scroll-cord {
  position: absolute;
  top: 8px;
  left: 18px;
  right: 18px;
  height: 4px;
  border-radius: 999px;
  background: var(--ai);
}
.gold-cord .scroll-cord { background: var(--kin); }
.ai-cord .scroll-cord { background: var(--ai); }
.open-scroll {
  min-height: 184px;
  display: grid;
  grid-template-columns: 18px 1fr 18px;
  align-items: stretch;
}
.scroll-roll {
  background: linear-gradient(90deg, var(--washi), var(--paper));
  border: 2px solid rgba(42, 38, 34, 0.2);
  box-shadow: inset 0 0 0 3px rgba(42, 38, 34, 0.04);
}
.scroll-roll.left { border-radius: 10px 0 0 10px; }
.scroll-roll.right { border-radius: 0 10px 10px 0; transform: scaleX(-1); }
.scroll-body {
  background: var(--paper);
  color: var(--sumi);
  border-block: 2px solid rgba(42, 38, 34, 0.2);
  padding: 18px 14px 14px;
  text-align: center;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
}
.crest-medallion {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yoru-deep);
  color: var(--tsuki);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}
.scroll-body h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.scroll-body p { margin: 0; font-size: 14px; line-height: 1.55; }
.closed-scroll {
  min-height: 184px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}
.closed-scroll-svg { width: 132px; max-width: 100%; height: auto; }
.unlock-source {
  width: 100%;
  margin: 0;
  color: var(--tsuki);
  font-weight: 800;
  line-height: 1.5;
}
.nickname-grid { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); align-items: start; }
.nickname-card {
  position: relative;
  min-height: 238px;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.tanzaku {
  position: relative;
  width: 112px;
  min-height: 178px;
  border: 2px solid rgba(42, 38, 34, 0.2);
  border-radius: 8px;
  background: var(--washi);
  color: var(--sumi);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  padding: 22px 12px 14px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  line-height: 1.7;
  font-weight: 900;
}
button.tanzaku {
  cursor: pointer;
  min-height: 178px;
}
button.tanzaku:hover {
  border-color: var(--chochin);
  box-shadow: var(--hover-ring-shadow);
}
button.tanzaku:disabled {
  opacity: 1;
  cursor: default;
}
.tanzaku-hole {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
  opacity: 0.62;
}
.tanzaku-lantern {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 34px;
  height: 34px;
}
.tanzaku-lantern svg { width: 100%; height: 100%; filter: drop-shadow(0 0 8px rgba(232, 163, 61, 0.58)); }
.nickname-card.equipped .tanzaku {
  border-color: var(--chochin);
  box-shadow: var(--focus-ring-shadow);
}
.locked-silhouette {
  background: var(--yoru-deep);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
}
.mystery-mark {
  writing-mode: horizontal-tb;
  font-size: 32px;
}
.tanzaku-caption {
  margin: 0;
  color: var(--tsuki);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab-button.active { background: var(--action-bg); color: var(--action-text); border-color: var(--chochin); }
.license-card, .settings-panel { padding: 20px; display: grid; gap: 12px; }
.license-head { display: flex; gap: 14px; align-items: center; }
.license-head svg { width: 76px; height: 76px; }
.license-head h2 { margin: 0; font-size: 34px; }
.license-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.license-list dt { font-weight: 800; color: var(--sumi); }
.license-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.license-actions { justify-content: flex-start; }
.passcode-box, .restore-box, .danger-zone { display: grid; gap: 10px; border-top: 2px solid rgba(42, 38, 34, 0.16); padding-top: 14px; }
.passcode-box output, code { overflow-wrap: anywhere; font-weight: 800; color: var(--sumi); }
.setting-row { display: flex; gap: 10px; align-items: center; font-weight: 800; }
.teacher-mode-row {
  border: 2px solid rgba(232, 163, 61, 0.38);
  border-radius: 8px;
  padding: 10px;
}
.teacher-menu a { color: var(--paper-link); font-weight: 800; }
.version-label {
  margin: 2px 0 0;
  color: var(--paper-muted);
  font-size: 12px;
  text-align: right;
  cursor: pointer;
  user-select: none;
}
.teacher-unlock {
  display: grid;
  gap: 8px;
  justify-items: end;
  border-top: 2px solid rgba(42, 38, 34, 0.12);
  padding-top: 10px;
}
.teacher-unlock-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.teacher-unlock input {
  width: 140px;
  min-height: 42px;
  border: 2px solid rgba(42, 38, 34, 0.22);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--sumi);
}
.teacher-result-note {
  margin: 8px 0;
  color: var(--sumi);
  font-weight: 900;
}
textarea { width: 100%; border: 2px solid rgba(42, 38, 34, 0.22); border-radius: 8px; padding: 10px; font: inherit; background: #fff; color: var(--sumi); }
.danger-zone button { border-color: var(--shu); color: var(--sumi); background: var(--paper); }
#printLicense { display: none; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  background: var(--yoru-deep);
  color: var(--tsuki);
  border: 2px solid var(--chochin);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-weight: 800;
}
.toast-with-crest {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-crest {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--sumi);
}
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(11, 18, 32, 0.76); display: grid; place-items: center; padding: 20px; }
.dialog { width: min(520px, 100%); background: var(--paper); color: var(--sumi); border: 3px solid var(--chochin); border-radius: 8px; padding: 22px; text-align: center; box-shadow: var(--shadow); }
.result-overlay { z-index: 28; }
.result-dialog {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  text-align: left;
}
.menu-overlay { z-index: 27; }
.menu-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  text-align: left;
}
.menu-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.menu-modal-head h2 { margin: 0; font-size: clamp(24px, 4vw, 34px); }
.menu-modal-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.teacher-badge {
  display: inline-block;
  border: 2px solid var(--chochin);
  border-radius: 999px;
  color: var(--sumi);
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 900;
}
.menu-back { flex: 0 0 auto; }
.menu-card-list { display: grid; gap: 10px; }
.menu-card {
  width: 100%;
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-color: rgba(42, 38, 34, 0.2);
  background: var(--washi);
  color: var(--sumi);
  padding: 13px 15px;
  text-align: left;
}
.menu-card:hover,
.menu-card:focus-visible {
  border-color: var(--chochin);
  box-shadow: var(--focus-ring-shadow);
}
.menu-card.locked {
  border-style: dashed;
  background: rgba(42, 38, 34, 0.06);
  color: var(--paper-muted);
  cursor: not-allowed;
}
.menu-card-main { min-width: 0; display: grid; gap: 5px; }
.menu-card-title { display: flex; align-items: center; gap: 7px; font-size: 20px; }
.menu-card-desc { color: var(--sumi); line-height: 1.55; }
.menu-card-meta { color: var(--paper-muted); font-size: 13px; font-weight: 800; }
.menu-lock {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu-card-badge { align-self: stretch; display: grid; place-items: center; }
.menu-tier {
  min-width: 70px;
  height: 68px;
  display: grid;
  grid-template-columns: 30px auto;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 8px;
  background: var(--yoru-deep);
  color: var(--tsuki);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
}
.menu-tier .tier-badge { width: 30px; height: 30px; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.result-modal-shell { display: grid; gap: 12px; }
.result-modal-shell h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 4vw, 38px);
}
.result-modal { display: grid; gap: 10px; }
.result-main-stat {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px;
  border: 3px double rgba(42, 38, 34, 0.22);
  border-radius: 8px;
  background: var(--washi);
}
.result-main-stat span,
.result-summary-grid span,
.result-speed span {
  font-size: 13px;
  font-weight: 800;
  color: rgba(42, 38, 34, 0.66);
}
.result-main-stat strong {
  font-size: clamp(42px, 7vw, 66px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-summary-grid,
.result-speed {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.result-summary-grid div,
.result-speed div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 2px solid rgba(42, 38, 34, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.38);
  text-align: center;
}
.result-summary-grid strong,
.result-speed strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.result-speed {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.result-speed strong { color: var(--paper-link); }
.tier-box strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tier-badge {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
}
.tier-badge svg { width: 100%; height: 100%; display: block; }
.tier-copper { --tier-color: var(--tier-copper); }
.tier-silver { --tier-color: var(--tier-silver); }
.tier-gold { --tier-color: #D9B45C; }
.tier-platinum { --tier-color: var(--tier-platinum); }
.tier-gekko { --tier-color: #ECE7D8; }
.tier-copper .tier-badge, .tier-silver .tier-badge, .tier-gold .tier-badge, .tier-platinum .tier-badge, .tier-gekko .tier-badge { color: var(--tier-color); background: var(--metal-bg); border-radius: 50%; }
.tier-box strong { color: var(--sumi); }
.banzuke-tier strong { color: var(--tsuki); }
.tier-gekko .tier-badge {
  filter: drop-shadow(0 0 8px rgba(236, 231, 216, 0.42));
}
.moon-bloom {
  justify-self: center;
  width: 72px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--tsuki);
  box-shadow: 0 0 0 10px rgba(236, 231, 216, 0.08), 0 0 30px rgba(236, 231, 216, 0.28);
  animation: moonBloom 900ms ease-out both;
}
.result-best-ribbon {
  justify-self: center;
  border: 2px solid var(--kin);
  border-radius: 999px;
  color: var(--sumi);
  background: rgba(217, 180, 92, 0.22);
  padding: 4px 14px;
  font-weight: 900;
}
.result-weak {
  border-top: 2px solid rgba(42, 38, 34, 0.12);
  padding-top: 10px;
}
.result-weak h3 { margin: 0 0 8px; font-size: 16px; }
.result-growth { border-top: 1px solid var(--line); padding-top: 8px; }
.result-growth h3 { margin: 0; font-size: 16px; }
.result-growth p { margin: 4px 0; }
.result-growth kbd { padding: 2px 5px; border: 1px solid var(--paper-muted); border-radius: 4px; font: inherit; }
.growth-records, .backup-tools, .observation-tools { border-top: 2px solid rgba(42, 38, 34, 0.16); padding-top: 14px; }
.growth-records h2, .backup-tools h2 { margin: 0 0 10px; font-size: 20px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid rgba(42, 38, 34, 0.2); padding: 7px 10px; overflow-wrap: anywhere; }
.backup-diff { table-layout: fixed; }
.backup-diff th:first-child { width: 24%; }
.backup-tools .button-row { justify-content: flex-start; }
.observation-tools summary { cursor: pointer; font-weight: 800; }
.observation-tools .setting-row { margin: 10px 0; font-weight: 500; }
.observation-tools p { line-height: 1.7; }
.storage-warning { padding: 12px; border: 2px solid var(--shu); color: var(--tsuki); }
.result-weak-list { display: flex; flex-wrap: wrap; gap: 8px; }
.result-weak-list span {
  border: 2px solid rgba(42, 38, 34, 0.14);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
}
.result-weak-list kbd {
  min-width: 1.8em;
  display: inline-grid;
  place-items: center;
  margin-right: 4px;
  border-radius: 5px;
  background: var(--yoru-deep);
  color: var(--tsuki);
  font: inherit;
  text-transform: uppercase;
}
.result-message {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(42, 38, 34, 0.06);
}
.result-message h2 { display: none; }
.result-message p { margin: 0; line-height: 1.7; }
.result-actions { margin-top: 2px; }
.result-actions .primary {
  background: var(--action-bg);
  border-color: var(--chochin);
  color: var(--action-text);
}
.banzuke-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.banzuke-course {
  min-height: 118px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  text-align: left;
}
.banzuke-course strong { font-size: 20px; }
.banzuke-course small { color: var(--muted); }
.banzuke-course:disabled small { color: inherit; }

@keyframes missFlash {
  from { background: rgba(212, 84, 74, 0.26); }
  to { background: var(--paper); }
}

@keyframes comboFade {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-4px); }
}

@keyframes shurikenFly {
  from { opacity: 0; transform: translate(62px, -58px) rotate(-220deg) scale(0.76); }
  to { opacity: 1; transform: translate(0, 0) rotate(18deg) scale(1); }
}

@keyframes shurikenGlow {
  0%, 100% { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.38)); }
  50% { filter: drop-shadow(0 0 8px rgba(232, 163, 61, 0.84)); }
}

@keyframes moonBloom {
  from { opacity: 0; transform: scale(0.62); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes teacherShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes secretReveal {
  from { opacity: 0; transform: translateY(12px); filter: brightness(0.55); }
  to { opacity: 1; transform: translateY(0); filter: brightness(1); }
}

.teacher-unlock.shake { animation: teacherShake 180ms ease both; }
.map-node.secret-reveal { animation: secretReveal 1200ms ease-out both; }

@media (max-width: 1024px) {
  .home-grid { grid-template-columns: 1fr; }
  .next-panel { position: static; }
  .next-panel { grid-row: 1; }
  .topbar, .play-header { align-items: flex-start; flex-direction: column; }
  .stat-line { justify-content: flex-start; }
  .key { width: 36px; height: 38px; }
  .map-path.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-path.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .result-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-dialog { width: min(700px, 100%); }
  .banzuke-record-card { grid-template-columns: minmax(0, 1fr) 160px; }
}

@media (max-width: 640px) {
  .banzuke-record-card { grid-template-columns: minmax(0, 1fr); }
  .banzuke-tier { grid-template-columns: 52px minmax(0, 1fr); }
  .banzuke-tier .tier-badge { width: 52px; height: 52px; }
}

.learning-mount { max-width: 980px; margin: 24px auto; }
.learning-tabs { flex-wrap: wrap; }
.learning-list { display: grid; gap: 12px; }
.learning-item { display: flex; gap: 18px; align-items: center; min-height: 104px; text-align: left; background: var(--surface); border-color: var(--line); color: var(--tsuki); }
.learning-item > span:last-child { min-width: 0; }
.learning-item strong, .learning-item span span, .learning-item small { display: block; }
.learning-item strong { font-size: 20px; margin-bottom: 5px; }
.learning-item small { color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.learning-icon { flex: 0 0 52px; }
.learning-icon svg { width: 52px; height: 52px; }
.learning-note { color: var(--muted); line-height: 1.8; }
.mission-entry { display: flex; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.mission-entry h3 { margin: 0; }
.mission-entry p { line-height: 1.8; }
.mission-entry small { color: var(--muted); }
.mission-light { flex: 0 0 48px; color: var(--muted); --chochin: var(--muted); opacity: 0.55; }
.mission-light svg { width: 48px; height: 48px; }
.mission-entry.earned .mission-light { color: var(--kin); --chochin: var(--kin); opacity: 1; }
.mastery-keyboard .key { width: 68px; height: 80px; gap: 5px; flex-direction: column; }
.key-letter { display: block; }
.key { position: relative; }
.finger-symbol { font-size: 10px; line-height: 1; color: var(--muted); }
.key-mastery { font-size: 11px; color: var(--tsuki); white-space: nowrap; }
.reading-entry { padding: 18px 0; border-bottom: 1px solid var(--line); }
.reading-entry summary { cursor: pointer; font-size: 21px; line-height: 2.1; }
.reading-entry rt { font-size: 45%; }
.reading-entry p { line-height: 1.9; }
.reading-source { color: var(--muted); }
.reading-books { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.reading-books h3 { font-size: 18px; }
.reading-books p { font-size: 14px; color: var(--muted); }
.library-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.library-heading small { color: var(--muted); }
.library-courses { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.library-courses button { min-height: 66px; background: var(--surface); color: var(--tsuki); border-color: var(--line); }
.library-courses button[aria-pressed="true"] { border-color: var(--ai); background: var(--yoru-deep); }
.library-heading rt, .library-courses rt, .library-work rt { font-size: 45%; }
.library-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 0 0 20px; }
.library-toolbar p { flex: 1 1 100%; margin: 4px 0; color: var(--muted); }
.library-toolbar label { display: flex; align-items: center; gap: 10px; }
.library-toolbar select { max-width: 230px; background: var(--surface); color: var(--tsuki); border-color: var(--line); }
.library-toolbar button { margin-left: auto; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.library-work { display: flex; align-items: center; gap: 16px; min-height: 150px; background: var(--paper); color: var(--sumi); text-align: left; border-color: var(--paper-muted); padding: 18px; }
.library-work > span:last-child { min-width: 0; }
.library-work strong, .library-work span span, .library-work small { display: block; }
.library-work strong { font-size: 21px; line-height: 1.8; }
.library-work small { color: var(--paper-muted); line-height: 1.8; font-size: 12px; }
.library-work-icon { width: 42px; flex: 0 0 42px; color: var(--ai); }
.library-work-icon svg { width: 42px; height: 42px; }
.literature-mode .prompt-kana { width: min(900px, 100%); }
.literature-mode .prompt-kanji { margin-bottom: 8px; }
.literature-mode .prompt-progress { line-height: 1.65; }
@media (max-width: 700px) {
  .library-courses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-grid { grid-template-columns: minmax(0, 1fr); }
  .library-toolbar button { margin-left: 0; }
}
.lesson-pack, .lesson-editor { padding: 20px 0; border-top: 1px solid var(--line); margin-top: 20px; }
.lesson-editor { max-width: 760px; display: grid; gap: 16px; }
.lesson-editor label { display: grid; gap: 8px; }
.lesson-editor label.setting-row { display: flex; }
.lesson-editor input, .lesson-editor select, .lesson-editor textarea { width: 100%; }
.lesson-editor input[type="checkbox"] { width: auto; }
select { font: inherit; background: var(--paper); color: var(--sumi); border: 1px solid var(--paper-muted); border-radius: 6px; padding: 10px; max-width: 100%; }
.readability-settings { border: 1px solid var(--line); margin: 16px 0; border-radius: 6px; }
.readability-settings legend { font-weight: 700; }
body[data-text-size="large"] { --reading-scale: 1.16; font-size: 18px; }
body[data-line-spacing="wide"] { --prompt-leading: 1.7; }
body[data-line-spacing="wide"] .learning-mount, body[data-line-spacing="wide"] .menu-card-desc, body[data-line-spacing="wide"] .settings-panel { line-height: 1.9; }
.courier-mount { width: 100%; }
.courier-hud { display: flex; gap: 20px; align-items: center; padding: 0 20px; min-height: 35px; font-variant-numeric: tabular-nums; }
.courier-hud strong { font-size: 24px; }
.courier-hud #courierStatus { margin-left: auto; font-size: 14px; color: var(--muted); }
.courier-scene { display: block; width: 100%; height: 210px; background: var(--yoru-deep); }
.courier-moon { fill: var(--tsuki); opacity: 0.9; }
.courier-mountains { fill: var(--ai); opacity: 0.2; }
.courier-roofs { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linejoin: round; opacity: 0.55; }
.courier-road { stroke: var(--path-line); stroke-width: 4; stroke-dasharray: 6 12; }
.courier-bridge { fill: none; stroke: var(--tsuki); stroke-width: 4; }
.courier-gate { fill: none; stroke: var(--chochin); stroke-width: 6; stroke-linecap: round; }
.courier-parcel, #courierPile rect { fill: var(--paper); stroke: var(--sumi); stroke-width: 2; }
.courier-tie { stroke: var(--ai); stroke-width: 4; }
.courier-body { fill: var(--ai); stroke: var(--tsuki); stroke-width: 2; }
.courier-limbs { fill: none; stroke: var(--tsuki); stroke-width: 5; stroke-linecap: round; }
.courier-scarf { fill: var(--ai); }
.courier-delivery-glow { stroke: var(--kin); stroke-width: 4; fill: none; opacity: 0; }
.courier-travel { height: 4px; background: var(--line); }
.courier-travel span { display: block; height: 4px; background: var(--chochin); }
.courier-mode .dojo { gap: 14px; min-height: 0; }
.courier-mode .prompt-kana { margin-top: 4px; }
.courier-mode .combo-fx { bottom: 12px; }
.result-game-detail { color: var(--sumi); font-variant-numeric: tabular-nums; }
.courier-route-bar { display: flex; gap: 16px; align-items: center; min-height: 30px; padding: 0 20px; font-size: 13px; flex-wrap: wrap; }
.courier-route-bar #courierShortcut { margin-left: auto; color: var(--kin); }
.courier-route-bar #courierGhostCount { color: var(--muted); }
.route-decoration { display: none; }
.courier-mount[data-route="roof"] [data-scene="roof"],
.courier-mount[data-route="bamboo"] [data-scene="bamboo"],
.courier-mount[data-route="bridge"] [data-scene="bridge"],
.courier-mount[data-route="garden"] [data-scene="garden"] { display: inline; }
.courier-bamboo { fill: none; stroke: var(--ai); stroke-width: 5; stroke-linecap: round; }
.courier-garden { fill: none; stroke: var(--muted); stroke-width: 4; stroke-linejoin: round; }
.courier-river { stroke: var(--ai); fill: none; stroke-width: 10; opacity: 0.7; }
.courier-fork { stroke: var(--path-line); stroke-width: 3; stroke-dasharray: 6 8; fill: none; opacity: 0; }
.courier-mount[data-shortcut="true"] .courier-fork { opacity: 1; }
.courier-ghost { opacity: 0.3; }
.courier-journey { display: flex; gap: 20px; justify-content: center; min-height: 28px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.courier-journey span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border: 1px solid var(--muted); border-radius: 50%; }
.courier-journey .visited { color: var(--tsuki); }
.courier-journey .visited::before { background: var(--kin); border-color: var(--kin); }
.courier-mount.complete .courier-journey { border-bottom: 1px solid var(--kin); }
.courier-avatar { --head-color: var(--ai); --belt-color: var(--ai); }
.avatar-head, .avatar-body, .avatar-scarf { fill: var(--head-color); stroke: var(--tsuki); stroke-width: 1.5; }
.avatar-eye-band, .avatar-bag { fill: var(--paper); stroke: var(--sumi); stroke-width: 1.5; }
.avatar-eyes { stroke: var(--sumi); stroke-width: 2; stroke-linecap: round; }
.avatar-limbs { fill: none; stroke: var(--tsuki); stroke-width: 4; stroke-linecap: round; }
.avatar-belt { fill: var(--belt-color); stroke: var(--tsuki); stroke-width: 1; }
.avatar-bag-tie { stroke: var(--ai); stroke-width: 3; }
.avatar-moon, .avatar-leaf, .avatar-wave, .avatar-bag-wave, .avatar-bag-moon { display: none; }
.courier-avatar[data-head="head-moon"] { --head-color: var(--rank-hakkin); }
.courier-avatar[data-head="head-moon"] .avatar-moon { display: inline; fill: var(--sumi); }
.courier-avatar[data-head="head-leaf"] .avatar-leaf { display: inline; fill: none; stroke: var(--tsuki); stroke-width: 1.5; }
.courier-avatar[data-belt="belt-plum"] { --belt-color: var(--rank-murasaki); }
.courier-avatar[data-belt="belt-wave"] .avatar-wave { display: inline; fill: none; stroke: var(--tsuki); stroke-width: 1.5; }
.courier-avatar[data-bag="bag-wave"] .avatar-bag-wave { display: inline; fill: none; stroke: var(--ai); stroke-width: 1.5; }
.courier-avatar[data-bag="bag-moon"] .avatar-bag-moon { display: inline; fill: none; stroke: var(--sumi); stroke-width: 1.5; }
.wardrobe-preview { display: flex; justify-content: center; height: 168px; padding: 10px; background: var(--yoru-deep); border-block: 1px solid var(--line); }
.wardrobe-preview svg { height: 148px; width: 130px; }
.wardrobe-slot { border: 0; border-top: 1px solid var(--line); padding: 16px 0; margin: 18px 0 0; }
.wardrobe-slot legend { font-weight: 700; padding-right: 12px; }
.wardrobe-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wardrobe-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; border-color: var(--line); background: var(--surface); color: var(--tsuki); min-height: 120px; }
.wardrobe-item strong, .wardrobe-item span, .wardrobe-item small { display: block; }
.wardrobe-item span { font-size: 14px; font-weight: 400; margin-top: 6px; line-height: 1.6; }
.wardrobe-item .wardrobe-icon, .wardrobe-item .wardrobe-item-text { margin: 0; }
.wardrobe-icon svg { display: block; width: 52px; height: 70px; }
.wardrobe-item small { color: var(--muted); margin-top: 8px; }
.wardrobe-item.equipped { border-color: var(--chochin); }
.shared-form { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 20px 0; border-bottom: 1px solid var(--line); }
.shared-form label, #sharedGenerated label { display: grid; gap: 8px; flex: 1 1 220px; min-width: 0; }
.shared-form input, .shared-form select, #sharedGenerated textarea { width: 100%; min-width: 0; }
#sharedGenerated { padding: 20px 0; }
#sharedGenerated textarea, .result-challenge input { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; }
#sharedSelect { margin-top: 10px; }
.result-challenge { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12px; }
.result-challenge input { width: 100%; min-width: 0; padding: 6px 8px; font-size: 12px; background: var(--washi); color: var(--sumi); border: 1px solid var(--paper-muted); border-radius: 4px; }
.result-coach { border-top: 1px solid var(--paper-muted); padding-top: 8px; text-align: left; }
.result-coach h3 { margin: 0 0 4px; font-size: 15px; }
.result-coach p { margin: 0; font-size: 14px; line-height: 1.65; }
.result-courier { grid-template-columns: 180px minmax(0, 1fr); gap: 8px; }
.result-courier > * { grid-column: 1 / -1; }
.result-courier .result-main-stat { grid-column: 1; align-self: stretch; align-content: center; padding: 8px; }
.result-courier .result-main-stat strong { font-size: 48px; }
.result-courier .result-summary-grid { grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.result-courier .result-summary-grid div { padding: 6px; }
.result-courier .result-speed div { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px; }
.result-courier .result-speed strong { font-size: 32px; }
.result-courier .result-game-detail { margin: 0; font-size: 13px; line-height: 1.6; }
.result-courier .result-weak { padding-top: 5px; }
.result-courier .result-weak h3 { font-size: 14px; margin-bottom: 4px; }
.result-courier .result-weak-list span { font-size: 13px; padding: 3px 8px; }
.result-courier .result-growth { font-size: 13px; padding-top: 4px; }
.result-courier .result-growth h3 { font-size: 14px; }
.menu-footer-note { color: var(--paper-muted); font-size: 13px; text-align: left; }
body[data-reduce-motion="true"] *, body[data-reduce-motion="true"] *::before, body[data-reduce-motion="true"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (max-width: 1024px) {
  .mastery-keyboard .key { width: 54px; height: 76px; }
  .courier-hud { flex-wrap: wrap; gap: 10px; }
  .courier-scene { height: 180px; }
}
@media (max-width: 700px) {
  .wardrobe-items { grid-template-columns: 1fr; }
  .result-challenge { grid-template-columns: 1fr; }
  .result-courier { grid-template-columns: 120px minmax(0, 1fr); }
  .mastery-keyboard .key { width: 28px; height: 70px; font-size: 14px; }
  .key-mastery { font-size: 8px; }
  .courier-hud #courierStatus { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .shuriken-hit { animation: none !important; transform: rotate(18deg); opacity: 1; }
}

@page {
  size: A4 portrait;
  margin: 18mm;
}

@media print {
  html, body {
    width: auto;
    min-height: auto;
    margin: 0;
    background: #fff !important;
    color: #2A2622 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  body > *:not(#printLicense) { display: none !important; }
  #printLicense,
  #printLicense[hidden] {
    display: block !important;
    background: #fff !important;
    color: #2A2622 !important;
  }
  #printLicense * {
    box-shadow: none !important;
    text-shadow: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .print-license-card {
    width: 174mm;
    height: 250mm;
    margin: 0 auto;
    background: #fff;
    color: #2A2622;
    font-family: "Noto Sans JP", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", system-ui, sans-serif;
  }
  .print-license-frame {
    min-height: 100%;
    border: 5px double #2A2622;
    padding: 9mm 11mm;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 4.2mm;
    text-align: center;
  }
  .print-logo-crest {
    width: 18mm;
    height: 18mm;
    color: #2A2622;
  }
  .print-license-card h1 {
    margin: 0;
    font-size: 34pt;
    line-height: 1;
    letter-spacing: 0;
  }
  .print-license-card rt { font-size: 8pt; font-weight: 600; }
  .print-license-name {
    margin: 0;
    font-size: 23pt;
    font-weight: 800;
  }
  .print-license-name span { font-size: 15pt; }
  .print-license-text {
    width: 122mm;
    margin: 0;
    font-size: 13.5pt;
    line-height: 1.9;
  }
  .print-rank {
    margin: 0;
    font-size: 31pt;
    font-weight: 900;
    line-height: 1.2;
  }
  .print-nickname {
    margin: 0;
    font-size: 15pt;
    font-weight: 800;
  }
  .print-banzuke {
    margin: 0;
    font-size: 11pt;
    font-weight: 800;
  }
  .print-scrolls {
    display: grid;
    gap: 2.8mm;
    justify-items: center;
  }
  .print-scrolls p { margin: 0; font-size: 11.5pt; font-weight: 800; }
  .print-crest-row {
    display: flex;
    gap: 5mm;
    justify-content: center;
  }
  .print-crest {
    width: 18mm;
    height: 18mm;
    color: #2A2622;
  }
  .print-crest.empty { opacity: 0.28; }
  .print-records {
    width: 116mm;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-block: 1.5px solid #2A2622;
    padding: 3mm 0;
    gap: 0;
  }
  .print-records dt,
  .print-records dd {
    margin: 0;
    font-size: 10pt;
    font-weight: 800;
  }
  .print-records dd {
    grid-row: 2;
    font-size: 17pt;
    font-variant-numeric: tabular-nums;
  }
  .print-footer {
    width: 122mm;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: 6mm;
    font-size: 10pt;
    font-weight: 700;
  }
  .print-footer p { margin: 0; }
  .print-observation { width: 174mm; color: #2A2622; background: #fff; }
  .print-observation h1 { font-size: 23pt; }
  .print-observation p { font-size: 11pt; line-height: 1.8; }
  .print-observation ul { padding: 0; list-style: none; }
  .print-observation li { padding: 7mm 0; border-bottom: 1px solid #2A2622; font-size: 14pt; }
  .observation-memo { height: 55mm; border: 1px solid #2A2622; }
}
