:root {
  color-scheme: light;
  --bg: #f2f3f4;
  --paper: #fff;
  --ink: #26292e;
  --muted: #616770;
  --line: #dce0e5;
  --accent: #343a44;
  --pale: #eaedf1;
  --success: #276b52;
  --error: #a53535;
  --dock-height: 210px;
  font-family: Inter, 'Segoe UI', Arial, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, select, input[type=checkbox] { cursor: pointer; }
button { border: 0; background: none; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #5870ba; outline-offset: 3px; }
button:disabled, input:disabled { opacity: .55; cursor: not-allowed; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.app-shell { max-width: 920px; margin: auto; padding: 0 28px; }
.site-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 0; }
.header-context { min-width: 0; flex: 1; }
.header-context .lesson-select { display: block; appearance: auto; width: 100%; max-width: 360px; min-height: 48px; padding: 10px 12px; border: 1px solid #aeb5bf; border-radius: 10px; background: var(--paper); font-size: 16px; font-weight: 600; }
.header-context .lesson-select:hover { border-color: var(--accent); }
.lesson-select[data-pointer-focus]:focus { outline: none; box-shadow: none; }
.session-summary { min-height: 32px; padding: 0; color: var(--muted); font-size: 14px; text-align: left; }
.settings-button { display: flex; align-items: center; justify-content: center; gap: 9px; height: 48px; min-height: 48px; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.settings-button:hover, .quiet-button:hover, .icon-button:hover { background: var(--pale); }
.player-card { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); background: var(--paper); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 8px 30px #26292e06; }
.card-heading { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 22px; border-bottom: 1px solid var(--line); }
.lesson-progress { display: grid; gap: 5px; width: 150px; min-width: 0; }
.lesson-progress-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.lesson-progress-label strong { color: var(--ink); font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
#lesson-progress { display: block; appearance: none; border: 0; width: 100%; height: 4px; border-radius: 4px; overflow: hidden; background: var(--line); color: var(--accent); accent-color: var(--accent); }
#lesson-progress::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
#lesson-progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
#lesson-progress::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
.quiet-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px; border-radius: 10px; font-size: 13px; }
.quiet-button svg { width: 19px; height: 19px; }
.artwork-wrap { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 18px; background: #f6f3ef; }
.artwork-wrap img { display: block; width: 100%; height: 270px; object-fit: contain; border-radius: 12px; }
.artwork-caption { font-size: 10px; letter-spacing: 1px; text-align: center; margin-top: 14px; color: #68645f; }
.phrase-content { min-width: 0; display: flex; flex-direction: column; align-self: center; padding: 24px; gap: 12px; }
.section-label { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: 1.2px; font-weight: 550; }
.phrase-texts { display: flex; flex-direction: column; gap: 13px; }
.phrase-row { display: flex; align-items: baseline; gap: 10px; }
.lang-label { width: 21px; flex-shrink: 0; font-size: 10px; color: var(--muted); letter-spacing: 1px; }
h2, p { overflow-wrap: anywhere; }
.target-row h2 { margin: 0; font-size: clamp(24px, 2.5vw, 31px); line-height: 1.2; font-weight: 600; letter-spacing: -.5px; }
.target-copy { flex: 1; min-width: 0; }
.russian p { margin: 0; font-size: 18px; line-height: 1.35; color: var(--muted); }
.is-test .russian p { font-size: 18px; font-weight: 400; line-height: 1.4; color: var(--muted); }
.is-test .target-row h2 { font-size: clamp(25px, 2.7vw, 32px); font-weight: 650; color: inherit; }
.is-test .target-row { align-items: center; min-height: 112px; padding: 16px; border-radius: 14px; background: var(--accent); color: #fff; }
.is-test .target-row .lang-label { color: #d5dae1; }
.is-test .target-row .voice-indicator i { background: #fff; }
.answer-placeholder { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; color: #d5dae1; font-size: 14px; line-height: 1.4; }
.answer-dots { color: #fff; font-size: 24px; line-height: 1; letter-spacing: 7px; }
.answer-hidden .target-row .voice-indicator { display: none; }
.voice-indicator { display: none; align-self: center; gap: 3px; height: 18px; }
.phrase-row.active .voice-indicator { display: inline-flex; }
.voice-indicator i { width: 3px; height: 9px; background: var(--accent); border-radius: 2px; margin: auto 0; }
.voice-indicator i:nth-child(2) { height: 17px; }
.translation-toggle { align-self: flex-start; margin-left: 22px; padding: 4px 8px; }
.translation-hidden, .recall-support, .playback-status { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
.recall-support p { margin: 0; }
.playback-status { background: var(--pale); padding: 12px; border-radius: 12px; }
.is-voice .playback-status { display: none; }
.voice-response { background: var(--pale); padding: 13px; border-radius: 13px; }
.voice-response-heading { display: flex; align-items: center; gap: 9px; }
.voice-response-heading strong { font-size: 15px; font-weight: 600; }
.voice-response p { margin: 5px 0 0; color: #5a626d; font-size: 13px; line-height: 1.45; }
.voice-level { --voice-level: 0; display: block; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #818a96; overflow: hidden; background: #fff; }
.voice-level span { display: block; height: 100%; background: var(--success); transform: scaleY(var(--voice-level)); transform-origin: bottom; }
.voice-response[data-state=speaking] { background: #e6f1eb; }
.voice-response[data-state=speaking] .voice-response-heading { color: #24553e; }
.voice-response[data-state=unavailable] { background: #fff0df; }
.secondary-button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; min-height: 44px; margin-top: 10px; background: var(--paper); font-size: 13px; }
.player-controls { grid-column: 1/-1; border-top: 1px solid var(--line); background: var(--paper); }
.dock-inner { max-width: 600px; margin: auto; padding: 18px 24px 10px; }
.transport { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 14px; align-items: center; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; border-radius: 12px; width: 48px; height: 50px; }
.play-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 52px; background: var(--accent); color: #fff; font-weight: 600; border-radius: 13px; padding: 12px 18px; }
.play-button:hover, .primary-button:hover { background: #252a33; }
.is-loading .play-button { opacity: .7; }
.answer-button { width: 100%; display: block; min-height: 46px; border: 1px solid #aeb5bf; border-radius: 12px; margin-bottom: 10px; font-size: 15px; font-weight: 550; }
.answer-button:hover { background: var(--pale); }
.dock-secondary { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
.dock-tools { display: flex; align-items: center; gap: 20px; }
.dock-tool { position: relative; flex-direction: column; gap: 6px; min-height: 52px; padding: 6px 8px; border: 0; color: var(--muted); background: transparent; font-size: 12px; font-weight: 400; }
.dock-tool:hover { background: transparent; }
.dock-tool[aria-pressed=false] .toggle-icon, #keep-screen-on:not(:checked) + .toggle-icon { color: #9aa1ab; }
.dock-tool[aria-pressed=true], .awake-button:has(input:checked) { color: var(--ink); font-weight: 600; }
.dock-tool[aria-pressed=true] .toggle-icon > svg, #keep-screen-on:checked + .toggle-icon > svg { stroke-width: 2.1; }
.toggle-icon { display: inline-flex; }
.personal-loading { max-width: 480px; margin: 15vh auto; padding: 24px; line-height: 1.6; }
.personal-loading a, .personal-navigation a { color: var(--ink); text-underline-offset: 4px; }
.personal-navigation { display: flex; justify-content: space-between; gap: 16px; padding: 20px 0 6px; font-size: 14px; }
.screen-awake { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.awake-button { cursor: pointer; }
.awake-button:has(input:focus-visible) { outline: 3px solid #5870ba; outline-offset: 3px; }
.awake-button:has(input:disabled) { opacity: .55; cursor: not-allowed; }
#settings-awake-slot .awake-button { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0; min-height: 44px; font-size: 14px; }
.awake-feedback p { margin: 0; font-size: 12px; line-height: 1.35; color: var(--muted); }
.screen-awake[data-state=unavailable] .awake-feedback p, .screen-awake[data-state=released] .awake-feedback p { color: #8a4d1c; }
input[type=checkbox] { appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; width: 42px; height: 26px; border: 1px solid #8c939d; background: #e0e3e8; border-radius: 20px; margin: 9px 0; }
input[type=checkbox]::before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::before { transform: translateX(16px); }
input[type=checkbox]::after { content: ''; position: absolute; inset: -9px 0; }
#keep-screen-on { position: absolute; inset: 0; z-index: 1; opacity: 0; width: 100%; height: 100%; margin: 0; border: 0; cursor: pointer; }
#keep-screen-on:disabled { cursor: not-allowed; }
#keep-screen-on::before, #keep-screen-on::after { display: none; }
.audio-error { padding: 10px 12px; background: #fff0ed; color: var(--error); border-radius: 10px; font-size: 13px; line-height: 1.4; margin: 8px 0 0; }
.keyboard-hint { text-align: center; margin: 18px 0; font-size: 12px; color: var(--muted); }
kbd { font: inherit; padding: 3px 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.panel-open { overflow: hidden; }
.sheet { padding: 0; width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 48px); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: var(--paper); overflow: hidden; box-shadow: 0 20px 70px #10172233; }
@supports(height:100dvh) { .sheet { max-height: calc(100dvh - 48px); } }
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: #171d2966; }
.sheet-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-shrink: 0; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet-heading h2 { margin: 0; font-size: 20px; font-weight: 650; line-height: 1.25; }
.sheet-heading .section-label { margin: 0 0 5px; }
.close-button { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; border-radius: 12px; background: var(--pale); font-size: 25px; font-weight: 400; }
.sheet-content { padding: 18px; overflow-y: auto; overscroll-behavior: contain; }
fieldset { padding: 0; margin: 0 0 20px; border: 0; min-width: 0; }
legend, .field-label { display: block; padding: 0; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.field-label { margin-top: 18px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.segmented button { min-height: 46px; padding: 10px 8px; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.segmented button[aria-pressed=true] { color: #fff; background: var(--accent); border-color: var(--accent); }
.mode-picker button:last-child { grid-column: 1/-1; }
.help-text { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 59px; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.setting-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
select { background: var(--bg); border: 1px solid var(--line); padding: 10px; min-height: 44px; border-radius: 9px; font-size: 16px; max-width: 100%; }
.lesson-select { width: 100%; }
.full-width { width: 100%; margin-top: 20px; }
.recording-details { margin-top: 12px; }
.recording-details summary { min-height: 44px; display: list-item; padding: 13px 0; cursor: pointer; font-size: 13px; }
.recording-content { border-top: 1px solid var(--line); padding-top: 12px; }
.time-label { display: flex; gap: 5px; justify-content: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek { display: block; width: 100%; margin: 8px 0; height: 32px; accent-color: var(--accent); }
.download-link { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.language-route { display: flex; align-items: center; gap: 8px; margin: 15px 0; color: var(--muted); font-size: 12px; }
.recording-content > strong { display: block; font-size: 14px; }
.phrase-sheet { width: min(620px, calc(100% - 32px)); }
.playlist-progress { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.phrase-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.phrase-point { height: 44px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; background: var(--bg); }
.phrase-point.done { background: #e6eee9; color: #305942; }
.phrase-point.done::after { content: ' ✓'; font-size: 9px; }
.phrase-point[aria-current=true] { color: #fff; background: var(--accent); border-color: var(--accent); }
.phrase-map-legend { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; font-size: 11px; color: var(--muted); }
.phrase-map-legend button { font-size: 12px; }
.playlist { list-style: none; margin: 0; padding: 0; }
.track-button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 4px; border-top: 1px solid var(--line); text-align: left; border-radius: 0; }
.track-button[aria-current=true] { background: var(--pale); border-radius: 10px; padding: 14px 8px; }
.track-number { color: var(--muted); min-width: 17px; font-size: 11px; }
.track-thumbnail { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }
.track-copy { flex: 1; min-width: 0; }
.track-copy strong { display: block; font-size: 14px; line-height: 1.35; font-weight: 550; }
.track-copy small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.track-end { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.track-end svg { width: 18px; height: 18px; }
.noscript { padding: 24px; }
@media(max-width:740px),(hover:none) and (pointer:coarse) {
  html { scroll-padding-top: 96px; scroll-padding-bottom: calc(var(--dock-height) + 20px); }
  .app-shell { max-width: 640px; padding: 0; }
  .site-header { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: max(7px, env(safe-area-inset-top)) 16px 7px; border-bottom: 1px solid var(--line); gap: 8px; }
  .session-summary { font-size: 13px; min-height: 28px; }
  .settings-button { width: 48px; flex-shrink: 0; padding: 10px; }
  .settings-button span { display: none; }
  main { padding-bottom: calc(var(--dock-height) + 18px); }
  .player-card { display: block; border: 0; border-radius: 0; background: var(--bg); box-shadow: none; }
  .card-heading { border: 0; padding: 5px 16px; }
  .lesson-progress { width: 140px; }
  .artwork-wrap { padding: 0; margin: 0 16px; border-radius: 15px; overflow: hidden; }
  .artwork-wrap img { width: 100%; height: clamp(120px, 24dvh, 195px); border-radius: 0; }
  .artwork-caption { display: none; }
  .phrase-content { padding: 12px 16px 14px; gap: 11px; }
  #card-mode-label { display: none; }
  .target-row h2, .is-test .target-row h2 { font-size: 27px; }
  .is-test .target-row { padding: 14px; }
  .is-test .russian p { font-size: 17px; }
  .is-test #translations { padding: 0 4px; }
  .russian p { font-size: 18px; }
  .lang-label { font-size: 9px; width: 18px; }
  .phrase-row { gap: 8px; }
  .player-controls { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; box-shadow: 0 -4px 18px #26292e05; padding-bottom: env(safe-area-inset-bottom); }
  .dock-inner { max-width: 640px; padding: 10px 16px 5px; }
  .transport { gap: 10px; }
  .play-button { min-height: 50px; font-size: 15px; }
  .dock-secondary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; align-items: start; }
  .dock-tools, #mobile-awake-slot, #mobile-awake-slot .screen-awake { display: contents; }
  .dock-tool { width: 100%; min-width: 0; min-height: 52px; padding: 5px 2px; font-size: 11px; white-space: nowrap; }
  #mobile-awake-slot .awake-feedback { grid-column: 1 / -1; text-align: center; }
  #mobile-awake-slot .screen-awake:not([data-state=unavailable]):not([data-state=released]):not([data-state=unsupported]) .awake-feedback { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #mobile-awake-slot .awake-feedback p { font-size: 11px; }
  .keyboard-hint { display: none; }
  .sheet { width: 100%; max-width: 640px; margin: auto auto 0; max-height: calc(100dvh - 14px); border-radius: 23px 23px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .sheet-heading { padding-top: 13px; }
  .sheet-heading h2 { font-size: 19px; }
  .sheet-content { padding: 16px 18px 20px; }
}
@media(max-width:360px) {
  .site-header { padding-left: 12px; padding-right: 12px; }
  .session-summary { font-size: 12px; }
  .phrase-content { padding-left: 16px; padding-right: 16px; }
  .target-row h2, .is-test .target-row h2 { font-size: 25px; }
  .dock-inner { padding-left: 12px; padding-right: 12px; }
}
@media(orientation:landscape) and (max-height:540px) and (hover:none) and (pointer:coarse) {
  .app-shell { max-width: 100%; }
  .site-header { padding-top: 3px; padding-bottom: 3px; }
  .header-context { display: flex; align-items: center; gap: 16px; }
  .header-context .lesson-select { width: auto; max-width: 45vw; }
  .session-summary { min-height: 44px; }
  .player-card { display: grid; grid-template-columns: 36% minmax(0,1fr); }
  .card-heading { grid-column: 1/-1; padding-top: 0; padding-bottom: 0; }
  .artwork-wrap { align-self: start; margin-right: 0; }
  .artwork-wrap img { height: 140px; }
  .phrase-content { padding-top: 5px; }
  .dock-inner { max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding-top: 7px; padding-bottom: 7px; }
  .transport { flex: 1 1 220px; min-width: 220px; grid-template-columns: 44px minmax(80px,1fr) 44px; gap: 5px; }
  #voice-actions, #recall-actions { flex: 0 1 145px; }
  .answer-button { margin: 0; padding: 7px 10px; font-size: 13px; }
  .dock-secondary { flex: 1 1 276px; margin: 0; }
  .dock-tool { min-height: 44px; gap: 4px; padding: 2px; }
  .audio-error { flex-basis: 100%; }
}
@media(prefers-reduced-motion:no-preference) { button, input[type=checkbox] { transition: background-color .12s, border-color .12s; } }
