:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, sans-serif; background: var(--color-background); color: var(--color-text); }
* { box-sizing: border-box; }
/* Column layout: the screen fills the viewport, so the legal footer sits at the bottom from the first paint and does not
   jump down once app.js renders (layout shift 0.08 on start, measured by tests/browser/perf.mjs, #5). */
body { display: flex; flex-direction: column; min-height: 100dvh; margin: 0; background: radial-gradient(circle at 85% 0%, var(--color-glow) 0, transparent var(--layout-glow-radius)), var(--color-background); }
button, input, a { font: inherit; }
button { cursor: pointer; touch-action: manipulation; border: 0; border-radius: var(--radius-control); padding: var(--space-sm) var(--space-m); font-weight: var(--weight-bold); background: var(--color-accent); color: var(--color-on-accent); }
button:disabled { cursor: default; opacity: .72; }
/* Two-button rule: when a screen shows two buttons together, exactly one is primary (filled);
   the other is .secondary-button (outlined, transparent fill) so hierarchy is always visible. */
button[type="submit"], .secondary-button, .danger-button { min-height: var(--touch-min); }
.secondary-button { background: transparent; color: var(--color-text); border: var(--stroke-thin) solid var(--color-border-button); }
.text-link { position: relative; display: inline-block; padding: .3rem 0; background: transparent; color: var(--color-link); font-weight: var(--weight-bold); text-decoration: underline; text-underline-offset: var(--layout-link-underline-offset); }
.text-link:hover, .text-link:focus-visible { color: var(--color-link-hover); }
/* Touch target ≥ 44 px without changing the line: an invisible hit area centred on the link text. */
.text-link::after, .nav-link::after { content: ""; position: absolute; top: 50%; right: 0; left: 0; min-height: var(--touch-min); transform: translateY(-50%); }
select { min-height: var(--layout-control-height); padding: .7rem .8rem; border: var(--stroke-thin) solid var(--color-border-field); border-radius: var(--radius-control); background: var(--color-field); color: var(--color-text); }
a { color: inherit; }
.app-shell { flex: 1 0 auto; width: min(var(--layout-content-width), 100%); margin: 0 auto; padding: var(--space-m) var(--space-m) var(--space-xxxl); }
/* Legal links below every screen (index.html, #13); .text-link keeps the 44 px hit area, the gap keeps targets apart. */
.legal-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-s) var(--space-xl); width: min(var(--layout-content-width), 100%); margin: 0 auto; padding: var(--space-s) var(--space-m) max(var(--space-xl), env(safe-area-inset-bottom)); font-size: var(--font-nav); }
.skip-link { position: fixed; left: var(--space-sm); top: calc(-1 * var(--layout-skip-link-offset)); z-index: 20; min-height: var(--touch-min); padding: .7rem var(--space-m); background: var(--color-text); color: var(--color-on-accent); border-radius: var(--radius-chip); }
.skip-link:focus { top: var(--space-sm); }
.topbar { display: flex; justify-content: space-between; gap: var(--space-m); color: var(--color-text-subtle); font-size: var(--font-nav); padding: var(--space-xs) 0 var(--space-xxl); border-bottom: var(--stroke-thin) solid var(--color-divider); }
.topbar-actions { display: flex; align-items: center; gap: var(--space-m); }
.sync-status { color: var(--color-text-muted); font-size: var(--font-footnote); }
.brand { color: var(--color-text-strong); font-size: var(--font-body); font-weight: var(--weight-extra-bold); text-decoration: none; }
.mission-back { color: var(--color-link); text-decoration: none; }
.intro h1 { max-width: 14ch; font-size: clamp(var(--font-hero-min), 8vw, var(--font-hero-max)); line-height: var(--line-height-hero); margin: var(--space-xs) 0 var(--space-m); }
.mission-heading h1 { max-width: none; font-size: clamp(var(--font-heading-min), 4vw, var(--font-mission-heading-max)); line-height: var(--line-height-heading); margin: var(--space-xs) 0 .6rem; }
.intro p, .mission-heading p { max-width: 58ch; color: var(--color-text-subtle); line-height: var(--line-height-intro); }
.eyebrow { font-size: var(--font-footnote); color: var(--color-link); font-weight: var(--weight-extra-bold); text-transform: uppercase; letter-spacing: .1em; margin: 0 0 .4rem; }
.song-form, .player-panel, .mission-panel { margin-top: var(--space-ml); background: var(--color-surface-translucent); border: var(--stroke-thin) solid var(--color-divider); border-radius: var(--radius-panel); padding: var(--space-m); }
.lyrics-mode { width: min(var(--layout-lyrics-width), 100%); min-height: 100dvh; padding: 0 var(--space-m) var(--space-xl); background: var(--color-lyrics-background); }
.lyrics-mode .topbar { padding: .85rem 0 var(--space-m); }
.lyrics-mode .player-panel.lyrics-player { margin: 0; padding: 0; border: 0; border-radius: var(--radius-panel); background: var(--color-player-background); overflow: hidden; }
.song-player-stage { position: relative; aspect-ratio: 16 / 9; min-height: var(--layout-player-min-height); max-width: 100%; }
.lyrics-mode .player-slot { width: 100%; height: 100%; border-radius: 0; }
.lyrics-mode .player-slot iframe { width: 100%; height: 100%; }
.player-status { position: absolute; inset: auto var(--space-m) var(--space-m); margin: 0; color: var(--color-player-status); font-size: var(--font-small); line-height: var(--line-height-compact); text-align: center; pointer-events: none; }
.player-status:empty { display: none; }
.player-status-error { color: var(--color-player-error); }
.song-player-column { display: grid; align-content: start; gap: var(--space-sm); min-width: 0; }
.song-learning-cta { display: grid; place-items: center; min-height: var(--layout-cta-height); border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-on-accent); font-weight: var(--weight-heavy); text-align: center; text-decoration: none; }
.lyrics-mode .lyrics-panel { margin: 0; }
.lyrics-viewport { height: clamp(var(--layout-lyrics-viewport-min), 50dvh, var(--layout-lyrics-viewport-max)); max-height: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--color-scrollbar) transparent; }
.lyrics-list { display: grid; padding: max(7vh, var(--space-xxl)) 0; }
.lyric-line { width: 100%; min-height: var(--layout-lyric-line-height); text-align: left; padding: .85rem var(--space-m); background: transparent; color: var(--color-lyric-inactive); border: 0; border-bottom: var(--stroke-thin) solid var(--color-lyric-divider); border-radius: 0; transition: color var(--duration-fast), border-color var(--duration-fast), padding-left var(--duration-fast), opacity var(--duration-fast); opacity: .55; cursor: pointer; }
.lyric-line:focus-visible { outline: var(--stroke-focus) solid var(--color-focus); outline-offset: calc(-1 * var(--stroke-focus)); }
.lyric-line:hover { color: var(--color-text-strong); opacity: .8; }
.lyric-line.active { color: var(--color-text-strong); border-bottom-color: var(--color-focus); padding-left: 1.35rem; opacity: 1; }
.original { display: block; margin: 0; font-size: clamp(var(--font-body), 4vw, var(--font-emphasis)); font-weight: var(--weight-emphasis); line-height: var(--line-height-snug); }
.lyric-word { display: inline; padding: 0; border-radius: var(--radius-lyric-word); background: transparent; color: inherit; font: inherit; font-weight: inherit; text-align: inherit; }
.lyric-word:hover, .lyric-word:focus-visible { color: var(--color-text-strong); background: var(--color-word-hover); outline: var(--stroke-thin) solid var(--color-focus); }
.lyric-line.active .original { font-size: clamp(var(--font-heading-min), 6vw, var(--font-headline)); font-weight: var(--weight-heavy); }
.translation { display: block; color: var(--color-translation); font-size: clamp(var(--font-footnote), 3.2vw, var(--font-body)); line-height: var(--line-height-snug); margin-top: .3rem; }
.lyric-line.active .translation { color: var(--color-translation-active); font-size: clamp(var(--font-translation-active-min), 3.8vw, var(--font-translation-active-max)); }
/* Song view lines (.song-lyric-line; the final lyrics game keeps the rules above): inactive lines use their own colours
   instead of opacity (≥ 4.5:1). The seek control is a sibling of the word buttons (no nested controls): a transparent
   button stretched over the whole line, under the text; the text lets the pointer through, so a tap anywhere but on a
   word seeks. Word buttons stay inline in the running text (WCAG 2.5.8 inline exception), no extra hit area. */
