:root {
  --bg:#f2f5ff; --surface:#fff; --text:#24304b; --muted:#606c85; --primary:#4260d5; --soft:#eaf0ff; --border:#dce3f1; --green:#167446; --green-bg:#e4f6ea; --red:#ae3245; --red-bg:#ffe9ed;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#141c2c; --surface:#202b40; --text:#eef2ff; --muted:#b1bed6; --primary:#a7b8ff; --soft:#303e60; --border:#3c4964; --green:#92e3b2; --green-bg:#203e32; --red:#ffabb8; --red-bg:#482b38; }
}
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font-size:14px; line-height:1.65; }
#app { max-width:420px; min-height:100dvh; margin:auto; }
button, input { font:inherit; }
button { cursor:pointer; color:inherit; }
button, input { border:1px solid var(--border); border-radius:14px; background:var(--surface); }
button { min-height:44px; padding:10px 14px; }
button:hover { border-color:var(--primary); }
:focus-visible { outline:3px solid var(--primary); outline-offset:3px; }
header { position:sticky; top:0; z-index:2; display:flex; align-items:center; gap:12px; padding:14px 20px; background:var(--surface); border-bottom:1px solid var(--border); }
header h1 { font-size:18px; margin:0; flex:1; }
.icon { padding:8px; min-width:44px; }
.icon[data-speak] { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; flex-shrink:0; border-radius:50%; color:var(--primary); border:1px solid var(--border); background:var(--surface); }
.brand { color:var(--primary); font-size:24px; }
main { padding:20px 20px 112px; }
h2 { font-size:21px; line-height:1.5; margin:8px 0 12px; }
h3 { font-size:15px; margin:0 0 12px; }
p { margin:6px 0; }
.muted, small { color:var(--muted); }
.eyebrow { font-size:11px; letter-spacing:.12em; color:var(--primary); font-weight:700; }
.banner { border-radius:10px; padding:8px 12px; color:var(--primary); background:var(--soft); font-size:12px; text-align:center; margin-bottom:24px; }
.card { background:var(--surface); border:1px solid var(--border); border-radius:20px; padding:20px; margin:16px 0; }
.actions { display:grid; gap:10px; margin-top:20px; }
.primary { background:var(--primary); color:var(--surface); border-color:transparent; font-weight:700; }
.secondary { background:var(--soft); color:var(--primary); border-color:transparent; font-weight:700; }
.section-title { display:flex; align-items:baseline; justify-content:space-between; margin:28px 0 12px; }
.section-title h2 { font-size:16px; margin:0; }
.level { display:block; width:100%; text-align:left; padding:16px; margin:10px 0; border-radius:18px; }
.line { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.level strong { font-size:15px; }
.level small { display:block; margin-top:8px; }
progress { display:block; width:100%; height:6px; margin-top:12px; border:0; border-radius:9px; overflow:hidden; background:var(--soft); accent-color:var(--primary); }
progress::-webkit-progress-bar { background:var(--soft); }
progress::-webkit-progress-value { background:var(--primary); }
progress::-moz-progress-bar { background:var(--primary); }
input[type=search] { width:100%; padding:12px 14px; color:var(--text); margin:16px 0 8px; }
.word-row { display:flex; width:100%; align-items:center; justify-content:space-between; text-align:left; gap:8px; margin:10px 0; padding:16px; }
.word-row strong { display:block; font-size:19px; overflow-wrap:anywhere; }
.word-row small { display:block; margin-top:3px; }
.chip { display:inline-block; flex-shrink:0; border-radius:8px; background:var(--soft); color:var(--muted); padding:4px 8px; font-size:11px; }
.learning { color:var(--primary); }
.learned { color:var(--green); background:var(--green-bg); }
.bottom { position:fixed; bottom:0; left:50%; transform:translateX(-50%); width:min(100%,420px); padding:12px 20px calc(12px + env(safe-area-inset-bottom)); background:var(--surface); border-top:1px solid var(--border); }
.bottom button { width:100%; }
.word-title { font-size:34px; letter-spacing:-.04em; margin:8px 0; overflow-wrap:anywhere; min-width:0; }
ol { padding-left:24px; margin-bottom:0; }
li { padding:4px 0; }
.example { display:block; width:100%; text-align:left; border:0; padding:0; background:none; }
.example span { display:block; }
.example { display:flex; align-items:center; gap:10px; }
.example-play { flex-shrink:0; display:inline-flex !important; align-items:center; justify-content:center; width:44px; height:44px; border-radius:50%; color:var(--primary); border:1px solid var(--border); background:var(--surface); }
.example-text { flex:1; min-width:0; }
.example-line { display:flex; align-items:center; justify-content:flex-start; gap:8px; }
.example-line p { margin:0; }
.example .english { font-size:17px; margin-bottom:10px; }
.related { display:flex; flex-wrap:wrap; gap:8px; }
.related button { background:var(--soft); color:var(--primary); }
.related small { display:block; font-size:11px; }
dialog { width:calc(100% - 24px); max-width:396px; max-height:85dvh; overflow:auto; margin:auto auto 12px; padding:22px; border:1px solid var(--border); border-radius:24px; background:var(--surface); color:var(--text); }
dialog::backdrop { background:#111a36a6; }
dialog h2 { font-size:20px; margin:0; }
.segment { display:flex; gap:6px; margin:12px 0 24px; }
.segment button { flex:1; }
.segment [aria-pressed=true] { background:var(--primary); color:var(--surface); }
.setting { margin-top:24px; }
.toggle { width:22px; height:22px; accent-color:var(--primary); }
.mode { width:100%; text-align:left; margin-top:10px; }
#toast { position:fixed; bottom:100px; left:50%; transform:translateX(-50%); max-width:calc(100% - 32px); width:max-content; padding:12px 18px; background:var(--text); color:var(--bg); border-radius:14px; z-index:5; pointer-events:none; opacity:0; }
#toast.visible { opacity:1; }
button:disabled { cursor:default; opacity:.65; }
.correct { color:var(--green); background:var(--green-bg); border-color:var(--green); }
.wrong { color:var(--red); background:var(--red-bg); border-color:var(--red); }
button.correct:disabled, button.wrong:disabled { opacity:1; }
.study-card { min-height:280px; }
.actions .line > button { flex:1; }
#spelling-input { width:100%; padding:12px 14px; color:var(--text); }
.spelling-diff { display:flex; flex-wrap:wrap; gap:4px; font-size:24px; }
.spelling-diff span { padding:2px 6px; border-radius:6px; white-space:pre; }
.step small { display:block; margin-top:4px; }
.step .line small { margin:0; }
#storage-warning { padding:10px 16px; background:var(--red-bg); color:var(--red); font-size:12px; text-align:center; }
label { display:block; margin:14px 0 4px; font-size:13px; color:var(--muted); }
input[type=text], textarea { width:100%; padding:12px 14px; color:var(--text); border:1px solid var(--border); border-radius:14px; background:var(--surface); font:inherit; }
textarea { min-height:72px; resize:vertical; }
.form-error { color:var(--red); margin-top:12px; }
.danger { color:var(--red); }
.hidden-file { display:none; }
.word-actions { display:flex; gap:10px; margin-top:16px; }
.word-actions > * { flex:1; }
img, svg { max-width:100%; }

.key-hint{display:none;text-align:center;color:var(--muted,#667);font-size:.8rem;margin:.25rem 0 0}
@media (hover:hover) and (pointer:fine){.key-hint{display:block}}
