.sc-workspace { --sc-ink: #263b36; --sc-muted: #64736c; --sc-accent: #326a57; color: var(--sc-ink); align-content:start; grid-auto-rows:max-content; }
.ui-v2.study-route .sentence-space.sc-workspace { height:auto; min-height:100dvh; overflow:visible; padding-bottom:24px; }
.ui-v2.study-route .workspace:has(.sc-workspace) { height:auto; min-height:100dvh; overflow:visible; }
.sc-course-back { display:inline-flex; align-items:center; align-self:start; gap:8px; justify-self:start; color:#263b36; background:#fffdf8; border:1px solid #dedfd3; border-radius:12px; padding:10px 16px; }
.sc-home-header { display:flex; justify-content:space-between; align-items:center; gap:24px; padding:12px 0 24px; }
.sc-workspace h2 { font-size:clamp(23px, 3vw, 32px); line-height:1.4; margin:8px 0 12px; color:var(--sc-ink); }
.sc-workspace h3 { line-height:1.6; color:var(--sc-ink); }
.sc-workspace p { line-height:1.8; }
.sc-eyebrow { font-size:13px; font-weight:700; letter-spacing:.04em; color:var(--sc-accent); }
.sc-lesson { width:100%; box-sizing:border-box; max-width:900px; margin:16px auto; background:#fffdf8; border:1px solid #dedfd3; border-radius:22px; padding:clamp(18px, 3vw, 36px); box-shadow:0 12px 40px #233d3210; }
.sc-lesson header { margin-bottom:24px; }
.sc-stage-list { list-style:none; padding:0; display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin:0 0 28px; }
.sc-stage-list li { display:flex; align-items:center; gap:7px; color:#626c65; font-size:13px; padding:10px 4px; border-bottom:3px solid #e5e7dc; }
.sc-stage-list li span { background:#eff0e8; width:23px; height:23px; border-radius:50%; display:grid; place-items:center; flex-shrink:0; }
.sc-stage-list li[aria-current="step"] { border-color:var(--sc-accent); color:var(--sc-accent); font-weight:700; }
.sc-stage-list li.done { border-color:#a0baa8; }
.sc-prompt { background:#eef2e8; border-radius:16px; padding:20px 24px; margin:20px 0; white-space:pre-line; }
.sc-prompt h3 { margin:8px 0; font-size:24px; }
.sc-prompt p { margin:8px 0; }
.sc-dialogue { border-left:3px solid #acbda4; padding-left:14px; }
.sc-dialogue strong,.sc-dialogue small { display:block; }
.sc-model { text-align:center; margin:30px 0; }
.sc-model strong { display:block; font-size:clamp(23px,3vw,32px); line-height:1.7; }
.sc-model span { display:block; color:var(--sc-muted); margin-top:6px; }
.sc-chunks { display:flex; flex-wrap:wrap; gap:10px; margin:20px 0; }
.sc-chunks>div { flex:1 1 145px; border:1px solid #dedfd3; border-radius:12px; padding:15px; background:#fff; }
.sc-chunks strong { display:block; color:var(--sc-accent); font-size:21px; margin-bottom:8px; }
.sc-chunks span { font-size:14px; line-height:1.7; }
.sc-note { color:var(--sc-muted); font-size:14px; }
.sc-workspace .sc-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:10px; margin:16px 0; }
.sc-lesson>button,.sc-lesson form>button,.sc-feedback>button { display:flex; align-items:center; justify-content:center; width:fit-content; max-width:100%; margin-inline:auto; }
.sc-workspace button { min-height:42px; }
.sc-workspace .sc-actions>button:not(.primary),.sc-choice-grid button { padding:11px 18px; border:1px solid #cbd5cb; border-radius:11px; background:#fffdf8; color:var(--sc-ink); }
.sc-workspace .sc-actions>button:not(.primary):not(:disabled):hover,.sc-choice-grid button:not(:disabled):hover { border-color:var(--sc-accent); background:#edf4ec; }
.sc-workspace .sc-actions>button[aria-pressed="true"] { background:var(--sc-accent); color:#fff; }
.sc-lesson button,.sc-library button,.sc-course-list button { white-space:normal; }
.sc-workspace textarea,.sc-workspace input:not([type="checkbox"]) { display:block; width:100%; box-sizing:border-box; color:var(--sc-ink); background:#fff; border:1px solid #b5c1b8; border-radius:12px; padding:14px; font:inherit; margin:10px 0 16px; }
.sc-workspace textarea { font-size:20px; line-height:1.7; resize:vertical; }
.sc-workspace label { font-size:14px; font-weight:600; }
.sc-workspace button:focus-visible,.sc-workspace summary:focus-visible,.sc-workspace textarea:focus-visible,.sc-workspace input:focus-visible { outline:3px solid #759e81; outline-offset:3px; }
.sc-workspace button[aria-pressed="true"] { background:var(--sc-accent); color:#fff; }
.sc-token-answer { min-height:84px; border:2px dashed #b7c5b5; padding:15px; border-radius:14px; display:flex; justify-content:center; flex-wrap:wrap; align-items:center; gap:8px; }
.sc-token-pool { display:flex; justify-content:center; flex-wrap:wrap; gap:9px; padding:20px 0; }
.sc-token-answer button,.sc-token-pool button { font-size:20px; padding:10px 16px; border:1px solid #cbd7ce; border-radius:12px; background:#fff; color:var(--sc-ink); box-shadow:0 3px 0 #dfe6df; }
.sc-token-answer button { background:#e9f2e9; border-color:#93b49b; }
.sc-token-pool button:disabled { opacity:.4; box-shadow:none; }
.sc-token-pool button:not(:disabled):hover,.sc-token-answer button:not(:disabled):hover { background:#edf4ec; border-color:var(--sc-accent); }
.sc-choice-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.sc-choice-grid button { padding:16px; text-align:center; }
.sc-word-bank { padding:16px; background:#f5f0e3; border-radius:12px; margin-bottom:20px; }
.sc-word-bank>div { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.sc-word-bank span { background:#fffdf8; padding:5px 12px; border-radius:8px; }
.sc-hints,.sc-feedback { border-radius:14px; padding:18px 22px; margin:18px 0; background:#f5eedf; white-space:pre-line; }
.sc-feedback { border:2px solid #d4ac57; background:#fff6df; color:#634818; }
.sc-feedback.correct { background:#e9f6eb; border-color:#4a9763; color:#205633; }
.sc-feedback.wrong { background:#fff0ed; border-color:#d77768; color:#943d32; }
.sc-feedback-heading { display:flex; justify-content:center; align-items:center; gap:12px; }
.sc-feedback-heading strong { font-size:20px; line-height:1.5; }
.sc-feedback-icon { display:grid; place-items:center; width:42px; height:42px; flex-shrink:0; border-radius:50%; color:#fff; background:#987125; }
.sc-feedback.correct .sc-feedback-icon { background:#328050; }
.sc-feedback.wrong .sc-feedback-icon { background:#bd5143; }
.sc-feedback p { text-align:center; overflow-wrap:anywhere; }
.sc-reference,.sc-form-guide { border:1px solid #d7decf; border-radius:12px; margin:18px 0; padding:14px 18px; }
.sc-workspace summary { cursor:pointer; line-height:1.7; }
.sc-reference summary,.sc-form-guide summary { text-align:center; list-style-position:inside; }
.sc-verb-table { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:16px; }
.sc-verb-table>div { padding:14px; background:#f2f4ec; border-radius:10px; }
.sc-verb-table strong,.sc-verb-table small { display:block; line-height:1.8; }
.sc-verb-table p { font-size:14px; margin-bottom:0; }
.sc-skip { background:transparent; border:0; color:var(--sc-muted); margin-top:10px; }
.sc-ai-setting { border:1px solid #d6dfd2; background:#f6f6ee; padding:18px 22px; border-radius:14px; margin:24px 0; }
.sc-ai-setting label { display:flex; align-items:center; gap:10px; }
.sc-ai-setting input { width:18px; height:18px; accent-color:var(--sc-accent); }
.sc-ai-setting p { margin:8px 0 0; color:var(--sc-muted); }
.sc-tutor { margin-top:28px; padding-top:18px; border-top:1px solid #dfe0d5; }
.sc-workspace .sc-help-toggle { display:flex; align-items:center; justify-content:center; gap:12px; max-width:100%; margin:0 auto; padding:12px 18px 12px 12px; border:1px solid #c9bfdf; border-radius:20px; background:linear-gradient(120deg,#f4efff,#fffaf3); color:#51416e; box-shadow:0 4px 16px #68518a14,inset 0 1px 0 #fff; transition:box-shadow .18s,border-color .18s; }
.sc-workspace .sc-help-toggle:hover,.sc-workspace .sc-help-toggle[aria-expanded="true"] { border-color:#9a82be; box-shadow:0 6px 20px #68518a26; }
.sc-help-icon { width:44px; height:44px; flex-shrink:0; display:grid; place-items:center; border-radius:14px; background:linear-gradient(145deg,#8870ac,#635080); color:#fff; box-shadow:inset 0 1px 0 #ffffff40; }
.sc-help-label { text-align:left; }
.sc-help-label strong { display:block; font-size:16px; letter-spacing:.02em; }
.sc-help-label small { display:block; margin-top:4px; font-size:12px; color:#786887; font-weight:400; }
.sc-help-badge { padding:3px 7px; border:1px solid #ded5e9; border-radius:20px; font-size:11px; color:#786887; }
.sc-help-chevron { flex-shrink:0; }
.sc-help-toggle[aria-expanded="true"] .sc-help-chevron { transform:rotate(180deg); }
.sc-tutor-body { margin-top:16px; }
.sc-tutor-body>p { font-size:13px; color:var(--sc-muted); }
.sc-chat p { white-space:pre-wrap; background:#eef1e9; padding:14px; border-radius:12px; overflow-wrap:anywhere; }
.sc-chat p.user { background:#f3eee4; margin-left:24px; }
.sc-chat small { display:block; color:var(--sc-accent); font-weight:700; }
.sc-tutor textarea { font-size:16px; }
.sc-course-list { margin:30px 0; }
.sc-course-list header { display:flex; justify-content:space-between; flex-wrap:wrap; align-items:center; gap:10px; }
.sc-course-list>button { display:flex; width:100%; align-items:center; justify-content:space-between; padding:18px 22px; margin:10px 0; border:1px solid #dedfd3; background:#fffdf8; color:var(--sc-ink); border-radius:14px; text-align:left; gap:16px; }
.sc-course-list strong,.sc-course-list small { display:block; line-height:1.8; }
.sc-course-list small { color:var(--sc-muted); }
.sc-library details { background:#fffdf8; border:1px solid #dedfd3; padding:18px; border-radius:14px; margin:14px 0; }
.sc-library summary span { margin-left:20px; color:var(--sc-muted); }
.sc-library audio { display:block; width:min(100%,400px); }
.sc-skill-summary,.sc-result>div { display:flex; gap:8px; flex-wrap:wrap; margin:14px 0; }
.sc-result { border-bottom:1px solid #dedfd3; margin:18px 0; }
.sc-skill-summary span,.sc-result span { border-radius:8px; padding:6px 10px; background:#edf1e5; font-size:13px; }
@media(max-width:600px) {
  .sc-stage-list { gap:4px; }
  .sc-stage-list li { flex-direction:column; font-size:11px; text-align:center; }
  .sc-prompt { padding:16px; }
  .sc-verb-table,.sc-choice-grid { grid-template-columns:1fr; }
  .sc-lesson { padding:18px 14px; border-radius:16px; }
  .sc-workspace .sc-actions>button { flex:1 1 auto; }
  .sc-library summary span { display:block; margin:4px 0 0; }
  .sc-course-list>button { padding:16px; }
}
:root {
  --brand-700: #173f38;
  --brand-600: #1f5d50;
  --brand-500: #287565;
  --ink-900: #172321;
  --ink-700: #3f504c;
  --ink-500: #687873;
  --surface-page: #f4f8fa;
  --surface-panel: #ffffff;
  --surface-muted: #edf3f4;
  --line-soft: #dce5e7;
  --success-600: #20845f;
  --success-100: #e7f6ef;
  --error-600: #c84c48;
  --error-100: #fff0ef;
  --mode-primary: #2f8fdb;
  --mode-strong: #176eaf;
  --mode-soft: #eaf6ff;
  --mode-line: #9ed1f4;
  --radius-control: 10px;
  --radius-card: 16px;
  --radius-panel: 20px;
  --shadow-panel: 0 18px 48px rgba(27, 54, 50, 0.09);
  --motion-fast: 140ms;
  --motion-normal: 220ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

.theme-vocab-new {
  --mode-primary: #2f8fdb;
  --mode-strong: #176eaf;
  --mode-soft: #eaf6ff;
  --mode-line: #9ed1f4;
}

.theme-vocab-review {
  --mode-primary: #dc6857;
  --mode-strong: #b5483d;
  --mode-soft: #fff0ed;
  --mode-line: #f0b1a7;
}

.theme-sentence-new {
  --mode-primary: #7759c9;
  --mode-strong: #5940a5;
  --mode-soft: #f1edff;
  --mode-line: #c4b7ef;
}

.theme-sentence-review {
  --mode-primary: #c98b20;
  --mode-strong: #966514;
  --mode-soft: #fff6df;
  --mode-line: #e8c879;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-normal: 0ms;
  }
}
:root {
  color: #24302f;
  background: #eef3ef;
  font-family: Inter, "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }

.app-shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: 236px 1fr;
  background:
    linear-gradient(135deg, rgba(122, 152, 141, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(202, 78, 72, 0.12), transparent 30%),
    #eef3ef;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: #1e2b29;
  color: #f7fbf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  margin-bottom: 28px;
}
.brand.large { justify-content: center; color: #24302f; margin-bottom: 10px; }

nav { display: grid; gap: 8px; }
.mobile-nav { display: none; }
.nav, .icon-text {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d9e6df;
  background: transparent;
  border-radius: 8px;
  padding: 0 12px;
}
.nav svg { width: 19px; height: 19px; }
.nav.active, .nav:hover { background: #314440; color: #ffffff; }

.account { margin-top: auto; display: grid; gap: 8px; color: #d9e6df; }
.account small { color: #9fb5ad; }
.icon-text { justify-content: flex-start; padding: 0; }

.workspace { min-width: 0; padding: 28px; overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 20px; margin-bottom: 14px; }
.topbar p { color: #64746d; margin-top: 6px; }

.sync-pill, .banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(36, 48, 47, 0.08);
}
.banner { width: 100%; margin-bottom: 16px; color: #8d332d; background: #fff2f0; }
.banner.compact { margin: 0; font-size: 14px; }
.audio-issue-toast { position: fixed; z-index: 120; top: max(18px, env(safe-area-inset-top)); right: 22px; max-width: min(420px, calc(100vw - 24px)); min-height: 46px; padding: 11px 15px; display: flex; align-items: center; gap: 9px; border: 1px solid #cfded8; border-radius: 12px; color: #315c51; background: rgba(250, 255, 253, 0.98); box-shadow: 0 14px 34px rgba(20, 53, 46, 0.2); font-size: 14px; font-weight: 800; pointer-events: none; animation: audio-issue-toast-in 180ms ease-out; }
.audio-issue-toast.pending svg { animation: audio-issue-toast-spin 1s linear infinite; }
.audio-issue-toast.success { color: #23604f; border-color: #b7d9ce; background: rgba(238, 250, 246, 0.98); }
.audio-issue-toast.error { color: #8d3f43; border-color: #edc7c8; background: rgba(255, 244, 244, 0.98); }
@keyframes audio-issue-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes audio-issue-toast-spin { to { transform: rotate(360deg); } }

.dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.metric, .wide-panel, .study-card, .settings-panel, .empty, .auth-panel {
  border: 1px solid rgba(36, 48, 47, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 42px rgba(36, 48, 47, 0.08);
}
.metric { min-height: 112px; padding: 18px; display: grid; align-content: space-between; }
.metric span { color: #64746d; }
.metric strong { font-size: 32px; overflow-wrap: anywhere; }
.metric.compact-value strong { font-size: 25px; white-space: nowrap; }
.wide-panel { grid-column: 1 / -1; padding: 20px; }
.queue-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.actions { display: flex; gap: 10px; margin-top: 16px; }

.primary, .success, .ghost, .actions button, .answer-grid button, .settings-panel button, .word-row button, .choice-option {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: #24302f;
  border: 1px solid rgba(36, 48, 47, 0.12);
}
.primary { background: #2d6a62; color: #ffffff; border-color: #2d6a62; }
.success { background: #3b7d4f; color: #ffffff; border-color: #3b7d4f; }
.ghost { background: transparent; }

.study-view { min-height: calc(100vh - 150px); display: grid; place-items: center; }
.study-card { width: min(680px, 100%); min-height: 540px; padding: 28px; display: grid; gap: 16px; text-align: center; position: relative; align-content: start; }
.card-top { display: flex; justify-content: space-between; color: #64746d; }
.study-card > .word-discard-control { position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; align-items: center; gap: 6px; }
.study-card > .word-discard-control ~ .study-session-header { padding-right: 18px; }
.study-card .word-discard-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #7e8b99; cursor: pointer; }
.study-card .word-discard-button:hover { background: #fce8e8; color: #b44343; }
.study-card .word-discard-button:focus-visible { outline: 2px solid #b44343; outline-offset: 2px; }
.study-card .word-discard-button:disabled { opacity: .45; cursor: wait; }
.word-discard-control > span { max-width: 190px; padding: 5px 8px; border-radius: 6px; background: #fff; color: #b44343; font-size: 12px; }
.question-meta { display: flex; align-items: center; justify-content: center; gap: 10px; color: #64746d; }
.type-pill { display: inline-flex; align-items: center; min-height: 30px; border-radius: 999px; padding: 0 12px; color: #ffffff; background: #b34f49; font-size: 14px; }
.learning-progress { width: min(260px, 100%); min-height: 10px; justify-self: center; display: block; padding: 0; background: transparent; }
.progress-dots { width: 100%; display: flex; gap: 6px; }
.progress-dots i { flex: 1 1 0; min-width: 12px; height: 8px; border-radius: 999px; background: #d5dfda; }
.progress-dots i.filled { background: #2d6a62; }
.smart-evidence { width: min(260px, 100%); height: 8px; justify-self: center; border-radius: 999px; overflow: hidden; background: #d5dfda; }
.smart-evidence i { display: block; height: 100%; border-radius: inherit; background: #2d6a62; transition: width 180ms ease; }
.audio-tools.floating { position: absolute; top: 76px; right: 28px; display: grid; gap: 8px; }
.audio-button { width: 46px; height: 46px; border-radius: 50%; color: #ffffff; background: #b34f49; display: grid; place-items: center; }
.flag-button { width: 46px; height: 46px; border-radius: 50%; color: #7a5144; background: #fff6ec; border: 1px solid rgba(122, 81, 68, 0.22); display: grid; place-items: center; }
.word-prompt { display: grid; gap: 8px; justify-items: center; }
.jp-word { font-size: clamp(52px, 8vw, 92px); font-weight: 800; line-height: 1.05; word-break: keep-all; }
.kana { font-size: 24px; color: #4f6861; }
.meaning, .hidden-meaning { min-height: 90px; display: grid; place-items: center; gap: 8px; color: #64746d; }
.meaning strong { font-size: 28px; color: #24302f; }
.answer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.answer-grid button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.audio-prompt { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 12px; color: #4f6861; font-size: 22px; }
.audio-prompt .learning-progress { margin-top: 2px; }
.audio-play { width: 96px; height: 96px; border-radius: 50%; background: #2d6a62; color: #ffffff; display: grid; place-items: center; box-shadow: 0 16px 34px rgba(45, 106, 98, 0.26); }
.flag-inline { min-height: 34px; border-radius: 999px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; background: #fff6ec; color: #7a5144; border: 1px solid rgba(122, 81, 68, 0.2); font-size: 14px; }
.meaning-prompt { min-height: 140px; display: grid; place-items: center; align-content: center; gap: 8px; }
.meaning-prompt strong { font-size: 30px; color: #24302f; }
.meaning-prompt span { color: #64746d; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-option { min-height: 78px; padding: 12px 14px; display: grid; place-items: center; gap: 4px; text-align: center; line-height: 1.35; }
.choice-option strong { font-size: 18px; overflow-wrap: anywhere; }
.choice-option span { color: #64746d; font-size: 14px; }
.choice-option.correct { border-color: #3b7d4f; background: #e8f5ec; color: #225331; }
.choice-option.wrong { border-color: #b34f49; background: #fff1f0; color: #8d332d; }
.choice-option.muted { opacity: 0.62; }
.feedback { min-height: 66px; border-radius: 8px; padding: 10px 14px; display: grid; place-items: center; gap: 4px; }
.feedback.correct { background: #e8f5ec; color: #225331; }
.feedback.wrong { background: #fff1f0; color: #8d332d; }
.feedback span { overflow-wrap: anywhere; }
.input-prompt { min-height: 140px; display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 10px 12px; font-size: 56px; font-weight: 800; }
.input-prompt .learning-progress, .input-prompt .smart-evidence { grid-column: 1 / -1; width: min(260px, 100%); }
.input-prompt svg { color: #b34f49; flex: 0 0 auto; }
.kana-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.kana-input { min-height: 48px; border-radius: 8px; border: 1px solid rgba(36, 48, 47, 0.18); padding: 0 14px; background: #ffffff; font-size: 22px; text-align: center; }
.sentence-card { gap: 14px; }
.pattern-main { font-size: clamp(34px, 5vw, 58px); font-weight: 800; line-height: 1.16; color: #24302f; overflow-wrap: anywhere; }
.pattern-structure { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; justify-self: center; border-radius: 8px; padding: 6px 12px; background: #e8f3ef; color: #2d6a62; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.sentence-example { min-height: 76px; display: grid; place-items: center; gap: 6px; color: #24302f; font-size: 24px; }
.sentence-example span { color: #4f6861; font-size: 18px; }
.pattern-details { border: 1px solid rgba(36, 48, 47, 0.1); border-radius: 8px; background: #ffffff; padding: 14px; display: grid; gap: 8px; text-align: left; color: #4f5f59; }
.pattern-details strong { color: #24302f; font-size: 24px; text-align: center; }
.pattern-details.compact { padding: 12px; gap: 6px; }
.pattern-details.compact strong { font-size: 18px; text-align: left; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-row span { border-radius: 999px; padding: 4px 8px; background: #f3eee8; color: #7a5144; font-size: 13px; }
.token-board { display: grid; gap: 12px; }
.token-answer, .token-pool { min-height: 68px; border: 1px dashed rgba(36, 48, 47, 0.22); border-radius: 8px; padding: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; background: rgba(255, 255, 255, 0.62); }
.token-answer button, .token-pool button { min-height: 38px; border-radius: 8px; padding: 0 12px; background: #ffffff; border: 1px solid rgba(36, 48, 47, 0.14); color: #24302f; }
.token-answer button { background: #e8f3ef; border-color: #2d6a62; }
.compact-actions { justify-content: center; margin-top: 0; }
.sentence-output { width: 100%; min-height: 112px; resize: vertical; border: 1px solid rgba(36, 48, 47, 0.18); border-radius: 8px; padding: 14px; background: #ffffff; color: #24302f; font: inherit; font-size: 18px; line-height: 1.55; }
.output-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.output-comparison > div { padding: 12px; border: 1px solid rgba(36, 48, 47, 0.1); border-radius: 8px; background: #f5f8f6; display: grid; gap: 5px; }
.output-comparison small { color: #64746d; }
.output-comparison span { color: #4f6861; }

.sentence-space { display: grid; gap: 14px; }
.sentence-back {
  width: max-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: #4f6861;
}
.sentence-back:hover { background: rgba(255, 255, 255, 0.7); }
.sentence-home { display: grid; gap: 22px; }
.sentence-stats { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 14px; }
.sentence-stats > div {
  min-height: 100px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  border-top: 3px solid #2d6a62;
  background: rgba(255, 255, 255, 0.78);
}
.sentence-stats span { color: #64746d; }
.sentence-stats strong { font-size: 30px; }
.sentence-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sentence-action {
  min-height: 108px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #24302f;
}
.sentence-action svg { flex: 0 0 auto; color: #b34f49; }
.sentence-action span { min-width: 0; display: grid; gap: 5px; }
.sentence-action strong { font-size: 18px; }
.sentence-action small { color: #64746d; line-height: 1.4; }
.sentence-action.primary-action { color: #ffffff; background: #2d6a62; border-color: #2d6a62; }
.sentence-action.primary-action svg, .sentence-action.primary-action small { color: #e8f3ef; }
.sentence-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-left: 3px solid #b34f49;
  background: rgba(255, 255, 255, 0.62);
  color: #4f5f59;
  line-height: 1.7;
}
.sentence-note svg { flex: 0 0 auto; margin-top: 3px; color: #b34f49; }
.sentence-study-view { min-height: calc(100vh - 200px); }
.sentence-question-hint { color: #64746d; }
.sentence-reading-prompt {
  min-height: 116px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  overflow-wrap: anywhere;
  background: #f5f8f6;
  border-radius: 8px;
}
.sentence-reading-prompt strong { font-size: 30px; line-height: 1.5; color: #24302f; }
.sentence-reading-prompt span { font-size: 17px; color: #64746d; }
.sentence-reading-prompt.text-compact strong { font-size: 25px; }
.sentence-reading-prompt.text-dense strong { font-size: 21px; }
.sentence-reading-prompt.text-micro strong { font-size: 18px; }
.cloze-prompt {
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 16px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
  background: #f5f8f6;
  border-radius: 8px;
}
.sentence-finished {
  min-height: calc(100vh - 200px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  color: #4f6861;
}
.sentence-finished p { color: #64746d; }
.sentence-finished .primary { min-width: 220px; }
.sentence-library { display: grid; gap: 16px; }
.sentence-search {
  width: min(520px, 100%);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(36, 48, 47, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: #64746d;
}
.sentence-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #24302f; }
.sentence-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.sentence-library-item {
  min-width: 0;
  padding: 17px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid rgba(36, 48, 47, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}
.sentence-library-item header { display: flex; justify-content: space-between; color: #64746d; }
.sentence-library-item header > span { color: #b34f49; font-weight: 700; }
.sentence-library-item h2 { margin: 0; font-size: 25px; overflow-wrap: anywhere; }
.sentence-library-item > strong { color: #2d6a62; }
.sentence-library-item p { color: #4f5f59; line-height: 1.55; }
.sentence-library-item .pattern-structure { justify-self: stretch; }
.sentence-library-item .sentence-example { min-height: 64px; font-size: 19px; text-align: center; }
.sentence-library-item .sentence-example span { font-size: 15px; }
.sentence-library-item > small { color: #64746d; line-height: 1.5; }

.review-setup, .review-summary { min-height: calc(100vh - 150px); display: grid; place-items: center; }
.review-setup-panel, .review-summary-panel { width: min(560px, 100%); padding: 28px; border: 1px solid rgba(36, 48, 47, 0.08); border-radius: 8px; background: rgba(255, 255, 255, 0.94); box-shadow: 0 16px 42px rgba(36, 48, 47, 0.08); display: grid; justify-items: center; gap: 18px; }
.review-setup-panel > svg { color: #b34f49; }
.minute-presets { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.minute-presets button { min-height: 42px; border-radius: 8px; border: 1px solid rgba(36, 48, 47, 0.14); color: #24302f; background: #ffffff; }
.minute-presets button.active { color: #ffffff; background: #2d6a62; border-color: #2d6a62; }
.minute-input { display: grid; grid-template-columns: minmax(100px, 150px) auto; align-items: center; gap: 10px; color: #64746d; }
.minute-input input { min-height: 48px; border-radius: 8px; border: 1px solid rgba(36, 48, 47, 0.18); padding: 0 12px; text-align: center; font-size: 22px; color: #24302f; background: #ffffff; }
.review-due-count { color: #64746d; }
.review-start-error { margin: 0; color: #b42318; font-size: 0.9rem; }
.review-setup-panel > .primary, .review-summary-panel > .primary { width: 100%; }
.review-summary-panel { justify-items: stretch; }
.review-summary-panel h2, .review-summary-panel p { text-align: center; }
.review-summary-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review-summary-actions button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.summary-grid .metric { min-height: 96px; padding: 14px; }
.summary-grid .metric strong { font-size: 24px; }
.smart-review-card .choice-option { transition: border-color 120ms ease, background 120ms ease; }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.word-row { min-height: 118px; border: 1px solid rgba(36, 48, 47, 0.08); border-radius: 8px; background: rgba(255, 255, 255, 0.92); padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.word-row strong { font-size: 24px; margin-right: 8px; }
.word-row span { color: #4f6861; }
.word-row p, .word-row small { grid-column: 1 / 2; color: #64746d; }
.word-actions { grid-row: 1 / 6; grid-column: 2; display: grid; align-content: start; gap: 8px; }
.word-actions button { width: 42px; padding: 0; display: grid; place-items: center; }
.word-actions button:last-child { background: #fff6ec; color: #7a5144; }
.ability-overview { grid-column: 1 / 2; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ability-overview > div { min-width: 0; display: grid; gap: 4px; }
.ability-overview span { font-size: 12px; color: #64746d; text-align: center; }
.ability-overview i { height: 5px; border-radius: 999px; overflow: hidden; background: #d5dfda; }
.ability-overview b { display: block; height: 100%; background: #2d6a62; }
.mastery-details { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid rgba(36, 48, 47, 0.1); display: grid; gap: 8px; }
.mastery-details > div { min-width: 0; display: grid; grid-template-columns: minmax(110px, 1fr) auto; gap: 3px 10px; text-align: left; }
.mastery-details > div strong { font-size: 14px; }
.mastery-details > div span { color: #4f6861; font-size: 13px; }
.mastery-details > div small { grid-column: 1 / -1; }
.word-row.expanded { grid-column: span 2; }

.settings-panel, .empty { padding: 22px; display: grid; gap: 14px; }
.level-row { display: flex; flex-wrap: wrap; gap: 10px; }
.level.active { background: #b34f49; color: #ffffff; border-color: #b34f49; }
.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.number-grid label { display: grid; gap: 8px; color: #64746d; }
.number-grid label small { line-height: 1.45; color: #83908b; }
.number-grid input { min-height: 44px; border-radius: 8px; border: 1px solid rgba(36, 48, 47, 0.18); padding: 0 12px; background: #ffffff; color: #24302f; }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.toggle-option { min-height: 52px; border: 1px solid rgba(36, 48, 47, 0.12); border-radius: 8px; background: #ffffff; color: #24302f; padding: 0 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-option.active { border-color: #2d6a62; background: #e8f3ef; }
.toggle-option input { width: 18px; height: 18px; accent-color: #2d6a62; }
.issue-list { display: grid; gap: 8px; }
.audio-repair-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid rgba(36, 48, 47, 0.1); border-radius: 8px; background: #ffffff; }
.audio-repair-row > div { min-width: 0; display: grid; gap: 4px; }
.audio-repair-row small { color: #64746d; }
.audio-repair-row button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; }
.feedback-audio-flag { justify-self: center; }
.issue-row { border: 1px solid rgba(36, 48, 47, 0.1); border-radius: 8px; background: #ffffff; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: baseline; }
.issue-row strong { font-size: 18px; }
.issue-row span { color: #4f6861; }
.issue-row small { grid-column: 1 / -1; color: #64746d; }

.insights-page { display: grid; gap: 18px; }
.insight-summary { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; }
.insight-metric { min-height: 104px; padding: 16px; border-top: 3px solid #2d6a62; background: rgba(255, 255, 255, 0.88); display: grid; align-content: space-between; }
.insight-metric span { display: flex; align-items: center; gap: 7px; color: #64746d; font-size: 14px; }
.insight-metric svg { width: 17px; color: #b34f49; }
.insight-metric strong { font-size: 26px; overflow-wrap: anywhere; }
.insight-metric small { color: #7a8882; font-size: 12px; line-height: 1.35; }
.insight-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr); gap: 16px; }
.insight-section { padding: 20px; border: 1px solid rgba(36, 48, 47, 0.08); border-radius: 8px; background: rgba(255, 255, 255, 0.9); }
.insight-section > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.insight-section h2 { margin: 0 0 4px; }
.insight-section header p, .insight-section header > strong { color: #64746d; font-size: 14px; }
.activity-chart { height: 190px; display: grid; grid-template-columns: repeat(14, minmax(18px, 1fr)); align-items: end; gap: 7px; padding-top: 24px; border-bottom: 1px solid rgba(36, 48, 47, 0.12); }
.activity-day { height: 100%; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.activity-day > span { min-height: 17px; color: #64746d; font-size: 11px; }
.activity-day > i { width: min(26px, 74%); min-height: 3px; border-radius: 4px 4px 0 0; background: #2d6a62; }
.activity-day > small { height: 22px; color: #7b8984; font-size: 10px; white-space: nowrap; transform: rotate(-38deg); }
.ability-bars { display: grid; gap: 16px; }
.ability-bars > div { display: grid; grid-template-columns: 66px 1fr 32px; align-items: center; gap: 9px; }
.ability-bars span { color: #4f5f59; font-size: 14px; }
.ability-bars strong { font-size: 14px; text-align: right; }
.ability-track { height: 9px; border-radius: 999px; background: #d5dfda; position: relative; }
.ability-track i { display: block; height: 100%; border-radius: inherit; background: #2d6a62; }
.ability-track b { position: absolute; top: -3px; width: 2px; height: 15px; background: #b34f49; }
.ability-legend { margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 7px; color: #64746d; font-size: 12px; }
.ability-legend i { width: 22px; height: 7px; background: #2d6a62; border-radius: 999px; }
.ability-legend b { width: 2px; height: 13px; margin-left: 8px; background: #b34f49; }
.segment-control { display: flex; padding: 3px; border: 1px solid rgba(36, 48, 47, 0.12); border-radius: 8px; background: #f1f5f2; }
.segment-control button { min-height: 34px; padding: 0 12px; border-radius: 6px; color: #64746d; background: transparent; }
.segment-control button.active { color: #ffffff; background: #2d6a62; }
.mistake-list { display: grid; gap: 9px; }
.mistake-row { border: 1px solid rgba(36, 48, 47, 0.1); border-radius: 8px; background: #ffffff; }
.mistake-row summary { min-height: 58px; padding: 11px 14px; display: grid; grid-template-columns: auto minmax(90px, auto) minmax(120px, 1fr) auto; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.mistake-row summary::-webkit-details-marker { display: none; }
.mistake-row summary > span:not(.mistake-level) { color: #4f6861; overflow-wrap: anywhere; }
.mistake-row summary small { color: #64746d; text-align: right; }
.mistake-level { min-width: 31px; color: #b34f49; font-weight: 700; }
.mistake-row > div { padding: 13px 14px 15px 55px; border-top: 1px solid rgba(36, 48, 47, 0.08); display: grid; gap: 6px; color: #4f5f59; }
.mistake-row > div > strong { color: #24302f; }
.mistake-row > div small { color: #64746d; }
.mistake-empty { min-height: 100px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #64746d; }
.efficiency-panel { display: grid; gap: 16px; }
.efficiency-panel > header { margin-bottom: 0; }
.efficiency-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.efficiency-metric { min-width: 0; min-height: 108px; padding: 13px; display: grid; align-content: space-between; gap: 6px; border: 1px solid #dce8e4; border-radius: 8px; background: #f8fcfa; }
.efficiency-metric > span { min-width: 0; display: flex; align-items: center; gap: 6px; color: #59716a; font-size: 12px; }
.efficiency-metric svg { width: 16px; color: #2d7967; }
.efficiency-metric strong { color: #193d35; font-size: 23px; overflow-wrap: anywhere; }
.efficiency-metric small { color: #71817c; }
.question-efficiency-list { overflow: hidden; border: 1px solid #dde8e4; border-radius: 8px; }
.question-efficiency-list > div { min-height: 48px; padding: 9px 13px; display: grid; grid-template-columns: minmax(180px, 1fr) 70px 90px 150px; align-items: center; gap: 12px; border-top: 1px solid #e5eeeb; }
.question-efficiency-list > div:first-child { border-top: 0; }
.question-efficiency-list .question-efficiency-head { min-height: 38px; color: #657873; background: #f1f6f4; font-size: 12px; font-weight: 800; }
.question-efficiency-list strong { min-width: 0; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.question-efficiency-list strong small { padding: 3px 6px; flex: 0 0 auto; border-radius: 999px; color: #2b6d5d; background: #e4f2ed; font-size: 10px; }
.question-efficiency-list > div > span { color: #4f6861; }
.challenge-analytics-panel { display: grid; gap: 16px; }
.challenge-analytics-panel > header { margin-bottom: 0; }
.challenge-analytics-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.challenge-analytics-detail { padding: 14px; display: grid; grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr); align-items: center; gap: 10px 18px; border: 1px solid #dde8e4; border-radius: 8px; background: #f8fcfa; }
.challenge-analytics-detail p { margin: 4px 0 0; color: #71817c; font-size: 13px; }
.challenge-analytics-detail > small { grid-column: 1 / -1; color: #71817c; }
.challenge-interruption-list { display: flex; flex-wrap: wrap; gap: 8px; }
.challenge-interruption-list span { padding: 7px 10px; border-radius: 999px; color: #285f53; background: #e4f2ed; font-size: 12px; font-weight: 800; }
.challenge-interruption-list .empty-state { color: #71817c; background: #edf2f0; }

.auth-screen { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef3ef, #dce9e4 55%, #f5e8df); }
.auth-panel { width: min(420px, 100%); padding: 28px; display: grid; gap: 14px; }
.auth-panel h1 { text-align: center; font-size: 28px; }
.auth-panel input { width: 100%; min-height: 46px; border-radius: 8px; border: 1px solid rgba(36, 48, 47, 0.18); padding: 0 14px; background: #ffffff; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; overflow: visible; padding: 10px 12px; gap: 8px; }
  .brand { grid-column: 1; grid-row: 1; margin: 0; font-size: 16px; white-space: nowrap; }
  nav { grid-column: 1 / -1; grid-row: 2; display: flex; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .nav { flex: 1 0 auto; justify-content: center; padding: 0 10px; white-space: nowrap; }
  .nav span { white-space: nowrap; }
  .account { grid-column: 3; grid-row: 1; margin: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
  .account .icon-text { min-height: 34px; }
  .workspace { padding: 20px; }
  .dashboard { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .answer-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .kana-form { grid-template-columns: 1fr; }
  .audio-tools.floating { position: static; margin: 0 auto; display: flex; justify-content: center; }
  .input-prompt { font-size: 40px; }
  .minute-presets, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-row.expanded { grid-column: auto; }
  .sentence-stats { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .sentence-actions { grid-template-columns: 1fr; }
  .sentence-action { min-height: 86px; }
  .sentence-library-grid { grid-template-columns: 1fr; }
  .cloze-prompt { font-size: 23px; }
  .insight-summary { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .insight-grid { grid-template-columns: 1fr; }
  .challenge-analytics-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .challenge-analytics-detail { grid-template-columns: 1fr; }
  .challenge-analytics-detail > small { grid-column: 1; }
  .output-comparison { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .account > div, .account > small { display: none; }
  .workspace { padding: 16px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 28px; }
  .sync-pill { padding: 8px; }
  .sentence-stats { gap: 9px; }
  .sentence-stats > div { min-height: 88px; padding: 13px; }
  .sentence-stats strong { font-size: 26px; }
  .study-card { padding: 18px; }
  .audio-repair-row { align-items: stretch; flex-direction: column; }
  .mistake-row summary { grid-template-columns: auto 1fr; }
  .mistake-row summary > span:not(.mistake-level), .mistake-row summary small { grid-column: 2; text-align: left; }
  .mistake-row > div { padding-left: 14px; }
  .insight-section > header { flex-direction: column; }
  .challenge-analytics-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .challenge-analytics-detail { grid-template-columns: 1fr; }
  .challenge-analytics-detail > small { grid-column: 1; }
}

/* M1 visual system: the old rules remain available when uiRedesignV2 is disabled. */
.ui-v2 {
  color: var(--ink-900);
  background: var(--surface-page);
}

.ui-v2 .workspace {
  background: var(--surface-page);
}

.ui-v2 .study-card {
  width: min(760px, 100%);
  min-height: 620px;
  padding: 24px 30px 28px;
  gap: 13px;
  border-color: var(--line-soft);
  border-radius: var(--radius-panel);
  background: var(--surface-panel);
  box-shadow: var(--shadow-panel);
  animation: study-enter var(--motion-normal) var(--ease-out);
}

.ui-v2 .study-session-header {
  min-height: 42px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--ink-900);
}

.ui-v2 .study-session-header strong {
  justify-self: start;
  font-size: 19px;
}

.ui-v2 .study-session-header > span {
  color: var(--ink-700);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ui-v2 .study-exit {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  color: var(--ink-700);
  background: transparent;
}

.ui-v2 .study-exit:hover {
  color: var(--mode-strong);
  background: var(--mode-soft);
}

.ui-v2 .session-progress {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-muted);
}

.ui-v2 .session-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mode-primary);
  transition: width var(--motion-normal) var(--ease-out);
}

.ui-v2 .question-meta {
  min-height: 32px;
  gap: 8px;
}

.ui-v2 .type-pill {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--mode-primary);
  font-size: 13px;
  font-weight: 700;
}

.ui-v2 .question-meta > span:last-child {
  color: var(--mode-strong);
  font-weight: 800;
}

.ui-v2 .word-prompt {
  gap: 5px;
}

.ui-v2 .jp-word {
  color: var(--ink-900);
  font-size: clamp(58px, 8vw, 84px);
  letter-spacing: 0;
}

.ui-v2 .kana {
  color: var(--ink-700);
  font-size: 23px;
}

.ui-v2 .learning-progress {
  width: min(210px, 72%);
}

.ui-v2 .progress-dots i {
  height: 6px;
  background: var(--surface-muted);
}

.ui-v2 .progress-dots i.filled {
  background: var(--mode-primary);
}

.ui-v2 .prompt-audio-tools {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.ui-v2 .prompt-audio-tools button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--mode-line);
  border-radius: var(--radius-control);
  color: var(--mode-strong);
  background: var(--mode-soft);
  transition: transform var(--motion-fast) var(--ease-out), background var(--motion-fast) ease;
}

.ui-v2 .prompt-audio-tools button:hover {
  transform: translateY(-2px);
  background: #ffffff;
}

.ui-v2 .question-instruction {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: var(--ink-700);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.ui-v2 .question-instruction i {
  width: 4px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--mode-primary);
}

.ui-v2 .choice-grid {
  gap: 11px;
}

.ui-v2 .choice-option {
  position: relative;
  min-height: 86px;
  border-color: var(--line-soft);
  border-radius: var(--radius-control);
  background: #ffffff;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.ui-v2 .choice-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--mode-primary);
  background: var(--mode-soft);
}
.ui-v2 .character-stage .choice-option:hover:not(:disabled) strong { color: #ffffff; }

.ui-v2 .choice-option strong {
  color: var(--ink-900);
  font-size: 20px;
}

.ui-v2 .choice-option.correct {
  border: 2px solid var(--success-600);
  background: var(--success-100);
  animation: answer-pop var(--motion-normal) var(--ease-out);
}

.ui-v2 .choice-option.correct strong {
  color: var(--success-600);
}

.ui-v2 .choice-option.wrong {
  border-color: var(--error-600);
  background: var(--error-100);
  animation: answer-shake var(--motion-normal) ease;
}

.ui-v2 .choice-option.muted {
  opacity: 0.68;
}

.ui-v2 .choice-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--success-600);
}

.ui-v2 .feedback {
  min-height: 62px;
  padding: 10px 15px;
  grid-template-columns: auto 1fr;
  justify-items: start;
  gap: 12px;
  text-align: left;
  border: 1px solid transparent;
}

.ui-v2 .feedback.correct {
  border-color: #b9e2d1;
  background: var(--success-100);
}

.ui-v2 .feedback.wrong {
  border-color: #efc0bd;
  background: var(--error-100);
}

.ui-v2 .feedback > span {
  display: grid;
  gap: 2px;
}

.ui-v2 .feedback strong {
  font-size: 16px;
}

.ui-v2 .feedback small {
  color: currentColor;
  font-size: 14px;
}

.ui-v2 .study-next {
  width: 100%;
  min-height: 52px;
  color: #ffffff;
  background: var(--brand-600);
  border-color: var(--brand-600);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform var(--motion-fast) var(--ease-out), background var(--motion-fast) ease;
}

.ui-v2 .study-next:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--brand-700);
}

@keyframes study-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes answer-pop {
  0% { transform: scale(0.98); }
  65% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

@keyframes answer-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-3px); }
  70% { transform: translateX(3px); }
}

@media (max-width: 860px) {
  .audio-issue-toast { top: max(10px, env(safe-area-inset-top)); right: 12px; left: 12px; max-width: none; justify-content: center; text-align: center; }
  .ui-v2.study-route {
    display: block;
    min-height: 100dvh;
  }

  .ui-v2.study-route > .sidebar,
  .ui-v2.study-route .workspace > .topbar {
    display: none;
  }

  .ui-v2.study-route .workspace {
    width: 100%;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  .ui-v2.study-route .workspace > .banner {
    position: fixed;
    z-index: 10;
    top: 8px;
    left: 12px;
    width: calc(100% - 24px);
  }

  .ui-v2.study-route .study-view {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    display: block;
    overflow: hidden;
    background: var(--surface-panel);
  }

  .ui-v2.study-route .study-card {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: max(12px, env(safe-area-inset-top)) 20px calc(86px + env(safe-area-inset-bottom));
    gap: 10px;
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .ui-v2.study-route .study-session-header {
    min-height: 38px;
    grid-template-columns: 38px 1fr auto;
  }

  .ui-v2.study-route .study-exit {
    width: 38px;
    height: 38px;
  }

  .ui-v2.study-route .study-session-header strong {
    font-size: 18px;
  }

  .ui-v2.study-route .question-meta {
    min-height: 26px;
  }

  .ui-v2.study-route .type-pill {
    min-height: 24px;
    font-size: 12px;
  }

  .ui-v2.study-route .jp-word {
    font-size: clamp(54px, 18vw, 72px);
  }

  .ui-v2.study-route .kana {
    font-size: 21px;
  }

  .ui-v2.study-route .prompt-audio-tools button {
    width: 40px;
    height: 40px;
  }

  .ui-v2.study-route .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .ui-v2.study-route .choice-option {
    min-height: 84px;
    padding: 9px;
  }

  .ui-v2.study-route .choice-option strong {
    font-size: 18px;
  }

  .ui-v2.study-route .feedback {
    min-height: 58px;
  }

  .ui-v2.study-route .study-next {
    position: fixed;
    z-index: 8;
    left: 20px;
    right: 20px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100% - 40px);
    min-height: 56px;
    box-shadow: 0 10px 28px rgba(23, 63, 56, 0.18);
  }
}

@media (max-width: 340px), (max-height: 620px) {
  .ui-v2.study-route .study-card {
    gap: 7px;
    padding-inline: 14px;
  }

  .ui-v2.study-route .jp-word {
    font-size: 52px;
  }

  .ui-v2.study-route .choice-option {
    min-height: 64px;
  }

  .ui-v2.study-route .feedback {
    min-height: 50px;
    padding-block: 7px;
  }

  .ui-v2.study-route .study-next {
    left: 14px;
    right: 14px;
    width: calc(100% - 28px);
  }
}

/* Character themes keep the study structure stable while swapping art and motifs. */
.character-theme-katan {
  --character-accent: #e94286;
  --character-soft: #fff0f6;
  --character-ink: #7e2450;
}

.guide-companion {
  width: 100%;
  min-height: 132px;
  padding: 14px 16px 0;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--character-accent) 24%, var(--line-soft));
  border-radius: var(--radius-panel);
  color: var(--character-ink);
  background: linear-gradient(112deg, var(--character-soft), rgba(255, 255, 255, 0.96));
}

.guide-companion > img {
  grid-column: 1;
  align-self: end;
  width: 118px;
  height: 132px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 10px 14px rgba(71, 34, 57, 0.16));
}

.guide-companion-copy { grid-column: 2; display: grid; gap: 5px; }
.guide-companion-copy strong { font-size: 18px; line-height: 1.35; }
.guide-companion-copy span { color: var(--ink-600); font-size: 14px; line-height: 1.55; }
.guide-voice-button {
  grid-column: 3;
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--character-accent) 34%, white);
  border-radius: var(--radius-control);
  color: var(--character-ink);
  background: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}
.guide-voice-button:disabled { cursor: default; opacity: 0.58; }
.guide-companion.compact { min-height: 96px; padding-block-start: 10px; grid-template-columns: 82px minmax(0, 1fr) auto; }
.guide-companion.compact > img { width: 82px; height: 96px; }
.guide-companion.compact .guide-companion-copy strong { font-size: 16px; }
.session-complete > .guide-companion,
.sentence-finished > .guide-companion,
.review-summary-panel > .guide-companion { width: min(520px, 100%); justify-self: center; }

@media (max-width: 640px) {
  .guide-companion,
  .guide-companion.compact {
    min-height: 104px;
    padding: 10px 12px 0;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 6px 12px;
  }
  .guide-companion > img,
  .guide-companion.compact > img { width: 72px; height: 104px; grid-row: 1 / span 2; }
  .guide-companion-copy { grid-column: 2; }
  .guide-companion-copy strong { font-size: 15px; }
  .guide-companion-copy span { font-size: 12px; }
  .guide-voice-button { grid-column: 2; justify-self: start; min-height: 34px; padding-inline: 9px; font-size: 12px; }
}

.guide-character,
.study-theme-decor { display: none; }

.themed-action {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.themed-action .action-motif {
  position: absolute;
  z-index: -1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  opacity: 0.16;
  pointer-events: none;
}

.themed-action .action-motif svg { width: 30px; height: 30px; fill: currentColor; }
.themed-action .action-motif svg:nth-child(1) { transform: translateY(9px) rotate(-14deg); }
.themed-action .action-motif svg:nth-child(2) { width: 42px; height: 42px; transform: translateY(-7px) rotate(10deg); }
.themed-action .action-motif svg:nth-child(3) { transform: translateY(8px) rotate(16deg); }
.themed-action .action-label { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }

@keyframes guide-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 1700px) {
  .ui-v2 .character-stage {
    width: 100%;
    grid-template-columns: 110px minmax(0, 920px) minmax(240px, 290px);
    grid-template-rows: auto;
    align-items: start;
    justify-content: center;
    column-gap: 24px;
  }

  .ui-v2 .character-stage > .study-theme-decor {
    grid-column: 1;
    grid-row: 1;
    min-height: 620px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    color: var(--character-accent);
    opacity: 0.14;
    pointer-events: none;
  }

  .ui-v2 .character-stage > .study-theme-decor svg { width: 34px; height: 34px; fill: currentColor; }
  .ui-v2 .character-stage > .study-theme-decor svg:nth-child(2) { width: 54px; height: 54px; transform: rotate(-12deg); }
  .ui-v2 .character-stage > .study-theme-decor svg:nth-child(3) { transform: rotate(15deg); }

  .ui-v2 .character-stage > .study-card {
    grid-column: 2;
    grid-row: 1;
  }

  .ui-v2 .guide-character {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    min-height: 620px;
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: end;
    animation: guide-enter 320ms var(--ease-out);
  }

  .ui-v2 .guide-message {
    position: relative;
    z-index: 2;
    width: min(230px, 100%);
    margin: 26px auto -16px;
    padding: 13px 16px;
    display: grid;
    gap: 3px;
    border: 1px solid color-mix(in srgb, var(--character-accent) 28%, white);
    border-radius: var(--radius-control);
    background: rgba(255, 255, 255, 0.94);
    color: var(--character-ink);
    box-shadow: 0 12px 30px rgba(88, 39, 64, 0.1);
  }

  .ui-v2 .guide-message strong { font-size: 14px; }
  .ui-v2 .guide-message span { color: var(--ink-700); font-size: 13px; line-height: 1.45; }
  .ui-v2 .guide-art-frame { position: relative; align-self: end; height: 520px; overflow: hidden; }
  .ui-v2 .guide-art-frame img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 18px 22px rgba(47, 34, 45, 0.14)); }

  .ui-v2 .guide-heart-trail {
    position: absolute;
    top: 76px;
    right: 4px;
    display: grid;
    gap: 14px;
    color: var(--character-accent);
    opacity: 0.24;
  }

  .ui-v2 .guide-heart-trail svg { width: 20px; height: 20px; fill: currentColor; }
  .ui-v2 .guide-heart-trail svg:nth-child(2) { margin-left: 15px; width: 14px; height: 14px; }
  .ui-v2 .guide-heart-trail svg:nth-child(3) { margin-left: 3px; width: 10px; height: 10px; }
}

@media (max-width: 860px) {
  .ui-v2.study-route .study-theme-decor {
    position: absolute;
    z-index: 0;
    top: 48px;
    right: 14px;
    display: flex;
    gap: 5px;
    color: var(--character-accent);
    opacity: 0.08;
    pointer-events: none;
  }

  .ui-v2.study-route .study-theme-decor svg { width: 18px; height: 18px; fill: currentColor; }
  .ui-v2.study-route .study-theme-decor svg:nth-child(2) { transform: translateY(10px); }
  .ui-v2.study-route .study-theme-decor svg:nth-child(3) { transform: translateY(-5px); }
  .ui-v2.study-route .study-theme-decor svg:nth-child(4) { display: none; }
  .ui-v2.study-route .themed-action .action-motif { opacity: 0.1; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-v2 .guide-character { animation: none; }
}

/* M2 responsive navigation and shared study shell. */
.mobile-more-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(23, 35, 33, 0.34);
}

.mobile-more-sheet {
  width: 100%;
  padding: 18px 18px calc(92px + env(safe-area-inset-bottom));
  display: grid;
  gap: 4px;
  border-radius: 8px 8px 0 0;
  background: var(--surface-panel);
  box-shadow: 0 -16px 40px rgba(23, 35, 33, 0.16);
  animation: mobile-sheet-enter var(--motion-normal) var(--ease-out);
}

.mobile-more-sheet header {
  min-height: 44px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-more-sheet header strong { font-size: 19px; }
.mobile-more-sheet header button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-control); color: var(--ink-700); background: var(--surface-muted); }

.mobile-more-action {
  min-height: 54px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-900);
  background: transparent;
  text-align: left;
}

.mobile-more-action > svg:first-child { color: var(--brand-500); }
.mobile-more-action > svg:last-child { color: var(--ink-500); }

.mobile-account {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  align-items: center;
}

.mobile-account small { color: var(--ink-500); }
.mobile-account button { grid-column: 2; grid-row: 1 / 3; min-height: 42px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border-radius: var(--radius-control); color: var(--error-600); background: var(--error-100); }

.review-exit {
  min-height: 38px;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border-radius: var(--radius-control);
  color: var(--ink-700);
  background: transparent;
}

.review-exit:hover { color: var(--mode-strong); background: var(--mode-soft); }

@keyframes mobile-sheet-enter {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 860px) {
  .ui-v2:not(.study-route) {
    display: block;
    min-height: 100dvh;
  }

  .ui-v2:not(.study-route) .sidebar {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 0;
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    display: block;
    border-top: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.98);
    color: var(--ink-700);
    box-shadow: 0 -8px 28px rgba(23, 35, 33, 0.08);
  }

  .ui-v2:not(.study-route) .sidebar > .brand,
  .ui-v2:not(.study-route) .sidebar > .desktop-nav,
  .ui-v2:not(.study-route) .sidebar > .account {
    display: none;
  }

  .ui-v2:not(.study-route) .mobile-nav {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    overflow: visible;
  }

  .ui-v2:not(.study-route) .mobile-nav .nav {
    min-width: 0;
    min-height: 56px;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    border-radius: var(--radius-control);
    color: var(--ink-500);
    font-size: 11px;
  }

  .ui-v2:not(.study-route) .mobile-nav .nav svg { width: 20px; height: 20px; }
  .ui-v2:not(.study-route) .mobile-nav .nav.active { color: var(--brand-600); background: #e8f2ef; }

  .ui-v2:not(.study-route) .workspace {
    min-height: 100dvh;
    padding: 18px 16px calc(88px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  .ui-v2:not(.study-route) .topbar {
    margin-bottom: 16px;
  }

  .ui-v2:not(.study-route) .topbar h1 { font-size: 27px; }
  .ui-v2:not(.study-route) .topbar p { font-size: 13px; }

  .ui-v2.study-route .review-setup,
  .ui-v2.study-route .review-summary {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: max(12px, env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    align-content: center;
    overflow-y: auto;
    background: var(--mode-soft);
  }

  .ui-v2.study-route .review-setup-panel,
  .ui-v2.study-route .review-summary-panel {
    width: 100%;
    padding: 20px;
    gap: 14px;
    box-shadow: none;
  }

  .ui-v2.study-route .review-summary-actions { grid-template-columns: 1fr; }
  .ui-v2.study-route .review-summary-actions button { min-height: 54px; }

  .ui-v2.study-route .sentence-space {
    width: 100%;
    height: 100dvh;
    display: block;
    overflow: hidden;
  }

  .ui-v2.study-route .sentence-space > .sentence-back { display: none; }
  .ui-v2.study-route .sentence-study-view { min-height: 100dvh; height: 100dvh; }

  .ui-v2.study-route .sentence-card {
    width: 100%;
    min-width: 0;
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .ui-v2.study-route .sentence-card > * {
    min-width: 0;
    max-width: 100%;
  }

  .ui-v2.study-route .sentence-card .pattern-main {
    width: 100%;
    font-size: clamp(28px, 9vw, 38px);
    text-align: center;
    overflow-wrap: anywhere;
  }

  .ui-v2.study-route .sentence-card .pattern-structure {
    width: fit-content;
    max-width: 100%;
    display: flex;
    white-space: normal;
    text-align: center;
  }

  .ui-v2.study-route .sentence-card .sentence-example,
  .ui-v2.study-route .sentence-card .pattern-details,
  .ui-v2.study-route .sentence-card .pattern-details p {
    width: 100%;
    overflow-wrap: anywhere;
  }

  .ui-v2.study-route .sentence-card .pattern-details,
  .ui-v2.study-route .sentence-card .output-comparison {
    max-height: 180px;
    overflow-y: auto;
  }

  .ui-v2.study-route .mobile-study-actions {
    position: fixed;
    z-index: 8;
    right: 20px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 20px;
    width: calc(100% - 40px);
    margin: 0;
    padding: 0;
    background: var(--surface-panel);
    box-shadow: 0 -8px 18px rgba(23, 35, 33, 0.06);
  }

  .ui-v2.study-route .mobile-study-actions button { min-height: 54px; }

  .ui-v2.study-route .smart-review-card .audio-prompt {
    min-height: 150px;
  }
}

@media (max-width: 340px), (max-height: 620px) {
  .ui-v2:not(.study-route) .workspace { padding-inline: 12px; }
  .ui-v2.study-route .sentence-card .pattern-details,
  .ui-v2.study-route .sentence-card .output-comparison { max-height: 125px; }
  .ui-v2.study-route .audio-prompt { min-height: 120px; }
  .ui-v2.study-route .meaning-prompt { min-height: 95px; }
}

/* M3 shared mode feedback and completion system. */
.ui-v2 .study-card {
  border-top: 3px solid var(--mode-line);
}

.ui-v2 .study-card .study-next,
.ui-v2 .study-card > .primary.study-next,
.ui-v2 .review-setup-panel > .primary,
.ui-v2 .review-summary-panel > .primary,
.ui-v2 .sentence-finished > .primary,
.ui-v2 .completion-action {
  color: #ffffff;
  background: var(--mode-strong);
  border-color: var(--mode-strong);
}

.ui-v2 .study-card .study-next:hover:not(:disabled),
.ui-v2 .review-setup-panel > .primary:hover:not(:disabled),
.ui-v2 .review-summary-panel > .primary:hover:not(:disabled),
.ui-v2 .sentence-finished > .primary:hover:not(:disabled),
.ui-v2 .completion-action:hover:not(:disabled) {
  background: var(--mode-primary);
  border-color: var(--mode-primary);
}

.ui-v2 .audio-play,
.ui-v2 .audio-button {
  color: #ffffff;
  background: var(--mode-primary);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--mode-primary) 28%, transparent);
}

.ui-v2 .audio-play:hover,
.ui-v2 .audio-button:hover { background: var(--mode-strong); }

.ui-v2 .smart-evidence i,
.ui-v2 .token-answer button {
  background: var(--mode-primary);
}

.ui-v2 .smart-evidence i { transition: width var(--motion-normal) var(--ease-out); }
.ui-v2 .input-prompt svg { color: var(--mode-strong); }
.ui-v2 .token-answer button { color: #ffffff; border-color: var(--mode-strong); }

.ui-v2 .review-setup-panel,
.ui-v2 .review-summary-panel,
.ui-v2 .sentence-finished {
  border-top: 3px solid var(--mode-line);
}

.ui-v2 .review-setup-panel > svg { color: var(--mode-primary); }
.ui-v2 .review-setup-panel > h2 { color: var(--ink-900); }
.ui-v2 .minute-presets button.active { color: #ffffff; background: var(--mode-strong); border-color: var(--mode-strong); }

.streak-badge {
  min-height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--mode-line);
  border-radius: 999px;
  color: var(--mode-strong);
  background: var(--mode-soft);
  font-size: 13px;
  font-weight: 800;
  animation: streak-enter var(--motion-normal) var(--ease-out);
}

.ui-v2 .feedback {
  animation: feedback-enter var(--motion-normal) var(--ease-out);
}

.ui-v2 .study-card.answer-correct {
  animation: answer-card-correct 520ms var(--ease-out);
}

.ui-v2 .study-card.answer-wrong {
  animation: answer-card-wrong 520ms ease;
}

.audio-glyph {
  position: relative;
  width: 1em;
  height: 1em;
  display: inline-grid;
  place-items: center;
  font-size: 1em;
}

.audio-glyph svg { width: 100%; height: 100%; }

.audio-glyph i {
  position: absolute;
  inset: -5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.audio-glyph.playing i { animation: audio-ring 1s ease-out infinite; }
.audio-glyph.playing i:last-child { animation-delay: 320ms; }

.completion-header {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.completion-header h2 { margin: 0; font-size: 26px; color: var(--ink-900); }
.completion-header p { color: var(--ink-500); line-height: 1.55; }
.completion-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--mode-primary);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--mode-primary) 25%, transparent);
  animation: completion-enter 600ms var(--ease-out);
}

.completion-stats {
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0;
  border-block: 1px solid var(--mode-line);
}

.completion-stats > div {
  min-height: 78px;
  padding: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
}

.completion-stats > div + div { border-left: 1px solid var(--mode-line); }
.completion-stats strong { color: var(--mode-strong); font-size: 28px; }
.completion-stats span { color: var(--ink-500); font-size: 13px; }

.session-complete {
  width: min(620px, 100%);
  min-height: 520px;
  margin: auto;
  padding: 38px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 26px;
  border: 1px solid var(--line-soft);
  border-top: 3px solid var(--mode-line);
  border-radius: var(--radius-panel);
  background: var(--surface-panel);
  box-shadow: var(--shadow-panel);
}

.completion-action {
  min-width: 220px;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius-control);
  font-weight: 800;
}

.ui-v2 .summary-grid { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.ui-v2 .sentence-finished { width: min(620px, 100%); min-height: 520px; margin: auto; padding: 32px; }

@keyframes feedback-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes streak-enter {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes answer-card-correct {
  0% { box-shadow: var(--shadow-panel); }
  45% { box-shadow: 0 0 0 3px var(--success-600), var(--shadow-panel); }
  100% { box-shadow: var(--shadow-panel); }
}

@keyframes answer-card-wrong {
  0%, 100% { box-shadow: var(--shadow-panel); }
  35%, 70% { box-shadow: 0 0 0 2px var(--error-600), var(--shadow-panel); }
}

@keyframes audio-ring {
  0% { opacity: 0.55; transform: scale(0.72); }
  100% { opacity: 0; transform: scale(1.55); }
}

@keyframes completion-enter {
  0% { opacity: 0; transform: scale(0.82) rotate(-7deg); }
  70% { transform: scale(1.05) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@media (max-width: 860px) {
  .ui-v2.study-route .study-card { border-top-color: var(--mode-primary); }
  .ui-v2.study-route .session-complete,
  .ui-v2.study-route .sentence-finished {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: max(24px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 4px solid var(--mode-primary);
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
  }

  .ui-v2.study-route .question-meta { flex-wrap: wrap; }
  .ui-v2.study-route .streak-badge { min-height: 24px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-v2 .feedback,
  .ui-v2 .study-card.answer-correct,
  .ui-v2 .study-card.answer-wrong,
  .streak-badge,
  .completion-icon,
  .audio-glyph.playing i { animation: none; }
}

/* M3 desktop workspace and long-answer density. */
.today-panel-heading,
.today-queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.today-panel-heading h2,
.today-queue-heading h2 { margin: 0; }
.today-panel-heading p,
.today-queue-heading span { color: var(--ink-500); font-size: 14px; }

.today-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.today-action {
  min-width: 0;
  min-height: 82px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--action-color);
  border-radius: var(--radius-control);
  color: var(--ink-900);
  background: #ffffff;
  text-align: left;
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.today-action.new-vocab { --action-color: #2f8fdb; }
.today-action.vocab-review { --action-color: #dc6857; }
.today-action.sentence-study { --action-color: #7759c9; }
.today-action > svg { color: var(--action-color); }
.today-action > svg:last-child { color: var(--ink-500); }
.today-action span { min-width: 0; display: grid; gap: 5px; }
.today-action strong { font-size: 17px; }
.today-action small { color: var(--ink-500); overflow-wrap: anywhere; }
.today-action:hover { transform: translateY(-2px); border-color: var(--action-color); box-shadow: 0 10px 24px rgba(23, 35, 33, 0.08); }

.today-queue-heading { padding-top: 4px; border-top: 1px solid var(--line-soft); }
.queue-empty-inline { grid-column: 1 / -1; min-height: 58px; display: grid; place-items: center start; color: var(--ink-500); text-align: left; }

.ui-v2 .wide-panel {
  display: grid;
  gap: 18px;
}

.ui-v2.study-route .sentence-space > .sentence-back { display: none; }

.ui-v2 .choice-option.text-compact strong { font-size: 17px; line-height: 1.32; }
.ui-v2 .choice-option.text-dense strong { font-size: 15px; line-height: 1.28; }
.ui-v2 .choice-option.text-micro strong { font-size: 13px; line-height: 1.24; }
.ui-v2 .choice-option.text-dense span,
.ui-v2 .choice-option.text-micro span { font-size: 12px; line-height: 1.25; }
.ui-v2 .choice-option strong,
.ui-v2 .choice-option span { max-width: 100%; overflow-wrap: anywhere; text-wrap: balance; }
.ui-v2 .meaning-prompt.text-compact strong,
.ui-v2 .cloze-prompt.text-compact { font-size: 24px; }
.ui-v2 .meaning-prompt.text-dense strong,
.ui-v2 .cloze-prompt.text-dense { font-size: 20px; }
.ui-v2 .meaning-prompt.text-micro strong,
.ui-v2 .cloze-prompt.text-micro { font-size: 17px; line-height: 1.42; }

@media (min-width: 861px) {
  .ui-v2 .dashboard { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ui-v2 .workspace > .topbar,
  .ui-v2 .workspace > .banner,
  .ui-v2 .workspace > section,
  .ui-v2 .workspace > .sentence-space { width: min(1280px, 100%); margin-inline: auto; }

  .ui-v2 .study-view {
    min-height: calc(100vh - 126px);
    padding-top: 2px;
    place-items: start center;
  }

  .ui-v2 .study-card {
    width: min(920px, 100%);
    min-height: min(620px, calc(100vh - 132px));
    padding: 28px 40px 32px;
    gap: 18px;
  }

  .ui-v2 .study-card > .study-next {
    position: static;
    width: min(340px, 100%);
    margin-top: 4px;
    justify-self: center;
  }

  .ui-v2 .study-card > .mobile-study-actions {
    position: static;
    width: min(760px, 100%);
    margin: 4px auto 0;
    justify-self: center;
  }

  .ui-v2 .study-card .choice-grid { width: min(760px, 100%); justify-self: center; }
  .ui-v2 .study-card .feedback { width: min(760px, 100%); justify-self: center; }
  .ui-v2 .study-card .feedback-audio-flag { justify-self: center; }
  .ui-v2 .sentence-card .pattern-details,
  .ui-v2 .sentence-card .output-comparison { max-height: 220px; overflow-y: auto; }

  .ui-v2 .review-setup-panel { width: min(640px, 100%); }
  .ui-v2 .review-summary-panel { width: min(820px, 100%); }
  .ui-v2 .review-summary,
  .ui-v2 .review-setup { min-height: calc(100vh - 126px); align-items: start; padding-top: 2px; }

  .ui-v2 .sentence-home { align-content: start; }
  .ui-v2 .sentence-note { width: min(920px, 100%); }
}

@media (max-width: 860px) {
  .today-actions { grid-template-columns: 1fr; gap: 8px; }
  .today-action { min-height: 68px; padding-block: 10px; }
  .ui-v2 .wide-panel { gap: 14px; }

  .ui-v2.study-route .audio-prompt {
    min-height: 140px;
    gap: 8px;
    padding-top: 4px;
    font-size: 18px;
  }

  .ui-v2.study-route .audio-play { width: 82px; height: 82px; }
  .ui-v2.study-route .flag-inline { min-height: 32px; font-size: 13px; }
  .ui-v2.study-route .choice-option { min-height: 76px; max-height: 104px; overflow: hidden; }
  .ui-v2.study-route .choice-option.text-compact strong { font-size: 16px; }
  .ui-v2.study-route .choice-option.text-dense strong { font-size: 14px; }
  .ui-v2.study-route .choice-option.text-micro strong { font-size: 12px; }
  .ui-v2.study-route .choice-option.text-dense span,
  .ui-v2.study-route .choice-option.text-micro span { font-size: 11px; }
  .ui-v2.study-route .meaning-prompt.text-compact strong,
  .ui-v2.study-route .cloze-prompt.text-compact { font-size: 21px; }
  .ui-v2.study-route .meaning-prompt.text-dense strong,
  .ui-v2.study-route .cloze-prompt.text-dense { font-size: 18px; }
  .ui-v2.study-route .meaning-prompt.text-micro strong,
  .ui-v2.study-route .cloze-prompt.text-micro { font-size: 15px; }
}

@media (max-width: 340px), (max-height: 620px) {
  .ui-v2.study-route .choice-option { min-height: 62px; max-height: 82px; padding: 6px; }
  .ui-v2.study-route .choice-option.text-compact strong { font-size: 14px; }
  .ui-v2.study-route .choice-option.text-dense strong { font-size: 12px; line-height: 1.2; }
  .ui-v2.study-route .choice-option.text-micro strong { font-size: 10.5px; line-height: 1.16; }
  .ui-v2.study-route .choice-option.text-dense span,
  .ui-v2.study-route .choice-option.text-micro span { font-size: 10px; }
  .ui-v2.study-route .audio-prompt { min-height: 116px; gap: 5px; font-size: 15px; }
  .ui-v2.study-route .audio-play { width: 68px; height: 68px; }
  .ui-v2.study-route .meaning-prompt.text-micro strong,
  .ui-v2.study-route .cloze-prompt.text-micro { font-size: 13px; }
}

/* M4 wide-screen stage: the answer card stays on the content centerline. */
.study-stage-motif { display: none; }

@media (min-width: 861px) {
  .ui-v2.guide-enabled.study-route .workspace {
    background-color: var(--surface-page);
    background-image: url("./vocab-new-xLKELXtF.webp");
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
  }
}

@media (min-width: 1700px) {
  .ui-v2 .character-stage {
    position: relative;
    width: 100%;
    min-height: 800px;
    padding-top: 36px;
    display: grid;
    grid-template-columns: minmax(0, 920px);
    grid-template-rows: auto;
    align-items: start;
    justify-content: center;
  }

  .ui-v2 .character-stage > .study-card {
    z-index: 2;
    grid-column: 1;
    grid-row: 1;
    width: min(920px, 100%);
    min-height: min(760px, calc(100vh - 118px));
    padding: 30px 40px 112px;
    gap: 22px;
    border-color: color-mix(in srgb, var(--mode-primary) 34%, var(--line-soft));
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.965);
    backdrop-filter: blur(2px);
    box-shadow: 0 20px 54px rgba(28, 43, 49, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  }

  .ui-v2 .character-stage > .study-theme-decor {
    position: absolute;
    z-index: 1;
    top: 126px;
    right: calc(50% + 500px);
    width: 220px;
    height: 360px;
    padding: 8px;
    display: block;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 48%, var(--line-soft));
    border-left: 4px solid var(--mode-primary);
    border-radius: 5px;
    background: rgba(242, 247, 249, 0.9);
    color: var(--mode-strong);
    box-shadow: 0 16px 34px rgba(28, 43, 49, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.76);
    opacity: 1;
    pointer-events: none;
  }

  .ui-v2 .study-theme-decor img { width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0.76; mix-blend-mode: multiply; }
  .ui-v2 .study-theme-decor > span { position: absolute; right: 13px; bottom: 12px; display: flex; gap: 8px; color: var(--mode-strong); }
  .ui-v2 .study-theme-decor > span svg { width: 17px; height: 17px; }

  .ui-v2 .guide-character {
    position: absolute;
    z-index: 1;
    top: 36px;
    left: calc(50% + 488px);
    width: 300px;
    min-height: 760px;
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: end;
  }

  .ui-v2 .guide-message {
    width: min(238px, 100%);
    margin-top: 34px;
    border-color: color-mix(in srgb, var(--mode-primary) 36%, white);
    color: var(--mode-strong);
    box-shadow: 0 12px 30px rgba(28, 43, 49, 0.12);
  }
  .ui-v2 .guide-art-frame { height: 665px; overflow: visible; }
  .ui-v2 .guide-art-frame img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
  .ui-v2 .guide-heart-trail { color: var(--mode-primary); }

  .ui-v2 .study-stage-motif {
    position: absolute;
    z-index: 3;
    left: 50%;
    width: min(700px, 72%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    color: var(--mode-primary);
    opacity: 0.3;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .ui-v2 .study-stage-motif i { height: 1px; flex: 1 1 auto; background: currentColor; }
  .ui-v2 .study-stage-motif svg { width: 18px; height: 18px; fill: currentColor; }
  .ui-v2 .study-stage-motif svg:nth-of-type(2) { width: 26px; height: 26px; }
  .ui-v2 .motif-top { top: 19px; }
  .ui-v2 .motif-bottom { bottom: -3px; }

  .ui-v2 .character-stage:not(.sentence-study-view) > .study-card > .study-next {
    position: absolute;
    right: auto;
    bottom: 38px;
    left: 50%;
    width: min(360px, calc(100% - 80px));
    margin: 0;
    transform: translateX(-50%);
  }

  .ui-v2 .character-stage:not(.sentence-study-view) > .study-card > .study-next:hover:not(:disabled) {
    transform: translateX(-50%) translateY(-1px);
  }

  .ui-v2 .character-stage:not(.sentence-study-view) > .study-card > .mobile-study-actions {
    position: absolute;
    right: 40px;
    bottom: 38px;
    left: 40px;
    width: auto;
    margin: 0;
  }

  .ui-v2 .character-stage .input-prompt { min-height: 190px; }
  .ui-v2 .character-stage .meaning-prompt { min-height: 180px; }
  .ui-v2 .character-stage .audio-prompt { min-height: 220px; }
  .ui-v2 .character-stage .choice-option { min-height: 96px; }
  .ui-v2 .character-stage .themed-action .action-motif { opacity: 0.22; }
  .ui-v2 .character-stage .themed-action {
    border: 1px solid color-mix(in srgb, var(--mode-strong) 78%, white);
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), inset 0 0 18px rgba(255, 255, 255, 0.08), 0 8px 18px color-mix(in srgb, var(--mode-primary) 20%, transparent);
  }
}

@media (max-width: 860px) {
  .ui-v2.study-route .study-theme-decor { display: none; }
  .ui-v2.study-route .study-stage-motif { display: none; }
  .ui-v2.study-route .motif-top {
    position: absolute;
    z-index: 0;
    top: 50px;
    right: 16px;
    width: 76px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--mode-primary);
    opacity: 0.08;
    pointer-events: none;
  }
  .ui-v2.study-route .motif-top i { display: none; }
  .ui-v2.study-route .motif-top svg { width: 17px; height: 17px; fill: currentColor; }
}

/* M4 anime cyber study stage. The learning mode owns the accent; Katan stays a supporting character. */
.ui-v2 .character-stage.theme-vocab-new {
  --mode-primary: #18d8ff;
  --mode-strong: #03a9dc;
  --mode-soft: #092b49;
  --mode-line: #197aa8;
  --success-600: var(--mode-primary);
  --success-100: var(--mode-soft);
}

.ui-v2 .character-stage.theme-vocab-review {
  --mode-primary: #ff4f91;
  --mode-strong: #e93278;
  --mode-soft: #3a1538;
  --mode-line: #a52d6a;
  --success-600: var(--mode-primary);
  --success-100: var(--mode-soft);
}

.ui-v2 .character-stage.theme-sentence-new {
  --mode-primary: #a879ff;
  --mode-strong: #8355e8;
  --mode-soft: #25194b;
  --mode-line: #6246a9;
  --success-600: var(--mode-primary);
  --success-100: var(--mode-soft);
}

.ui-v2 .character-stage.theme-sentence-review {
  --mode-primary: #ffc44f;
  --mode-strong: #e69825;
  --mode-soft: #392a18;
  --mode-line: #9f6e2a;
  --success-600: var(--mode-primary);
  --success-100: var(--mode-soft);
}

.ui-v2.study-route:has(.theme-vocab-new) { --page-accent: #18d8ff; }
.ui-v2.study-route:has(.theme-vocab-review) { --page-accent: #ff4f91; }
.ui-v2.study-route:has(.theme-sentence-new) { --page-accent: #a879ff; }
.ui-v2.study-route:has(.theme-sentence-review) { --page-accent: #ffc44f; }

.ui-v2.study-route .sidebar .nav.active,
.ui-v2.study-route .sidebar .nav:hover,
.ui-v2.study-route .mobile-nav .nav.active {
  color: #ffffff;
  border-left: 3px solid var(--page-accent);
  background: color-mix(in srgb, var(--page-accent) 18%, #243b39);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--page-accent) 10%, transparent);
}

@media (min-width: 861px) {
  .ui-v2.guide-enabled.study-route .workspace {
    color: #eaf8ff;
    background-color: #03051a;
    background-image: url("./vocab-new-xLKELXtF.webp");
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
  }

  .ui-v2.guide-enabled.study-route .topbar h1 { color: #f3fbff; text-shadow: 0 0 16px rgba(24, 216, 255, 0.34); }
  .ui-v2.guide-enabled.study-route .topbar p { color: #9db6c9; }
  .ui-v2.guide-enabled.study-route .sync-pill {
    color: #c7e9f4;
    border: 1px solid rgba(24, 216, 255, 0.28);
    background: rgba(3, 9, 32, 0.86);
    box-shadow: 0 0 20px rgba(24, 216, 255, 0.12);
  }

  .ui-v2.guide-enabled.study-route .character-stage > .study-card {
    color: #edfaff;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 72%, #0c2142);
    border-top: 3px solid var(--mode-primary);
    border-radius: 3px;
    background: rgba(4, 9, 31, 0.94);
    box-shadow: 0 0 0 1px rgba(8, 25, 57, 0.9), 0 0 34px color-mix(in srgb, var(--mode-primary) 16%, transparent), 0 28px 70px rgba(0, 0, 12, 0.58);
    backdrop-filter: blur(7px);
  }

  .ui-v2.guide-enabled.study-route .study-session-header,
  .ui-v2.guide-enabled.study-route .study-session-header > span,
  .ui-v2.guide-enabled.study-route .question-instruction,
  .ui-v2.guide-enabled.study-route .audio-prompt,
  .ui-v2.guide-enabled.study-route .meaning-prompt span,
  .ui-v2.guide-enabled.study-route .kana,
  .ui-v2.guide-enabled.study-route .cloze-prompt span,
  .ui-v2.guide-enabled.study-route .sentence-reading-prompt span { color: #a9c0d2; }

  .ui-v2.guide-enabled.study-route .study-session-header strong,
  .ui-v2.guide-enabled.study-route .jp-word,
  .ui-v2.guide-enabled.study-route .input-prompt,
  .ui-v2.guide-enabled.study-route .meaning-prompt strong,
  .ui-v2.guide-enabled.study-route .cloze-prompt,
  .ui-v2.guide-enabled.study-route .sentence-reading-prompt strong,
  .ui-v2.guide-enabled.study-route .pattern-title,
  .ui-v2.guide-enabled.study-route .sentence-example { color: #f3fbff; }

  .ui-v2.guide-enabled.study-route .cloze-prompt {
    color: #f3fbff;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 38%, #233957);
    background: rgba(8, 20, 48, 0.88);
    box-shadow: inset 0 0 20px color-mix(in srgb, var(--mode-primary) 7%, transparent);
  }

  .ui-v2.guide-enabled.study-route .sentence-reading-prompt {
    border: 1px solid color-mix(in srgb, var(--mode-primary) 38%, #233957);
    background: rgba(8, 20, 48, 0.88);
    box-shadow: inset 0 0 20px color-mix(in srgb, var(--mode-primary) 7%, transparent);
  }

  .ui-v2.guide-enabled.study-route .jp-word,
  .ui-v2.guide-enabled.study-route .input-prompt,
  .ui-v2.guide-enabled.study-route .pattern-title {
    text-shadow: 0 0 18px color-mix(in srgb, var(--mode-primary) 30%, transparent);
  }

  .ui-v2.guide-enabled.study-route .study-exit { color: #a9c0d2; }
  .ui-v2.guide-enabled.study-route .study-exit:hover { color: var(--mode-primary); background: var(--mode-soft); }
  .ui-v2.guide-enabled.study-route .session-progress,
  .ui-v2.guide-enabled.study-route .progress-dots i,
  .ui-v2.guide-enabled.study-route .smart-evidence { background: #12223b; }
  .ui-v2.guide-enabled.study-route .session-progress i,
  .ui-v2.guide-enabled.study-route .progress-dots i.filled,
  .ui-v2.guide-enabled.study-route .smart-evidence i { box-shadow: 0 0 10px var(--mode-primary); }

  .ui-v2.guide-enabled.study-route .type-pill {
    color: #020818;
    background: var(--mode-primary);
    box-shadow: 0 0 14px color-mix(in srgb, var(--mode-primary) 45%, transparent);
  }
  .ui-v2.guide-enabled.study-route .question-meta > span:last-child { color: var(--mode-primary); }

  .ui-v2.guide-enabled.study-route .choice-option {
    color: #eaf8ff;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 34%, #233957);
    border-radius: 3px;
    background: rgba(8, 20, 48, 0.86);
    box-shadow: inset 0 0 0 1px rgba(125, 199, 231, 0.04);
  }
  .ui-v2.guide-enabled.study-route .choice-option strong { color: #f0fbff; }
  .ui-v2.guide-enabled.study-route .choice-option span { color: #91a9bc; }
  .ui-v2.guide-enabled.study-route .choice-option:hover:not(:disabled) {
    color: #ffffff;
    border-color: var(--mode-primary);
    background: var(--mode-soft);
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--mode-primary) 12%, transparent), 0 0 14px color-mix(in srgb, var(--mode-primary) 20%, transparent);
  }
  .ui-v2.guide-enabled.study-route .choice-option.correct {
    border-color: var(--mode-primary);
    background: color-mix(in srgb, var(--mode-soft) 78%, #091735);
    box-shadow: 0 0 18px color-mix(in srgb, var(--mode-primary) 28%, transparent);
  }
  .ui-v2.guide-enabled.study-route .choice-option.correct strong { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .choice-option.correct .choice-mark { color: var(--mode-primary); }
  .ui-v2.guide-enabled.study-route .choice-option.wrong {
    border-color: #ff6178;
    background: #42152a;
    box-shadow: 0 0 18px rgba(255, 97, 120, 0.22);
  }

  .ui-v2.guide-enabled.study-route .kana-form input,
  .ui-v2.guide-enabled.study-route .token-answer,
  .ui-v2.guide-enabled.study-route .pattern-details,
  .ui-v2.guide-enabled.study-route .output-comparison > div {
    color: #f3fbff;
    border-color: color-mix(in srgb, var(--mode-primary) 40%, #233957);
    background: rgba(8, 20, 48, 0.88);
  }
  .ui-v2.guide-enabled.study-route .kana-form input::placeholder { color: #718ca3; }
  .ui-v2.guide-enabled.study-route .kana-form input:focus {
    border-color: var(--mode-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mode-primary) 22%, transparent), 0 0 18px color-mix(in srgb, var(--mode-primary) 18%, transparent);
  }

  .ui-v2.guide-enabled.study-route .flag-inline {
    color: #c7e9f4;
    border-color: rgba(110, 194, 226, 0.28);
    background: rgba(7, 18, 42, 0.88);
  }
  .ui-v2.guide-enabled.study-route .feedback.correct {
    color: #f4fbff;
    border-color: var(--mode-primary);
    background: color-mix(in srgb, var(--mode-soft) 78%, #091735);
    box-shadow: 0 0 16px color-mix(in srgb, var(--mode-primary) 18%, transparent);
  }
  .ui-v2.guide-enabled.study-route .feedback.wrong { color: #ffd1d7; border-color: #8d3150; background: #371329; }

  .ui-v2.guide-enabled.study-route .study-theme-decor {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 74%, #172e55);
    border-left: 4px solid var(--mode-primary);
    border-radius: 2px;
    background: #050b22;
    box-shadow: 0 0 24px color-mix(in srgb, var(--mode-primary) 18%, transparent), inset 0 0 22px rgba(0, 0, 0, 0.42);
  }
  .ui-v2.guide-enabled.study-route .study-theme-decor img { opacity: 0.88; mix-blend-mode: normal; image-rendering: auto; }
  .ui-v2.guide-enabled.study-route .study-theme-decor > span { color: var(--mode-primary); filter: drop-shadow(0 0 5px currentColor); }

  .ui-v2.guide-enabled.study-route .guide-message {
    color: var(--mode-primary);
    border: 1px solid color-mix(in srgb, var(--mode-primary) 64%, #203657);
    border-radius: 3px;
    background: rgba(4, 10, 34, 0.92);
    box-shadow: 0 0 22px color-mix(in srgb, var(--mode-primary) 16%, transparent);
  }
  .ui-v2.guide-enabled.study-route .guide-message span { color: #b7cbd9; }
  .ui-v2.guide-enabled.study-route .guide-art-frame img { filter: drop-shadow(0 18px 24px rgba(0, 0, 15, 0.58)); }

  .ui-v2.guide-enabled.study-route .study-stage-motif {
    color: var(--mode-primary);
    opacity: 0.72;
    filter: drop-shadow(0 0 6px currentColor);
  }
  .ui-v2.guide-enabled.study-route .study-stage-motif svg { fill: none; stroke-width: 1.6; }
  .ui-v2.guide-enabled.study-route .study-stage-motif svg:nth-child(3) { width: 28px; height: 28px; }

  .ui-v2.guide-enabled.study-route .themed-action {
    color: #ffffff;
    border: 1px solid var(--mode-primary);
    border-radius: 3px;
    background: color-mix(in srgb, var(--mode-strong) 80%, #07132e);
    box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.07), 0 0 18px color-mix(in srgb, var(--mode-primary) 25%, transparent);
  }
  .ui-v2.guide-enabled.study-route .themed-action:hover:not(:disabled) {
    background: var(--mode-strong);
    box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.1), 0 0 24px color-mix(in srgb, var(--mode-primary) 38%, transparent);
  }
  .ui-v2.guide-enabled.study-route .themed-action .action-motif { color: #d9f8ff; opacity: 0.18; }
  .ui-v2.guide-enabled.study-route .themed-action .action-motif svg { fill: none; stroke-width: 1.5; }
}

@media (min-width: 1700px) {
  .ui-v2.guide-enabled.study-route .character-stage { padding-top: 58px; }
  .ui-v2.guide-enabled.study-route .character-stage > .study-card {
    min-height: min(730px, calc(100vh - 136px));
    padding-top: 34px;
  }
  .ui-v2.guide-enabled.study-route .motif-top { top: 32px; }
  .ui-v2.guide-enabled.study-route .motif-bottom { bottom: -1px; }
}

@media (max-width: 860px) {
  .ui-v2.guide-enabled.study-route .study-card {
    border-top-color: var(--mode-primary);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--mode-primary) 12%, rgba(23, 35, 33, 0.08));
  }
  .ui-v2.guide-enabled.study-route .themed-action {
    border: 1px solid var(--mode-primary);
    border-radius: 5px;
    box-shadow: 0 7px 18px color-mix(in srgb, var(--mode-primary) 20%, transparent);
  }
}

/* Each learning module uses a coordinated anime background in its own palette. */
@media (min-width: 861px) {
  .ui-v2.guide-enabled.study-route .workspace:has(.theme-vocab-new) {
    --page-accent: #18d8ff;
    background-image: url("./vocab-new-xLKELXtF.webp");
  }

  .ui-v2.guide-enabled.study-route .workspace:has(.theme-vocab-review) {
    --page-accent: #ff4f91;
    background-image: url("./vocab-review-xg2bKXvm.webp");
  }

  .ui-v2.guide-enabled.study-route .workspace:has(.theme-sentence-new) {
    --page-accent: #a879ff;
    background-image: url("./sentence-new-X9qXFwD3.webp");
  }

  .ui-v2.guide-enabled.study-route .workspace:has(.theme-sentence-review) {
    --page-accent: #ffc44f;
    background-image: url("./sentence-review-DngHCBGI.webp");
  }

  .ui-v2.guide-enabled.study-route .topbar {
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--page-accent, #18d8ff) 28%, #263a5a);
    border-left: 3px solid var(--page-accent, #18d8ff);
    border-radius: 3px;
    background: rgba(4, 10, 31, 0.82);
    box-shadow: 0 12px 28px rgba(0, 0, 14, 0.24);
  }

  .ui-v2.guide-enabled.study-route .topbar h1 { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .topbar p { color: #c3d6e3; }

  .ui-v2.guide-enabled.study-route .character-stage > .study-card {
    background: rgba(5, 12, 35, 0.92);
    box-shadow: 0 0 0 1px rgba(12, 31, 64, 0.88), 0 0 30px color-mix(in srgb, var(--mode-primary) 14%, transparent), 0 28px 68px rgba(0, 0, 14, 0.52);
  }

  .ui-v2.guide-enabled.study-route .guide-heart-trail {
    color: color-mix(in srgb, var(--mode-primary) 74%, #ff5f9e);
  }

  .ui-v2.guide-enabled.study-route .hidden-meaning,
  .ui-v2.guide-enabled.study-route .sentence-question-hint {
    color: #c0d2df;
  }

  .ui-v2.guide-enabled.study-route .pattern-main {
    color: #f7fcff;
    text-shadow: 0 0 20px color-mix(in srgb, var(--mode-primary) 28%, transparent);
  }

  .ui-v2.guide-enabled.study-route .pattern-structure {
    color: #eefbff;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 42%, #244064);
    background: color-mix(in srgb, var(--mode-soft) 72%, #081735);
  }

  .ui-v2.guide-enabled.study-route .sentence-example { color: #f4fbff; }
  .ui-v2.guide-enabled.study-route .sentence-example span { color: #b8cedc; }

  .ui-v2.guide-enabled.study-route .sentence-card .pattern-details,
  .ui-v2.guide-enabled.study-route .sentence-card .output-comparison,
  .ui-v2.guide-enabled.study-route .sentence-card > .mobile-study-actions,
  .ui-v2.guide-enabled.study-route .sentence-card > .choice-grid,
  .ui-v2.guide-enabled.study-route .sentence-card > .feedback {
    width: min(760px, 100%);
    justify-self: center;
  }

  .ui-v2.guide-enabled.study-route .pattern-details {
    color: #d7e7f0;
    border-color: color-mix(in srgb, var(--mode-primary) 42%, #294365);
    background: rgba(8, 20, 48, 0.9);
  }

  .ui-v2.guide-enabled.study-route .pattern-details strong { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .pattern-details span { color: #d7e7f0; }
  .ui-v2.guide-enabled.study-route .pattern-details b { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .pattern-details .tag-row span {
    color: #f3fbff;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 42%, #38516f);
    background: color-mix(in srgb, var(--mode-soft) 76%, #0b1b3d);
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .mobile-study-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .mobile-study-actions button {
    min-height: 50px;
    color: #edfaff;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 46%, #34506f);
    border-radius: 3px;
    background: rgba(12, 29, 61, 0.92);
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .mobile-study-actions button:hover:not(:disabled) {
    border-color: var(--mode-primary);
    background: var(--mode-soft);
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .mobile-study-actions button.success {
    color: #ffffff;
    border-color: var(--mode-primary);
    background: var(--mode-strong);
    box-shadow: 0 0 18px color-mix(in srgb, var(--mode-primary) 22%, transparent);
  }

  .ui-v2.guide-enabled.study-route .study-card .answer-grid button.success,
  .ui-v2.guide-enabled.study-route .study-card .actions button.success {
    color: #ffffff;
    border-color: var(--mode-primary);
    background: var(--mode-strong);
    box-shadow: 0 0 18px color-mix(in srgb, var(--mode-primary) 22%, transparent);
  }

  .ui-v2.guide-enabled.study-route .review-setup {
    min-height: calc(100vh - 132px);
    align-content: center;
    color: #edfaff;
    background: transparent;
  }

  .ui-v2.guide-enabled.study-route .review-summary {
    min-height: calc(100vh - 132px);
    align-content: center;
    background: transparent;
  }

  .ui-v2.guide-enabled.study-route .review-setup-panel,
  .ui-v2.guide-enabled.study-route .review-summary-panel,
  .ui-v2.guide-enabled.study-route .sentence-finished {
    color: #edfaff;
    border-color: color-mix(in srgb, var(--mode-primary) 48%, #294365);
    background: rgba(5, 12, 35, 0.94);
    box-shadow: 0 20px 52px rgba(0, 0, 14, 0.46);
  }

  .ui-v2.guide-enabled.study-route .review-setup-panel h2,
  .ui-v2.guide-enabled.study-route .review-summary-panel h2,
  .ui-v2.guide-enabled.study-route .sentence-finished h2 { color: #ffffff; }

  .ui-v2.guide-enabled.study-route .review-setup-panel p,
  .ui-v2.guide-enabled.study-route .review-summary-panel p,
  .ui-v2.guide-enabled.study-route .sentence-finished p,
  .ui-v2.guide-enabled.study-route .review-due-count,
  .ui-v2.guide-enabled.study-route .minute-input { color: #c9dce7; }

  .ui-v2.guide-enabled.study-route .minute-presets button,
  .ui-v2.guide-enabled.study-route .minute-input input,
  .ui-v2.guide-enabled.study-route .review-summary-actions button:not(.primary) {
    color: #edfaff;
    border-color: color-mix(in srgb, var(--mode-primary) 42%, #34506f);
    background: rgba(12, 29, 61, 0.92);
  }

  .ui-v2.guide-enabled.study-route .summary-grid .metric,
  .ui-v2.guide-enabled.study-route .completion-stats > div {
    border-color: color-mix(in srgb, var(--mode-primary) 36%, #34506f);
    background: rgba(8, 20, 48, 0.72);
  }

  .ui-v2.guide-enabled.study-route .summary-grid .metric span,
  .ui-v2.guide-enabled.study-route .completion-stats span { color: #c9dce7; }

  .ui-v2.guide-enabled.study-route .summary-grid .metric strong,
  .ui-v2.guide-enabled.study-route .completion-stats strong { color: #ffffff; }

  .ui-v2.guide-enabled.study-route .review-setup > .review-exit {
    color: #d2e5ef;
    border: 1px solid rgba(137, 190, 216, 0.24);
    background: rgba(4, 10, 31, 0.82);
  }

  .ui-v2.guide-enabled.study-route .review-setup > .empty {
    width: min(520px, 100%);
    min-height: 170px;
    margin: auto;
    align-content: center;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 48%, #294365);
    border-top: 3px solid var(--mode-primary);
    border-radius: 3px;
    color: #d7e7f0;
    background: rgba(5, 12, 35, 0.92);
    box-shadow: 0 20px 52px rgba(0, 0, 14, 0.46);
  }

  .ui-v2.guide-enabled.study-route .review-setup > .empty h2 { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .review-setup > .empty p { color: #bfd2df; }
}

/* Q版 Katan sits on the card edge so feedback stays in the learner's focal area. */
@keyframes chibi-breathe {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes chibi-listen {
  0%, 100% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-5px) rotate(-3deg); }
  70% { transform: translateY(-2px) rotate(3deg); }
}

@keyframes chibi-correct-pop {
  0% { opacity: 0; transform: translateY(38px) scale(0.72) rotate(-8deg); }
  48% { opacity: 1; transform: translateY(-16px) scale(1.12) rotate(5deg); }
  72% { transform: translateY(3px) scale(0.97) rotate(-2deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}

@keyframes chibi-encourage-drop {
  0% { opacity: 0; transform: translateY(-18px) scale(1.08); }
  42% { opacity: 1; transform: translateY(12px) scale(0.96); }
  68% { transform: translateY(5px) translateX(-4px); }
  82% { transform: translateY(5px) translateX(4px); }
  100% { transform: translateY(5px) translateX(0); }
}

@keyframes answer-card-correct {
  0%, 100% { transform: translateY(0); }
  34% {
    transform: translateY(-3px);
    border-color: var(--mode-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--mode-primary) 72%, transparent), 0 0 64px color-mix(in srgb, var(--mode-primary) 48%, transparent), 0 28px 68px rgba(0, 0, 14, 0.52);
  }
}

@keyframes answer-card-wrong {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-8px); }
  34% { transform: translateX(7px); }
  50% { transform: translateX(-5px); }
  66% { transform: translateX(4px); }
  82% { transform: translateX(-2px); }
}

@media (min-width: 1100px) {
  .ui-v2.guide-enabled.study-route .character-stage { padding-top: 105px; }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character {
    position: absolute;
    z-index: 10;
    top: -104px;
    left: 50%;
    width: 168px;
    height: 168px;
    min-height: 0;
    display: grid;
    place-items: center;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 9px 14px rgba(0, 0, 14, 0.45));
  }

  .ui-v2.guide-enabled.study-route .guide-idle > img { animation: chibi-breathe 3s ease-in-out infinite; }
  .ui-v2.guide-enabled.study-route .guide-speaking > img { animation: chibi-listen 1.15s ease-in-out infinite; }
  .ui-v2.guide-enabled.study-route .guide-correct > img { animation: chibi-correct-pop 720ms var(--ease-out) both; }
  .ui-v2.guide-enabled.study-route .guide-encourage > img { animation: chibi-encourage-drop 760ms var(--ease-out) both; }
  .ui-v2.guide-enabled.study-route .guide-celebrate > img { animation: chibi-correct-pop 720ms var(--ease-out) both; }

  .ui-v2.guide-enabled.study-route .chibi-guide-caption {
    position: absolute;
    top: 90px;
    left: calc(100% - 3px);
    min-width: 94px;
    max-width: 180px;
    padding: 7px 10px;
    border: 1px solid color-mix(in srgb, var(--mode-primary) 60%, #365071);
    border-radius: 3px;
    color: #f5fbff;
    background: rgba(5, 12, 35, 0.94);
    box-shadow: 0 0 16px color-mix(in srgb, var(--mode-primary) 18%, transparent);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
  }

  .ui-v2.guide-enabled.study-route .guide-correct .chibi-guide-caption {
    color: #ffffff;
    border-color: var(--mode-primary);
    background: var(--mode-strong);
  }

  .ui-v2.guide-enabled.study-route .guide-encourage .chibi-guide-caption {
    border-color: #ff6178;
    background: #42152a;
  }

  .ui-v2.guide-enabled.study-route .motif-top { display: none; }
}

@media (min-width: 1700px) {
  .ui-v2.guide-enabled.study-route .character-stage { padding-top: 112px; }
  .ui-v2.guide-enabled.study-route .study-card > .guide-character {
    top: -110px;
    left: 50%;
    width: 178px;
    height: 178px;
  }
}

@media (max-width: 1099px) {
  .ui-v2.guide-enabled.study-route .study-card > .guide-character {
    position: absolute;
    z-index: 6;
    top: 112px;
    left: -22px;
    width: 116px;
    height: 116px;
    min-height: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 7px 11px rgba(0, 0, 14, 0.42));
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character.guide-idle {
    height: 154px;
  }

  .ui-v2.guide-enabled.study-route .guide-idle > img {
    content: url("./mobile-idle-CH_NO5W1.png");
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character .chibi-guide-caption { display: none; }
  .ui-v2.guide-enabled.study-route .guide-idle > img { animation: chibi-breathe 3s ease-in-out infinite; }
  .ui-v2.guide-enabled.study-route .guide-speaking > img { animation: chibi-listen 1.15s ease-in-out infinite; }
  .ui-v2.guide-enabled.study-route .guide-correct > img { animation: chibi-correct-pop 720ms var(--ease-out) both; }
  .ui-v2.guide-enabled.study-route .guide-encourage > img { animation: chibi-encourage-drop 760ms var(--ease-out) both; }
  .ui-v2.guide-enabled.study-route .guide-celebrate > img { animation: chibi-correct-pop 720ms var(--ease-out) both; }
}

@media (max-width: 860px) {
  .ui-v2.guide-enabled.study-route .study-card > .guide-character {
    position: fixed;
    top: max(104px, calc(env(safe-area-inset-top) + 92px));
    left: -14px;
    width: clamp(82px, 23vw, 100px);
    height: clamp(82px, 23vw, 100px);
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character.guide-idle {
    left: -5px;
    width: clamp(88px, 24vw, 106px);
    height: clamp(128px, 34vw, 150px);
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .guide-character {
    top: max(2px, env(safe-area-inset-top));
    right: 70px;
    left: auto;
    width: 56px;
    height: 56px;
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .guide-character.guide-idle {
    right: 72px;
    left: auto;
    width: 48px;
    height: 72px;
  }
}

@media (max-width: 430px) {
  .ui-v2.guide-enabled.study-route .study-card > .guide-character {
    top: max(98px, calc(env(safe-area-inset-top) + 86px));
    left: -24px;
    width: clamp(72px, 20vw, 84px);
    height: clamp(72px, 20vw, 84px);
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character.guide-idle {
    left: -18px;
    width: clamp(76px, 21vw, 88px);
    height: clamp(110px, 30vw, 126px);
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .guide-character {
    top: max(1px, env(safe-area-inset-top));
    right: 66px;
    left: auto;
    width: 52px;
    height: 52px;
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .guide-character.guide-idle {
    right: 68px;
    left: auto;
    width: 46px;
    height: 70px;
  }
}

@media (max-width: 340px), (max-height: 620px) {
  .ui-v2.guide-enabled.study-route .study-card > .guide-character {
    top: max(82px, calc(env(safe-area-inset-top) + 72px));
    left: -13px;
    width: 72px;
    height: 72px;
  }

  .ui-v2.guide-enabled.study-route .study-card > .guide-character.guide-idle {
    left: -7px;
    width: 76px;
    height: 108px;
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .guide-character {
    top: env(safe-area-inset-top);
    right: 58px;
    left: auto;
    width: 46px;
    height: 46px;
  }

  .ui-v2.guide-enabled.study-route .sentence-card > .guide-character.guide-idle {
    right: 60px;
    left: auto;
    width: 42px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-v2.guide-enabled.study-route .study-card > .guide-character > img { animation: none; }
}

/* M5 deterministic scene challenges. */
.challenge-map,
.challenge-detail,
.challenge-result,
.challenge-empty {
  width: min(1180px, 100%);
  margin-inline: auto;
}

.challenge-map > header {
  min-height: 180px;
  padding: 28px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid rgba(34, 91, 78, 0.16);
  border-radius: var(--radius-panel);
  color: #f9fffc;
  background: radial-gradient(circle at 82% 30%, rgba(255, 204, 105, 0.2), transparent 24%), linear-gradient(128deg, #153d36, #246454);
  box-shadow: var(--shadow-panel);
}
.challenge-map > header span { color: #a9e3d4; font-size: 12px; font-weight: 900; letter-spacing: 0.16em; }
.challenge-map > header h2 { margin: 7px 0 4px; font-size: clamp(26px, 3vw, 38px); }
.challenge-map > header p { color: #d1e9e2; }
.challenge-map > header > svg { flex: 0 0 auto; color: #ffd27b; }
.challenge-level-section { display: grid; gap: 4px; }
.challenge-level-heading { padding: 26px 26px 0; display: flex; align-items: center; gap: 13px; }
.challenge-level-heading > span { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #276f60, #d79a35); box-shadow: 0 8px 20px rgba(33, 89, 76, 0.2); font-size: 18px; font-weight: 900; }
.challenge-level-heading h3 { margin: 0; font-size: 22px; }
.challenge-level-heading p { margin-top: 3px; color: var(--ink-500); font-size: 13px; }
.challenge-level-progress { width: min(230px, 28vw); margin-left: auto; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 10px; }
.challenge-level-progress strong { color: #286b5c; font-size: 20px; }
.challenge-level-progress span { color: var(--ink-500); font-size: 12px; font-weight: 700; text-align: right; }
.challenge-level-progress i { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 999px; background: #e1e9e5; }
.challenge-level-progress b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2d806c, #efb64f); transition: width 300ms ease; }
.challenge-map-track { position: relative; padding: 34px 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 340px)); gap: 28px; }
.challenge-map-track::before { display: none; }
.challenge-map-card { position: relative; min-height: 370px; padding: 24px; display: grid; align-content: start; gap: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-panel); background: var(--surface-panel); box-shadow: var(--shadow-card); }
.challenge-map-card.locked { filter: saturate(0.7); }
.challenge-map-card.passed { border-color: rgba(207, 151, 36, 0.5); background: linear-gradient(150deg, #fffdf5, #fff8df); }
.challenge-node { position: absolute; z-index: 2; top: 34px; left: 34px; width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid rgba(255, 255, 255, 0.94); border-radius: 50%; color: #fff; background: #2c7766; box-shadow: 0 5px 14px rgba(16, 55, 46, 0.28); font-weight: 900; }
.challenge-card-art { min-height: 96px; display: grid; place-items: center; border-radius: var(--radius-control); color: #23705d; background: linear-gradient(135deg, #def1eb, #fff4dc); }
.challenge-card-art.scene-art { min-height: 150px; background-position: center; background-size: cover; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.challenge-map-card.locked .challenge-card-art.scene-art { filter: grayscale(0.65) brightness(0.72); }
.challenge-card-art.scene-art > svg { padding: 8px; border-radius: 50%; color: #fff; background: rgba(24, 48, 43, 0.72); }
.challenge-card-art svg + svg { position: absolute; top: 32px; right: 35px; color: #675f59; }
.challenge-card-status { justify-self: start; padding: 4px 9px; border-radius: 999px; color: #236553; background: #e1f2ec; font-size: 12px; font-weight: 800; }
.challenge-map-card.locked .challenge-card-status { color: #665f5b; background: #ece9e6; }
.challenge-map-card.passed .challenge-card-status { color: #7b5816; background: #fff0bd; }
.challenge-map-card h3 { margin: 0; font-size: 24px; }
.challenge-map-card p { min-height: 44px; color: var(--ink-500); line-height: 1.5; }
.challenge-map-card > small { color: var(--ink-500); }
.challenge-map-card > button { min-height: 44px; margin-top: auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #28715f; border-radius: var(--radius-control); color: #236553; background: #fff; font-weight: 800; }
.challenge-unlock-bar { height: 8px; overflow: hidden; border-radius: 999px; background: #e7ece9; }
.challenge-unlock-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2d806c, #efb64f); }

.challenge-back { min-height: 42px; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 7px; border: 0; color: var(--ink-600); background: transparent; }
.challenge-detail { display: grid; gap: 18px; }
.challenge-detail-hero { min-height: 260px; padding: 30px 36px; display: grid; grid-template-columns: 1fr 220px; align-items: center; overflow: hidden; border-radius: var(--radius-panel); color: #fff; background: radial-gradient(circle at 82% 38%, rgba(255, 196, 95, 0.28), transparent 28%), linear-gradient(130deg, #163f38, #286b5c); box-shadow: var(--shadow-panel); }
.challenge-detail-hero h2 { margin: 10px 0 7px; font-size: clamp(32px, 4vw, 46px); }
.challenge-detail-hero p { color: #d5ebe5; font-size: 16px; }
.challenge-detail-hero img { width: 100%; height: 210px; object-fit: cover; object-position: 58% center; align-self: center; border: 2px solid rgba(255, 255, 255, 0.28); border-radius: 18px; box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24); }
.challenge-level { padding: 5px 10px; border: 1px solid rgba(255, 255, 255, 0.26); border-radius: 999px; color: #ffe2a7; font-size: 12px; font-weight: 800; }
.challenge-meta { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 16px; }
.challenge-meta span { display: inline-flex; align-items: center; gap: 7px; color: #f0faf7; }
.challenge-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.challenge-detail-grid article { padding: 20px; display: grid; align-content: start; gap: 11px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); background: var(--surface-panel); box-shadow: var(--shadow-card); }
.challenge-detail-grid h3 { margin: 0; }
.challenge-detail-grid p,
.challenge-detail-grid small { color: var(--ink-500); }
.challenge-checkline { display: flex; align-items: center; gap: 8px; color: var(--ink-700); }
.challenge-checkline svg { color: #2c7b68; }
.challenge-tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.challenge-tag-list span { padding: 6px 9px; border-radius: 999px; color: #296756; background: #e5f3ee; font-size: 12px; }
.challenge-tag-list span.missing { color: #765f55; background: #eeeae7; }
.challenge-scene-words { display: grid; gap: 8px; }
.challenge-scene-words > div { padding: 9px 10px; display: grid; grid-template-columns: auto 1fr; gap: 3px 9px; border-radius: 8px; background: #edf7f3; }
.challenge-scene-words > div.missing { background: #f1eeeb; }
.challenge-scene-words strong { color: #245f50; }
.challenge-scene-words span { color: var(--ink-700); }
.challenge-scene-words small { grid-column: 1 / -1; color: var(--ink-500); }
.challenge-lock-note { padding: 13px 15px; display: flex; align-items: center; gap: 9px; border-radius: var(--radius-control); color: #815723; background: #fff5db; }
.challenge-start { width: min(440px, 100%); min-height: 54px; justify-self: center; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-size: 16px; }

.challenge-run-shell { width: min(1080px, 100%); min-height: calc(100vh - 150px); margin-inline: auto; display: grid; grid-template-rows: auto minmax(300px, 1fr) auto; overflow: hidden; border: 1px solid rgba(32, 71, 63, 0.2); border-radius: var(--radius-panel); background: #f5faf8; box-shadow: var(--shadow-panel); }
.challenge-run-top { min-height: 64px; padding: 10px 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; color: #f6fffb; background: #183f37; }
.challenge-run-top > button { justify-self: start; display: inline-flex; align-items: center; gap: 6px; border: 0; color: #d7ebe5; background: transparent; }
.challenge-run-top > div { display: grid; justify-items: center; gap: 2px; }
.challenge-run-top > div span,
.challenge-run-top > span { color: #acd4c9; font-size: 12px; }
.challenge-run-top > span { justify-self: end; }
.challenge-vn-stage { position: relative; min-height: 430px; background-position: center; background-size: cover; isolation: isolate; }
.challenge-vn-stage::after { content: ""; position: absolute; inset: 40% 0 0; z-index: -1; background: linear-gradient(transparent, rgba(7, 18, 17, 0.58)); }
.challenge-vn-dialogue { position: absolute; right: 4%; bottom: 24px; left: 4%; padding: 22px 28px 20px; border: 1px solid rgba(255, 255, 255, 0.62); border-radius: 6px 22px 22px; color: #fafffd; background: linear-gradient(115deg, rgba(12, 34, 31, 0.93), rgba(27, 61, 53, 0.87)); box-shadow: 0 18px 38px rgba(0, 0, 0, 0.3); backdrop-filter: blur(12px); }
.challenge-vn-dialogue h2 { margin: 5px 0 6px; color: #fff; font-size: clamp(23px, 3vw, 34px); }
.challenge-vn-dialogue > p { color: #e0eeea; }
.challenge-vn-dialogue .challenge-kana { color: #b8dcd2; font-size: 14px; }
.challenge-speaker { color: #be4776; font-size: 12px; font-weight: 900; letter-spacing: 0.12em; }
.challenge-vn-dialogue .challenge-speaker { display: inline-block; margin-top: -36px; padding: 6px 13px; border-radius: 999px; color: #fff; background: #bd3f75; box-shadow: 0 6px 14px rgba(99, 20, 53, 0.28); }
.challenge-reply-audio { min-height: 34px; margin-top: 10px; display: flex; align-items: center; gap: 8px; color: #d5ebe5; font-size: 12px; }
.challenge-reply-audio.pending svg { animation: challenge-audio-pulse 1.2s ease-in-out infinite; }
.challenge-reply-audio.failed { color: #f2d5d5; }
.challenge-reply-audio audio { width: min(340px, 100%); height: 34px; }
@keyframes challenge-audio-pulse { 50% { opacity: 0.42; transform: scale(0.9); } }
.challenge-answer-panel { padding: 17px 26px 22px; display: grid; align-content: start; gap: 11px; background: #fff; }
.challenge-prompt { display: flex; align-items: center; gap: 8px; color: #275f52; font-weight: 800; }
.challenge-turn-feedback { padding: 11px 13px; display: flex; align-items: center; gap: 8px; border-radius: var(--radius-control); }
.challenge-turn-feedback.correct { color: #20604d; background: #e3f4ed; }
.challenge-turn-feedback.wrong { color: #8c3f43; background: #fff0f0; }
.challenge-hints { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.challenge-hints button { min-height: 36px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #ead6a5; border-radius: 999px; color: #7b5a23; background: #fff9e9; font-size: 12px; }
.challenge-hints button.revealed { border-radius: 10px; color: #5e4b29; background: #fff4d4; }
.challenge-hints button:disabled { opacity: 0.42; }
.challenge-text-entry { display: grid; gap: 7px; }
.challenge-text-entry > label { color: var(--ink-600); font-size: 12px; font-weight: 800; }
.challenge-text-entry > div { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.challenge-text-entry input { min-width: 0; height: 50px; padding: 0 15px; border: 1px solid #abc9c0; border-radius: var(--radius-control); color: var(--ink-900); background: #fbfffd; font-size: 16px; outline: none; }
.challenge-text-entry input:focus { border-color: #2b7765; box-shadow: 0 0 0 3px rgba(43, 119, 101, 0.13); }
.challenge-text-entry button { min-width: 108px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.challenge-text-entry > small { color: var(--ink-500); }
.challenge-final-panel { align-content: center; justify-items: center; }
.challenge-final-panel .challenge-turn-feedback { width: min(560px, 100%); }
.challenge-view-result { width: min(360px, 100%); min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

.challenge-result { position: relative; min-height: 650px; padding: 32px 44px 44px; display: grid; justify-items: center; align-content: start; gap: 15px; overflow: hidden; border: 1px solid #e6d7ac; border-radius: var(--radius-panel); background: radial-gradient(circle at center 20%, #fff8d8, transparent 32%), #fffdf7; box-shadow: var(--shadow-panel); text-align: center; }
.challenge-reward-cg { position: relative; width: min(760px, 100%); aspect-ratio: 16 / 9; overflow: hidden; border: 3px solid #fff; border-radius: 20px; box-shadow: 0 18px 40px rgba(96, 67, 20, 0.24); }
.challenge-reward-cg img { width: 100%; height: 100%; object-fit: cover; }
.challenge-reward-cg span { position: absolute; top: 14px; left: 14px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; color: #fff5c9; background: rgba(37, 28, 41, 0.76); font-size: 11px; font-weight: 900; letter-spacing: 0.1em; backdrop-filter: blur(8px); }
.challenge-result-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #d59b2b; box-shadow: 0 12px 24px rgba(184, 130, 31, 0.24); }
.challenge-result h2 { margin: 0; font-size: 32px; }
.challenge-result > p { color: var(--ink-500); }
.challenge-score { font-size: 62px; color: #9b6b18; line-height: 1; }
.challenge-score small { margin-left: 3px; font-size: 18px; }
.challenge-objective-result { width: min(560px, 100%); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.challenge-objective-result > div { padding: 10px 12px; display: flex; align-items: center; gap: 7px; border-radius: var(--radius-control); text-align: left; }
.challenge-objective-result .done { color: #286754; background: #e7f4ef; }
.challenge-objective-result .missed { color: #8d4548; background: #fff0f0; }
.challenge-corrections { width: min(620px, 100%); display: grid; gap: 10px; padding: 16px; border: 1px solid rgba(83, 68, 29, 0.16); border-radius: 14px; background: rgba(255, 249, 224, 0.82); text-align: left; }
.challenge-corrections h3 { margin: 0 0 2px; font-size: 16px; }
.challenge-corrections div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding-top: 9px; border-top: 1px solid rgba(83, 68, 29, 0.12); }
.challenge-corrections strong, .challenge-corrections span { overflow-wrap: anywhere; }
.challenge-corrections small { grid-column: 1 / -1; color: var(--ink-600); }
.challenge-rewards { width: min(560px, 100%); padding: 14px 16px; display: flex; align-items: center; gap: 11px; border: 1px solid #efd58d; border-radius: var(--radius-control); color: #7f5c1d; background: #fff6d8; text-align: left; }
.challenge-rewards > div { display: grid; gap: 3px; }
.challenge-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.challenge-result-actions button { min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c9d6d1; border-radius: var(--radius-control); background: #fff; }
.challenge-result-actions button.primary { color: #fff; border-color: #2d6a62; background: #2d6a62; }
.challenge-empty { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-panel); background: var(--surface-panel); text-align: center; }
.challenge-empty svg { color: #2b7765; }

@media (max-width: 860px) {
  .ui-v2:has(.challenge-run-shell) .sidebar { display: none; }
  .ui-v2 .workspace:has(.challenge-run-shell) { padding: 0; }
  .ui-v2 .workspace:has(.challenge-run-shell) > .topbar,
  .ui-v2 .workspace:has(.challenge-run-shell) > .banner { display: none; }
  .challenge-map > header { min-height: 150px; padding: 22px; }
  .challenge-level-heading { padding-inline: 0; }
  .challenge-map-track { padding: 24px 0; grid-template-columns: 1fr; }
  .challenge-detail-hero { min-height: 210px; padding: 22px; grid-template-columns: 1fr 105px; }
  .challenge-detail-hero img { height: 150px; }
  .challenge-detail-grid { grid-template-columns: 1fr; }
  .challenge-run-shell { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; grid-template-rows: auto 48dvh minmax(0, 1fr); }
  .challenge-run-top { padding-top: max(10px, env(safe-area-inset-top)); grid-template-columns: auto 1fr auto; }
  .challenge-run-top > div { justify-items: start; }
  .challenge-vn-stage { min-height: 0; background-position: 58% center; }
  .challenge-vn-dialogue { right: 14px; bottom: 14px; left: 14px; padding: 17px 18px 15px; }
  .challenge-vn-dialogue h2 { font-size: 22px; }
  .challenge-answer-panel { min-height: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .challenge-result { min-height: calc(100dvh - 120px); padding: 28px 18px; }
  .challenge-objective-result { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .challenge-map > header > svg { display: none; }
  .challenge-level-heading { align-items: flex-start; flex-wrap: wrap; }
  .challenge-level-heading > span { width: 46px; height: 46px; border-radius: 14px; }
  .challenge-level-progress { width: 100%; margin: 8px 0 0; padding-left: 59px; }
  .challenge-detail-hero { grid-template-columns: 1fr; }
  .challenge-detail-hero img { display: none; }
  .challenge-meta { margin-top: 16px; }
  .challenge-run-top > div span { display: none; }
  .challenge-run-top > button { font-size: 0; }
  .challenge-run-top > button svg { width: 22px; height: 22px; }
  .challenge-vn-dialogue { padding: 14px; }
  .challenge-vn-dialogue h2 { font-size: 19px; }
  .challenge-vn-dialogue .challenge-kana { font-size: 12px; }
  .challenge-text-entry > div { grid-template-columns: 1fr 82px; }
  .challenge-text-entry button { min-width: 0; }
}

/* Mobile readability fixes from real-device QA (2026-07-13). */
.ui-v2.guide-enabled.study-route .choice-option.correct {
  border-color: #e78bb5;
  background: #fff1f7;
  box-shadow: 0 0 0 2px rgba(231, 139, 181, 0.14);
}
.ui-v2.guide-enabled.study-route .choice-option.correct strong { color: #7a3158; }
.ui-v2.guide-enabled.study-route .choice-option.correct span { color: #765d6b; }
.ui-v2.guide-enabled.study-route .choice-option.correct .choice-mark { color: #c64f88; }
.ui-v2.guide-enabled.study-route .feedback.correct {
  color: #245f4e;
  border-color: #add9ca;
  background: #edf8f4;
  box-shadow: 0 5px 16px rgba(36, 95, 78, 0.08);
}

@media (max-width: 860px) {
  .ui-v2:not(.study-route),
  .ui-v2:not(.study-route) .workspace { max-width: 100%; overflow-x: clip; }
  .ui-v2:not(.study-route) .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
  .ui-v2:not(.study-route) .topbar > div { min-width: 0; }
  .ui-v2:not(.study-route) .sync-pill { flex: 0 0 auto; white-space: nowrap; }
  .ui-v2 .dashboard > .metric.compact-value { grid-column: 1 / -1; }
  .ui-v2 .dashboard > .metric.compact-value strong { white-space: normal; }

  .ui-v2 .insights-page,
  .ui-v2 .insights-page > *,
  .ui-v2 .insight-summary,
  .ui-v2 .insight-grid,
  .ui-v2 .insight-section { width: 100%; min-width: 0; max-width: 100%; }
  .ui-v2 .insights-page { overflow-x: clip; }
  .ui-v2 .insight-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-v2 .insight-metric { min-width: 0; padding: 14px 12px; }
  .ui-v2 .insight-metric span { min-width: 0; flex-wrap: wrap; line-height: 1.35; }
  .ui-v2 .insight-metric strong { min-width: 0; font-size: clamp(22px, 7vw, 28px); overflow-wrap: anywhere; }
  .ui-v2 .insight-section { overflow: hidden; }
  .ui-v2 .activity-chart { width: 100%; min-width: 0; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; }
  .ui-v2 .activity-day > small { font-size: 8px; }
  .ui-v2 .efficiency-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-v2 .efficiency-metric { min-height: 100px; }
  .ui-v2 .question-efficiency-list { overflow: hidden; }
  .ui-v2 .question-efficiency-list .question-efficiency-head { display: none; }
  .ui-v2 .question-efficiency-list > div:not(.question-efficiency-head) { min-width: 0; padding: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; }
  .ui-v2 .question-efficiency-list strong { grid-column: 1 / -1; }
  .ui-v2 .question-efficiency-list > div > span { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
  .ui-v2 .question-efficiency-list > div > span::before { color: #81908b; font-size: 10px; font-weight: 800; }
  .ui-v2 .question-efficiency-list > div > span:nth-child(2)::before { content: "答题次数"; }
  .ui-v2 .question-efficiency-list > div > span:nth-child(3)::before { content: "正确率"; }
  .ui-v2 .question-efficiency-list > div > span:nth-child(4)::before { content: "平均 / 中位耗时"; }
}

/* Exam training: independent JLPT-style practice. */
.exam-hub { display: grid; gap: 28px; }
.exam-hero {
  position: relative;
  min-height: 480px;
  padding: 42px;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-radius: 26px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 24px 55px rgba(23, 28, 45, 0.2);
}
.exam-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 42%, rgba(15, 18, 32, 0.7)); }
.exam-hero-copy { position: relative; z-index: 1; width: min(500px, 100%); padding: 25px 27px; display: grid; justify-items: start; gap: 13px; border: 1px solid rgba(255,255,255,.28); border-radius: 21px; color: #fff; background: rgba(18, 22, 39, .7); box-shadow: 0 18px 45px rgba(0,0,0,.2); backdrop-filter: blur(12px); }
.exam-kicker { padding: 7px 11px; display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; color: #fff3ae; background: rgba(255,255,255,.12); font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.exam-hero-copy h2 { margin: 0; font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.04em; }
.exam-hero-copy p { margin: 0; max-width: 460px; color: rgba(255,255,255,.84); line-height: 1.65; }
.exam-start { min-height: 50px; padding: 0 18px; display: inline-flex; align-items: center; gap: 9px; border: 0; border-radius: 14px; color: #3c2b12; background: linear-gradient(135deg, #ffe475, #ffbd58); box-shadow: 0 10px 26px rgba(255, 190, 74, .25); font-weight: 900; }
.exam-start:hover { transform: translateY(-2px); filter: brightness(1.04); }
.exam-start-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.exam-restart { min-height: 46px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.28); border-radius: 14px; color: #fff; background: rgba(255,255,255,.09); font-weight: 800; }
.exam-hero-stats { position: absolute; z-index: 2; right: 30px; bottom: 30px; display: flex; gap: 8px; }
.exam-hero-stats > div { min-width: 92px; padding: 12px 14px; display: grid; gap: 2px; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; color: #fff; background: rgba(17,21,35,.7); backdrop-filter: blur(10px); }
.exam-hero-stats strong { font-size: 22px; }
.exam-hero-stats span { color: rgba(255,255,255,.68); font-size: 10px; }
.exam-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; }
.exam-section-heading > div { display: grid; gap: 5px; }
.exam-section-heading span { color: #8b6ee5; font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.exam-section-heading h3 { margin: 0; font-size: 24px; }
.exam-section-heading p { width: min(440px, 50%); margin: 0; color: var(--ink-500); line-height: 1.55; }
.exam-level-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.exam-level-card { min-width: 0; padding: 16px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; border: 1px solid var(--line-soft); border-radius: 17px; background: var(--surface-panel); box-shadow: 0 8px 22px rgba(31,43,40,.05); }
.exam-level-card > div:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.exam-level-card strong, .exam-level-card span { overflow-wrap: anywhere; }
.exam-level-card span { color: var(--ink-500); font-size: 11px; line-height: 1.35; }
.exam-level-card > svg { color: #9ca9a4; }
.exam-level-card.available { border-color: #bda9f5; background: linear-gradient(145deg, #fff, #f3eeff); }
.exam-level-card.available > svg { color: #7858d5; }
.exam-level-orb { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(145deg, #8566e4, #6042bc); font-size: 15px; font-weight: 900; box-shadow: 0 9px 18px rgba(102,72,191,.2); }
.exam-level-card.locked { opacity: .63; }
.exam-level-card.locked .exam-level-orb { color: #64706c; background: #e8edeb; box-shadow: none; }

.exam-question-shell { width: min(980px, 100%); margin-inline: auto; overflow: hidden; border: 1px solid #d8dde8; border-radius: 25px; background: #f8f9fc; box-shadow: 0 24px 60px rgba(30,35,52,.13); }
.exam-question-top { min-height: 72px; padding: 12px 22px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; color: #fff; background: #171b2e; }
.exam-question-top > button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; color: #fff; background: rgba(255,255,255,.08); }
.exam-question-top > div { min-width: 0; display: grid; gap: 3px; }
.exam-question-top span { color: #c5bbeb; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.exam-question-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-question-top > b { color: #fff1ae; font-size: 15px; }
.exam-progress { height: 5px; background: #2b3048; }
.exam-progress i { height: 100%; display: block; border-radius: 0 999px 999px 0; background: linear-gradient(90deg, #a681ff, #ff81b5); transition: width .3s ease; }
.exam-listening-stage { position: relative; min-height: 330px; padding: 32px 42px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 18px; overflow: hidden; background-position: center 36%; background-size: cover; }
.exam-listening-stage::after { content: ""; position: absolute; inset: auto 0 0; height: 46%; pointer-events: none; background: linear-gradient(transparent, rgba(12,15,28,.78)); }
.exam-chibi { display: none; }
.exam-speaker { position: relative; z-index: 2; max-width: 150px; padding: 10px 14px; display: grid; gap: 1px; border: 1px solid rgba(255,255,255,.25); border-radius: 13px; color: #fff; background: rgba(18,21,35,.72); backdrop-filter: blur(9px); }
.exam-speaker.katan { justify-self: start; border-left: 4px solid #ff5ca7; }
.exam-speaker.sakura { justify-self: end; border-right: 4px solid #5ce6ef; text-align: right; }
.exam-speaker span { font-size: 17px; font-weight: 900; }
.exam-speaker small { color: rgba(255,255,255,.62); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.exam-speaker.active { animation: examSpeakerPulse 1.1s ease-in-out infinite alternate; }
@keyframes examSpeakerPulse { to { transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(255,255,255,.12); } }
.exam-play { position: relative; z-index: 3; width: 72px; height: 72px; padding: 0; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; color: #fff; background: rgba(99,69,187,.92); box-shadow: 0 13px 32px rgba(20,16,45,.35); backdrop-filter: blur(9px); }
.exam-play.playing { background: rgba(220,75,127,.9); }
.exam-audio-error { position: absolute; z-index: 4; top: 15px; right: 15px; margin: 0; padding: 8px 10px; border-radius: 9px; color: #7d303e; background: rgba(255,236,239,.94); font-size: 11px; }
.exam-audio-report { position: absolute; z-index: 4; top: 15px; left: 15px; min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(255,255,255,.32); border-radius: 999px; color: #fff; background: rgba(17,21,35,.72); box-shadow: 0 7px 18px rgba(8,11,22,.18); backdrop-filter: blur(9px); font-size: 11px; font-weight: 800; }
.exam-audio-report:hover:not(:disabled) { background: rgba(98,70,178,.9); }
.exam-audio-report.reported { color: #d4eee6; border-color: rgba(164,226,207,.44); background: rgba(33,88,72,.78); opacity: 1; }
.exam-audio-report svg.lucide-loader-circle { animation: examReportSpin .8s linear infinite; }
@keyframes examReportSpin { to { transform: rotate(360deg); } }
.exam-report-notice { position: fixed; z-index: 120; top: max(14px, env(safe-area-inset-top)); left: 50%; max-width: calc(100vw - 28px); padding: 10px 14px; border: 1px solid; border-radius: 12px; transform: translateX(-50%); box-shadow: 0 12px 28px rgba(18,24,38,.18); font-size: 12px; font-weight: 800; animation: examReportNoticeIn .18s ease-out; }
.exam-report-notice.success { color: #235f4e; border-color: #a9d8c8; background: #edf8f4; }
.exam-report-notice.error { color: #873f50; border-color: #e5b7c2; background: #fff1f4; }
@keyframes examReportNoticeIn { from { opacity: 0; transform: translate(-50%, -7px); } }
.exam-answer-area { padding: 25px 30px 30px; display: grid; gap: 19px; }
.exam-prompt { display: grid; justify-items: center; gap: 5px; text-align: center; }
.exam-prompt > span { padding: 4px 9px; border-radius: 999px; color: #684ab9; background: #eee8ff; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.exam-prompt h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); }
.exam-prompt p { margin: 0; color: var(--ink-500); font-size: 13px; }
.exam-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.exam-option { min-height: 60px; padding: 11px 15px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; border: 1px solid #d9dfea; border-radius: 14px; color: #2b3040; background: #fff; text-align: left; font-weight: 800; }
.exam-option:hover:not(:disabled) { border-color: #9275e6; background: #f6f2ff; transform: translateY(-1px); }
.exam-option b { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #684ab9; background: #eee8ff; }
.exam-option.correct { border-color: #69b49d; color: #215d4e; background: #eaf7f2; opacity: 1; }
.exam-option.correct b { color: #fff; background: #47947e; }
.exam-option.wrong { border-color: #e09aab; color: #873f50; background: #fff0f3; opacity: 1; }
.exam-option.wrong b { color: #fff; background: #cd647c; }
.exam-option.muted { opacity: .48; }
.exam-feedback { padding: 17px; display: grid; gap: 14px; border: 1px solid; border-radius: 16px; }
.exam-feedback.correct { border-color: #b8ddcf; background: #f0f9f6; }
.exam-feedback.wrong { border-color: #edc5ce; background: #fff5f7; }
.exam-feedback > header { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px; }
.exam-feedback.correct > header > svg { color: #3e8c75; }
.exam-feedback.wrong > header > svg { color: #c45f77; }
.exam-feedback > header span { color: var(--ink-500); font-size: 12px; }
.exam-replay-controls { min-height: 44px; padding: 7px 10px; display: grid; grid-template-columns: auto minmax(120px,1fr) auto; align-items: center; gap: 10px; border: 1px solid rgba(105,74,185,.14); border-radius: 12px; background: rgba(255,255,255,.72); }
.exam-replay-controls button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: #684ab9; }
.exam-replay-controls input { width: 100%; accent-color: #684ab9; cursor: pointer; }
.exam-replay-controls time { min-width: 74px; color: #59667d; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.exam-transcript { display: grid; gap: 8px; }
.exam-transcript > div { padding: 13px 15px; display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 3px 10px; border-radius: 11px; background: rgba(255,255,255,.82); }
.exam-transcript b { grid-row: 1 / 4; padding-top: 1px; color: #694cbb; }
.exam-transcript p, .exam-transcript em, .exam-transcript small { margin: 0; overflow-wrap: anywhere; }
.exam-transcript p { font-size: 15px; font-weight: 800; line-height: 1.45; }
.exam-transcript em { color: #59667d; font-size: 14px; line-height: 1.45; font-style: normal; }
.exam-transcript small { color: var(--ink-500); font-size: 13px; line-height: 1.45; }
.exam-feedback-footer { display: flex; justify-content: flex-end; }
.exam-next { min-height: 42px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 11px; color: #fff; background: #684ab9; font-size: 13px; font-weight: 900; }

.exam-complete { min-height: 610px; padding: 42px 24px; display: grid; place-items: center; align-content: center; gap: 13px; border: 1px solid #e2d9fb; border-radius: 25px; background: radial-gradient(circle at 50% 20%, #f4ecff, transparent 34%), #fff; box-shadow: var(--shadow-panel); text-align: center; }
.exam-complete-badge { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 21px; color: #fff; background: linear-gradient(145deg, #8a69e7, #e367a1); box-shadow: 0 15px 30px rgba(111,73,199,.24); }
.exam-complete > span { color: #795acb; font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.exam-complete h2 { margin: 0; font-size: 32px; }
.exam-score-ring { --exam-score: 0deg; width: 150px; height: 150px; display: grid; place-items: center; grid-template-columns: auto auto; border-radius: 50%; background: radial-gradient(circle at center, #fff 58%, transparent 60%), conic-gradient(#8363df var(--exam-score), #ece8f5 0); }
.exam-score-ring strong { font-size: 46px; }
.exam-score-ring small { color: var(--ink-500); font-weight: 800; }
.exam-complete > p { color: var(--ink-500); }
.exam-complete-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.exam-complete-actions button { min-height: 48px; padding: 0 17px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #d5dbe0; border-radius: 12px; background: #fff; font-weight: 800; }
.exam-complete-actions button.primary { color: #fff; border-color: #684ab9; background: #684ab9; }

@media (max-width: 1100px) {
  .exam-level-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .exam-level-card.available { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .exam-hero { min-height: 610px; padding: 18px; background-position: center; }
  .exam-hero-copy { padding: 19px; }
  .exam-hero-stats { right: 18px; bottom: auto; left: 18px; top: 18px; justify-content: space-between; }
  .exam-hero-stats > div { min-width: 0; flex: 1; padding: 9px 10px; }
  .exam-hero-stats strong { font-size: 18px; }
  .exam-section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .exam-section-heading p { width: 100%; }
  .exam-level-grid { grid-template-columns: 1fr; }
  .exam-level-card.available { grid-column: auto; }
  .ui-v2 .workspace:has(.exam-question-shell) { padding: 0; }
  .ui-v2 .workspace:has(.exam-question-shell) > .topbar,
  .ui-v2 .workspace:has(.exam-question-shell) > .banner { display: none; }
  .ui-v2:has(.exam-question-shell) .sidebar { display: none; }
  .exam-question-shell { min-height: 100dvh; border: 0; border-radius: 0; }
  .exam-question-top { padding-top: max(12px, env(safe-area-inset-top)); }
  .exam-listening-stage { min-height: 40dvh; padding: 20px 18px; background-position: center; }
  .exam-chibi { position: absolute; z-index: 2; bottom: 45px; display: block; width: clamp(120px, 33vw, 185px); height: clamp(120px, 33vw, 185px); object-fit: contain; pointer-events: none; filter: drop-shadow(0 10px 14px rgba(10,12,24,.35)); }
  .exam-chibi.katan { left: -5px; }
  .exam-chibi.sakura { right: -5px; }
  .exam-speaker { align-self: end; }
  .exam-answer-area { padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); }
}

@media (max-width: 520px) {
  .exam-hero { min-height: 640px; background-position: 48% center; }
  .exam-hero-copy h2 { font-size: 34px; }
  .exam-hero-copy p { font-size: 13px; }
  .exam-hero-stats span { font-size: 8px; }
  .exam-question-top { min-height: 65px; padding-inline: 13px; }
  .exam-question-top > button { width: 38px; height: 38px; }
  .exam-question-top strong { font-size: 13px; }
  .exam-listening-stage { min-height: 280px; padding: 12px 10px; grid-template-columns: 1fr auto 1fr; gap: 7px; background-position: center 32%; }
  .exam-audio-report { top: 10px; left: 10px; min-height: 31px; padding-inline: 9px; font-size: 10px; }
  .exam-chibi { bottom: 42px; width: 138px; height: 138px; }
  .exam-chibi.katan { left: -18px; }
  .exam-chibi.sakura { right: -14px; }
  .exam-speaker { padding: 8px 9px; }
  .exam-speaker span { font-size: 14px; }
  .exam-play { width: 58px; height: 58px; }
  .exam-play svg { width: 24px; }
  .exam-options { grid-template-columns: 1fr; gap: 8px; }
  .exam-option { min-height: 54px; }
  .exam-feedback > header { grid-template-columns: auto 1fr; }
  .exam-feedback > header span { grid-column: 1 / -1; }
  .exam-transcript > div { grid-template-columns: 40px minmax(0,1fr); padding: 10px; }
  .exam-replay-controls { grid-template-columns: auto minmax(80px, 1fr); }
  .exam-replay-controls time { grid-column: 2; min-width: 0; text-align: left; }
}

/* Selective workspace redesign: task-first home, usable libraries and grouped settings. */
.metric, .wide-panel, .study-card, .settings-panel, .empty, .auth-panel,
.word-row, .sentence-action, .sentence-library-item, .review-setup-panel, .review-summary-panel,
.insight-section { border-radius: var(--radius-card); }

.mobile-more-sheet { border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
.ui-v2 .study-card,
.ui-v2 .character-stage > .study-card,
.ui-v2.guide-enabled.study-route .character-stage > .study-card { border-radius: var(--radius-panel); }
.ui-v2 .character-stage .themed-action { border-radius: var(--radius-control); }

.today-dashboard { grid-template-columns: 1fr !important; }
.today-focus-panel { grid-template-columns: minmax(340px, 1.12fr) 142px minmax(360px, .88fr); align-items: center; padding: 28px; }
.today-focus-copy { display: grid; justify-items: start; gap: 10px; }
.today-focus-copy h2 { margin: 0; font-size: clamp(25px, 3vw, 38px); line-height: 1.18; }
.today-focus-copy > p { color: var(--ink-500); line-height: 1.6; }
.today-focus-copy > .today-backlog-note { max-width: 680px; padding: 10px 12px; border-radius: var(--radius-control); background: color-mix(in srgb, var(--mode-primary) 9%, white); color: var(--ink-700); font-size: 13px; }
.today-focus-panel .guide-companion.compact { min-height: 154px; grid-template-columns: 132px minmax(0, 1fr) auto; padding-top: 8px; }
.today-focus-panel .guide-companion.compact > img { width: 132px; height: 146px; }
.today-progress-ring { --today-progress: 0deg; width: 132px; height: 132px; padding: 9px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand-500) var(--today-progress), #e2ece8 0); box-shadow: 0 12px 28px rgba(41,113,95,.13); }
.today-progress-ring > div { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: 1px; border-radius: 50%; color: var(--ink-900); background: var(--surface-panel); }
.today-progress-ring strong { font-size: 25px; line-height: 1; }
.today-progress-ring span { color: var(--ink-700); font-size: 12px; font-weight: 800; }
.today-progress-ring small { color: var(--ink-500); font-size: 11px; }
.today-eyebrow { color: var(--brand-500); font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.today-primary-action { min-width: min(330px, 100%); min-height: 58px; margin-top: 7px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; justify-items: start; column-gap: 14px; padding: 9px 15px 9px 18px; border-radius: var(--radius-control); text-align: left; font-weight: 900; }
.today-primary-action small { grid-column: 1; color: rgba(255,255,255,.75); font-size: 12px; font-weight: 600; }
.today-primary-action svg { grid-column: 2; grid-row: 1 / 3; }
.study-rest-control { display: grid; gap: 6px; max-width: 100%; }
.study-rest-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.study-rest-button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 13px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); color: var(--ink-700); background: var(--surface-panel); font-weight: 700; }
.study-rest-button:disabled { cursor: default; opacity: .65; }
.study-rest-row > span, .study-rest-control > small { color: var(--ink-500); font-size: 12px; line-height: 1.5; }
.study-rest-control > p { margin: 0; color: #b33c32; font-size: 13px; }
.today-summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.today-summary-strip > div { min-height: 88px; padding: 15px 17px; display: grid; align-content: space-between; gap: 7px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-panel); box-shadow: 0 9px 24px rgba(23,35,33,.045); }
.today-summary-strip span { color: var(--ink-500); font-size: 13px; }
.today-summary-strip strong { font-size: 22px; overflow-wrap: anywhere; }
.today-task-panel { padding: 24px; }
.queue-preview .word-row.compact { min-height: 92px; grid-template-columns: 1fr auto; padding: 12px 14px; }
.word-row.compact strong { font-size: 20px; }
.word-row.compact .word-actions { grid-row: 1 / 4; }

.library-page { display: grid; gap: 16px; }
.library-toolbar { padding: 14px; display: grid; grid-template-columns: minmax(280px, 1fr) repeat(3, minmax(140px, auto)); gap: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-panel); box-shadow: 0 10px 28px rgba(23,35,33,.045); }
.library-search { min-height: 46px; padding: 0 13px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); color: var(--ink-500); background: #fff; }
.library-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink-900); background: transparent; }
.library-toolbar select, .voice-field select { min-height: 46px; padding: 0 34px 0 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); color: var(--ink-900); background: #fff; }
.library-results-heading { display: flex; align-items: center; justify-content: space-between; color: var(--ink-500); }
.library-results-heading strong { color: var(--ink-900); }
.library-empty { min-height: 300px; padding: 28px; display: grid; place-items: center; align-content: center; gap: 10px; border: 1px dashed var(--line-soft); border-radius: var(--radius-panel); color: var(--ink-500); text-align: center; background: rgba(255,255,255,.55); }
.library-empty > .guide-companion { max-width: 560px; }
.library-empty > strong { color: var(--ink-900); font-size: 20px; }

.settings-panel.settings-grid { padding: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; border: 0; background: transparent; box-shadow: none; }
.settings-card { min-width: 0; padding: 21px; display: grid; gap: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-panel); box-shadow: 0 10px 28px rgba(23,35,33,.045); }
.settings-card > header h2 { margin: 0 0 4px; }
.settings-card > header p { color: var(--ink-500); font-size: 13px; line-height: 1.5; }
.settings-wide { grid-column: 1 / -1; }
.settings-sound-card { grid-column: 1 / -1; grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr); align-items: start; }
.settings-sound-card > header { grid-column: 1 / -1; }
.settings-card .toggle-option { border-radius: var(--radius-control); }
.settings-card .number-grid input { border-radius: var(--radius-control); }
.voice-field { display: grid; grid-template-columns: minmax(92px, .35fr) minmax(180px, 1fr); align-items: center; gap: 8px 14px; color: var(--ink-700); }
.voice-field small { grid-column: 2; color: var(--ink-500); line-height: 1.5; }
.shortcut-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.shortcut-editor.disabled { opacity: .55; }
.shortcut-disclosure { width: 100%; min-height: 48px; padding: 0 13px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); color: var(--ink-700); background: var(--surface-muted); text-align: left; }
.shortcut-disclosure span { font-weight: 800; }
.shortcut-disclosure small { min-width: 0; overflow: hidden; color: var(--ink-500); text-overflow: ellipsis; white-space: nowrap; }
.shortcut-disclosure svg { transition: transform 160ms ease; }
.shortcut-disclosure.open svg { transform: rotate(180deg); }
.shortcut-editor-panel { display: grid; gap: 10px; }
.shortcut-key-row { min-height: 46px; padding: 5px 6px 5px 12px; display: grid; grid-template-columns: 1fr minmax(78px, auto); align-items: center; gap: 9px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); color: var(--ink-700); background: var(--surface-muted); }
.shortcut-key-row button { min-height: 34px; padding: 0 10px; color: var(--ink-900); background: #fff; font-weight: 800; }
.shortcut-key-row button.recording { color: var(--brand-600); border-color: var(--brand-500); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-500) 18%, transparent); }
.shortcut-error { color: var(--error-600); font-size: 13px; }
.settings-secondary { justify-self: start; color: var(--brand-600); background: transparent !important; }
.settings-api-card code { padding: 11px 13px; overflow-wrap: anywhere; border-radius: var(--radius-control); color: var(--ink-700); background: var(--surface-muted); }
.audio-pack-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audio-pack-card .settings-secondary { display: inline-flex; align-items: center; gap: 7px; }
.audio-pack-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.audio-pack-group { min-width: 0; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-muted); }
.audio-pack-group h3 { margin: 0 0 10px; color: var(--ink-900); font-size: 15px; }
.audio-pack-list { display: grid; gap: 8px; }
.audio-pack-row { min-height: 64px; padding: 10px 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); background: var(--surface-panel); }
.audio-pack-copy { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 9px; }
.audio-pack-copy strong { color: var(--ink-900); }
.audio-pack-copy span, .audio-pack-note { color: var(--ink-500); font-size: 12px; }
.audio-pack-copy progress, .audio-pack-copy small { grid-column: 1 / -1; width: 100%; }
.audio-pack-copy progress { height: 5px; accent-color: var(--brand-500); }
.audio-pack-copy small { color: var(--error-600); overflow-wrap: anywhere; }
.audio-pack-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }
.audio-pack-actions button, .audio-pack-installed { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--radius-control); font-size: 12px; font-weight: 800; }
.audio-pack-installed { color: #197449; background: #e8f8ef; }
.audio-pack-bundled { min-height: 48px; padding: 10px 11px; display: flex; align-items: center; gap: 8px; border: 1px solid #ccebd9; border-radius: var(--radius-control); color: #197449; background: #f2fbf6; font-size: 12px; font-weight: 700; }
.audio-pack-delete { color: var(--error-600); background: transparent !important; }
.audio-pack-note { display: block; line-height: 1.6; }

.sentence-home-preview { display: grid; gap: 13px; }
.sentence-home-preview > header { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.sentence-home-preview h2 { margin: 0 0 4px; }
.sentence-home-preview header p { color: var(--ink-500); font-size: 13px; }
.sentence-home-preview header button { min-height: 40px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; border-radius: var(--radius-control); color: var(--brand-600); background: var(--surface-panel); border: 1px solid var(--line-soft); font-weight: 800; }
.sentence-home-preview > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sentence-home-preview article { min-width: 0; padding: 17px; display: grid; gap: 7px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-panel); }
.sentence-home-preview article > span { width: max-content; padding: 3px 7px; border-radius: 999px; color: #5940a5; background: #f1edff; font-size: 11px; font-weight: 900; }
.sentence-home-preview article strong { font-size: 20px; overflow-wrap: anywhere; }
.sentence-home-preview article p, .sentence-home-preview article small { color: var(--ink-500); line-height: 1.5; overflow-wrap: anywhere; }

.provider-diagnostics { padding: 13px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-control); background: var(--surface-muted); }
.provider-diagnostics summary { cursor: pointer; color: var(--ink-700); font-weight: 800; }
.provider-diagnostics summary span { margin-left: 8px; color: var(--ink-500); font-size: 12px; font-weight: 500; }
.provider-diagnostics-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.provider-diagnostics > small { display: block; margin-top: 9px; color: var(--ink-500); }

.minute-presets { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.minute-presets button, .minute-input input { border-radius: var(--radius-control); }
.review-due-count { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; }
.review-due-count strong { color: var(--ink-900); }

/* PC readability fixes for the dark study routes. */
@media (min-width: 861px) {
  .ui-v2.guide-enabled.study-route .meaning strong,
  .ui-v2.guide-enabled.study-route .meaning-prompt strong { color: #f4fbff; text-shadow: 0 2px 18px rgba(57,196,226,.14); }
  .ui-v2.guide-enabled.study-route .meaning,
  .ui-v2.guide-enabled.study-route .meaning span,
  .ui-v2.guide-enabled.study-route .meaning-prompt span { color: #a9becc; }
  .ui-v2.guide-enabled.study-route .review-exit { color: #d8e5ee; }
  .ui-v2.guide-enabled.study-route .review-exit:hover { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .review-due-count { color: #c6d5df; }
  .ui-v2.guide-enabled.study-route .review-due-count strong { color: #ffffff; }
  .ui-v2.guide-enabled.study-route .choice-option {
    border-color: color-mix(in srgb, var(--mode-primary) 48%, #91a8b8);
    border-radius: var(--radius-card);
  }
  .ui-v2.guide-enabled.study-route .choice-option:hover:not(:disabled) { border-color: var(--mode-primary); }
}

/* Mobile study routes use light cards, so critical copy must stay dark. */
@media (max-width: 860px) {
  .ui-v2.guide-enabled.study-route .meaning strong,
  .ui-v2.guide-enabled.study-route .meaning-prompt strong,
  .ui-v2.guide-enabled.study-route .jp-word,
  .ui-v2.guide-enabled.study-route .input-prompt {
    color: var(--ink-900);
    text-shadow: none;
  }
  .ui-v2.guide-enabled.study-route .meaning,
  .ui-v2.guide-enabled.study-route .meaning span,
  .ui-v2.guide-enabled.study-route .meaning-prompt span,
  .ui-v2.guide-enabled.study-route .kana,
  .ui-v2.guide-enabled.study-route .question-instruction,
  .ui-v2.guide-enabled.study-route .audio-prompt,
  .ui-v2.guide-enabled.study-route .review-exit,
  .ui-v2.guide-enabled.study-route .review-due-count {
    color: var(--ink-700);
  }
  .ui-v2.guide-enabled.study-route .review-due-count strong { color: var(--ink-900); }
}

@media (max-width: 960px) {
  .today-focus-panel { grid-template-columns: minmax(0, 1fr) auto; }
  .today-focus-panel .guide-companion.compact { grid-column: 1 / -1; }
  .library-toolbar { grid-template-columns: minmax(0, 1fr) repeat(3, minmax(0, 1fr)); }
  .library-search { grid-column: 1 / -1; }
  .settings-panel.settings-grid { grid-template-columns: 1fr; }
  .settings-wide { grid-column: auto; }
  .settings-sound-card { grid-column: auto; grid-template-columns: 1fr; }
  .settings-sound-card > header { grid-column: auto; }
}

@media (max-width: 860px) {
  .today-focus-panel, .today-task-panel { padding: 19px; }
  .today-focus-panel .guide-companion.compact { min-height: 142px; grid-template-columns: 104px minmax(0, 1fr); gap: 5px 10px; }
  .today-focus-panel .guide-companion.compact > img { width: 104px; height: 134px; }
  .today-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-toolbar { grid-template-columns: 1fr; }
  .library-search { grid-column: auto; }
  .sentence-home-preview > div { grid-template-columns: 1fr; }
  .provider-diagnostics-grid { grid-template-columns: 1fr; }
  .audio-pack-groups { grid-template-columns: 1fr; }
  .audio-pack-card > header { align-items: start; }
}

@media (max-width: 560px) {
  .today-focus-panel { grid-template-columns: 1fr; }
  .today-progress-ring { width: 118px; height: 118px; justify-self: center; }
  .today-summary-strip { gap: 8px; }
  .today-summary-strip > div { min-height: 78px; padding: 12px; }
  .today-summary-strip strong { font-size: 18px; }
  .today-primary-action { width: 100%; min-width: 0; }
  .shortcut-editor { grid-template-columns: 1fr; }
  .voice-field { grid-template-columns: 1fr; }
  .voice-field small { grid-column: 1; }
  .minute-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sentence-home-preview > header { align-items: start; flex-direction: column; }
  .audio-pack-row { align-items: stretch; flex-direction: column; }
  .audio-pack-actions { justify-content: flex-end; }
}
/* Keep the desktop workspace palette out of mobile and active study sessions. */
@media (min-width: 861px) {
  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)),
  .auth-screen {
    --brand-700: #244a91;
    --brand-600: #3464bd;
    --brand-500: #4778d6;
    --ink-900: #25334b;
    --ink-700: #4e5e77;
    --ink-600: #60708a;
    --ink-500: #68778f;
    --surface-page: #f8f7fe;
    --surface-panel: #ffffff;
    --surface-muted: #eef3fb;
    --line-soft: #e6e5f3;
    --shadow-panel: 0 8px 28px rgba(88, 73, 133, 0.07);
    --sky-soft: #eaf1ff;
    --sakura-soft: #ffeaf2;
    --violet-soft: #f0eaff;
    --apricot-soft: #fff1d8;
    color: var(--ink-900);
    background: var(--surface-page);

    & button, & input, & select { accent-color: var(--brand-500); }
    & :is(button, input, select, a):focus-visible {
      outline: 3px solid #4778d6;
      outline-offset: 3px;
    }
    & button { transition: background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast); }
    & .primary {
      color: #fff;
      border-color: var(--brand-500);
      background: var(--brand-500);
      box-shadow: 0 4px 12px rgba(71, 120, 214, 0.16);
    }
    & .primary:hover:not(:disabled) { background: var(--brand-600); border-color: var(--brand-600); }
  }

  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)) {
    grid-template-columns: 216px minmax(0, 1fr);

    & .sidebar {
      position: sticky;
      top: 0;
      height: 100dvh;
      min-height: 0;
      overflow-y: auto;
      padding: 32px 18px 22px;
      border-right: 1px solid #e9e2f1;
      color: var(--ink-700);
      background: linear-gradient(170deg, #fff 35%, #fff5f7 100%);
    }
    & .brand { padding-inline: 10px; margin-bottom: 34px; color: var(--ink-900); letter-spacing: -0.5px; }
    & .brand svg { box-sizing: content-box; padding: 8px; margin-left: -8px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #527fe1, #9c79d9); box-shadow: 0 4px 10px #8275c52b; }
    & .desktop-nav { gap: 6px; }
    & .nav { --nav-color: #4778d6; --nav-soft: #eaf1ff; min-height: 46px; gap: 12px; padding-inline: 14px; border-radius: 12px; color: var(--ink-700); }
    & .nav:nth-child(3) { --nav-color: #c66353; --nav-soft: #ffebe5; }
    & .nav:nth-child(4), & .nav:nth-child(5) { --nav-color: #835bc5; --nav-soft: #f0eaff; }
    & .nav:nth-child(6) { --nav-color: #a56b1a; --nav-soft: #fff1d8; }
    & .nav:nth-child(7) { --nav-color: #b45d89; --nav-soft: #ffeaf2; }
    & .nav svg { color: var(--nav-color); }
    & .nav:hover { color: var(--nav-color); background: var(--nav-soft); transform: translateX(2px); }
    & .nav.active { color: var(--nav-color); background: var(--nav-soft); box-shadow: inset 3px 0 var(--nav-color); font-weight: 700; }
    & .desktop-nav .nav:nth-child(5), & .desktop-nav .nav:last-child { margin-top: 16px; }
    & .account { padding: 20px 10px 0; margin-top: auto; border-top: 1px solid var(--line-soft); color: var(--ink-700); gap: 10px; }
    & .account small { color: var(--ink-500); }
    & .account .icon-text { color: var(--ink-500); font-size: 13px; }
    & .workspace { width: 100%; max-width: 1560px; margin-inline: auto; padding: 34px clamp(24px, 3vw, 52px) 48px; background: radial-gradient(ellipse at 98% 0, #ffe9ed 0, transparent 34%), radial-gradient(ellipse at 5% 10%, #e9efff 0, transparent 40%), var(--surface-page); }
    & .topbar { min-height: 58px; margin-bottom: 28px; }
    & .topbar h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.6px; }
    & .topbar p { color: var(--ink-500); font-size: 13px; margin-top: 9px; }
    & .sync-pill { color: var(--ink-500); font-size: 12px; border: 1px solid var(--line-soft); border-radius: 999px; background: #fff; box-shadow: none; }
    & .sync-pill svg { color: var(--brand-500); }
    & :is(.wide-panel, .settings-card, .word-row, .insight-section, .insight-metric, .empty, .library-toolbar) {
      border: 1px solid var(--line-soft);
      border-radius: 20px;
      background: #fff;
      box-shadow: var(--shadow-panel);
    }
    & :is(.today-panel-heading, .today-queue-heading, .settings-card > header, .insight-section) h2 { font-size: 18px; letter-spacing: -0.2px; }

    & .today-dashboard { gap: 20px; }
    & .today-focus-panel {
      position: relative;
      grid-template-columns: minmax(0, 1fr) minmax(280px, .9fr);
      gap: 14px 28px;
      padding: 28px 32px;
      border: 1px solid #849beb;
      border-radius: 24px;
      color: #fff;
      background: linear-gradient(90deg, #304b9abf 0%, #40549d73 42%, #6766a600 72%), url("./spring-study-room-B1XZD9wH.webp") center 62% / cover;
      box-shadow: 0 12px 32px #5e70c326;
    }
    & .today-focus-copy { grid-column: 1; grid-row: 1 / 3; gap: 14px; }
    & .today-eyebrow { padding: 6px 12px; border: 1px solid #ffffff50; border-radius: 999px; color: #fff; background: #ffffff18; font-size: 12px; font-weight: 700; letter-spacing: .1em; }
    & .today-focus-copy h2 { max-width: 460px; color: #fff; font-size: clamp(27px, 2.6vw, 38px); line-height: 1.4; letter-spacing: -1px; }
    & .today-focus-copy > p { color: #f3f5ff; font-size: 14px; }
    & .today-focus-copy > .today-backlog-note { color: #344565; background: #fff1da; }
    & .today-primary-action { min-width: 0; width: min(310px, 100%); min-height: 58px; margin-top: 6px; border: 1px solid #ffe7b0; border-radius: 14px; color: #493717; background: #ffe19b; box-shadow: 0 5px 0 #d9ad6638; }
    & .today-primary-action small { color: #6b5123; }
    & .today-primary-action:hover:not(:disabled) { color: #493717; background: #ffebb9; border-color: #ffebb9; transform: translateY(-2px); box-shadow: 0 7px 0 #d9ad6638; }
    & .today-focus-panel .guide-companion.compact {
      grid-column: 2;
      grid-row: 1;
      min-height: 176px;
      padding: 12px 14px 0 4px;
      grid-template-columns: 140px minmax(0, 1fr);
      gap: 8px;
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--ink-900);
      box-shadow: none;
    }
    & .today-focus-panel .guide-companion.compact > img { grid-row: 1 / 3; align-self: end; width: 140px; height: 168px; filter: drop-shadow(0 6px 8px #a34b8d20); }
    & .today-focus-panel .guide-companion-copy { align-self: end; padding: 12px; border: 1px solid #fff; border-radius: 16px 16px 16px 4px; background: #fff3f9ed; box-shadow: 0 5px 14px #55507918; }
    & .today-focus-panel .guide-voice-button { grid-column: 2; grid-row: 2; align-self: start; justify-self: start; min-height: 32px; margin-bottom: 12px; color: #944e83; border-color: #eac6e1; background: #fff3f9; font-size: 12px; }
    & .today-progress-ring { grid-column: 2; grid-row: 2; justify-self: end; width: 64px; height: 64px; padding: 5px; background: conic-gradient(#ffe19b var(--today-progress), #ffffff40 0); box-shadow: none; }
    & .today-progress-ring > div { color: #fff; background: #526bc1; }
    & .today-progress-ring :is(span, small) { color: #fff; }
    & .today-progress-ring strong { font-size: 18px; }
    & .today-progress-ring span { font-size: 10px; font-weight: 600; }
    & .today-progress-ring small { font-size: 10px; }
    & .today-summary-strip { gap: 12px; border: 0; background: transparent; padding: 0; }
    & .today-summary-strip > div { min-height: 90px; padding: 16px 20px; border: 1px solid #c8daf7; border-radius: 18px; box-shadow: 0 4px 0 #6586c30a; background: #eaf1ff; }
    & .today-summary-strip > div:nth-child(2) { background: #fff1d8; border-color: #efdcb8; }
    & .today-summary-strip > div:nth-child(3) { background: #ffeaf2; border-color: #f0ccdd; }
    & .today-summary-strip > div:nth-child(4) { background: #f0eaff; border-color: #dcd0f4; }
    & .today-summary-strip span { color: #56617b; }
    & .today-summary-strip strong { font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; }
    & .today-task-panel { padding: 24px; background: #ffffffd9; }
    & .today-actions { gap: 14px; }
    & .today-action { --action-color: #3264b9; --action-soft: #e8f1ff; --action-line: #bcd3f7; min-height: 124px; border: 1px solid var(--action-line); border-bottom-width: 4px; border-radius: 16px; background: var(--action-soft); box-shadow: none; padding: 20px 16px; }
    & .today-action.vocab-review { --action-color: #b75548; --action-soft: #ffede5; --action-line: #f2cbbb; }
    & .today-action.sentence-study { --action-color: #7753b0; --action-soft: #f1eaff; --action-line: #d6c4f1; }
    & .today-action > svg:first-child { box-sizing: content-box; padding: 10px; border-radius: 13px; background: #ffffffb3; }
    & .today-action strong { color: var(--action-color); font-size: 17px; }
    & .today-action small { color: #59657b; }
    & .today-action:hover { transform: translateY(-3px); background: var(--action-soft); border-color: var(--action-color); box-shadow: 0 8px 16px #6966a015; }

    & .library-toolbar { padding: 16px; border-color: #dad0f1; background: linear-gradient(105deg, #eaf1ff, #f3eaff); grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(110px, auto)); }
    & .library-search { grid-column: auto; background: var(--surface-page); }
    & .library-search:focus-within { outline: 3px solid var(--brand-500); outline-offset: 2px; }
    & .library-search input:focus-visible { outline: none; }
    & .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    & .word-row { padding: 20px; min-height: 130px; gap: 10px; border-left: 4px solid #a8c3f0; }
    & .word-row strong { color: var(--ink-900); font-size: 23px; }
    & .word-row :is(span, p, small) { color: var(--ink-500); }
    & .word-row button { color: var(--brand-600); background: var(--surface-muted); border-color: var(--line-soft); }
    & .word-row.expanded { grid-column: 1 / -1; }

    & .settings-grid { gap: 20px; }
    & .settings-card { padding: 24px; gap: 18px; }
    & .settings-card > header { margin: -24px -24px 0; padding: 20px 24px 16px; border-bottom: 1px solid var(--line-soft); border-radius: 19px 19px 0 0; background: var(--sky-soft); }
    & .settings-answer-card > header { background: var(--violet-soft); }
    & .settings-sound-card > header { background: var(--sakura-soft); }
    & .settings-wide > header { background: var(--apricot-soft); }
    & .settings-card :is(.field-label, .number-grid label) { color: var(--ink-700); }
    & .settings-card .number-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
    & .settings-card .number-grid label { align-content: start; }
    & .settings-card .number-grid label small { color: var(--ink-500); }
    & .settings-card :is(input, select) { border-color: var(--line-soft); color: var(--ink-900); }
    & .settings-card :is(.level, .toggle-option, .shortcut-disclosure) { border-color: var(--line-soft); background: #f8faff; color: var(--ink-700); }
    & .settings-card :is(.level.active, .toggle-option.active) { border-color: #bbcff3; background: #eef4ff; color: var(--brand-700); }
    & .settings-card .toggle-option { padding: 14px; min-height: 50px; }
    & .settings-card .primary { background: var(--brand-500); color: #fff; }
    & .settings-card .primary:hover:not(:disabled) { background: var(--brand-600); }

    & .insight-summary { gap: 12px; }
    & .insight-metric { --metric-color: #9a6225; padding: 20px; min-width: 0; min-height: 140px; grid-template-rows: auto 1fr 16px; gap: 12px; background: var(--apricot-soft); border-color: #eedab9; }
    & .insight-metric:nth-child(2) { --metric-color: #3c66b0; background: var(--sky-soft); border-color: #cbdaf5; }
    & .insight-metric:nth-child(3) { --metric-color: #7850b2; background: var(--violet-soft); border-color: #d8caef; }
    & .insight-metric:nth-child(4) { --metric-color: #ab557d; background: var(--sakura-soft); border-color: #efcbda; }
    & .insight-metric:nth-child(5) { --metric-color: #4565a0; background: #eaf2fa; border-color: #ccdeef; }
    & .insight-metric :is(span, small), & .insight-section header :is(p, strong) { color: var(--ink-500); }
    & .insight-metric svg { color: var(--metric-color); }
    & .insight-metric strong { align-self: center; color: var(--metric-color); font-size: 25px; font-weight: 750; font-variant-numeric: tabular-nums; }
    & .insight-section { padding: 24px; }
    & :is(.activity-day > i, .ability-track > i, .ability-legend > i) { background: var(--brand-500); }
    & .ability-track { background: #e9eff9; }
    & :is(.efficiency-metric, .challenge-analytics-detail) { background: #f6f8fc; border-color: var(--line-soft); border-radius: 12px; }
    & :is(.efficiency-metric strong, .efficiency-metric svg) { color: var(--brand-700); }
    & :is(.efficiency-metric > span, .efficiency-metric small, .challenge-analytics-detail p, .challenge-analytics-detail > small, .question-efficiency-list > div > span) { color: var(--ink-500); }
    & .question-efficiency-list, & .question-efficiency-list > div { border-color: var(--line-soft); }
    & .question-efficiency-list .question-efficiency-head { background: var(--surface-muted); color: var(--ink-700); }
    & .question-efficiency-list strong small, & .challenge-interruption-list span { color: var(--brand-700); background: #eaf1ff; }
    & .challenge-detail-hero, & .challenge-map > header { border-color: #b5abed; background: linear-gradient(120deg, #496eca, #8f68bf); box-shadow: var(--shadow-panel); }
    & .challenge-map > header :is(span, p) { color: #e5eeff; }
    & .challenge-level-heading > span { color: #735226; background: #ffe4a5; box-shadow: 0 4px 0 #ecd49e; }
    & .challenge-level-progress strong { color: var(--brand-600); }
    & .challenge-level-progress i { background: #e9eff9; }
    & .challenge-level-progress b { background: var(--brand-500); }
    & .challenge-node { background: var(--brand-500); box-shadow: 0 4px 12px rgba(40,65,105,.16); }
    & .sc-workspace { --sc-ink: var(--ink-900); --sc-muted: var(--ink-500); --sc-accent: var(--brand-600); }
    & .sc-course-list > button, & .sc-library details, & .sentence-action, & .sentence-stats > div { background: #fff; color: var(--ink-900); border-color: var(--line-soft); box-shadow: var(--shadow-panel); }
    & .sentence-action svg, & .sentence-stats strong { color: var(--brand-600); }
    & .sentence-action:nth-child(2) { background: #fff0e8; border-color: #efd2c6; }
    & .sentence-action:nth-child(3) { background: var(--violet-soft); border-color: #dcd0f4; }
    & .sentence-action:nth-child(4) { background: var(--apricot-soft); border-color: #efdcb8; }
    & .sentence-stats > div { border: 1px solid var(--line-soft); border-radius: 14px; }
    & .sc-ai-setting { background: var(--surface-muted); border-color: var(--line-soft); }
    & .sentence-action.primary-action { color: #fff; background: var(--brand-500); border-color: var(--brand-500); }
    & .sentence-action.primary-action :is(svg, small) { color: #fff; }
    & .challenge-card-art:not(.scene-art) { color: var(--brand-600); background: #eef4ff; }
    & .challenge-map-card { border-color: var(--line-soft); box-shadow: var(--shadow-panel); }
    & .challenge-map-card > button { color: var(--brand-600); border-color: #bbcff3; }
    & .challenge-map-card:not(.locked):not(.passed) .challenge-card-status { color: var(--brand-700); background: #eaf1ff; }
    & .challenge-unlock-bar { background: #e9eff9; }
    & .challenge-unlock-bar i { background: var(--brand-500); }
  }

  .auth-screen {
    background: linear-gradient(100deg, #e8eeffa6, #fce6f06b), url("./spring-study-room-B1XZD9wH.webp") center / cover;
    & .auth-panel { padding: 38px; gap: 20px; border: 1px solid #e1e7f0; border-radius: 20px; background: #fff; box-shadow: 0 16px 56px rgba(40,65,105,.08); }
    & .brand.large { color: var(--brand-600); }
    & h1 { color: var(--ink-900); font-size: 24px; }
    & input { min-height: 48px; border: 1px solid var(--line-soft); border-radius: 10px; color: var(--ink-900); }
  }
}

@media (min-width: 861px) and (max-height: 780px) {
  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)) {
    & .sidebar { padding-top: 22px; }
    & .brand { margin-bottom: 22px; }
    & .nav { min-height: 40px; }
    & .account { padding-top: 14px; gap: 6px; }
  }
}

@media (min-width: 861px) and (max-width: 1150px) {
  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)) {
    grid-template-columns: 184px minmax(0, 1fr);
    & .sidebar { padding-inline: 12px; }
    & .workspace { padding-inline: 24px; }
    & .today-focus-panel { padding: 24px; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; }
    & .today-focus-panel .guide-companion.compact { grid-template-columns: 100px minmax(0, 1fr); padding-inline: 6px; }
    & .today-focus-panel .guide-companion.compact > img { width: 100px; height: 144px; }
    & .today-focus-panel .guide-companion-copy strong { font-size: 14px; }
    & .today-summary-strip > div { padding-inline: 14px; }
    & .today-summary-strip strong { font-size: 18px; }
    & .today-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    & .today-action:last-child { grid-column: 1 / -1; }
    & .today-action { min-height: 96px; }
    & .library-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    & .library-search { grid-column: 1 / -1; }
    & .insight-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    & .insight-grid { grid-template-columns: minmax(0, 1fr); }
    & .settings-panel.settings-grid { grid-template-columns: minmax(0, 1fr); }
    & .settings-sound-card { grid-template-columns: minmax(0, 1fr); }
  }
}
/* Non-study phone/tablet pages share the desktop palette, with touch-sized layouts. */
@media (max-width: 860px) {
  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)),
  .auth-screen {
    --brand-700: #244a91;
    --brand-600: #3464bd;
    --brand-500: #4778d6;
    --ink-900: #25334b;
    --ink-700: #4e5e77;
    --ink-600: #60708a;
    --ink-500: #68778f;
    --surface-page: #f8f7fe;
    --surface-panel: #fff;
    --surface-muted: #eef3fb;
    --line-soft: #e6e5f3;
    --shadow-panel: 0 6px 20px #5849850c;
    color: var(--ink-900);
    background: var(--surface-page);
    & :is(button, input, select) { accent-color: var(--brand-500); }
    & :is(button, input, select, a):focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; }
    & .primary { color: #fff; border-color: var(--brand-500); background: var(--brand-500); }
  }

  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)) {
    & .workspace { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); background: radial-gradient(ellipse at 100% 0, #ffeaf2 0, transparent 35%), radial-gradient(ellipse at 0 5%, #e9efff 0, transparent 40%), var(--surface-page); }
    & .topbar { gap: 12px; align-items: center; margin-bottom: 20px; }
    & .topbar h1 { color: var(--ink-900); font-size: 25px; line-height: 1.25; }
    & .topbar p { color: var(--ink-500); font-size: 12px; line-height: 1.5; }
    & .sync-pill { flex-shrink: 0; gap: 5px; padding: 7px 9px; color: var(--ink-500); background: #ffffffd9; border: 1px solid var(--line-soft); border-radius: 999px; box-shadow: none; font-size: 11px; }
    & .sync-pill svg { width: 15px; color: var(--brand-500); }
    & .sidebar { background: #fff9fcf5; border-top: 1px solid #e6dff1; box-shadow: 0 -4px 18px #68579c0a; }
    & .mobile-nav .nav { --nav-color: #4778d6; --nav-soft: #eaf1ff; min-height: 48px; border-radius: 12px; color: var(--ink-700); }
    & .mobile-nav .nav:nth-child(3) { --nav-color: #b75548; --nav-soft: #ffede5; }
    & .mobile-nav .nav:nth-child(4) { --nav-color: #7753b0; --nav-soft: #f1eaff; }
    & .mobile-nav .nav:nth-child(5) { --nav-color: #b45d89; --nav-soft: #ffeaf2; }
    & .mobile-nav .nav svg { color: var(--nav-color); }
    & .mobile-nav .nav.active { color: var(--nav-color); background: var(--nav-soft); }
    & .mobile-more-sheet { color: var(--ink-900); border: 1px solid var(--line-soft); border-radius: 24px 24px 0 0; background: #fbf9ff; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
    & .mobile-more-action { min-height: 52px; border-color: var(--line-soft); background: #fff; }
    & .mobile-more-action:nth-of-type(2) > svg:first-child { color: #a56b1a; }
    & .mobile-more-action:nth-of-type(3) > svg:first-child { color: #b45d89; }
    & :is(.wide-panel, .word-row, .settings-card, .insight-section, .empty, .library-toolbar) { border: 1px solid var(--line-soft); border-radius: 18px; background: #fff; box-shadow: var(--shadow-panel); }

    & .today-dashboard { gap: 14px; }
    & .today-focus-panel { grid-template-columns: 64px minmax(0, 1fr); gap: 16px 12px; padding: 20px 18px 16px; color: #fff; border-color: #899cdf; border-radius: 22px; background: linear-gradient(125deg, #304b9ad9 0%, #40549d8c 45%, #6766a61a 100%), url("./spring-study-room-B1XZD9wH.webp") 65% center / cover; box-shadow: 0 8px 24px #5e70c326; }
    & .today-focus-copy { grid-column: 1 / -1; gap: 12px; }
    & .today-eyebrow { padding: 5px 10px; border: 1px solid #ffffff50; border-radius: 999px; color: #fff; background: #ffffff18; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
    & .today-focus-copy h2 { color: #fff; font-size: 24px; line-height: 1.4; letter-spacing: -.5px; }
    & .today-focus-copy > p { color: #f5f6ff; font-size: 12px; line-height: 1.6; }
    & .today-focus-copy > .today-backlog-note { color: #344565; background: #fff1da; }
    & .today-primary-action { width: 100%; min-width: 0; min-height: 56px; margin-top: 2px; padding: 10px 14px; color: #493717; background: #ffe19b; border: 1px solid #ffe7b0; border-radius: 13px; box-shadow: 0 4px 0 #d9ad662b; font-size: 16px; }
    & .today-primary-action small { color: #6b5123; font-size: 11px; }
    & .today-primary-action:active { background: #ffebb9; }
    & .today-progress-ring { grid-column: 1; grid-row: 2; align-self: end; justify-self: start; width: 62px; height: 62px; padding: 4px; margin-bottom: 6px; background: conic-gradient(#ffe19b var(--today-progress), #ffffff40 0); box-shadow: none; }
    & .today-progress-ring > div { color: #fff; background: #526bc1; }
    & .today-progress-ring strong { font-size: 17px; }
    & .today-progress-ring :is(span, small) { color: #fff; font-size: 9px; }
    & .today-focus-panel .guide-companion.compact { grid-column: 2; grid-row: 2; min-height: 112px; padding: 0; grid-template-columns: 72px minmax(0, 1fr); gap: 6px; border: 0; border-radius: 0; background: transparent; color: var(--ink-900); overflow: visible; }
    & .today-focus-panel .guide-companion.compact > img { grid-column: 1; grid-row: 1 / 3; align-self: end; width: 72px; height: 104px; object-fit: contain; }
    & .today-focus-panel .guide-companion-copy { grid-column: 2; align-self: end; gap: 4px; padding: 9px; border: 1px solid #fff; border-radius: 13px 13px 13px 3px; background: #fff3f9f0; }
    & .today-focus-panel .guide-companion-copy strong { font-size: 12px; line-height: 1.5; }
    & .today-focus-panel .guide-companion-copy span { display: none; }
    & .today-focus-panel .guide-voice-button { grid-column: 2; grid-row: 2; align-self: start; justify-self: start; min-height: 44px; padding: 0 8px; color: #944e83; border-color: #eac6e1; background: #fff3f9; font-size: 11px; }
    & .today-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    & .today-summary-strip > div { min-height: 80px; padding: 14px; border: 1px solid #c8daf7; border-radius: 16px; background: #eaf1ff; box-shadow: none; }
    & .today-summary-strip > div:nth-child(2) { background: #fff1d8; border-color: #efdcb8; }
    & .today-summary-strip > div:nth-child(3) { background: #ffeaf2; border-color: #f0ccdd; }
    & .today-summary-strip > div:nth-child(4) { background: #f0eaff; border-color: #dcd0f4; }
    & .today-summary-strip span { color: #56617b; font-size: 12px; }
    & .today-summary-strip strong { font-size: 20px; font-weight: 700; }
    & .today-task-panel { padding: 16px; }
    & :is(.today-panel-heading, .today-queue-heading) { gap: 8px; }
    & :is(.today-panel-heading, .today-queue-heading) h2 { font-size: 18px; }
    & :is(.today-panel-heading p, .today-queue-heading span) { font-size: 12px; line-height: 1.6; }
    & .today-actions { grid-template-columns: 1fr; gap: 10px; }
    & .today-action { --action-color: #3264b9; --action-soft: #e8f1ff; --action-line: #bcd3f7; min-height: 84px; padding: 14px 12px; border: 1px solid var(--action-line); border-bottom-width: 3px; border-radius: 14px; background: var(--action-soft); box-shadow: none; }
    & .today-action.vocab-review { --action-color: #b75548; --action-soft: #ffede5; --action-line: #f2cbbb; }
    & .today-action.sentence-study { --action-color: #7753b0; --action-soft: #f1eaff; --action-line: #d6c4f1; }
    & .today-action > svg:first-child { box-sizing: content-box; padding: 8px; border-radius: 11px; background: #ffffffb3; }
    & .today-action strong { color: var(--action-color); font-size: 16px; }
    & .today-action small { color: #59657b; font-size: 12px; }
    & .queue-preview { grid-template-columns: minmax(0, 1fr); }

    & .library-toolbar { padding: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; background: linear-gradient(105deg, #eaf1ff, #f3eaff); border-color: #dad0f1; }
    & .library-search { grid-column: 1 / -1; min-height: 46px; background: #fff; }
    & .library-search:focus-within { outline: 2px solid var(--brand-500); outline-offset: 2px; }
    & .library-search input:focus-visible { outline: none; }
    & .library-toolbar select { min-width: 0; width: 100%; font-size: 14px; }
    & .library-toolbar select:last-child { grid-column: 1 / -1; }
    & .library-grid { grid-template-columns: minmax(0, 1fr); }
    & .word-row { padding: 16px; border-left: 3px solid #a8c3f0; }
    & .word-row strong { color: var(--ink-900); font-size: 23px; }
    & .word-row :is(span, p, small) { color: var(--ink-500); }
    & .word-row button { min-width: 44px; min-height: 44px; color: var(--brand-600); background: var(--surface-muted); border-color: var(--line-soft); }

    & .settings-panel.settings-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    & .settings-card { padding: 18px; gap: 16px; }
    & .settings-card > header { margin: -18px -18px 0; padding: 17px 18px; border-bottom: 1px solid var(--line-soft); border-radius: 17px 17px 0 0; background: #eaf1ff; }
    & .settings-card > header h2 { font-size: 18px; }
    & .settings-answer-card > header { background: #f0eaff; }
    & .settings-sound-card > header { background: #ffeaf2; }
    & .settings-wide > header { background: #fff1d8; }
    & .settings-card :is(input, select) { min-width: 0; max-width: 100%; border-color: var(--line-soft); color: var(--ink-900); }
    & .settings-card .number-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    & .settings-card .number-grid label { min-width: 0; align-content: start; color: var(--ink-700); font-size: 13px; }
    & .settings-card .number-grid input { width: 100%; }
    & .settings-card .number-grid small { color: var(--ink-500); font-size: 11px; }
    & .settings-card :is(.level, .toggle-option, .shortcut-disclosure) { border-color: var(--line-soft); background: #f8faff; color: var(--ink-700); }
    & .settings-card :is(.level.active, .toggle-option.active) { border-color: #bbcff3; background: #eef4ff; color: var(--brand-700); }
    & .settings-card .level { min-width: 44px; min-height: 44px; }
    & .settings-card .toggle-option { min-height: 48px; padding: 12px; border-radius: 12px; }
    & .settings-card .primary { min-height: 44px; color: #fff; background: var(--brand-500); }

    & .insight-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    & .insight-metric { --metric-color: #9a6225; min-width: 0; min-height: 122px; padding: 14px; border: 1px solid #eedab9; border-radius: 16px; background: #fff1d8; grid-template-rows: auto 1fr auto; gap: 10px; }
    & .insight-metric:nth-child(2) { --metric-color: #3c66b0; background: #eaf1ff; border-color: #cbdaf5; }
    & .insight-metric:nth-child(3) { --metric-color: #7850b2; background: #f0eaff; border-color: #d8caef; }
    & .insight-metric:nth-child(4) { --metric-color: #ab557d; background: #ffeaf2; border-color: #efcbda; }
    & .insight-metric:nth-child(5) { --metric-color: #4565a0; grid-column: 1 / -1; min-height: 100px; background: #eaf2fa; border-color: #ccdeef; }
    & .insight-metric :is(span, small) { color: var(--ink-500); font-size: 12px; }
    & .insight-metric svg { flex-shrink: 0; color: var(--metric-color); }
    & .insight-metric strong { align-self: center; color: var(--metric-color); font-size: 24px; }
    & .insight-section { padding: 16px; }
    & :is(.activity-day > i, .ability-track > i, .ability-legend > i) { background: var(--brand-500); }
    & .ability-track { background: #e9eff9; }
    & :is(.efficiency-metric, .challenge-analytics-detail) { border-color: var(--line-soft); background: #f6f5fc; border-radius: 12px; }
    & :is(.efficiency-metric strong, .efficiency-metric svg) { color: var(--brand-700); }
    & .question-efficiency-list .question-efficiency-head { background: var(--surface-muted); color: var(--ink-700); }
    & .question-efficiency-list strong small, & .challenge-interruption-list span { color: var(--brand-700); background: #eaf1ff; }

    & .challenge-detail-hero, & .challenge-map > header { border-color: #b5abed; background: linear-gradient(120deg, #496eca, #8f68bf); box-shadow: var(--shadow-panel); }
    & .challenge-map > header :is(span, p) { color: #e5eeff; }
    & .challenge-level-heading > span { color: #735226; background: #ffe4a5; box-shadow: none; }
    & .challenge-level-progress strong { color: var(--brand-600); }
    & .challenge-level-progress i, & .challenge-unlock-bar { background: #e9eff9; }
    & .challenge-level-progress b, & .challenge-unlock-bar i, & .challenge-node { background: var(--brand-500); }
    & .challenge-map-card > button { min-height: 46px; color: var(--brand-600); border-color: #bbcff3; }
    & .challenge-map-card:not(.locked):not(.passed) .challenge-card-status { color: var(--brand-700); background: #eaf1ff; }
    & .sc-workspace { --sc-ink: var(--ink-900); --sc-muted: var(--ink-500); --sc-accent: var(--brand-600); }
    & .sc-course-list > button, & .sc-library details, & .sentence-action, & .sentence-stats > div { background: #fff; color: var(--ink-900); border-color: var(--line-soft); box-shadow: var(--shadow-panel); }
    & .sentence-action svg, & .sentence-stats strong { color: var(--brand-600); }
    & .sentence-action:nth-child(2) { background: #fff0e8; }
    & .sentence-action:nth-child(3) { background: #f0eaff; }
    & .sentence-action:nth-child(4) { background: #fff1d8; }
    & .sentence-stats > div { border: 1px solid var(--line-soft); border-radius: 14px; }
    & .sc-ai-setting { background: var(--surface-muted); border-color: var(--line-soft); }
    & .sentence-action.primary-action { color: #fff; background: var(--brand-500); border-color: var(--brand-500); }
    & .sentence-action.primary-action :is(svg, small) { color: #fff; }
  }

  .auth-screen { padding: 20px; background: linear-gradient(140deg, #dce8ffd9, #fce6f099), url("./spring-study-room-B1XZD9wH.webp") 65% center / cover;
    & .auth-panel { padding: 24px; border: 1px solid #fff; border-radius: 22px; background: #ffffffed; box-shadow: 0 12px 36px #58518b20; }
    & .brand.large { color: var(--brand-600); }
    & input { min-height: 48px; border-color: var(--line-soft); border-radius: 12px; }
    & .primary { min-height: 48px; border-radius: 12px; }
  }
}

@media (min-width: 600px) and (max-width: 860px) {
  .app-shell:not(.study-route):not(:has(.exam-question-shell, .exam-complete, .challenge-run-shell, .challenge-result)) {
    & .workspace { padding-inline: 24px; }
    & .today-focus-panel { grid-template-columns: minmax(0, 1fr) 220px; padding: 24px; }
    & .today-focus-copy { grid-column: 1; grid-row: 1 / 3; }
    & .today-focus-panel .guide-companion.compact { grid-column: 2; grid-row: 1; }
    & .today-progress-ring { grid-column: 2; grid-row: 2; justify-self: end; }
    & .today-summary-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    & .today-summary-strip strong { font-size: 18px; }
    & .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
}
