/* Spokka — look A「駅サイン」 is the base; B and C override tokens + a few rules. */
:root, [data-theme="A"] {
  --bg: #F2F1EC; --surface: #FFFFFF; --ink: #141414; --sub: #55534C; --mute: #8A887F; --line: #E2E0D8; --rule: #141414;
  --ok: #00995C; --ok-ink: #00764A; --come: #FF5B14; --come-ink: #C73E00; --come-soft: #FFE6DA;
  --primary: #141414; --primary-ink: #FFFFFF; --go: #00995C; --go-ink: #FFFFFF;
  --radius: 6px; --radius-l: 8px; --rule-w: 4px; --tile: 4px;
  --f-ja: "Noto Sans JP", system-ui, sans-serif; --f-zh: "Noto Sans SC", "Noto Sans JP", sans-serif; --f-num: "Inter", "Noto Sans JP", sans-serif;
  --w-head: 900; --w-num: 800;
}
[data-theme="B"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --ink: #0B0B0B; --sub: #6B6B6B; --mute: #8E8E8E; --line: #E5E5E5; --rule: #E5E5E5;
  --ok: #2440FF; --ok-ink: #1A2FCC; --come: #2440FF; --come-ink: #1A2FCC; --come-soft: #E9ECFF;
  --primary: #0B0B0B; --primary-ink: #fff; --go: #0B0B0B; --go-ink: #fff;
  --radius: 28px; --radius-l: 14px; --rule-w: 1px; --tile: 50%;
  --w-head: 500; --w-num: 300;
}
[data-theme="C"] {
  --bg: #F3F6F5; --surface: #FFFFFF; --ink: #0F1B2D; --sub: #5A6676; --mute: #7D8794; --line: #E3E8E6; --rule: #E3E8E6;
  --ok: #0B6E5F; --ok-ink: #0B6E5F; --come: #E09A00; --come-ink: #8A5A00; --come-soft: #FFF1CC;
  --primary: #0B6E5F; --primary-ink: #fff; --go: #0B6E5F; --go-ink: #fff;
  --radius: 16px; --radius-l: 18px; --rule-w: 0px; --tile: 12px;
  --w-head: 700; --w-num: 800;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--f-ja); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