.song-lyric-line { position: relative; color: var(--color-lyric-idle); opacity: 1; cursor: default; }
.song-lyric-line:hover { color: var(--color-lyric-inactive); opacity: 1; }
.song-lyric-line.active { color: var(--color-text-strong); }
.song-lyric-line:not(.active) .translation { color: var(--color-translation-idle); }
.song-lyric-line .original, .song-lyric-line .translation { position: relative; pointer-events: none; }
.song-lyric-line .lyric-word { pointer-events: auto; }
.lyric-seek { position: absolute; inset: 0; width: 100%; padding: 0; border-radius: 0; background: transparent; }
.lyric-seek:focus-visible { outline: var(--stroke-focus) solid var(--color-focus); outline-offset: calc(-1 * var(--stroke-focus)); }
.lyrics-actions { position: relative; min-height: var(--layout-lyrics-actions-height); }
.lyrics-follow-button { position: absolute; right: var(--space-sm); bottom: var(--space-sm); padding: .45rem .6rem; font-size: var(--font-footnote); box-shadow: 0 .25rem .8rem var(--color-shadow); }
.song-end-screen { position: absolute; right: 0; bottom: 0; left: 0; padding: 1.1rem; background: linear-gradient(0deg, var(--color-end-screen-fade-start), var(--color-end-screen-fade-mid) 76%, var(--color-end-screen-fade-end)); }
.song-end-screen[hidden] { display: none; }
.song-end-screen p { margin: 0 0 var(--space-sm); color: var(--color-text); font-size: var(--font-lead); font-weight: var(--weight-extra-bold); }
.song-end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.song-end-actions button { background: var(--color-surface-interactive); color: var(--color-text); border: var(--stroke-thin) solid var(--color-border-button); }
.lyric-learn-button { display: grid; place-items: center; min-height: var(--layout-control-height); padding: .7rem .9rem; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-on-accent); font-weight: var(--weight-extra-bold); text-align: center; text-decoration: none; }
.lyrics-panel { position: relative; }
.search-intro { padding-top: var(--space-m); }
.install-hint { max-width: var(--layout-install-hint-width); margin: var(--space-m) auto 0; padding: .9rem var(--space-m); display: grid; gap: .3rem; border: var(--stroke-thin) solid var(--color-border-field); border-radius: var(--radius-tile); background: var(--color-surface-translucent); }
.install-hint span { color: var(--color-text-muted); font-size: var(--font-small); }
.search-panel { margin-top: var(--space-l); background: var(--color-surface-translucent); border: var(--stroke-thin) solid var(--color-divider); border-radius: var(--radius-panel); padding: var(--space-m); }
.song-guide { max-width: var(--layout-song-guide-width); }.song-guide-steps { display: grid; gap: .85rem; margin: var(--space-l) 0; }.song-guide-steps article { display: grid; grid-template-columns: var(--layout-step-badge-size) 1fr; gap: var(--space-sm); align-items: start; padding: var(--space-m); background: var(--color-surface-translucent); border: var(--stroke-thin) solid var(--color-border); border-radius: var(--radius-tile); }.song-guide-steps span { display: grid; place-items: center; width: var(--layout-step-badge-size); height: var(--layout-step-badge-size); background: var(--color-accent); border-radius: 50%; color: var(--color-on-accent); font-weight: var(--weight-heavy); }.song-guide-steps strong, .song-guide-steps p { display: block; margin: 0; }.song-guide-steps p { margin-top: var(--space-xs); color: var(--color-text-muted); line-height: var(--line-height-compact); }
.install-onboarding-screen { display: grid; gap: var(--space-m); }
.install-phone { width: min(var(--layout-install-phone-width), 52vw); aspect-ratio: 9 / 16; justify-self: center; position: relative; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border: var(--stroke-device-frame) solid var(--color-device-frame); border-radius: var(--radius-device); background: linear-gradient(160deg, var(--color-device-screen-start), var(--color-device-screen-end) 62%); box-shadow: 0 1rem 2.5rem var(--color-device-shadow); }
.install-browser-bar { display: flex; gap: .32rem; padding: .7rem; }.install-browser-bar span { width: var(--layout-install-dot-size); height: var(--layout-install-dot-size); border-radius: 50%; background: var(--color-device-dot); }.install-page-mark { align-self: center; justify-self: center; display: grid; place-items: center; width: var(--layout-install-mark-size); height: var(--layout-install-mark-size); border-radius: var(--radius-install-mark); background: var(--color-accent); color: var(--color-on-accent); font-size: var(--font-install-mark); font-weight: var(--weight-black); }.install-browser-toolbar { display: flex; justify-content: space-around; align-items: center; min-height: var(--layout-install-toolbar-height); border-top: var(--stroke-thin) solid var(--color-device-toolbar-line); color: var(--color-text); }.install-browser-toolbar strong { font-size: var(--font-title); color: var(--color-text); }
.ios-install-steps { display: grid; gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }.ios-install-steps li { display: grid; grid-template-columns: var(--layout-step-number-size) 1fr; gap: .7rem; align-items: start; }.install-step-number { display: grid; place-items: center; width: var(--layout-step-number-size); height: var(--layout-step-number-size); border-radius: 50%; background: var(--color-accent); color: var(--color-on-accent); font-weight: var(--weight-heavy); }.ios-install-steps strong, .ios-install-steps small { display: block; }.ios-install-steps small, .install-android-note { margin-top: .15rem; color: var(--color-text-muted); line-height: var(--line-height-compact); }.install-android-note { margin: 0; padding-top: .8rem; border-top: var(--stroke-thin) solid var(--color-border); font-size: var(--font-note); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: var(--space-m); margin-bottom: .85rem; }
.section-heading > a { color: var(--color-link); font-size: var(--font-footnote); font-weight: var(--weight-emphasis); text-decoration: none; }
.starter-song-grid { display: grid; gap: .45rem; }
.starter-song-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .65rem; width: 100%; min-height: var(--layout-song-card-height); padding: .8rem; border: var(--stroke-thin) solid var(--color-border); border-radius: var(--radius-card); background: linear-gradient(105deg, var(--color-surface-raised), var(--color-song-card-end)); color: var(--color-text); text-align: left; }
.starter-song-card:hover { border-color: var(--color-focus); background: var(--color-surface-hover); }
.starter-song-card strong, .starter-song-card small { display: block; }
.starter-song-card small { margin-top: .18rem; color: var(--color-text-muted); }
.continue-panel { border-color: var(--color-border-continue); }
.song-search-panel { margin-top: var(--space-l); }
.language-profile-form, .account-update-form { display: grid; gap: .65rem; }
.language-profile-form label, .account-update-form label { margin-top: .35rem; color: var(--color-text-soft); font-weight: var(--weight-bold); }
/* One text field for every form (sign-in, sign-up, password reset, account, search): same size, spacing and states.
   Exercise inputs (typed recall, completion, lyrics gaps) keep their own game styling. */
