:root {
  --paper: #f7f1e7;
  --paper-2: #fffaf1;
  --ink: #25364a;
  --muted: #6e7d8f;
  --blue: #7da8d8;
  --blue-soft: #e2effb;
  --line: rgba(73, 94, 116, 0.15);
  --shadow: 0 22px 60px rgba(44, 68, 96, 0.15);
  --gold: #c5a45a;
  --vermilion: #b96e62;
  --wood: #9f7651;
  --fawn: #c69774;
  --ink-gray: #6f747a;
  --clay: #b78365;
  --sakura: #d99bab;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.preview-notice {
  position: fixed;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  z-index: 40;
  width: min(560px, calc(100% - 24px));
  box-sizing: border-box;
  border: 1px solid rgba(142, 105, 53, .34);
  border-radius: 14px;
  background: rgba(255, 248, 232, .92);
  color: #624920;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(76, 52, 23, .12);
}

.preview-notice a {
  color: #8c3e2f;
  font-weight: 700;
  margin-left: 8px;
  text-decoration: none;
}

.home-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 42;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(73, 94, 116, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #416fa8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 0 10px 28px rgba(76, 52, 23, .1);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(213, 233, 253, .9), transparent 36rem),
    radial-gradient(circle at bottom right, rgba(247, 210, 220, .38), transparent 36rem),
    url('../assets/sakura-paper.webp'),
    var(--paper);
  background-size: cover, cover, 760px auto, auto;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
code { background: rgba(255,255,255,.7); padding: .15rem .3rem; border-radius: .35rem; }
.app-root { min-height: 100svh; }
.auth-screen { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.phone-shell { min-height: 100svh; max-width: 520px; margin: 0 auto; padding: env(safe-area-inset-top) 14px calc(92px + env(safe-area-inset-bottom)); }
.top-scrollbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px 10px; backdrop-filter: blur(20px); }
.screen-content { padding: 6px 0 20px; }
.stack { display: grid; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row strong { display: block; letter-spacing: .02em; }
.brand-row small { display: block; color: var(--muted); font-size: .78rem; }
.brand-row.small strong { font-size: 1rem; }
.seal-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #8e4539; background: rgba(255,255,255,.78); border: 1px solid rgba(185, 110, 98, .18); box-shadow: inset 0 0 0 4px rgba(185,110,98,.06); font-weight: 900; }
.account-pill, .page-tab { font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.55); padding: 6px 9px; border-radius: 999px; white-space: nowrap; }
.notebook-page { position: relative; overflow: hidden; padding: 18px; border-radius: 26px; background: linear-gradient(145deg, rgba(255,252,245,.96), rgba(248,242,232,.92)); border: 1px solid rgba(102, 86, 62, .11); box-shadow: var(--shadow); }
.notebook-page::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(143, 111, 72, .08), transparent 8%, transparent 92%, rgba(143, 111, 72, .05)); mix-blend-mode: multiply; }
.notebook-page::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 10px; height: 1px; background: linear-gradient(90deg, transparent, rgba(80,82,91,.1), transparent); }
.auth-card { width: min(100%, 430px); display: grid; gap: 16px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 8vw, 3.1rem); line-height: .95; letter-spacing: -.04em; margin-bottom: 10px; }
h2 { font-size: 1.25rem; margin-bottom: 8px; }
.muted { color: var(--muted); line-height: 1.6; }
.guide-note { padding: 13px 15px; border-radius: 18px; background: rgba(226, 239, 251, .65); border: 1px solid rgba(125, 168, 216, .18); color: #46627f; line-height: 1.55; }
.setup-note { padding: 12px; border-radius: 16px; background: rgba(255,255,255,.72); border: 1px dashed rgba(185,110,98,.35); color: #7a594a; line-height: 1.5; }
.primary-action, .soft-action, .text-action { border: 0; border-radius: 18px; min-height: 48px; padding: 12px 16px; font-weight: 800; }
.primary-action { background: linear-gradient(135deg, #6e9bd2, #4c80be); color: white; box-shadow: 0 14px 26px rgba(79, 128, 190, .24); }
.soft-action { background: rgba(226, 239, 251, .9); color: #355779; border: 1px solid rgba(91,139,193,.14); }
.text-action { background: transparent; color: #537aaa; min-height: 36px; padding: 8px; }
.form-grid { display: grid; gap: 12px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: .9rem; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.78); padding: 13px 14px; color: var(--ink); }
.art-frame { border-radius: 24px; background: rgba(255,255,255,.72); border: 9px solid rgba(255,255,255,.72); box-shadow: inset 0 0 0 1px rgba(88, 94, 101, .08), 0 14px 38px rgba(74, 90, 109, .12); overflow: hidden; }
.art-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.art-frame.hero-art { height: 230px; }
.art-frame.landmark, .art-frame.wide { height: 185px; }
.art-frame.landmark img, .art-frame.wide img { object-fit: cover; }
.scroll-hero .art-frame, .guide-card .art-frame, .record-hero .art-frame, .lantern-intro .art-frame { height: 190px; }
.ritual-title { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: start; }
.ritual-title span { width: 42px; height: 42px; border-radius: 50%; background: var(--blue-soft); display: grid; place-items: center; color: #577fae; font-weight: 900; }
.scroll-steps { display: grid; gap: 10px; }
.step-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; text-align: left; width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,.62); border-radius: 18px; padding: 12px; color: var(--ink); }
.step-row small { color: var(--muted); font-size: .75rem; }
.step-row.current { border-color: rgba(110,155,210,.4); background: rgba(226,239,251,.88); }
.step-row.done { opacity: .82; }
.step-state { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.9); color: #5d88bd; font-weight: 900; }
.meta-line { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.meta-line span { font-size: .69rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: rgba(255,255,255,.64); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; }
.phrase-slip { margin: 14px 0; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(247,241,231,.86)); border: 1px solid rgba(120,96,64,.12); display: grid; gap: 5px; }
.phrase-slip strong { font-size: 1.18rem; }
.phrase-slip span, .phrase-slip small { color: var(--muted); line-height: 1.45; }
.mokkan-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 8px; }
.mokkan-tag { min-width: 104px; padding: 12px 10px; border-radius: 13px; background: linear-gradient(180deg, #d9bb8d, #b98b5c); color: #332719; box-shadow: inset 0 0 0 1px rgba(80,44,22,.16); display: grid; gap: 2px; }
.mokkan-tag strong { font-size: 1.2rem; }
.mokkan-tag span, .mokkan-tag small { font-size: .77rem; opacity: .85; }
.route-list { display: grid; gap: 12px; position: relative; }
.route-list::before { content: ""; position: absolute; left: 31px; top: 12px; bottom: 12px; width: 2px; background: linear-gradient(var(--blue), rgba(125,168,216,.08)); }
.route-stop { display: grid; grid-template-columns: 44px 62px 1fr 36px; gap: 12px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); color: var(--ink); }
.route-stop img { width: 62px; height: 62px; border-radius: 17px; object-fit: cover; border: 3px solid rgba(255,255,255,.82); }
.route-number { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #6688ad; font-weight: 900; }
.route-copy strong, .route-copy small { display: block; }
.route-copy small { color: var(--muted); }
.route-stop.selected { border-color: rgba(110,155,210,.4); }
.stamp-mini { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: #9c594f; }
.lantern-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; color: var(--muted); }
.lantern-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #fff3cc; color: #b38627; }
.word-big { font-size: 4rem; text-align: center; margin: 16px 0 4px; }
.word-answer { text-align: center; color: var(--muted); margin-bottom: 18px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row > * { flex: 1; }
.legend-row, .record-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.legend-row span, .record-stats span { border-radius: 14px; padding: 10px; background: rgba(255,255,255,.6); color: var(--muted); text-align: center; }
.record-stats strong { display: block; color: var(--ink); font-size: 1.45rem; }
.stamp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.passport-stamp { aspect-ratio: 1; display: grid; place-items: center; text-align: center; border-radius: 50%; border: 2px solid currentColor; padding: 13px; background: rgba(255,255,255,.6); }
.passport-stamp strong { font-size: .85rem; }
.passport-stamp span { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.gold { color: var(--gold); } .vermilion { color: var(--vermilion); } .wood { color: var(--wood); } .fawn { color: var(--fawn); } .ink { color: var(--ink-gray); } .clay { color: var(--clay); } .sakura { color: var(--sakura); }
.phrase-line { padding: 12px; border-radius: 14px; background: rgba(255,255,255,.6); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.6); }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 20; width: min(520px, 100%); display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(251,246,237,.86); backdrop-filter: blur(22px); border-top: 1px solid var(--line); }
.nav-btn { border: 0; background: transparent; border-radius: 18px; color: var(--muted); padding: 8px 3px; font-size: .72rem; font-weight: 800; }
.nav-btn span { display: block; font-size: 1rem; margin-bottom: 2px; }
.nav-btn.active { background: var(--blue-soft); color: #426a98; }
.overlay-panel { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; background: rgba(35,45,58,.34); backdrop-filter: blur(7px); padding: 18px; }
.note-sheet { max-height: 86svh; overflow-y: auto; width: min(520px, 100%); margin: 0 auto; }
.close-btn { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.78); color: var(--ink); z-index: 2; }
.memory-question { border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 12px 0; background: rgba(255,255,255,.58); }
.memory-question legend { font-weight: 800; }
.memory-question label { display: block; margin: 8px 0; color: var(--ink); }
.memory-question small { display: block; color: var(--muted); line-height: 1.45; }
.toast { position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px); background: rgba(37,54,74,.94); color: white; border-radius: 999px; padding: 12px 16px; opacity: 0; pointer-events: none; transition: 180ms ease; max-width: min(92vw, 460px); z-index: 80; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.center { text-align: center; }
@media (min-width: 760px) {
  .phone-shell { padding-inline: 0; }
  .auth-card { padding: 24px; }
}

/* v8.1 guided path + pseudo-haptics */
button, .kanji-tile, .route-stop { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tactile, button, .kanji-tile, .route-stop {
  transform-origin: center;
  transition: transform 170ms cubic-bezier(.22,1.6,.36,1), box-shadow 170ms ease, filter 170ms ease, background 170ms ease;
}
.tactile:hover, button:hover, .kanji-tile:hover { filter: brightness(1.02); }
.tactile:active, button:active, .kanji-tile:active, .route-stop:active, .pressing {
  animation: nara-wobble 260ms cubic-bezier(.2,1.7,.3,1) both;
  box-shadow: 0 8px 18px rgba(42, 65, 92, .12) !important;
}
.primary-action:active, .primary-action.pressing { transform: scale(.96); }
@keyframes nara-wobble {
  0% { transform: scale(1); }
  35% { transform: scale(.94) rotate(-1.2deg); }
  70% { transform: scale(1.035) rotate(.9deg); }
  100% { transform: scale(1) rotate(0); }
}
.page-in { animation: page-in 360ms cubic-bezier(.2,.9,.22,1) both; }
@keyframes page-in { from { opacity:0; transform: translateY(16px) scale(.985); } to { opacity:1; transform: translateY(0) scale(1); } }
.guided-hero { display:grid; gap:14px; }
.guided-copy h1 { margin-bottom: 10px; }
.next-wide { width:100%; min-height:58px; font-size:1rem; }
.path-ribbon { display:grid; grid-template-columns: repeat(5, 1fr); gap:6px; align-items:start; margin: 4px 0 2px; }
.path-ribbon small { display:block; font-size:.64rem; color:var(--muted); text-align:center; line-height:1.1; }
.path-dot { width:28px; height:28px; margin:0 auto 4px; border-radius:50%; display:grid; place-items:center; background:rgba(255,255,255,.75); border:1px solid var(--line); color:var(--muted); font-weight:900; }
.path-dot.lit { background:var(--blue-soft); color:#426a98; box-shadow:0 0 0 5px rgba(126,168,216,.12); }
.kanji-preview .kanji-hero, .kanji-study-head { display:grid; grid-template-columns: 104px 1fr; gap:16px; align-items:center; }
.kanji-mark { min-height:104px; border-radius:24px; display:grid; place-items:center; font-size:4.5rem; font-weight:900; line-height:1; background:linear-gradient(145deg, rgba(255,255,255,.94), rgba(226,239,251,.76)); border:1px solid rgba(113,150,190,.16); box-shadow: inset 0 0 0 8px rgba(255,255,255,.34); }
.kanji-mark.giant { min-height:128px; font-size:6rem; }
.kanji-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap:10px; }
.kanji-tile { border:1px solid var(--line); border-radius:18px; background:rgba(255,255,255,.68); min-height:82px; padding:8px; color:var(--ink); display:grid; place-items:center; gap:2px; }
.kanji-tile strong { font-size:2.2rem; line-height:1; }
.kanji-tile small { color:var(--muted); font-size:.68rem; line-height:1.1; }
.kanji-tile.selected { border-color:rgba(110,155,210,.48); background:var(--blue-soft); }
.kanji-tile.complete, .record-kanji.earned { background:rgba(244,230,195,.72); color:#7f5a23; border-color:rgba(197,164,90,.34); }
.record-kanji { min-height:52px; border-radius:16px; display:grid; place-items:center; background:rgba(255,255,255,.56); border:1px solid var(--line); font-size:1.7rem; font-weight:900; color:var(--muted); }
.study-section { padding:14px; border-radius:20px; background:rgba(255,255,255,.62); border:1px solid var(--line); margin:12px 0; }
.study-section.done { background:rgba(232,242,255,.74); border-color:rgba(110,155,210,.28); }
.study-section h2 { margin:0; }
.kanji-sheet .phrase-slip, .kanji-sheet .study-section { animation: sheet-rise 320ms cubic-bezier(.2,.9,.22,1) both; }
@keyframes sheet-rise { from { opacity:.0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
.guided-nav::before { content:""; }
.bottom-nav { overflow: visible; }
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
@media (max-width: 390px) {
  .kanji-preview .kanji-hero, .kanji-study-head { grid-template-columns: 1fr; }
  .kanji-mark { min-height:120px; }
}

/* v8.2 guided, gated story path */
.stage-card { animation: page-in 320ms cubic-bezier(.2,.9,.22,1) both; }
.story-ribbon .path-dot.current { background:#fff; border-color:rgba(110,155,210,.62); color:#426a98; box-shadow:0 0 0 5px rgba(126,168,216,.15), 0 8px 20px rgba(79,128,190,.12); }
.story-scroll { max-height: 320px; overflow-y: auto; padding: 14px; border-radius: 20px; background: rgba(255,255,255,.62); border: 1px solid var(--line); line-height: 1.75; scroll-behavior: smooth; }
.story-scroll p:last-child { margin-bottom: 26px; }
.source-note { font-size: .88rem; color: var(--muted); padding: 10px 12px; border-radius: 14px; background: rgba(226,239,251,.58); }
.trace-board { position: relative; min-height: 260px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; place-items: center; margin: 16px 0; border-radius: 28px; background: radial-gradient(circle, rgba(255,255,255,.88), rgba(226,239,251,.58)); border: 1px solid rgba(110,155,210,.18); overflow: hidden; }
.trace-kanji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9rem; line-height: 1; font-weight: 900; color: rgba(37,54,74,.08); pointer-events: none; }
.trace-dot { position: relative; z-index: 2; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(110,155,210,.28); background: rgba(255,255,255,.82); color: #426a98; font-weight: 900; box-shadow: 0 12px 24px rgba(74,90,109,.1); }
.trace-dot.lit { background: var(--blue-soft); color: #2f639a; box-shadow: 0 0 0 8px rgba(126,168,216,.16), 0 12px 24px rgba(74,90,109,.12); }
.record-preview { display: grid; place-items: center; padding: 18px; }
.passport-stamp.earned { min-width: 140px; min-height: 140px; }
.kanji-preview .kanji-hero { grid-template-columns: 104px 1fr; }
.stage-card .next-wide:disabled, .primary-action:disabled { opacity: .42; filter: grayscale(.15); transform: none !important; box-shadow: none; }
.danger-text { color: #a24b42; }
.lantern-card { animation: page-in 260ms ease both; }
.record-grid-kanji { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
@media (max-width: 390px) {
  .trace-board { min-height: 220px; gap: 10px; }
  .trace-dot { width: 48px; height: 48px; }
  .trace-kanji { font-size: 7.5rem; }
}

/* v8.2 guided story path */
.auth-card .setup-note,
.setup-note {
  font-size: .88rem;
  line-height: 1.55;
  color: #6b7380;
  background: rgba(255,255,255,.58);
  border: 1px solid rgba(94,118,146,.15);
  padding: 12px 14px;
  border-radius: 18px;
}
.current-stage {
  position: relative;
  overflow: hidden;
}
.current-stage::after {
  content: "";
  position: absolute;
  inset: auto 18px 12px auto;
  width: 82px;
  height: 82px;
  background: radial-gradient(circle, rgba(126,168,216,.16), transparent 64%);
  pointer-events: none;
}
.path-dot.current {
  background: linear-gradient(180deg, #fff, #dfeeff);
  border-color: rgba(90,132,184,.42);
  box-shadow: 0 0 0 8px rgba(126,168,216,.14), 0 10px 20px rgba(66,98,135,.12);
  color: #2e5d90;
}
.stage-help {
  color: var(--muted);
  border-left: 3px solid rgba(126,168,216,.6);
  padding-left: 12px;
}
.story-stack {
  display: grid;
  gap: 12px;
}
.story-panel {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.64);
  border: 1px solid var(--line);
  animation: sheet-rise 320ms cubic-bezier(.2,.9,.22,1) both;
}
.badge.tiny {
  font-size: .7rem;
  padding: 4px 8px;
  margin-bottom: 8px;
}
.phrase-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.choice-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.choice-grid.locked {
  opacity: .52;
  pointer-events: none;
}
.choice {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  color: var(--ink);
  text-align: left;
  padding: 12px 14px;
  font-weight: 780;
}
.trace-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.trace-dot {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 4px;
}
.trace-dot span {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: #375f8b;
  font-weight: 900;
}
.trace-dot small {
  color: var(--muted);
  line-height: 1.15;
}
.trace-dot.lit {
  background: rgba(244,230,195,.7);
  border-color: rgba(197,164,90,.42);
}
.complete-stage h2 {
  color: #405f85;
}
.subtle-card {
  opacity: .95;
}
.chapter summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
}
.chapter summary::-webkit-details-marker { display: none; }
.chapter[open] summary { margin-bottom: 14px; }
.record-grid-kanji {
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
}
.current-stage .kanji-study-head,
.kanji-study-head {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  align-items: center;
}
@media (max-width: 420px) {
  .trace-row { grid-template-columns: 1fr; }
  .current-stage .kanji-study-head,
  .kanji-study-head { grid-template-columns: 1fr; }
}

/* v8.2 true guided-story path */
.app-header .account-pill {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanji-stage-head {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 14px;
  align-items: center;
}
.story-image {
  height: 220px;
}
.story-image img {
  object-fit: cover;
}
.stage-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.stage-chip {
  border-radius: 999px;
  padding: 8px 4px;
  text-align: center;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .04em;
  background: rgba(255,255,255,.62);
  color: var(--muted);
  border: 1px solid var(--line);
}
.stage-chip.current {
  background: var(--blue-soft);
  color: #426a98;
  box-shadow: 0 0 0 4px rgba(126,168,216,.12);
}
.stage-chip.done {
  background: rgba(242, 230, 199, .82);
  color: #805d2d;
  border-color: rgba(197,164,90,.28);
}
.compact-next {
  padding: 15px 16px;
}
.seal-mark.mini {
  width: 34px;
  height: 34px;
  font-size: .88rem;
}
.stage-sheet {
  display: grid;
  gap: 14px;
}
.story-scroll {
  max-height: 44svh;
  overflow-y: auto;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--line);
  box-shadow: inset 0 -18px 24px rgba(247,241,231,.72);
}
.story-scroll p {
  font-size: 1rem;
  line-height: 1.72;
}
.memory-thread {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(226,239,251,.62);
  border: 1px solid rgba(125,168,216,.2);
}
.phrase-list {
  display: grid;
  gap: 10px;
}
.phrase-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.64);
  color: var(--ink);
  padding: 14px;
  display: grid;
  gap: 5px;
}
.phrase-card strong {
  font-size: 1.12rem;
}
.phrase-card span,
.phrase-card small {
  color: var(--muted);
}
.phrase-card.heard {
  border-color: rgba(110,155,210,.38);
  background: rgba(226,239,251,.76);
}
.trace-pad {
  position: relative;
  min-height: 240px;
  border-radius: 24px;
  border: 1px solid rgba(112, 138, 166, .18);
  background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(226,239,251,.66));
  overflow: hidden;
  touch-action: none;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.2);
}
.trace-pad > span {
  position: absolute;
  font-size: 10rem;
  font-weight: 900;
  line-height: 1;
  color: rgba(37,54,74,.08);
  pointer-events: none;
}
.trace-pad canvas {
  position: relative;
  width: 100%;
  height: 230px;
  z-index: 1;
}
.trace-pad small {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  color: var(--muted);
  background: rgba(255,255,255,.76);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .75rem;
}
.trace-pad.trace-ready {
  border-color: rgba(197,164,90,.44);
  box-shadow: 0 0 0 5px rgba(197,164,90,.12), inset 0 0 0 8px rgba(255,255,255,.28);
}
.choice-button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 8px 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.7);
  color: var(--ink);
  font-weight: 750;
}
.choice-button.selected {
  border-color: rgba(185,110,98,.32);
  background: rgba(250,238,235,.78);
}
.choice-button.correct {
  border-color: rgba(110,155,210,.4);
  background: var(--blue-soft);
}
.library-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.library-stats span {
  text-align: center;
  padding: 10px 8px;
  border-radius: 16px;
  background: rgba(255,255,255,.62);
  color: var(--muted);
  font-weight: 800;
}
details summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
details summary::-webkit-details-marker { display: none; }
details summary span {
  color: var(--muted);
  font-size: .85rem;
}
.library-grid,
.record-grid-kanji {
  padding-top: 8px;
}
.record-grid-kanji .record-kanji {
  border: 0;
}
button:disabled {
  filter: grayscale(.1);
  box-shadow: none !important;
}
.stage-sheet .primary-action:disabled::after {
  content: "";
}
/* stronger pseudo-haptic click */
.tactile:active,
button:active,
.kanji-tile:active,
.phrase-card:active,
.choice-button:active,
.pressing {
  animation: nara-snap 310ms cubic-bezier(.2,1.75,.22,1) both !important;
}
@keyframes nara-snap {
  0% { transform: translateY(0) scale(1) rotate(0); }
  32% { transform: translateY(2px) scale(.935) rotate(-1.35deg); }
  68% { transform: translateY(-1px) scale(1.035) rotate(.85deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}
.stage-sheet,
.overlay-panel {
  animation: stage-slide-up 320ms cubic-bezier(.2,.95,.24,1) both;
}
@keyframes stage-slide-up {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 410px) {
  .kanji-stage-head,
  .kanji-study-head {
    grid-template-columns: 1fr;
  }
  .kanji-mark.giant {
    min-height: 150px;
  }
  .stage-chip {
    font-size: .58rem;
    padding-inline: 2px;
  }
}



/* v8.3 pseudo-haptic interaction system */
:root {
  --haptic-lift: -3px;
  --haptic-shadow: 0 18px 34px rgba(42, 68, 96, .18);
  --haptic-glow: 0 0 0 4px rgba(125, 168, 216, .16);
}
button,
.tactile,
.kanji-tile,
.route-stop,
.phrase-card,
.choice-button,
.record-kanji,
.review-tile,
.review-session-card,
details summary {
  position: relative;
  overflow: hidden;
  transform:
    translate3d(var(--haptic-x, 0px), var(--haptic-y, 0px), 0)
    scale(var(--haptic-scale, 1))
    rotate(var(--haptic-rotate, 0deg));
  transition:
    transform 170ms cubic-bezier(.18,.92,.24,1.55),
    box-shadow 190ms cubic-bezier(.18,.92,.24,1),
    filter 190ms ease,
    border-color 190ms ease,
    background-color 190ms ease;
  will-change: transform, box-shadow, filter;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:not(:disabled):hover,
.tactile:not(:disabled):hover,
.kanji-tile:not(:disabled):hover,
.route-stop:not(:disabled):hover,
.phrase-card:not(:disabled):hover,
.choice-button:not(:disabled):hover,
.record-kanji:not(:disabled):hover,
.review-tile:not(:disabled):hover,
details summary:hover {
  --haptic-y: var(--haptic-lift);
  --haptic-scale: 1.018;
  box-shadow: var(--haptic-shadow), var(--haptic-glow);
  filter: saturate(1.06) brightness(1.015);
}
button.haptic-hover:not(:disabled),
.tactile.haptic-hover:not(:disabled),
.kanji-tile.haptic-hover:not(:disabled),
.route-stop.haptic-hover:not(:disabled),
.phrase-card.haptic-hover:not(:disabled),
.choice-button.haptic-hover:not(:disabled),
.record-kanji.haptic-hover:not(:disabled),
.review-tile.haptic-hover:not(:disabled) {
  --haptic-scale: 1.026;
  box-shadow: var(--haptic-shadow), var(--haptic-glow);
}
button.haptic-pressing:not(:disabled),
.tactile.haptic-pressing:not(:disabled),
.kanji-tile.haptic-pressing:not(:disabled),
.route-stop.haptic-pressing:not(:disabled),
.phrase-card.haptic-pressing:not(:disabled),
.choice-button.haptic-pressing:not(:disabled),
.record-kanji.haptic-pressing:not(:disabled),
.review-tile.haptic-pressing:not(:disabled),
.pressing {
  animation: nara-press-squish 360ms cubic-bezier(.17,1.65,.25,1) both !important;
}
button.haptic-pop:not(:disabled),
.tactile.haptic-pop:not(:disabled),
.kanji-tile.haptic-pop:not(:disabled),
.route-stop.haptic-pop:not(:disabled),
.phrase-card.haptic-pop:not(:disabled),
.choice-button.haptic-pop:not(:disabled),
.record-kanji.haptic-pop:not(:disabled),
.review-tile.haptic-pop:not(:disabled) {
  animation: nara-release-pop 430ms cubic-bezier(.16,1.7,.22,1) both !important;
}
@keyframes nara-press-squish {
  0% { transform: translate3d(var(--haptic-x, 0px), var(--haptic-y, 0px), 0) scale(1) rotate(0); }
  32% { transform: translate3d(calc(var(--haptic-x, 0px) * .45), 2px, 0) scale(.925, .965) rotate(-1.2deg); }
  66% { transform: translate3d(calc(var(--haptic-x, 0px) * .25), -1px, 0) scale(1.035, .99) rotate(.8deg); }
  100% { transform: translate3d(var(--haptic-x, 0px), var(--haptic-y, 0px), 0) scale(var(--haptic-scale, 1)) rotate(var(--haptic-rotate, 0deg)); }
}
@keyframes nara-release-pop {
  0% { transform: translate3d(0, 2px, 0) scale(.95); }
  42% { transform: translate3d(0, -4px, 0) scale(1.045); }
  72% { transform: translate3d(0, 1px, 0) scale(.992); }
  100% { transform: translate3d(var(--haptic-x, 0px), var(--haptic-y, 0px), 0) scale(var(--haptic-scale, 1)); }
}
.haptic-ripple {
  position: absolute;
  left: var(--ripple-x, 50%);
  top: var(--ripple-y, 50%);
  width: 14px;
  height: 14px;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.88), rgba(255,255,255,.22) 58%, transparent 68%);
  transform: translate(-50%, -50%) scale(0);
  animation: nara-ripple 560ms cubic-bezier(.18,.8,.22,1) forwards;
  mix-blend-mode: screen;
  z-index: 2;
}
@keyframes nara-ripple {
  to { opacity: 0; transform: translate(-50%, -50%) scale(18); }
}
.haptic-spark {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(197,164,90,.9);
  box-shadow: 0 0 18px rgba(197,164,90,.5);
  animation: spark-fade 520ms ease-out forwards;
}
@keyframes spark-fade {
  to { opacity: 0; transform: translateY(-16px) scale(.2); }
}
button:focus-visible,
.tactile:focus-visible,
.kanji-tile:focus-visible,
.route-stop:focus-visible,
.phrase-card:focus-visible,
.choice-button:focus-visible,
.record-kanji:focus-visible,
.review-tile:focus-visible {
  outline: 0;
  box-shadow: var(--haptic-shadow), 0 0 0 5px rgba(185,110,98,.22) !important;
}
body.reduced-motion button,
body.reduced-motion .tactile,
body.reduced-motion .kanji-tile,
body.reduced-motion .route-stop,
body.reduced-motion .phrase-card,
body.reduced-motion .choice-button,
body.reduced-motion .record-kanji,
body.reduced-motion .review-tile,
body.reduced-motion details summary {
  transition: none !important;
  animation: none !important;
  transform: none !important;
}

/* dedicated review screen */
.review-dashboard {
  display: grid;
  gap: 14px;
}
.review-queue {
  display: grid;
  gap: 10px;
}
.review-tile {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.68);
  color: var(--ink);
  padding: 14px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
}
.review-tile .review-kanji {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(226,239,251,.82);
  font-size: 2rem;
  font-weight: 900;
  font-family: "Noto Serif JP", serif;
}
.review-tile small,
.review-tile span {
  color: var(--muted);
}
.review-status {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255,255,255,.72);
}
.review-session-card {
  display: grid;
  gap: 14px;
}
.review-answer {
  padding: 14px;
  border-radius: 18px;
  background: rgba(226,239,251,.7);
  border: 1px solid rgba(125,168,216,.22);
}
.haptic-lab {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
@media (max-width: 410px) {
  .review-tile { grid-template-columns: 48px 1fr; }
  .review-status { grid-column: 1 / -1; width: fit-content; }
  .haptic-lab { grid-template-columns: 1fr; }
}

/* v8.4 story-card knowledge layer */
.profile-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 2px;
}
.profile-strip span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.62);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .78rem;
  font-weight: 750;
  color: var(--muted);
}
.profile-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}
.profile-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255,255,255,.62);
  min-height: 96px;
}
.profile-card span {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 850;
  margin-bottom: 6px;
}
.profile-card strong {
  display: block;
  font-size: .98rem;
  line-height: 1.35;
}
.profile-card p {
  margin: 6px 0 0;
  font-size: .86rem;
  line-height: 1.5;
  color: var(--muted);
}
.story-profile .profile-card:nth-child(3),
.story-profile .profile-card:nth-child(4),
.story-profile .profile-card:nth-child(5),
.story-profile .profile-card:nth-child(6) {
  grid-column: 1 / -1;
}
.review-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.mode-pill {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.7);
  min-height: 70px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
}
.mode-pill strong,
.mode-pill small {
  display: block;
}
.mode-pill small {
  color: var(--muted);
  margin-top: 4px;
}
.mode-pill.active {
  border-color: rgba(85,129,183,.45);
  background: linear-gradient(135deg, rgba(227,241,252,.95), rgba(255,255,255,.72));
  box-shadow: 0 12px 24px rgba(74,110,160,.14);
}
.review-tile em {
  display: block;
  color: var(--muted);
  font-size: .74rem;
  font-style: normal;
  margin-top: 2px;
}
.why-box {
  border: 1px solid rgba(126, 99, 64, .18);
  background: rgba(250,246,235,.75);
  border-radius: 18px;
  padding: 12px;
  margin: 14px 0;
}
.why-box strong,
.why-box span {
  display: block;
}
.why-box span {
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
}
.session-card .profile-card {
  min-height: 82px;
}
@media (max-width: 520px) {
  .profile-grid,
  .review-mode-grid {
    grid-template-columns: 1fr;
  }
}


