/* ============================================================================
 * styles.css — Japanese Learner
 * Genkō-yōshi aesthetic: characters in manuscript cells, furigana stacking,
 * maru/batsu ink feedback, indigo accents. No emoji — SVG icons only.
 * ========================================================================== */

:root {
  --paper: #f3efe6;
  --card: #fbf9f3;
  --ink: #211e19;
  --sumi: #26231d;
  --gray: #8c8678;
  --line: #e3ddcf;
  --line-soft: #ece6d9;

  --celadon: #e2ebe1;
  --celadon-line: #bcd0bf;
  --celadon-cross: #d2e0d3;

  --vermilion: #c6402e;
  --vermilion-soft: #f3e2dd;
  --indigo: #35426d;
  --indigo-d: #283152;
  --indigo-soft: #e7eaf1;
  --gold: #b0842f;

  --mincho: "Shippori Mincho", serif;
  --sans: "Be Vietnam Pro", "Zen Kaku Gothic New", sans-serif;

  --r: 14px;
  --maxw: 520px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
img { max-width: 100%; display: block; }
svg { display: block; }
.ico { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-fill { fill: currentColor; stroke: none; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 2px solid var(--line); border-radius: 12px;
  font-size: 1rem; font-weight: 600; letter-spacing: .02em;
  padding: .8rem 1.3rem; background: var(--card); color: var(--ink);
  box-shadow: 0 3px 0 var(--line);
  transition: transform .05s ease, box-shadow .05s ease, background .15s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .ico { width: 1.15rem; height: 1.15rem; }
.btn-ink { background: var(--indigo); color: #fff; border-color: var(--indigo-d); box-shadow: 0 4px 0 var(--indigo-d); }
.btn-ink:active { box-shadow: 0 0 0 var(--indigo-d); }
.btn-ink-outline { background: transparent; color: var(--indigo); border-color: var(--indigo); box-shadow: 0 3px 0 var(--indigo); }
.btn-ink-outline:active { box-shadow: 0 0 0 var(--indigo); }
.btn-block { width: 100%; }
.btn-lg { padding: .95rem 1.5rem; font-size: 1.05rem; }

.icon-btn { border: none; background: none; padding: .35rem; border-radius: 10px; color: var(--gray); display: inline-grid; place-items: center; }
.icon-btn .ico { width: 1.4rem; height: 1.4rem; }
.icon-btn:active { background: var(--line-soft); }

/* ---------------------------------------------------------------- top / dashboard */
.dash { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line); }
.dash-bar, .view, .session, .lesson-col-wrap { max-width: var(--maxw); margin: 0 auto; width: 100%; }
.dash-bar { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem .2rem; }
.brand { font-family: var(--mincho); font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; gap: .45rem; }
.brand .seal { width: 20px; height: 20px; color: var(--vermilion); }
.dash-bar .spacer { flex: 1; }
.stat { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-size: .92rem; }
.stat .ico { width: 1.05rem; height: 1.05rem; }
.stat.streak { color: var(--vermilion); }
.stat.xp { color: var(--gold); }

.tabs { display: flex; gap: 1.6rem; padding: 0 1.2rem; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.tab { font-family: var(--mincho); font-size: 1.1rem; background: none; border: none; color: var(--gray); position: relative; padding: .5rem 0 .7rem; letter-spacing: .06em; }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--vermilion); }

.topbar-min { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.topbar-min .title { font-family: var(--mincho); font-weight: 700; }
.topbar-min .spacer { flex: 1; }

.view { flex: 1; padding: 1.1rem 1rem 3rem; }

/* ---------------------------------------------------------------- goal */
.goal { display: flex; align-items: center; gap: .85rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: .75rem .95rem; margin-bottom: 1.3rem; }
.ring { --p: 0; width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--vermilion) calc(var(--p) * 1%), var(--line-soft) 0); display: grid; place-items: center; }
.ring::after { content: ""; width: 33px; height: 33px; border-radius: 50%; background: var(--card); }
.ring .ring-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--vermilion); }
.goal .g-main { font-weight: 700; }
.goal .g-sub { color: var(--gray); font-size: .82rem; }

/* hub (home) area cards */
.areas { display: flex; flex-direction: column; gap: .8rem; }
.area { display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; background: var(--card);
  border: 2px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; box-shadow: 0 3px 0 var(--line);
  transition: transform .05s, box-shadow .05s; }