.text-field { width: 100%; min-width: 0; min-height: var(--layout-control-height); padding: var(--space-sm) var(--space-m); border: var(--stroke-thin) solid var(--color-border-field); border-radius: var(--radius-input); background: var(--color-field); color: var(--color-text); font-size: var(--font-input); }
.text-field::placeholder { color: var(--color-placeholder); opacity: 1; }
.text-field:focus-visible { border-color: var(--color-focus); outline: var(--stroke-focus) solid var(--color-focus); outline-offset: 0; }
.text-field:user-invalid, .text-field[aria-invalid="true"] { border-color: var(--color-danger); }
.text-field:user-invalid:focus-visible, .text-field[aria-invalid="true"]:focus-visible { outline-color: var(--color-danger); }
.text-field:disabled { background: var(--color-surface-sunken); color: var(--color-text-muted); cursor: not-allowed; }
.action-row { display: flex; flex-wrap: wrap; gap: .6rem; }
/* Destructive actions: outlined like .secondary-button, filled only for the final confirmation. */
.danger-button { background: transparent; color: var(--color-danger); border: var(--stroke-thin) solid var(--color-danger); }
.danger-button-filled { background: var(--color-danger-surface); color: var(--color-on-danger); }
.language-chip-grid { display: grid; grid-template-columns: 1fr; gap: .55rem; }
.onboarding-fieldset { display: grid; gap: .55rem; margin: 0; padding: 0 0 var(--space-m); border: 0; border-bottom: var(--stroke-thin) solid var(--color-divider); }
.onboarding-fieldset:last-of-type { padding-bottom: 0; border-bottom: 0; }
.onboarding-fieldset legend { padding: 0; color: var(--color-text); font-size: var(--font-lead); font-weight: var(--weight-extra-bold); }
.onboarding-fieldset p, .section-copy { margin: 0; color: var(--color-text-muted); line-height: var(--line-height-body); }
.level-card-grid { display: grid; gap: .55rem; }
.level-card { display: grid; gap: .2rem; width: 100%; padding: .85rem; border: var(--stroke-thin) solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface); color: var(--color-text); text-align: left; }
.level-card small { color: var(--color-text-muted); line-height: var(--line-height-snug); }
.level-card.selected { border-color: var(--color-focus); background: var(--color-surface-selected); box-shadow: 0 0 0 2px var(--color-selection-ring); }
.language-chip { display: flex; align-items: center; gap: var(--space-s); background: var(--color-surface); border: var(--stroke-thin) solid var(--color-border); color: var(--color-text); font-weight: var(--weight-semibold); text-align: left; }
.language-chip-flag { font-size: var(--font-title); line-height: var(--line-height-tight); }
.language-chip.selected { border-color: var(--color-focus); background: var(--color-surface-selected); box-shadow: 0 0 0 2px var(--color-selection-ring); }
.onboarding-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: var(--space-s); }
.profile-link { padding: 0; background: transparent; color: var(--color-link); font-size: var(--font-nav); }
.input-row { display: flex; gap: .6rem; }
.input-row .text-field { flex: 1; }
.input-row button { min-height: var(--layout-control-height); }
.starter-suggestions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-top: .85rem; }
.starter-suggestions p { width: 100%; margin: 0; color: var(--color-text-muted); font-size: var(--font-footnote); }
.starter-suggestion { padding: .45rem .6rem; border: var(--stroke-thin) solid var(--color-border); border-radius: var(--radius-chip); background: var(--color-surface-raised); color: var(--color-text); text-align: left; }
.starter-suggestion:hover { border-color: var(--color-focus); background: var(--color-surface-hover); }
.starter-suggestion strong, .starter-suggestion small { display: block; }
.starter-suggestion strong { font-size: var(--font-footnote); }
.starter-suggestion small { margin-top: .08rem; color: var(--color-text-muted); font-size: var(--font-footnote); font-weight: var(--weight-medium); }
.song-results { display: grid; gap: .6rem; margin-top: var(--space-m); }
.song-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; border: var(--stroke-thin) solid var(--color-border); background: var(--color-surface-raised); border-radius: var(--radius-tile); padding: .8rem; text-decoration: none; }
.library-tabs { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-bottom: var(--space-m); }
.library-tab { flex: 1; background: var(--color-surface); border: var(--stroke-thin) solid var(--color-border); color: var(--color-text-subtle); }
.library-tab.selected { background: var(--color-accent); color: var(--color-on-accent); }
.library-progress-track { display: block; height: var(--layout-progress-track-height); margin: .35rem 0; border-radius: var(--radius-progress); background: var(--color-divider); overflow: hidden; }
.library-progress-fill { display: block; height: 100%; background: var(--color-accent); }
.account-nudge { margin-top: var(--space-ml); background: var(--color-nudge-surface); border: var(--stroke-thin) solid var(--color-nudge-border); border-radius: var(--radius-panel); padding: var(--space-m); }
.account-nudge p { margin: 0 0 var(--space-sm); color: var(--color-text-soft); line-height: var(--line-height-relaxed); }
.account-settings { display: grid; gap: .65rem; }
.saved-profile-list { display: grid; gap: .45rem; }
.saved-profile { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); width: 100%; padding: var(--space-sm) .85rem; border: var(--stroke-thin) solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface-sunken); color: var(--color-text-soft); text-align: left; }
.saved-profile small { color: var(--color-text-muted); }
.saved-profile.active { border-color: var(--color-focus); background: var(--color-profile-active-surface); }
.saved-profile.active small { color: var(--color-text-status); }
.account-security, .account-management { display: grid; gap: var(--space-m); }
.account-verification, .account-action-group { display: grid; gap: .65rem; }
.account-action-group + .account-action-group { padding-top: var(--space-m); border-top: var(--stroke-thin) solid var(--color-divider); }
.account-delete-confirm > * + * { margin-top: .65rem; }
/* Status lines sit in the grid gap of their form or group; empty ones must not add space at the bottom. */
:is(.language-profile-form, .account-verification, .account-security, .account-action-group) .form-help { margin: 0; }
.search-panel h2 { margin: 0; font-size: var(--font-title); }
.badge-panel { border-color: var(--color-border-panel-accent); background: linear-gradient(135deg, var(--color-badge-panel-start), var(--color-badge-panel-end)); }
.achievement-track-list { display: grid; gap: .65rem; margin-top: .8rem; }
.achievement-track { display: grid; grid-template-columns: var(--layout-badge-size) 1fr; gap: var(--space-sm); align-items: center; padding: .85rem; border: var(--stroke-thin) solid var(--color-border); border-radius: var(--radius-track); background: var(--color-surface-sunken); }
.badge-icon { display: grid; place-items: center; width: var(--layout-badge-size); height: var(--layout-badge-size); border-radius: 50%; background: var(--color-badge-icon-surface); font-size: var(--font-badge); filter: grayscale(1); opacity: .55; }
.achievement-track strong, .achievement-track small { display: block; }
.achievement-track small { margin-top: .15rem; color: var(--color-text-muted); }
.badge-tier-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.badge-svg { display: block; width: var(--icon-m); height: var(--icon-m); }
.badge-tier { display: inline-grid; grid-template-columns: auto auto; gap: .15rem; align-items: center; color: var(--color-badge-locked); filter: grayscale(1); font-size: var(--font-small); }
.badge-tier em { font-size: var(--font-footnote); font-style: normal; }
.badge-tier.earned { color: var(--color-badge-earned); filter: none; }
.tier-bronze .badge-icon { background: var(--color-tier-bronze); filter: none; opacity: 1; }.tier-silver .badge-icon { background: var(--color-tier-silver); filter: none; opacity: 1; }.tier-gold .badge-icon { background: var(--color-tier-gold); filter: none; opacity: 1; }.tier-platinum .badge-icon { background: var(--color-tier-platinum); filter: none; opacity: 1; }
.sync-info { margin: .2rem 0; }
.vocabulary-actions { display: flex; justify-content: flex-end; margin-top: .8rem; }
.nav-link { position: relative; text-decoration: none; }.nav-link.active { color: var(--color-text-strong); text-decoration: underline; text-decoration-color: var(--color-focus); text-decoration-thickness: var(--stroke-underline); text-underline-offset: var(--layout-nav-underline-offset); }
.song-card-button { width: 100%; text-align: left; color: var(--color-text); font-weight: var(--weight-regular); }
.song-card:hover { border-color: var(--color-focus); background: var(--color-surface-hover); }
.song-card strong, .song-card small { display: block; }
.song-card small { margin-top: .15rem; color: var(--color-text-muted); font-size: var(--font-footnote); }
.song-art { display: grid; place-items: center; width: var(--layout-song-art-size); height: var(--layout-song-art-size); border-radius: var(--radius-card); background: linear-gradient(140deg, var(--color-accent), var(--color-song-art-end)); color: var(--color-on-song-art); font-size: var(--font-song-art); }
.empty-state { color: var(--color-text-muted); }
.import-loading { padding: var(--space-ml); border: var(--stroke-thin) solid var(--color-accent-shade); border-radius: var(--radius-tile); background: var(--color-surface-raised); color: var(--color-text-soft); }
.import-loading h2 { margin: .2rem 0 var(--space-s); }
.import-loading p:last-child { margin: 0; color: var(--color-text-muted); }
.song-heading { padding: var(--space-s) 0 .4rem; }
.song-heading h1 { margin: .1rem 0; font-size: clamp(var(--font-headline), 7vw, var(--font-song-title-max)); line-height: var(--line-height-tight); }
.song-heading p:last-child { margin: var(--space-s) 0 0; color: var(--color-text-muted); }
.mission-heading { padding-top: var(--space-s); }
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-top: var(--space-m); }
.pair-column, .choose-options { display: grid; gap: .55rem; }
.pair-button, .choose-option, [data-answer], [data-cloze] { min-height: var(--layout-option-height); text-align: left; background: var(--color-option-surface); color: var(--color-text); border: var(--stroke-thin) solid var(--color-border); padding: var(--space-sm); }
.pair-button.selected { border-color: var(--color-text-status); box-shadow: 0 0 0 2px var(--color-selection-ring); }
.pair-button.correct, .choose-option.correct, [data-answer].correct, [data-cloze].correct { background: var(--color-success-surface); border-color: var(--color-success); color: var(--color-on-success); }
.pair-button.wrong, .choose-option.wrong, [data-answer].wrong, [data-cloze].wrong { background: var(--color-danger-surface); border-color: var(--color-danger); color: var(--color-on-danger); }
.exercise-prompt, .cloze-line { margin: .65rem 0 var(--space-m); color: var(--color-text-prompt); font-size: clamp(var(--font-prompt-min), 6vw, var(--font-headline)); font-weight: var(--weight-extra-bold); line-height: var(--line-height-prompt); }
.target-highlight { background: var(--color-target-highlight); color: var(--color-text-prompt); padding: .05em .2em; border-radius: .3em; }
.word-preview { display: grid; gap: .65rem; max-height: calc(100dvh - var(--layout-word-preview-offset)); margin: var(--space-m) 0; overflow-y: auto; overscroll-behavior: contain; }
.word-preview article { display: grid; gap: .2rem; padding: .85rem; border-left: var(--stroke-accent-bar) solid var(--color-link); background: var(--color-surface-raised); }
.word-preview strong { font-size: var(--font-term); }
.word-preview span { color: var(--color-text-soft); }
.word-preview small { color: var(--color-text-hint); line-height: var(--line-height-compact); }
/* 44 px target (touch.min) that takes only the 32 px of the old button in the layout. */
.word-audio-button { display: grid; place-items: center; justify-self: end; align-self: start; width: var(--touch-min); height: var(--touch-min); margin: calc((var(--layout-audio-button-size) - var(--touch-min)) / 2); padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-text); }
.word-audio-button svg { display: block; width: var(--icon-m); height: var(--icon-m); }
.word-audio-button:hover, .word-audio-button:focus-visible { background: var(--color-surface-interactive); }
.word-audio-button.is-loading { animation: pronunciation-pulse var(--duration-pulse) ease-in-out infinite alternate; }
@keyframes pronunciation-pulse { to { opacity: .45; } }
.mission-loading, .mission-error { margin-top: var(--space-ml); color: var(--color-text-status); }
/* stylelint-disable-next-line declaration-no-important -- existing override kept for identical rendering (D-010) */
.mission-error { color: var(--color-error-text) !important; }
.mission-player { margin: var(--space-m) 0 .65rem; }
[data-play-cue] { margin-bottom: var(--space-m); }
.mission-cue-host { aspect-ratio: 16 / 9; margin: var(--space-s) 0 var(--space-m); overflow: hidden; border-radius: var(--radius-control); background: var(--color-player-background); }
.mission-cue-frame, .mission-cue-frame iframe { width: 100%; height: 100%; }
.mission-feedback { min-height: var(--layout-status-line-height); margin: var(--space-sm) 0 0; color: var(--color-text-status); font-weight: var(--weight-bold); }
.mission-feedback.correct { color: var(--color-feedback-correct); }
.mission-feedback.wrong { color: var(--color-feedback-wrong); }
.speech-record-button { width: 100%; min-height: var(--layout-input-height); margin-top: var(--space-xs); }
.speech-record-button.correct { background: var(--color-success-surface); border-color: var(--color-success); color: var(--color-on-success); }
.speech-record-button.wrong { background: var(--color-danger-surface); border-color: var(--color-danger); color: var(--color-on-danger); }
.speech-status { min-height: var(--layout-status-line-height); margin: var(--space-sm) 0 0; color: var(--color-text-subtle); line-height: var(--line-height-body); }
.mission-back { display: inline-block; margin-top: 1.4rem; }
.completion-form { display: grid; grid-template-columns: 1fr auto; gap: .65rem; align-items: end; margin-top: var(--space-m); }
.completion-form label { grid-column: 1 / -1; color: var(--color-text-soft); font-size: var(--font-heading-min); font-weight: var(--weight-extra-bold); letter-spacing: .1em; }
.completion-form input { min-width: 0; min-height: var(--layout-completion-input-height); padding: .7rem .85rem; border: var(--stroke-thin) solid var(--color-border-field); border-radius: var(--radius-control); background: var(--color-field); color: var(--color-text); }
.completion-form input.correct { border-color: var(--color-success); background: var(--color-success-surface); }
.completion-form input.wrong { border-color: var(--color-danger); background: var(--color-danger-surface); }
.typed-recall-form { display: grid; gap: .6rem; margin-top: var(--space-m); }
.typed-recall-form label { color: var(--color-text-soft); font-size: var(--font-small); font-weight: var(--weight-extra-bold); letter-spacing: .08em; text-transform: uppercase; }
.typed-recall-form > div { display: grid; grid-template-columns: 1fr auto; gap: .65rem; }
.typed-recall-form input { min-width: 0; min-height: var(--layout-input-height); padding: .8rem var(--space-m); border: var(--stroke-strong) solid var(--color-recall-border); border-radius: var(--radius-panel); outline: none; background: linear-gradient(135deg, var(--color-recall-surface-start), var(--color-recall-surface-end)); box-shadow: inset 0 0 0 1px var(--color-recall-inset), 0 0 0 .25rem var(--color-recall-glow); color: var(--color-text-strong); font-size: var(--font-emphasis); font-weight: var(--weight-bold); transition: border-color var(--duration-input-focus), box-shadow var(--duration-input-focus), transform var(--duration-input-focus); }
.typed-recall-form input:focus { border-color: var(--color-recall-focus-border); box-shadow: inset 0 0 0 1px var(--color-recall-focus-inset), 0 0 0 .3rem var(--color-recall-focus-glow); transform: translateY(calc(-1 * var(--layout-focus-lift))); }
.typed-recall-form button { min-height: var(--layout-input-height); }
.typed-recall-form small { color: var(--color-recall-hint); }
.letter-answer { display: block; min-height: var(--layout-letter-answer-height); margin: var(--space-m) 0 var(--space-sm); padding: var(--space-sm) var(--space-m); border: var(--stroke-strong) dashed var(--color-letter-answer-border); border-radius: var(--radius-panel); background: var(--color-letter-answer-surface); color: var(--color-text-strong); font-size: var(--font-heading-min); font-weight: var(--weight-extra-bold); letter-spacing: .08em; text-align: center; }
.letter-answer:empty::before { content: '…'; color: var(--color-letter-placeholder); }
.letter-blocks { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; }
.letter-blocks button { min-width: var(--layout-letter-block-min-width); min-height: var(--layout-letter-block-height); padding: .55rem .8rem; border: var(--stroke-thin) solid var(--color-letter-block-border); border-radius: var(--radius-input); background: linear-gradient(145deg, var(--color-letter-block-start), var(--color-letter-block-end)); color: var(--color-text-strong); font-size: var(--font-subtitle); font-weight: var(--weight-black); letter-spacing: .06em; }
.letter-blocks button:disabled { opacity: .35; }
.letter-block-actions { display: flex; justify-content: center; gap: .55rem; margin-top: .85rem; }
.mission-feedback-context { white-space: pre-line; line-height: var(--line-height-relaxed); overflow-wrap: anywhere; }
.word-detail-sheet { position: fixed; z-index: 20; inset: 0; display: grid; align-items: end; padding: var(--space-m); background: var(--color-scrim); }
.word-detail-card { position: relative; width: min(var(--layout-sheet-width), 100%); max-height: min(78dvh, var(--layout-sheet-max-height)); margin-inline: auto; overflow-y: auto; border: var(--stroke-thin) solid var(--color-sheet-border); border-radius: var(--radius-sheet); padding: var(--space-ml); background: var(--color-surface-sheet); box-shadow: 0 -1rem 3rem var(--color-shadow); }
.word-detail-card h2 { margin: .1rem 2.4rem .65rem 0; font-size: clamp(var(--font-word-title-min), 7vw, var(--font-word-title-max)); }
.word-detail-close { position: absolute; top: .7rem; right: .7rem; min-width: var(--layout-close-button-size); min-height: var(--layout-close-button-size); padding: 0; background: var(--color-close-button-surface); color: var(--color-text-strong); font-size: var(--font-close-icon); }
.word-detail-line { margin: .6rem 0 .2rem; color: var(--color-text-strong); font-size: var(--font-term); font-weight: var(--weight-extra-bold); line-height: var(--line-height-snug); }
.word-detail-loading { min-height: var(--layout-control-height); color: var(--color-text-status); }
.word-detail-definition { display: grid; gap: var(--space-sm); margin: var(--space-m) 0 0; }
.word-detail-definition div { padding: var(--space-sm); border-left: var(--stroke-accent-bar) solid var(--color-accent); background: var(--color-surface-interactive); }
.word-detail-definition dt { color: var(--color-link); font-size: var(--font-footnote); font-weight: var(--weight-extra-bold); text-transform: uppercase; letter-spacing: .06em; }
.word-detail-definition dd { margin: .3rem 0 0; color: var(--color-text); line-height: var(--line-height-body); }
.final-lyrics-list { display: grid; gap: var(--space-s); max-height: 43dvh; margin: var(--space-m) 0; overflow-y: auto; overscroll-behavior: contain; }
/* Inactive lines like the song view: idle colours instead of opacity (≥ 4.5:1 on surfaceSheet); the active line keeps
   its highlight (focus border, textStrong, translationActive). */