/* v8.5 UI/UX pass: scrollable lesson pages and guided review context */
.story-page { padding-bottom: 10px; }
.current-lesson-shell { overflow: visible; scroll-margin-top: 82px; }
.lesson-guide { overflow: visible; }
.guide-layout { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; margin: 8px 0 14px; }
.guide-deer { height: 92px; border-width: 6px; border-radius: 20px; }
.stage-guide-list, .review-guide ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.stage-guide-list li, .review-guide li { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,.58); border: 1px solid var(--line); }
.stage-guide-list li strong, .review-guide li strong { color: var(--ink); }
.stage-guide-list li span, .review-guide li span { color: var(--muted); line-height: 1.4; }
.stage-guide-list li.current { background: rgba(226,239,251,.9); border-color: rgba(110,155,210,.28); }
.stage-guide-list li.done { background: rgba(244,230,195,.55); }
.story-scroll { max-height: none !important; overflow: visible !important; }
.story-scroll p { font-size: 1rem; }
.review-guide { padding: 12px; margin: 12px 0; border-radius: 18px; background: rgba(226,239,251,.58); border: 1px solid rgba(125,168,216,.18); }
.review-guide h2 { margin-bottom: 10px; }
.review-session-card { scroll-margin-top: 82px; overflow: visible; }
.review-answer { padding: 14px; border-radius: 20px; background: rgba(255,255,255,.68); border: 1px solid var(--line); margin: 12px 0; line-height: 1.6; }
.review-answer strong { display:block; font-size: 1.25rem; margin-bottom: 6px; }
.review-answer small { display:block; color: var(--muted); margin-top: 8px; }
.review-status { min-width: 84px; text-align: center; }
.review-tile.flickering .review-status { color: #a66d34; }
.review-tile.steady .review-status { color: #4e7d55; }
.review-tile.glowing .review-status { color: #426a98; }
.account-pill { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 390px) {
  .guide-layout { grid-template-columns: 1fr; }
  .stage-guide-list li, .review-guide li { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════
   v9 · TONED WHITE + BLUE CLASSICAL THEME + DELUXE ATMOSPHERE
   Cooler, squarer, museum-framed — so the colorful webp art pops.
   ════════════════════════════════════════════════════════════════ */
:root {
  --paper:#eef4fb;
  --paper-2:#ffffff;
  --ink:#1b3550;
  --ink-2:#143049;
  --muted:#5b748f;
  --blue:#6d98cf;
  --blue-deep:#416fa8;
  --blue-soft:#e7f0fb;
  --line:rgba(34,72,112,.16);
  --line-strong:rgba(34,72,112,.30);
  --navy:#193653;
  --gold:#c2a15e;
  --vermilion:#b05a4f;
  --shadow:0 20px 48px rgba(28,58,92,.14);
  --f-serif:'Noto Serif JP', serif;
  --f-mono:'Space Mono', ui-monospace, monospace;
  --r-sharp:3px;
  --r-soft:6px;
  --ease:cubic-bezier(.16,1,.3,1);
}
body {
  background:
    radial-gradient(120% 80% at 50% -10%, #ffffff 0%, #eaf2fb 46%, #dfeaf7 100%) fixed,
    #e8f0f9;
  color: var(--ink);
}
body::before {
  /* faint architectural grid wash — classical paper, cool */
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none; opacity:.5;
  background:
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(34,72,112,.035) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(34,72,112,.035) 39px 40px);
  -webkit-mask:linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
          mask:linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

/* ── classical de-rounding + crisp framing ───────────────────── */
.notebook-page {
  border-radius: var(--r-soft);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.notebook-page::before {
  /* thin navy keyline inset — museum card */
  background: none;
  inset: 5px; border: 1px solid rgba(34,72,112,.10); border-radius: 3px;
  mix-blend-mode: normal;
}
.notebook-page::after {
  /* top accent hairline in nara-blue */
  left: 0; right: 0; top: 0; bottom: auto; height: 3px;
  background: linear-gradient(90deg, var(--blue-deep), var(--blue) 60%, transparent);
  opacity: .9;
}
.page-tab, .account-pill {
  border-radius: 2px; letter-spacing: .14em; border-color: var(--line-strong);
  background: rgba(255,255,255,.82); color: var(--blue-deep);
}
.art-frame {
  border-radius: 3px;
  border: 7px solid #ffffff;
  box-shadow: 0 0 0 1px var(--line-strong), 0 18px 40px rgba(28,58,92,.16);
}
.primary-action, .soft-action, .text-action, .nav-btn, .kanji-mark,
.kanji-tile, .record-kanji, .profile-card, .phrase-card, .choice-button,
.choice, .review-tile, .review-tile .review-kanji, .mode-pill, .why-box,
.story-scroll, .memory-thread, .trace-pad, .review-answer, .guide-note,
.setup-note, .library-stats span, .stage-guide-list li, .review-guide,
.toggle-row, .legend-row span, .record-stats span, .review-session-card,
.lantern-intro, .scroll-hero, .meta-line span {
  border-radius: var(--r-sharp) !important;
}
.stage-chip, .profile-strip span, .review-status { border-radius: 2px; }
.primary-action {
  background: linear-gradient(135deg, var(--blue-deep), var(--navy));
  box-shadow: 0 12px 24px rgba(25,54,83,.26);
}
.soft-action { background: rgba(231,240,251,.92); color: var(--blue-deep); border:1px solid var(--line-strong); }
.seal-mark { border-radius: 4px; color:#fff; background: var(--vermilion); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }

/* brand header — classical plate */
.app-header.top-scrollbar { background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.55)); }
.brand-row strong { font-family: var(--f-serif); font-weight: 700; letter-spacing:.02em; }

/* ── feel-good classical bottom navigation ───────────────────── */
.bottom-nav {
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(244,248,253,.96));
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -10px 30px rgba(28,58,92,.10);
}
.nav-btn { color: var(--muted); border-radius: var(--r-sharp); position: relative; transition: color .25s var(--ease); }
.nav-btn span { font-family: var(--f-serif); transition: transform .3s var(--ease); }
.nav-btn.active { background: transparent; color: var(--navy); }
.nav-btn.active span { transform: translateY(-3px) scale(1.16); }
.nav-btn.active::after {
  content:""; position:absolute; left:50%; bottom:2px; transform:translateX(-50%);
  width:18px; height:3px; border-radius:2px; background: var(--blue-deep);
  box-shadow: 0 0 10px rgba(65,111,168,.6);
}
.guided-nav::before { color: var(--muted); }

/* ── ambient: drifting sakura petals + rising lanterns ───────── */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.petal {
  position: fixed; top: -28px; width: 12px; height: 12px;
  background: linear-gradient(135deg, #cfe0f4, #9fc0e6);
  border-radius: 50% 0 50% 50%; opacity: .5;
  animation: petal-fall linear infinite;
}
@keyframes petal-fall { to { transform: translateY(112vh) rotate(420deg); } }
.lantern-mote {
  position: fixed; bottom: -30px; width: 13px; height: 18px; border-radius: 6px 6px 5px 5px;
  background: radial-gradient(circle at 50% 35%, #fff3cf, #f2c879 60%, #d79b3f);
  box-shadow: 0 0 16px 4px rgba(240,196,110,.5); opacity: .0;
  animation: lantern-rise linear infinite;
}
@keyframes lantern-rise {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: .85; }
  85% { opacity: .7; }
  100% { transform: translateY(-114vh) translateX(24px); opacity: 0; }
}

/* ── top scroll progress ─────────────────────────────────────── */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999;
  background: linear-gradient(90deg, var(--blue-deep), var(--gold));
  transition: width .12s linear; box-shadow: 0 0 8px rgba(65,111,168,.5);
}

/* ── sound toggle ────────────────────────────────────────────── */
.sound-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 9000;
  width: 38px; height: 38px; border-radius: 3px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong); color: var(--blue-deep);
  font-size: 1rem; line-height: 1; display: grid; place-items: center;
}
.sound-toggle.muted { color: var(--muted); opacity: .7; }

/* ── floating Mikasa guide chip ──────────────────────────────── */
.guide-chip {
  position: fixed; left: 12px; bottom: 84px; z-index: 70;
  display: flex; align-items: flex-end; gap: 8px; max-width: 290px;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.guide-chip.show { opacity: 1; transform: translateY(0); }
.guide-chip .gc-deer {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 3px; overflow: hidden;
  background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  animation: gc-bob 4.5s ease-in-out infinite;
}
.guide-chip .gc-deer img { width: 100%; height: 100%; object-fit: cover; }
@keyframes gc-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.guide-chip .gc-text {
  font-size: .78rem; font-weight: 600; line-height: 1.4; color: var(--ink);
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong); border-radius: 3px 3px 3px 0;
  padding: 9px 12px; box-shadow: var(--shadow);
}
@media (max-width: 460px) { .guide-chip { display: none; } }

/* ── reveal-on-enter ─────────────────────────────────────────── */
.rise { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.rise.seen { opacity: 1; transform: none; }
.rise.s1.seen { transition-delay: .05s; } .rise.s2.seen { transition-delay: .14s; }
.rise.s3.seen { transition-delay: .24s; } .rise.s4.seen { transition-delay: .34s; }

/* ── click glyph sparkle (deluxe) ────────────────────────────── */
.click-spark {
  position: fixed; z-index: 9999; pointer-events: none;
  font-family: var(--f-mono); font-weight: 700; font-size: 14px; color: var(--blue-deep);
  opacity: 1; transition: transform 1s ease, opacity 1s ease;
}

/* ════════ STROKE-ORDER CANVAS (Phase 1) ════════ */
.stroke-panel {
  margin: 14px 0; padding: 14px; border-radius: var(--r-soft);
  background: linear-gradient(180deg, #ffffff, #f4f9ff);
  border: 1px solid var(--line);
}
.panel-label {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--blue-deep); margin-bottom: 10px;
}
.sc-root { display: grid; gap: 12px; }
.sc-canvas {
  position: relative; width: 100%; max-width: 280px; margin: 0 auto; aspect-ratio: 1;
  border-radius: 3px; background:
    radial-gradient(circle at 50% 40%, #ffffff, #eef4fb);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.6);
}
.sc-svg { width: 100%; height: 100%; display: block; }
.sc-guide { stroke: rgba(34,72,112,.18); stroke-width: .6; stroke-dasharray: 3 3; }
.sc-future { fill: none; stroke: rgba(34,72,112,.12); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.sc-past   { fill: none; stroke: #7d97b4; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.sc-current{ fill: none; stroke: var(--navy); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.sc-dot    { fill: var(--vermilion); }
@keyframes sc-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.sc-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sc-counter { font-family: var(--f-mono); font-size: .76rem; color: var(--muted); letter-spacing: .04em; }
.sc-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-btn {
  border: 1px solid var(--line-strong); background: #fff; color: var(--blue-deep);
  border-radius: 3px; padding: 9px 12px; font-size: .8rem; font-weight: 700;
}
.sc-btn-next { background: var(--blue-deep); color: #fff; border-color: var(--blue-deep); }
.sc-btn-auto { background: rgba(231,240,251,.9); }
.sc-missing { color: var(--muted); font-size: .85rem; text-align: center; padding: 18px; }
.sc-done .sc-canvas { box-shadow: inset 0 0 0 6px rgba(231,240,251,.85), 0 0 0 2px rgba(65,111,168,.25); }

body.reduced-motion .petal,
body.reduced-motion .lantern-mote,
body.reduced-motion .guide-chip .gc-deer { animation: none !important; }
body.reduced-motion .click-spark { display: none; }