:lang(ja), :lang(zh-Hans) { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
.zh, [lang="zh-Hans"] { font-family: var(--f-zh); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num { font-family: var(--f-num); font-weight: var(--w-num); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--come); outline-offset: 2px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding: max(16px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); min-height: 100dvh; }
.screen.tabbed { padding-bottom: 0; }
.grow { flex: 1; }
.push { margin-top: auto; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sub { color: var(--sub); }
.small { font-size: 12px; }
.lbl { font-size: 11px; font-weight: 900; letter-spacing: .08em; color: var(--sub); }
[data-theme="B"] .lbl { font-weight: 500; letter-spacing: 0; }

/* buttons */
.btn { min-height: 56px; border: 0; border-radius: var(--radius); padding: 0 20px; font-size: 17px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; text-decoration: none; transition: transform .08s; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.go { background: var(--go); color: var(--go-ink); justify-content: space-between; min-height: 60px; font-size: 18px; }
.btn.line { background: transparent; border: 3px solid var(--ink); color: var(--ink); }
[data-theme="B"] .btn { font-weight: 500; } [data-theme="B"] .btn.line { border-width: 1px; } [data-theme="B"] .btn.go { justify-content: center; }
[data-theme="C"] .btn { font-weight: 700; } [data-theme="C"] .btn.line { border: 0; background: var(--surface); }
.btn.text { background: none; min-height: 44px; font-size: 13px; font-weight: 500; color: var(--sub); }
.btn[disabled] { opacity: .45; }
.btns { display: flex; gap: 8px; }
.btns .btn { font-size: 15px; }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 22px; }
.icon-btn svg { width: 22px; height: 22px; }

/* top bar in lesson */
.lbar { height: 52px; display: flex; align-items: center; gap: 10px; margin: -8px -6px 0; }
.segs { flex: 1; display: grid; gap: 3px; }
.seg { height: 6px; border-radius: 2px; background: var(--line); }
.seg.done { background: var(--ink); } .seg.done.r { background: var(--come); }
.seg.cur { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.lcount { font-size: 12px; width: 34px; text-align: right; color: var(--sub); }

/* home */
.home-top { display: flex; justify-content: space-between; align-items: center; margin: -6px -6px 0 0; }
.brand { font-size: 18px; font-weight: 900; letter-spacing: -.01em; }
.streak { margin-top: 14px; border-top: var(--rule-w) solid var(--rule); padding-top: 12px; display: flex; align-items: flex-end; gap: 8px; }
.streak .big { font-size: 76px; line-height: .9; }
.streak .unit { font-size: 16px; font-weight: 900; padding-bottom: 6px; }
.streak .freeze { margin-left: auto; text-align: right; padding-bottom: 4px; font-size: 11px; font-weight: 700; }
.streak .freeze .num { font-size: 22px; display: block; line-height: 1.1; }
.week { margin-top: 12px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.week div { text-align: center; font-size: 10px; color: var(--sub); }
.week i { display: block; height: 10px; margin-top: 3px; background: var(--line); border-radius: 1px; }
.week .d i { background: var(--ink); } .week .f i { background: #B9B7AE; } .week .t i { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); } .week .t.d i { background: var(--ink); }
.week .t { color: var(--ink); font-weight: 700; }
.sect { margin-top: 22px; font-size: 13px; font-weight: 900; letter-spacing: .06em; }
.plan { margin-top: 8px; background: var(--surface); border-radius: var(--radius-l); overflow: hidden; }
.plan .it { display: flex; align-items: center; gap: 14px; padding: 13px 14px; }
.plan .it + .it { border-top: 1.5px solid var(--line); }
.tile { width: 52px; height: 52px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 30px; border-radius: var(--tile); background: var(--ink); color: #fff; }
.tile.come { background: var(--come); } .tile.out { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 3px var(--ink); }
.tile.zero { background: var(--line); color: var(--mute); }
.plan .t1 { font-size: 16px; font-weight: 900; } .plan .t2 { font-size: 12px; color: var(--sub); margin-top: 1px; }
.home-done { margin-top: 8px; background: var(--surface); border-radius: var(--radius-l); padding: 18px 16px; }
.nb-link { margin-top: auto; border-top: var(--rule-w) solid var(--rule); padding: 12px 0 4px; display: flex; gap: 18px; align-items: center; font-size: 12px; font-weight: 700; text-decoration: none; min-height: 48px; }
.nb-link .num { font-size: 16px; }
.tabs { position: sticky; bottom: 0; margin: 14px -18px 0; background: var(--bg); border-top: 1.5px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; padding-bottom: env(safe-area-inset-bottom); }
.tabs a { height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; text-decoration: none; color: var(--mute); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs svg { width: 22px; height: 22px; }
[data-theme="B"] .streak { border-top-width: 1px; }
[data-theme="B"] .streak .big { font-size: 64px; font-weight: 300; }
[data-theme="B"] .tile { background: none; color: var(--ink); font-weight: 300; width: 36px; font-size: 26px; }
[data-theme="B"] .tile.come { color: var(--come); font-weight: 500; } [data-theme="B"] .tile.out { box-shadow: none; }
[data-theme="B"] .plan .t1 { font-weight: 500; }
[data-theme="B"] .plan { border-top: 1px solid var(--line); border-radius: 0; } [data-theme="B"] .plan .it { padding: 12px 0; border-bottom: 1px solid var(--line); } [data-theme="B"] .plan .it + .it { border-top: 0; }
[data-theme="C"] .home-hero { background: var(--primary); color: #fff; margin: -16px -18px 0; padding: max(18px, env(safe-area-inset-top)) 18px 22px; border-radius: 0 0 22px 22px; }
[data-theme="C"] .home-hero .streak { border: 0; }
[data-theme="C"] .home-hero .week i { background: rgba(255,255,255,.25); } [data-theme="C"] .home-hero .week .d i { background: #fff; } [data-theme="C"] .home-hero .week .t i { box-shadow: inset 0 0 0 2px #fff; } [data-theme="C"] .home-hero .week div { color: rgba(255,255,255,.8); }
[data-theme="C"] .home-hero .icon-btn { color: #fff; }
[data-theme="C"] .tile { color: var(--ink); background: #EEF2F1; } [data-theme="C"] .tile.come { background: #FFC233; } [data-theme="C"] .tile.out { box-shadow: none; }

/* prompt */
.tagrow { margin-top: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 900; padding: 3px 8px; border-radius: 3px; box-shadow: inset 0 0 0 2px var(--ink); display: inline-flex; align-items: center; gap: 4px; }
.tag.come { background: var(--come); color: #fff; box-shadow: none; }
[data-theme="B"] .tag { box-shadow: none; padding: 0; font-weight: 500; color: var(--sub); } [data-theme="B"] .tag.come { background: none; color: var(--come); }
.ask { margin-top: 14px; font-size: 13px; color: var(--sub); }
.say-ja { margin-top: 4px; font-size: 28px; font-weight: 700; line-height: 1.45; }
.hint-btn { align-self: flex-start; margin-top: 24px; height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px dashed var(--mute); background: transparent; font-size: 13px; color: var(--sub); display: inline-flex; align-items: center; gap: 6px; }
.hints { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.hint { background: var(--surface); border-radius: var(--radius); padding: 8px 12px; }
.hint .zh { font-size: 18px; } .hint .py { font-size: 11px; color: var(--sub); }
.talk { margin-top: auto; padding-top: 16px; display: flex; align-items: flex-end; justify-content: space-between; }
.side { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; font-size: 11px; color: var(--sub); padding: 0; }
.side span:first-child { width: 52px; height: 52px; border-radius: 26px; box-shadow: inset 0 0 0 1.5px var(--mute); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--ink); }
.side svg { width: 22px; height: 22px; }
.mic { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; font-size: 13px; font-weight: 700; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mic .ball { width: 96px; height: 96px; border-radius: 48px; background: var(--ink); display: flex; align-items: center; justify-content: center; transition: transform .12s, box-shadow .12s; }
.mic .ball svg { width: 36px; height: 36px; }
.mic.rec .ball { transform: scale(1.18); background: var(--come); box-shadow: 0 0 0 calc(10px + var(--lvl, 0) * 18px) var(--come-soft); }
.mic.cancel .ball { background: var(--mute); }
[data-theme="C"] .mic .ball { background: var(--primary); }
.typebox { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.typebox textarea { width: 100%; min-height: 88px; border: 2px solid var(--ink); border-radius: var(--radius-l); padding: 12px; font-family: var(--f-zh); font-size: 20px; line-height: 1.5; resize: none; background: var(--surface); }
[data-theme="B"] .typebox textarea { border-width: 1px; }
.recinfo { text-align: center; font-size: 13px; color: var(--sub); min-height: 40px; margin-top: 10px; }
.wave { height: 40px; display: flex; align-items: center; justify-content: center; gap: 3px; margin-top: 8px; }
.wave i { width: 4px; border-radius: 2px; background: var(--ink); height: 6px; transition: height .08s; }

/* checking */
.checking { margin-top: 26px; }
.checking .zh { font-size: 22px; line-height: 1.6; color: var(--sub); }
.dots { display: inline-flex; gap: 5px; margin-top: 18px; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--ink); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* result */
.verdict { margin: 0 -18px; padding: 16px 18px 14px; }
.verdict.come { background: var(--come); color: #fff; }
.verdict.ok { background: var(--ok); color: #fff; }
.verdict .v1 { font-size: 30px; font-weight: 900; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.verdict .v2 { font-size: 13px; margin-top: 2px; }
.verdict .meta { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; opacity: .95; margin-bottom: 6px; }
[data-theme="B"] .verdict.come, [data-theme="B"] .verdict.ok { background: none; color: var(--ink); } [data-theme="B"] .verdict .v1 { font-weight: 500; } [data-theme="B"] .verdict.come .v1 { color: var(--come); }
[data-theme="C"] .verdict { margin: 0; border-radius: var(--radius-l); margin-top: 6px; } [data-theme="C"] .verdict.come { background: #FFC233; color: var(--ink); }
.qline { margin-top: 12px; font-size: 12px; color: var(--sub); }
.you { margin-top: 12px; }
.you .zh { font-size: 22px; line-height: 1.7; margin-top: 2px; }
.ins { box-shadow: inset 0 0 0 3px var(--come); color: var(--come-ink); font-weight: 900; padding: 0 3px; margin: 0 1px; border-radius: 2px; }
.del { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--come); color: var(--mute); }
[data-theme="B"] .ins { box-shadow: none; border-bottom: 2px solid var(--come); font-weight: 500; }
[data-theme="C"] .ins { box-shadow: none; background: var(--come-soft); }
.fixlink { display: inline-flex; align-items: center; min-height: 36px; font-size: 12px; color: var(--sub); background: none; border: 0; padding: 0; text-decoration: underline; }
.card { margin-top: 12px; background: var(--surface); border-radius: var(--radius-l); padding: 14px; }
.card .lab { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 900; letter-spacing: .08em; color: var(--ok-ink); }
.card .zh.main { font-size: 21px; font-weight: 900; line-height: 1.5; margin-top: 4px; }
[data-theme="B"] .card .zh.main { font-size: 32px; font-weight: 500; line-height: 1.35; }
[data-theme="B"] .card { padding: 14px 0; } [data-theme="B"] .card .lab { font-weight: 500; color: var(--sub); letter-spacing: 0; }
[data-theme="C"] .card.ok { background: var(--primary); color: #fff; } [data-theme="C"] .card.ok .lab, [data-theme="C"] .card.ok .py { color: rgba(255,255,255,.85); }
.py { font-size: 12px; color: var(--sub); margin-top: 2px; }
.play { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 2px solid var(--ink); background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 0; }
.play svg { width: 16px; height: 16px; }
.play.on { background: var(--ink); } .play.on svg { fill: #fff; }
[data-theme="C"] .card.ok .play { border-color: #fff; background: transparent; } [data-theme="C"] .card.ok .play svg { fill: #fff; }
.why { margin-top: 14px; font-size: 14px; line-height: 1.75; }
.why b { font-weight: 900; }
.pt { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--sub); color: var(--sub); }
.native { margin-top: 14px; }
.native .zh { font-size: 16px; line-height: 1.6; margin-top: 2px; }
.comeback { margin-top: auto; padding-top: 12px; border-top: var(--rule-w) solid var(--rule); display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.comeback .tile { width: 28px; height: 28px; font-size: 14px; }
.comeback + .btns { margin-top: 12px; }
.compare .zh.past { font-size: 16px; line-height: 1.6; color: var(--mute); }
.retire { margin-top: 18px; border: 3px solid var(--ink); border-radius: var(--radius-l); padding: 14px 16px; background: var(--surface); }
.pips { display: flex; gap: 5px; } .pips i { width: 14px; height: 14px; border-radius: 7px; box-shadow: inset 0 0 0 2px var(--ink); } .pips i.on { background: var(--ink); }
.redo { margin-top: 12px; background: var(--surface); border-radius: var(--radius-l); padding: 12px 14px; font-size: 13px; }
.redo.ok { box-shadow: inset 0 0 0 2px var(--ok); } .redo.ng { box-shadow: inset 0 0 0 2px var(--come); }

/* free */
.free-ta { margin-top: 6px; width: 100%; min-height: 110px; border: 2px solid var(--ink); border-radius: var(--radius-l); padding: 12px; font-size: 16px; line-height: 1.6; resize: none; background: var(--surface); }
.chips { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }

/* done */
.done-h { margin-top: 40px; font-size: 28px; font-weight: 900; line-height: 1.35; }
.stats3 { margin-top: 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: var(--rule-w) solid var(--rule); border-bottom: 1.5px solid var(--line); }
.stats3 > div { padding: 14px 0; } .stats3 > div + div { padding-left: 12px; border-left: 1.5px solid var(--line); }
.stats3 .num { font-size: 32px; display: block; line-height: 1.1; }
.sched div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1.5px solid var(--line); font-size: 14px; }

/* notebook */
.seg3 { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.seg3 button { min-height: 44px; border: 0; background: var(--surface); font-size: 13px; }
.seg3 button + button { border-left: 2px solid var(--ink); }
.seg3 button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.nlist a { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1.5px solid var(--line); text-decoration: none; min-height: 60px; }
.nlist .t1 { font-size: 15px; font-weight: 700; } .nlist .t2 { font-size: 13px; color: var(--sub); margin-top: 1px; }
.nlist .when { font-size: 11px; color: var(--sub); white-space: nowrap; }
.dotpair { display: flex; gap: 4px; } .dotpair i { width: 10px; height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--ink); } .dotpair i.on { background: var(--ink); }
.empty { margin-top: 30px; text-align: center; color: var(--sub); font-size: 13px; line-height: 1.8; }
.hist { display: grid; grid-template-columns: 46px 20px 1fr; gap: 8px; padding: 12px 0; border-bottom: 1.5px solid var(--line); }
.examples { margin-top: 10px; background: var(--surface); border-radius: var(--radius-l); padding: 12px 14px; font-size: 16px; line-height: 1.8; }

/* onboarding + settings */
.ob-h { margin-top: 18px; font-size: 24px; font-weight: 900; line-height: 1.4; }
.opt { display: block; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius-l); padding: 14px 16px; margin-top: 10px; }
.opt[aria-pressed="true"] { border: 3px solid var(--ink); padding: 12.5px 14.5px; }
.opt .t1 { font-size: 16px; font-weight: 700; } .opt .t2 { font-size: 12px; color: var(--sub); margin-top: 2px; }
.hero-h { margin-top: 64px; font-size: 32px; font-weight: 900; line-height: 1.35; }
.example { margin-top: 36px; border: 1.5px dashed var(--mute); border-radius: var(--radius-l); padding: 16px; font-size: 13px; color: var(--sub); line-height: 1.7; }
.example .zh { font-size: 17px; color: var(--ink); }
.field { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: var(--radius-l); padding: 0 16px; min-height: 56px; }
.field input[type="time"] { border: 0; background: none; font-family: var(--f-num); font-size: 22px; font-weight: 700; }
.setrow { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1.5px solid var(--line); min-height: 56px; gap: 10px; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.themes button { min-height: 64px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); font-size: 12px; padding: 6px; }
.themes button[aria-pressed="true"] { border: 3px solid var(--ink); }
.sw { display: flex; gap: 3px; justify-content: center; margin-bottom: 4px; } .sw i { width: 14px; height: 14px; border-radius: 3px; }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 86vw; text-align: center; z-index: 9; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.fade { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade, .dots i { animation: none; } }