.final-lyric-line { padding: .7rem .8rem; border-left: var(--stroke-strong) solid var(--color-final-line-border); background: var(--color-surface-sheet); color: var(--color-lyric-idle); opacity: 1; }
.final-lyric-line:hover { opacity: 1; }
.final-lyric-line:not(.active) .translation { color: var(--color-translation-idle); }
.final-lyric-line.active { border-left-color: var(--color-focus); background: var(--color-surface-interactive); color: var(--color-text-strong); }
.final-lyric-line p { margin: 0; font-size: var(--font-input); font-weight: var(--weight-emphasis); line-height: var(--line-height-body); }
.final-lyric-line small { display: block; margin-top: .2rem; color: var(--color-text-muted); line-height: var(--line-height-snug); }
.final-gap-input { width: min(var(--layout-gap-input-width), 42vw); min-height: var(--layout-gap-input-height); margin: 0 .15rem; border: 0; border-bottom: var(--stroke-strong) solid var(--color-focus); border-radius: 0; background: var(--color-field); color: var(--color-text-strong); font: inherit; font-weight: var(--weight-extra-bold); }
.final-game-actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.speech-skip-button { background: var(--color-surface-interactive); color: var(--color-text); border: var(--stroke-thin) solid var(--color-border-button); }
.mission-mode { display: grid; grid-template-rows: auto auto minmax(0, 1fr); width: 100%; min-height: 100dvh; margin: 0; padding: var(--space-m); }
.mission-mode .topbar { padding-bottom: .65rem; }
.mission-mode .mission-heading { padding-top: 0; }
.mission-mode .mission-heading h1 { font-size: clamp(var(--font-prompt-min), 3vw, var(--font-mission-title-max)); margin-bottom: .35rem; }
.mission-mode .mission-panel { min-height: 0; display: grid; margin-top: .6rem; padding: .8rem; }
.mission-mode .word-preview { max-height: none; min-height: 0; margin: 0; }
.mission-mode .mission-panel:has(.word-preview) > [data-next] { position: relative; z-index: 1; margin-top: .6rem; }
.mission-mode:has(.word-preview) { height: 100dvh; overflow: hidden; }
.mission-mode .mission-panel:has(.word-preview) { grid-template-rows: minmax(0, 1fr) auto; }
.mission-mode .mission-panel:has(.word-preview) .word-preview { height: 100%; }
.mission-mode .word-preview article { padding: .6rem; }
@media (min-width: 768px) {
  .song-learning-cta { width: fit-content; min-width: var(--layout-cta-min-width); padding-inline: var(--space-ml); }
  .mission-mode .mission-cue-host { width: min(100%, var(--layout-cue-width-desktop)); margin: .4rem auto .65rem; }
  .mission-mode .choose-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mission-mode .choose-options button { min-height: var(--layout-option-height-desktop); }
  .lyrics-mode { display: block; width: min(var(--layout-lyrics-width-desktop), 100%); min-height: 100dvh; height: auto; overflow: visible; padding-bottom: var(--space-m); }
  .lyrics-mode .song-player-column { width: min(100%, var(--layout-content-width)); margin-inline: auto; }
  .lyrics-mode .song-player-stage { min-height: 0; width: 100%; margin-inline: auto; }
  .lyrics-mode .lyrics-panel { width: min(100%, var(--layout-content-width)); margin: var(--space-m) auto 0; }
  .lyrics-mode .lyrics-viewport { height: clamp(var(--layout-lyrics-viewport-min-desktop), 38dvh, var(--layout-lyrics-viewport-max-desktop)); min-height: 0; }
}

