/* ---------- 色彩與字型 ---------- */
:root {
  --paper: #f6f2ea;
  --card: #fffdf8;
  --ink: #1f1c18;
  --muted: #6f685e;
  --line: #e6dfd2;
  --soft: #efe9de;
  --accent: #c8442f;
  --accent-ink: #ffffff;
  --accent-soft: #f6ddd6;
  --good: #2f7d58;
  --good-soft: #dcefe4;
  --bad: #c23b2b;
  --bad-soft: #f7dcd8;
  --gold: #c08a1e;
  --m0: #fffdf8;
  --m1: #f3e3bf;
  --m2: #cfe6c9;
  --m3: #8cc79a;
  --pad-bg: #fffefb;
  --pad-grid: #e3d9c8;
  --pad-guide: #e9e1d3;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 6px 20px rgba(40, 30, 20, .06);
  --radius: 18px;
  --font-ui: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-kana: "Klee One", "Noto Sans TC", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161412; --card: #201d1a; --ink: #f0ebe3; --muted: #a59d91; --line: #35302a; --soft: #2a2622;
    --accent: #e3654f; --accent-ink: #1a0f0c; --accent-soft: #3d2520;
    --good: #5cb887; --good-soft: #1d3127; --bad: #e46a5a; --bad-soft: #3a201c; --gold: #e0b04c;
    --m0: #201d1a; --m1: #4a3d22; --m2: #2c4a32; --m3: #3f7d52;
    --pad-bg: #1c1a17; --pad-grid: #3a352f; --pad-guide: #36312a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161412; --card: #201d1a; --ink: #f0ebe3; --muted: #a59d91; --line: #35302a; --soft: #2a2622;
  --accent: #e3654f; --accent-ink: #1a0f0c; --accent-soft: #3d2520;
  --good: #5cb887; --good-soft: #1d3127; --bad: #e46a5a; --bad-soft: #3a201c; --gold: #e0b04c;
  --m0: #201d1a; --m1: #4a3d22; --m2: #2c4a32; --m3: #3f7d52;
  --pad-bg: #1c1a17; --pad-grid: #3a352f; --pad-guide: #36312a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- 基本 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); line-height: 1.25; letter-spacing: .01em; }
h2 { font-size: 1.1rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 56px; height: 56px; color: var(--good); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { font-size: .8rem; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* ---------- 版面 ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav .brand, .nav-user { display: none; }
.nav-links { display: grid; grid-template-columns: repeat(6, 1fr); }
.nav-link {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px; font-size: 11px; color: var(--muted);
}
.nav-link[aria-current] { color: var(--accent); }
.main { padding: 20px 16px calc(92px + env(safe-area-inset-bottom)); }
.view { max-width: 980px; margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-kana); font-weight: 600; font-size: 1.25rem; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 1.3rem;
}
.brand.big { font-size: 1.6rem; margin-bottom: 18px; }
.brand.big .brand-mark { width: 44px; height: 44px; font-size: 1.6rem; }

@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; width: 232px;
    border-top: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 22px 14px;
  }
  .nav .brand { display: flex; padding: 0 8px; }
  .nav-links { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
  .nav-link { flex-direction: row; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 15px; }
  .nav-link:hover { background: var(--soft); color: var(--ink); }
  .nav-link[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
  .nav-user { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 10px; border-radius: 12px; }
  .nav-user:hover { background: var(--soft); }
  .nav-user b, .nav-user small { display: block; line-height: 1.3; }
  .nav-user small { color: var(--muted); font-size: .75rem; }
  .main { margin-left: 232px; padding: 40px 48px 56px; }
}

/* ---------- 元件 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: .9rem; }
.link .ic { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-weight: 500; white-space: nowrap;
  transition: transform .08s, background .15s;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: scale(.97); }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 52px; font-size: 1.05rem; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; color: var(--muted); font-size: .9rem; padding: 6px 4px;
}
.link-btn:hover { color: var(--accent); }
.link-btn .ic { width: 18px; height: 18px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.row-btns.center { justify-content: center; }
.row-btns.spread { justify-content: space-between; }

.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 14px; overflow-x: auto; scrollbar-width: none; margin: 16px 0 8px; }
.tab { flex: 1 0 auto; text-align: center; padding: 8px 14px; border-radius: 10px; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.tab[aria-selected=true] { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: var(--shadow); }

.seg { display: inline-flex; flex: none; padding: 3px; background: var(--soft); border-radius: 12px; }
.seg button { white-space: nowrap; border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-size: .9rem; }
.seg button[aria-pressed=true] { background: var(--card); color: var(--accent); font-weight: 500; box-shadow: var(--shadow); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }

select { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 12px;
  font-size: .92rem; max-width: calc(100vw - 32px); text-align: center;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { #toast { bottom: 32px; left: calc(50% + 116px); } }

/* ---------- 頁首 ---------- */
.page-head { margin-bottom: 20px; }
.page-head.row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-title { margin: 26px 0 12px; font-size: 1rem; color: var(--muted); font-weight: 500; }
.mode-tip { font-size: .9rem; }

/* ---------- 首頁 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px; }
.stat-num { display: block; font-size: 1.5rem; line-height: 1.1; }
.stat-num small { font-size: .85rem; color: var(--muted); font-weight: 400; }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none; }
.stat-icon.flame { background: var(--accent-soft); color: var(--accent); }
.stat-icon.star { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.stat-icon .ic { width: 24px; height: 24px; }
.stat-ring { width: 44px; height: 44px; flex: none; }
.ring { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--soft); }
.ring-fg { stroke: var(--good); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .4s; }
@media (max-width: 560px) {
  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .stat-num { font-size: 1.3rem; }
  .stat-icon, .stat-ring { width: 36px; height: 36px; }
}

.grid-2 { display: grid; gap: 14px; margin-bottom: 14px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.continue { display: flex; flex-direction: column; gap: 8px; transition: transform .12s; }
a.continue:hover { transform: translateY(-2px); }
.continue-kana { font-family: var(--font-kana); font-size: 3.4rem; line-height: 1.2; font-weight: 600; letter-spacing: .08em; }
.continue-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.continue-foot b, .continue-foot small { display: block; }
.continue-foot small { color: var(--muted); font-size: .85rem; }
.review { display: flex; flex-direction: column; gap: 6px; }
.review-num { font-size: 1.05rem; }
.review-num b { font-size: 2.4rem; margin-right: 4px; }
.review .row-btns { margin-top: auto; padding-top: 10px; }

.mastery-row { margin-bottom: 14px; }
.mastery-row:last-child { margin-bottom: 0; }
.mastery-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.mastery-label b { font-family: var(--font-kana); font-size: 1.05rem; }
.mastery-label small { color: var(--muted); font-size: .82rem; }
.stack-bar { display: flex; height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.stack-bar .m3 { background: var(--good); }
.stack-bar .m1 { background: var(--m1); }

.rank-mini, .rank-list { list-style: none; margin: 0; padding: 0; }
.rank-mini li, .rank-list li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 12px; }
.rank-mini li.gap { margin-top: 6px; border-top: 1px dashed var(--line); border-radius: 0 0 12px 12px; }
.pos { width: 24px; text-align: center; font-weight: 700; color: var(--muted); }
.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
li.me { background: var(--accent-soft); }
li.me .name { font-weight: 500; }
.rank-list { padding: 8px; }
.rank-list li { padding: 10px 10px; }
.rank-list li.top .pos { color: var(--gold); }

/* ---------- 學習路線 ---------- */
.lessons { display: grid; gap: 10px; }
@media (min-width: 640px) { .lessons { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .lessons { grid-template-columns: repeat(3, 1fr); } }
.lesson {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 14px 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .12s, border-color .15s;
}
.lesson:hover { transform: translateY(-2px); border-color: var(--accent); }
.lesson-kana { font-family: var(--font-kana); font-weight: 600; font-size: 1.6rem; min-width: 3.4em; }
.lesson-info b, .lesson-info small { display: block; }
.lesson-info small { color: var(--muted); font-size: .82rem; }
.lesson-state { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.lesson-state .ic { width: 18px; height: 18px; }
.lesson .bar { position: absolute; left: 16px; right: 16px; bottom: 8px; height: 4px; }
.lesson.done .lesson-state { background: var(--good-soft); color: var(--good); }
.lesson.done .bar span { background: var(--good); }
.lesson.locked { opacity: .55; }
.lesson.locked:hover { transform: none; border-color: var(--line); }
.lesson.locked .lesson-state { background: var(--soft); color: var(--muted); }

.soon { border-style: dashed; box-shadow: none; }
.soon b { color: var(--accent); }
.vocab { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vocab-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; position: relative; }
.vocab-card .ic { position: absolute; top: 14px; right: 14px; color: var(--muted); }
.vocab-card .icon-btn { position: absolute; top: 8px; right: 8px; }
.vocab-card .icon-btn .ic { position: static; }
.vocab-w { font-family: var(--font-kana); font-weight: 600; font-size: 1.7rem; }
.grammar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 10px; }
.grammar b { font-family: var(--font-kana); font-size: 1.2rem; }
.grammar .link-btn { width: 100%; font-family: var(--font-kana); font-size: 1rem; }

/* ---------- 測驗 / 練習 ---------- */
.quiz { max-width: 560px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-count { font-size: .9rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dots { flex: 1; display: flex; gap: 6px; }
.dots span { flex: 1; height: 6px; border-radius: 99px; background: var(--soft); }
.dots span.done { background: var(--good); }
.dots span.now { background: var(--accent); }

.q-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 18px; text-align: center; }
.q-prompt { color: var(--muted); font-size: .95rem; }
.q-kana { font-family: var(--font-kana); font-weight: 600; font-size: clamp(5rem, 22vw, 7.5rem); line-height: 1.1; }
.play-big {
  display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%;
  border: 0; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .1s;
}
.play-big:active { transform: scale(.94); }
.play-big .ic { width: 44px; height: 44px; }
.play-big.sm { width: 64px; height: 64px; }
.play-big.sm .ic { width: 28px; height: 28px; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.opt {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 84px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  transition: border-color .12s, background .12s, transform .08s;
}
.opt:hover { border-color: var(--muted); }
.opt:active { transform: scale(.97); }
.kana-opts .opt { font-family: var(--font-kana); font-weight: 600; font-size: 2.6rem; }
.sound-opts .opt { min-height: 64px; flex-wrap: wrap; color: var(--muted); }
.sound-opts .n { font-weight: 700; color: var(--ink); }
.sound-opts .ro { width: 100%; font-weight: 500; color: var(--ink); margin-top: -4px; }
.opt.is-picked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.opt.is-right { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.opt:disabled { cursor: default; }
.hint, .romaji { font-size: 1.1rem; font-weight: 500; color: var(--accent); }

.feedback {
  width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border-radius: 14px; text-align: left;
}
.feedback.ok { background: var(--good-soft); }
.feedback.ng { background: var(--bad-soft); }
.feedback > div > b { display: inline-flex; align-items: center; gap: 4px; }
.feedback.ok > div > b { color: var(--good); }
.feedback.ng > div > b { color: var(--bad); }
.feedback .ic { width: 20px; height: 20px; }
.answer { display: block; font-size: .92rem; margin-top: 2px; }
.kana-inline { font-family: var(--font-kana); font-weight: 600; font-size: 1.3rem; border: 0; background: none; padding: 0 2px; text-decoration: underline dotted; text-underline-offset: 4px; }

.intro-kana {
  position: relative; border: 0; background: none; padding: 0 20px;
  font-family: var(--font-kana); font-weight: 600; font-size: clamp(6rem, 28vw, 9rem); line-height: 1.1;
}
.intro-play { position: absolute; right: -14px; top: 12px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.intro-play .ic { width: 20px; height: 20px; }

.pad-wrap { width: 100%; max-width: 320px; }
.pad {
  display: block; width: 100%; aspect-ratio: 1; touch-action: none; cursor: crosshair;
  background: var(--pad-bg); border: 2px solid var(--line); border-radius: 16px;
}
.pad-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pad-score { font-size: 1rem; }
.pad-score b { font-size: 1.3rem; }

.result { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px; }
.result-score { font-size: 4.2rem; font-weight: 700; line-height: 1; color: var(--accent); }
.result-score small { font-size: 1.6rem; }
.unlock { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 500; }
.unlock .ic { width: 20px; height: 20px; }
.wrong-list { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.chip-kana {
  display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: 6px 10px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--soft);
  font-family: var(--font-kana); font-weight: 600; font-size: 1.6rem; line-height: 1.2;
}
.chip-kana small { font-family: var(--font-ui); font-weight: 400; font-size: .75rem; color: var(--muted); }
.chip-kana.ok { background: var(--good-soft); border-color: transparent; }
.chip-kana.ng { background: var(--bad-soft); border-color: transparent; }

/* ---------- 練習選單 ---------- */
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 16px; }
.scope .tabs { margin: 0; flex: 0 1 auto; }
.modes { display: grid; gap: 10px; }
@media (min-width: 760px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode { display: flex; align-items: center; gap: 14px; transition: transform .12s, border-color .15s; }
.mode:hover { transform: translateY(-2px); border-color: var(--accent); }
.mode.dim { opacity: .6; }
.mode-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); flex: none; }
.mode-text { flex: 1; }
.mode-text b, .mode-text small { display: block; }
.mode-text small { color: var(--muted); font-size: .85rem; }
.badge { font-size: .78rem; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }

/* ---------- 五十音表 ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); }
.kana-grid { display: grid; gap: 6px; }
.kana-grid.c5 { grid-template-columns: repeat(5, 1fr); }
.kana-grid.c3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 900px) { .kana-grid.c3 { grid-template-columns: repeat(6, 1fr); } }
.cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 64px; padding: 6px 2px; border-radius: 12px; border: 1px solid var(--line);
}
.cell.empty { border: 0; }
.cell-ch { font-family: var(--font-kana); font-weight: 600; font-size: 1.7rem; line-height: 1.2; }
.cell-ro { font-size: .72rem; color: var(--muted); }
.cell.locked { opacity: .45; }
.cell.pop { animation: pop .3s; }
@keyframes pop { 50% { transform: scale(1.12); } }
.m0 { background: var(--m0); }
.m1 { background: var(--m1); }
.m2 { background: var(--m2); }
.m3 { background: var(--m3); }
@media (min-width: 640px) { .cell { min-height: 76px; } .cell-ch { font-size: 2rem; } }

/* ---------- 設定 ---------- */
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile .avatar { width: 52px; height: 52px; font-size: 1.3rem; }
.profile > div { flex: 1; min-width: 0; }
.profile b, .profile small { display: block; }
.settings { padding: 4px 18px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting b, .setting small { display: block; }
.setting small { color: var(--muted); font-size: .85rem; }

/* ---------- 登入 ---------- */
.login { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; }
.login-deco { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-kana); font-weight: 600; color: var(--accent); opacity: .07; }
.login-deco span { position: absolute; line-height: 1; }
.login-deco span:nth-child(1) { font-size: 46vmin; left: -6vmin; top: -8vmin; }
.login-deco span:nth-child(2) { font-size: 36vmin; right: -4vmin; bottom: -6vmin; }
.login-deco span:nth-child(3) { font-size: 22vmin; right: 12vmin; top: 6vmin; }
.login-card { position: relative; width: 100%; max-width: 420px; padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 1.6rem; }
.login-points { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 10px; }
.login-points li { display: flex; align-items: center; gap: 10px; }
.login-points .ic { color: var(--accent); }
.note { font-size: .8rem; color: var(--muted); text-align: center; }

.splash { min-height: 100dvh; display: grid; place-items: center; }
.splash .brand-mark { width: 56px; height: 56px; font-size: 2rem; font-family: var(--font-kana); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.9); opacity: .7; } }

.field { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.field input, .inline-field input {
  min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 1.05rem;
}
.field input:focus, .inline-field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.inline-field { display: flex; gap: 8px; }
.inline-field input { min-height: 44px; width: 10em; min-width: 0; font-size: 1rem; }
@media (max-width: 560px) {
  form.setting { flex-direction: column; align-items: stretch; }
  .inline-field input { flex: 1; width: auto; }
}

.upgrade { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 14px; border-color: var(--accent); }
.upgrade > div { flex: 1 1 260px; }
.upgrade b, .upgrade small { display: block; }
.settings + .settings { margin-top: 14px; }
.rank-note { color: var(--accent); margin: 6px 0 12px; }