.area:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.area-ico { width: 56px; height: 56px; flex: none; display: grid; place-items: center; border-radius: 6px;
  border: 1.5px solid var(--celadon-line); font-family: var(--mincho); font-weight: 700; font-size: 2rem; color: var(--sumi);
  background: linear-gradient(var(--celadon-cross), var(--celadon-cross)) center/100% 1px no-repeat,
    linear-gradient(var(--celadon-cross), var(--celadon-cross)) center/1px 100% no-repeat, var(--celadon); }
.area-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.area-txt b { font-family: var(--mincho); font-size: 1.2rem; }
.area-txt small { color: var(--gray); font-size: .85rem; }
.area-arrow { margin-left: auto; color: var(--gray); } .area-arrow .ico { width: 1.2rem; height: 1.2rem; }
.area.soon { opacity: .55; }
.area.soon .area-ico { color: var(--gray); background: var(--line-soft); border-color: var(--line); }

/* set bar */
.setbar { display: flex; align-items: center; gap: .7rem; width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: .7rem .9rem; margin-bottom: 1rem; text-align: left; }
.setbar .sb-ico { color: var(--indigo); display: inline-grid; } .setbar .sb-ico .ico { width: 1.3rem; height: 1.3rem; }
.setbar .sb-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.setbar .sb-txt small { color: var(--gray); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.setbar .sb-txt b { font-family: var(--mincho); font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setbar .sb-arrow { margin-left: auto; color: var(--gray); } .setbar .sb-arrow .ico { width: 1.1rem; height: 1.1rem; }

/* sets screen */
.set-list { display: flex; flex-direction: column; gap: .5rem; }
.set-row { display: flex; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.set-row.active { border-color: var(--vermilion); }
.set-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: .7rem; background: none; border: none; padding: .85rem .9rem; text-align: left; }
.set-mark { width: 1.3rem; color: var(--vermilion); display: inline-grid; } .set-mark .ico { width: 1.3rem; height: 1.3rem; }
.set-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.set-info b { font-family: var(--mincho); font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.set-info small { color: var(--gray); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.set-edit, .set-del { flex: none; }
.set-del { color: var(--gray); margin-right: .4rem; }
.set-textarea { width: 100%; min-height: 220px; font-family: var(--mincho); font-size: 1rem; line-height: 1.7;
  border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; background: var(--card); color: var(--ink); resize: vertical; }
.set-textarea:focus { outline: none; border-color: var(--indigo); }

/* practice bar */
.practice { display: flex; align-items: center; gap: .8rem; width: 100%; margin-bottom: 1.4rem;
  text-align: left; justify-content: flex-start; }
.practice .ico { width: 1.4rem; height: 1.4rem; }
.practice .p-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.practice .p-txt small { font-weight: 500; font-size: .8rem; opacity: .92; }

/* ---------------------------------------------------------------- genkō cells */
.genko { display: flex; flex-direction: column; align-items: center; }
.ruby { font-family: var(--mincho); font-size: clamp(.95rem, 4vw, 1.25rem); color: var(--gray);
  letter-spacing: .14em; min-height: 1.4em; margin-bottom: .45rem; transition: filter .25s ease; }
.ruby.hidden { filter: blur(8px); }
.cells { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.cell {
  width: clamp(54px, 15vw, 82px); aspect-ratio: 1; display: grid; place-items: center;
  border: 1.5px solid var(--celadon-line);
  background:
    linear-gradient(var(--celadon-cross), var(--celadon-cross)) center / 100% 1px no-repeat,
    linear-gradient(var(--celadon-cross), var(--celadon-cross)) center / 1px 100% no-repeat,
    var(--celadon);
  border-radius: 3px;
  font-family: var(--mincho); font-weight: 600; color: var(--sumi);
  font-size: clamp(2.2rem, 9vw, 3.4rem); line-height: 1;
}
.cell.sm { width: clamp(40px, 11vw, 56px); font-size: clamp(1.5rem, 6vw, 2.2rem); }
.annot { color: var(--gray); font-size: 1rem; margin-top: .55rem; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.hero-note { font-family: var(--sans); color: var(--gray); font-size: .9rem; margin-top: .55rem; max-width: 90%; }

/* ink-in motion on reveal/next */
@keyframes inkin { from { filter: blur(7px); opacity: .12; } to { filter: blur(0); opacity: 1; } }
.inkin .cell { animation: inkin .25s ease-out both; }
@media (prefers-reduced-motion: reduce) { .inkin .cell { animation: none; } }

/* ---------------------------------------------------------------- lesson column (path) */
.section-head { text-align: center; margin: 1.4rem 0 1rem; color: var(--gray); font-weight: 600; letter-spacing: .1em; font-size: .74rem; text-transform: uppercase; }
.lesson-col { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
/* Duolingo-style serpentine: nodes offset by --k (−2..2) × --wave. */
.lesson-col.winding { --wave: 38px; gap: 1.25rem; }
.lesson-col.winding .lcell { transform: translateX(calc(var(--k, 0) * var(--wave))); transition: transform .2s ease; }
@media (min-width: 620px) { .lesson-col.winding { --wave: 72px; gap: 1.5rem; } .lesson-col.winding .lcell .sq { width: 84px; height: 84px; font-size: 2rem; } }
.lcell { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; border: none; background: none; }
.lcell .sq {
  width: 72px; height: 72px; display: grid; place-items: center; border-radius: 4px;
  border: 1.5px solid var(--celadon-line);
  background:
    linear-gradient(var(--celadon-cross), var(--celadon-cross)) center / 100% 1px no-repeat,
    linear-gradient(var(--celadon-cross), var(--celadon-cross)) center / 1px 100% no-repeat,
    var(--celadon);
  font-family: var(--mincho); font-weight: 700; font-size: 1.7rem; color: var(--sumi);
  box-shadow: 0 3px 0 rgba(188, 208, 191, .5); transition: transform .05s, box-shadow .05s;
}
.lcell:active .sq { transform: translateY(3px); box-shadow: 0 0 0 rgba(188,208,191,.5); }
.lcell.done .sq { border-color: var(--vermilion); background: var(--card); color: var(--vermilion); box-shadow: 0 3px 0 var(--vermilion-soft); }
.lcell.special .sq { border-color: var(--indigo); color: var(--indigo); background: var(--card); box-shadow: 0 3px 0 var(--indigo-soft); font-size: 1.5rem; }
.lcell .lc-label { font-size: .72rem; color: var(--gray); font-weight: 600; }
.lcell .crown { display: flex; gap: 2px; height: 10px; }
.lcell .crown i { width: 6px; height: 6px; border-radius: 50%; background: var(--vermilion); display: block; }
.lcell .due { position: absolute; top: -6px; right: 50%; transform: translateX(28px); background: var(--vermilion); color: #fff;
  font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.path-link { width: 2px; height: 10px; background: var(--celadon-line); }

/* ---------------------------------------------------------------- session */
.session { flex: 1; display: flex; flex-direction: column; padding: 1rem; }
.sess-top { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.6rem; }
.progress { flex: 1; height: 12px; background: var(--line-soft); border-radius: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--vermilion); transition: width .3s ease; }
.hearts { display: inline-flex; gap: 2px; color: var(--vermilion); }
.hearts .ico { width: 1.05rem; height: 1.05rem; }
.hearts .lost { opacity: .22; }

.q-area { flex: 1; display: flex; flex-direction: column; position: relative; }
.q-instruction { color: var(--gray); font-weight: 600; font-size: .92rem; margin-bottom: 1.2rem; text-align: center; letter-spacing: .02em; }
.q-hero { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.q-pic { width: 180px; max-width: 64%; border-radius: var(--r); border: 1px solid var(--line); background: #fff; }
.q-meaning { font-size: 1.55rem; font-weight: 700; text-align: center; }
.q-sound { margin-top: .2rem; color: var(--indigo); }
.q-sound .ico { width: 1.7rem; height: 1.7rem; }

.choices { display: grid; gap: .65rem; margin-top: auto; }
.choice { display: flex; align-items: center; gap: .7rem; text-align: left; background: var(--card);
  border: 2px solid var(--line); border-radius: 12px; padding: .85rem 1rem; font-size: 1.05rem; font-weight: 500;
  box-shadow: 0 3px 0 var(--line); transition: transform .05s, box-shadow .05s; }
.choice:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.choice .c-pic { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); }
.choice .jp { font-family: var(--mincho); }
.choice.selected { border-color: var(--indigo); box-shadow: 0 3px 0 var(--indigo); background: var(--indigo-soft); }
.choice.correct { border-color: var(--vermilion); background: var(--vermilion-soft); box-shadow: 0 3px 0 var(--vermilion); }
.choice.wrong { border-color: var(--sumi); background: #efe9e0; box-shadow: 0 3px 0 var(--sumi); }
.choice.disabled { pointer-events: none; opacity: .6; }

.type-input { width: 100%; font-family: var(--mincho); font-size: 1.4rem; text-align: center; padding: .85rem 1rem;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); outline: none; margin-top: auto; }
.type-input:focus { border-color: var(--indigo); }

/* flashcard (learn + flash quiz) */
.fc { width: 100%; max-width: 360px; margin: auto; cursor: pointer; }
.fc-face { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem 1.2rem;
  display: flex; flex-direction: column; align-items: center; gap: .7rem; min-height: 230px; justify-content: center; }
.fc-hint { font-size: .72rem; color: var(--gray); letter-spacing: .08em; }

/* maru / batsu overlay */
.mark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5; }
.mark svg { width: 46%; max-width: 190px; height: auto; }
.mark .stroke { fill: none; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw .45s ease both; }
.mark.maru .stroke { stroke: var(--vermilion); stroke-width: 6.5; }
.mark.batsu .stroke { stroke: var(--sumi); stroke-width: 6.5; }
.mark .s2 { animation-delay: .16s; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .mark .stroke { animation: none; } }

/* feedback footer */
.feedback { position: sticky; bottom: 0; margin-top: 1rem; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0; background: var(--card); border-top: 1px solid var(--line); }
.feedback.ok { background: var(--vermilion-soft); border-color: #e7c9c1; }
.feedback.no { background: #eee8df; border-color: #ddd5c7; }
.feedback .fb-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; margin-bottom: .15rem; }
.feedback.ok .fb-head { color: var(--vermilion); }
.feedback.no .fb-head { color: var(--sumi); }
.feedback .fb-head .ico { width: 1.3rem; height: 1.3rem; }
.feedback .fb-ans { font-size: .92rem; margin-bottom: .75rem; }
.feedback .fb-ans b { font-family: var(--mincho); }
.grade-row { display: flex; gap: .6rem; }

/* result */
.result { text-align: center; padding-top: 2rem; }
.result .enso { width: 120px; height: 120px; margin: 0 auto 1rem; color: var(--vermilion); }
.result .big { font-family: var(--mincho); font-size: 1.7rem; font-weight: 700; margin-bottom: 1.4rem; }
.result-stats { display: flex; gap: .7rem; justify-content: center; margin-bottom: 1.8rem; }
.rstat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; min-width: 90px; }
.rstat .rv { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rstat.xp .rv { color: var(--gold); } .rstat.acc .rv { color: var(--vermilion); }
.rstat .rl { font-size: .7rem; color: var(--gray); text-transform: uppercase; letter-spacing: .05em; }

/* lesson intro */
.intro { padding-top: 1rem; }
.intro .big { font-family: var(--mincho); font-size: 1.6rem; font-weight: 700; margin-bottom: .3rem; }
.intro .sub { color: var(--gray); margin-bottom: 1.4rem; }
.wordlist { display: flex; flex-direction: column; gap: .1rem; margin: 1.2rem 0; }
.wl { display: flex; align-items: center; gap: .8rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line-soft); }
.wl .wl-jp { font-family: var(--mincho); font-size: 1.15rem; min-width: 5.5rem; }
.wl .wl-en { color: var(--gray); font-size: .92rem; }
.wl .wl-box { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.wl .wl-box.b { background: var(--vermilion); }

/* settings */
.h1 { font-family: var(--mincho); font-size: 1.45rem; font-weight: 700; margin: .4rem 0 1rem; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; padding: .95rem .2rem; border-bottom: 1px solid var(--line-soft); }
.row .r-label { font-weight: 600; } .row .r-sub { font-size: .8rem; color: var(--gray); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; background: var(--card); padding: .45rem .7rem; font-size: .85rem; font-weight: 600; color: var(--gray); }
.seg button.active { background: var(--indigo); color: #fff; }
.voice-sel { font-family: var(--sans); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; background: var(--card); color: var(--ink); max-width: 56vw; font-size: .85rem; }
.tts-config { padding: .3rem .2rem .9rem; border-bottom: 1px solid var(--line-soft); }
.tts-url { width: 100%; font-family: var(--sans); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .6rem; background: var(--card); color: var(--ink); font-size: .9rem; margin-bottom: .6rem; }
.tts-url:focus { outline: none; border-color: var(--indigo); }
.tts-row { display: flex; gap: .6rem; align-items: center; }
.tts-row .voice-sel { flex: 1; max-width: none; }
.switch { width: 46px; height: 27px; border-radius: 20px; background: var(--line); border: none; position: relative; transition: background .15s; }
.switch.on { background: var(--vermilion); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on::after { left: 22px; }
.muted { color: var(--gray); } .center { text-align: center; } .mt { margin-top: 1.2rem; }

/* numbers trainer — numeral is the hero, writing revealed to check */
.nt-big { font-family: var(--sans); font-weight: 600; font-size: clamp(3rem, 15vw, 5.4rem); text-align: center;
  line-height: 1.05; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.nt-big.inkin { animation: inkin .25s ease-out both; }
.nt-writing { margin-top: 1.1rem; transition: filter .25s ease; }
.nt-writing.hidden { filter: blur(10px); }
.speak-big { width: 88px; height: 88px; border-radius: 24px; background: var(--indigo); color: #fff; border: none;
  display: grid; place-items: center; margin: .6rem auto 1.4rem; box-shadow: 0 5px 0 var(--indigo-d); }
.speak-big .ico { width: 2.1rem; height: 2.1rem; stroke-width: 1.8; }
.speak-big:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--indigo-d); }
.nt-yours { font-size: 1rem; margin: .1rem 0 .9rem; color: var(--gray); }
.nt-yours b { font-family: var(--mincho); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.nt-yours.ok b { color: var(--vermilion); } .nt-yours.no b { color: var(--sumi); }
.nt-answer-label { font-size: .72rem; color: var(--gray); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .1rem; }
.nt-markbox { position: relative; width: 104px; height: 104px; margin: .2rem auto .7rem; }
.nt-markbox .mark svg { width: 100%; max-width: 104px; }
.nt-mode button { min-width: 92px; }
.nt-numeral-annot { color: var(--gray); font-size: 1rem; margin-top: .5rem; font-variant-numeric: tabular-nums; }
.nt-opts { display: flex; flex-wrap: wrap; gap: .7rem 1.1rem; justify-content: center; margin-top: 1.6rem; font-size: .84rem; color: var(--gray);
  border-top: 1px solid var(--line); padding-top: 1.2rem; }
.nt-opts select { font-family: var(--sans); border: 1px solid var(--line); border-radius: 8px; padding: .3rem .45rem; background: var(--card); color: var(--ink); }
.nt-actions { display: flex; gap: .8rem; justify-content: center; margin-top: 1.6rem; }

/* reading-rules guide */
.nt-bar { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1rem; flex-wrap: wrap; }
.guide-btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); background: var(--card);
  color: var(--indigo); border-radius: 999px; padding: .4rem .8rem; font-size: .82rem; font-weight: 600; }
.guide-btn .ico { width: 1rem; height: 1rem; }
/* mobile: bottom sheet (good as-is) */
.guide-ov { position: fixed; inset: 0; background: rgba(27, 26, 23, .45); display: grid; place-items: end center; z-index: 200;
  padding: 0; animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.guide-card { width: 100%; max-width: var(--maxw); background: var(--paper); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; max-height: 88vh; box-shadow: 0 -8px 30px -12px rgba(0,0,0,.3); }
/* desktop: centered dialog, fully visible */
@media (min-width: 620px) {
  .guide-ov { place-items: center; padding: 1.5rem; }
  /* Fixed height so the dialog doesn't resize when switching slides. */
  .guide-card { border-radius: 18px; height: min(86vh, 640px); box-shadow: 0 20px 50px -20px rgba(0,0,0,.4); }
}
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem .6rem; }
.guide-head b { font-family: var(--mincho); font-size: 1.2rem; }
.guide-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 1.1rem 1rem; }
.guide-note { color: var(--gray); font-size: .9rem; margin-bottom: .9rem; line-height: 1.5; }
.guide-rows { display: flex; flex-direction: column; gap: .5rem; }
.g-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .2rem; border-bottom: 1px solid var(--line-soft); }
.g-n { font-family: var(--sans); font-size: .82rem; color: var(--gray); min-width: 3.3rem; font-variant-numeric: tabular-nums; }
.g-k { font-family: var(--mincho); font-size: 1.5rem; min-width: 4.5rem; }
.g-r { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.g-r span { font-family: var(--mincho); font-size: 1.05rem; }
.g-r em { color: var(--gray); font-style: normal; font-size: .9rem; }
.g-r small { color: var(--gray); font-size: .76rem; }
.g-tag { font-size: .68rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px; white-space: nowrap; }
.g-tag.change { background: var(--vermilion-soft); color: var(--vermilion); }
.g-tag.irregular { background: #efe9e0; color: var(--sumi); }
.g-tag.keep1, .g-tag.drop1 { background: var(--celadon); color: #3f7d4a; }
.g-tag.two { background: var(--indigo-soft); color: var(--indigo); }
.guide-foot { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.1rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.guide-foot .icon-btn:disabled { opacity: .3; }
.guide-dots { display: flex; gap: 5px; }
.guide-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); display: block; }
.guide-dots i.on { background: var(--vermilion); }

/* toast */
#toast { position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%) translateY(2rem); background: var(--sumi); color: var(--paper);
  padding: .7rem 1.1rem; border-radius: 10px; font-size: .9rem; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { flex: 1; display: grid; place-items: center; color: var(--gray); font-weight: 600; min-height: 60vh; }