/* stylelint-disable-next-line declaration-no-important -- reduced motion must win over every animation and transition */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
/* stylelint-disable-next-line declaration-no-important -- existing override kept for identical rendering (D-010) */
@media (max-width: 480px) { .topbar { padding-bottom: var(--space-l); } .lyrics-mode { padding: 0 .65rem var(--space-m); } .lyrics-mode .topbar { padding: var(--space-sm) 0; } .song-player-stage { min-height: var(--layout-player-min-height-compact); border-radius: var(--radius-control) !important; } .lyrics-viewport { height: clamp(var(--layout-lyrics-viewport-min), 54dvh, var(--layout-lyrics-viewport-max-compact)); } .song-end-actions { grid-template-columns: 1fr; } .input-row { display: grid; } .input-row button { width: 100%; } .pair-grid { gap: .4rem; } .pair-button { min-height: var(--layout-option-height-compact); padding: .65rem var(--space-s); font-size: var(--font-option-compact); overflow-wrap: anywhere; } .song-actions { align-items: flex-end; flex-direction: column; } }

/* Mission interaction improvements */
.mission-loading-screen { min-height: 58dvh; display: grid; place-items: center; align-content: center; gap: .8rem; text-align: center; }
.mission-loading-screen h1, .mission-loading-screen p { margin: 0; }
.mission-progress-ring { --progress: 0; width: var(--layout-progress-ring-size); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--color-progress) calc(var(--progress) * 1%), var(--color-progress-track) 0); position: relative; }
.mission-progress-ring::before { content: ''; position: absolute; inset: .65rem; border-radius: inherit; background: var(--color-progress-center); }
.mission-progress-ring strong { position: relative; font-size: var(--font-badge); }
.order-options { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; }
.order-options button { flex: 0 1 auto; width: auto; min-height: var(--layout-order-option-height); padding-inline: .9rem; }
.final-lyrics-stage.paused::after { content: '⏸'; position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--font-pause-icon); background: var(--color-pause-scrim); color: var(--color-text-strong); }
.final-answer-bar:empty { display: none; }
.final-answer-bar { position: fixed; z-index: 12; left: 50%; bottom: max(var(--space-sm), env(safe-area-inset-bottom)); width: min(var(--layout-answer-bar-width), calc(100vw - var(--space-l))); transform: translateX(-50%); padding: .55rem .65rem; border: var(--stroke-thin) solid var(--color-answer-bar-border); border-radius: var(--radius-tile); background: var(--color-answer-bar-surface); box-shadow: 0 .7rem 2rem var(--color-answer-bar-shadow); backdrop-filter: blur(var(--layout-backdrop-blur)); }
.final-answer-bar .mission-feedback { min-height: 0; margin: 0 0 .4rem; font-size: var(--font-footnote); }
.final-choice-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
.final-choice-options button { min-height: var(--layout-final-choice-height); padding: var(--space-s) .35rem; border: var(--stroke-thin) solid var(--color-border-field); background: var(--color-surface-interactive); color: var(--color-text); font-size: clamp(var(--font-footnote), 3vw, var(--font-small)); line-height: var(--line-height-prompt); overflow-wrap: anywhere; }
.final-choice-options button.correct { background: var(--color-success-surface); border-color: var(--color-success); color: var(--color-on-success); }
.final-choice-options button.wrong { background: var(--color-danger-surface); border-color: var(--color-danger); color: var(--color-on-danger); }
.final-answer-correct { padding: .05em .16em; border-radius: .25em; background: var(--color-success-surface); color: var(--color-on-success); }
.final-answer-auto { padding: .05em .16em; border-radius: .25em; background: var(--color-danger-surface); color: var(--color-on-danger); }
.final-lyrics-panel .lyrics-list { padding-bottom: calc(var(--space-answer-bar-clearance) + env(safe-area-inset-bottom)); }
.final-lyric-line.active { border-bottom-color: var(--color-focus); background: var(--color-surface-sheet); }
.song-guide-actions { display: flex; justify-content: flex-start; margin-top: var(--space-ml); padding-top: var(--space-xs); }
.song-guide-actions button { min-height: var(--layout-cta-height); padding-inline: var(--space-ml); }
.completion-celebration { position: relative; overflow: hidden; padding: var(--space-xxl) var(--space-m); text-align: center; }.completion-primary { display: inline-grid; margin-top: var(--space-ml); padding: .85rem 1.2rem; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-on-accent); font-weight: var(--weight-heavy); text-decoration: none; }.completion-celebration .mission-back { display: block; margin-top: var(--space-m); }.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }.confetti i { position: absolute; width: var(--layout-confetti-width); height: var(--layout-confetti-height); background: var(--color-accent); animation: confetti-fall var(--duration-confetti) ease-out both; }.confetti i:nth-child(1){left:12%;background:var(--color-success)}.confetti i:nth-child(2){left:27%;animation-delay:.15s;background:var(--color-danger)}.confetti i:nth-child(3){left:43%;animation-delay:.35s}.confetti i:nth-child(4){left:61%;animation-delay:.08s;background:var(--color-confetti-gold)}.confetti i:nth-child(5){left:76%;animation-delay:.25s;background:var(--color-success)}.confetti i:nth-child(6){left:89%;animation-delay:.45s;background:var(--color-danger)}@keyframes confetti-fall{from{transform:translateY(calc(-1 * var(--layout-confetti-rise))) rotate(0);opacity:1}to{transform:translateY(var(--layout-confetti-drop)) rotate(360deg);opacity:0}}
.song-end-screen { z-index: 3; }
.mission-results { max-width: var(--layout-results-width); margin-inline: auto; }
.mission-result-totals { display: flex; justify-content: center; gap: .65rem; margin: var(--space-m) 0; }
.mission-result-totals p { margin: 0; padding: .45rem .7rem; border: var(--stroke-thin) solid var(--color-result-border); border-radius: var(--radius-chip); background: var(--color-result-surface); color: var(--color-text-result); font-weight: var(--weight-extra-bold); }
/* stylelint-disable-next-line declaration-no-important -- existing override kept for identical rendering (D-010) */
.mission-recommendation { margin: var(--space-m) auto; color: var(--color-text-result) !important; font-weight: var(--weight-bold); }
.mission-wrong-answers { position: relative; z-index: 1; margin: var(--space-ml) auto 0; padding: var(--space-m); border: var(--stroke-thin) solid var(--color-border-panel-accent); border-radius: var(--radius-tile); background: var(--color-wrong-answers-surface); text-align: left; }
.mission-wrong-answers h2 { margin: 0 0 .8rem; font-size: var(--font-lead); }
.mission-wrong-answers ol { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.mission-wrong-word-card { display: grid; gap: .2rem; padding: .85rem; border-left: var(--stroke-accent-bar) solid var(--color-danger); background: var(--color-surface-raised); }
.mission-wrong-word-card strong { font-size: var(--font-term); }
.mission-wrong-word-card span { color: var(--color-text-soft); }
.mission-wrong-word-card small { color: var(--color-text-hint); line-height: var(--line-height-compact); }
.mission-wrong-word-card p { margin: var(--space-xs) 0 0; color: var(--color-wrong-answer-note); font-size: var(--font-footnote); font-weight: var(--weight-bold); }
.search-state { display: grid; gap: var(--space-s); }
.search-hint, .search-incomplete { margin: var(--space-s) 0 0; }
.search-error-text { margin: 0; color: var(--color-error-text); font-weight: var(--weight-bold); }
.search-error .secondary-button { justify-self: start; }
.search-more { display: grid; gap: var(--space-s); justify-items: start; margin-top: var(--space-s); }
