:root {
    --paper: #f4f1e8;
    --paper-raised: #fffdf7;
    --ink: #17253d;
    --muted: #5f6b7a;
    --line: #d7d2c6;
    --blue: #2356c4;
    --blue-dark: #173f96;
    --blue-soft: #e4ebfb;
    --orange: #b54b1e;
    --orange-soft: #f8e6dc;
    --danger: #9d2c2c;
    --success: #1f6b4f;
    --content-bottom-clearance: 72px;
    --speaker-playing: #163e7a;
    --shadow: 0 12px 34px rgba(23, 37, 61, 0.11);
    --radius: 14px;
    font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
}

.reviews-page .due-banner { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.reviews-page .due-banner .primary-link, .reviews-page .review-finished { grid-column: 1 / -1; justify-content: center; }
.review-queue-note { margin: -6px 0 16px; color: var(--muted); font-size: 12px; }
.review-overdue { color: #875321; }
.calendar-heading h2 button { font: inherit; color: inherit; border: 0; background: transparent; min-height: 44px; padding: 0 8px; cursor: pointer; border-radius: 6px; }
.month-picker { display: flex; align-items: end; justify-content: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.month-picker[hidden] { display: none; }
.month-picker label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.month-picker select { min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper-raised); color: var(--ink); font-size: 16px; }
.calendar-feedback { min-height: 24px; margin: 4px 0; font-size: 12px; color: var(--muted); }
.calendar-legend { font-size: 11px; }
.date-wheel { font-size: 19px; font-variant-numeric: tabular-nums; }
.date-wheel-option { font-weight: 400; }
.date-wheel-option[aria-selected="true"] { font-weight: 750; }
.reviews-page .date-tasks { margin-top: 8px; }
#calendar-panel[aria-busy="true"] .calendar-grid { opacity: .75; }

.speech-controls {
    position: sticky;
    top: 8px;
    z-index: 15;
    margin: 20px 0;
    padding: 12px;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.speech-speed-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.speech-speed-row button, .speaker-button { min-width: 44px; min-height: 44px; }
.speech-speed-row output { min-width: 54px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.speech-controls p { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.speech-controls button:disabled { opacity: 0.45; cursor: not-allowed; }
.recent-sentence-row { display: flex; align-items: start; gap: 12px; }
.recent-sentence-row p { flex: 1; min-width: 0; }
.speaker-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

::selection {
    color: var(--ink);
    background: #f5c8a9;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
dialog:focus-visible {
    outline: 3px solid #ed9b61;
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 8px;
    left: 8px;
    padding: 10px 14px;
    color: white;
    background: var(--ink);
    transform: translateY(-140%);
}

.skip-link:focus {
    transform: translateY(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
    border-bottom: 1px solid rgba(23, 37, 61, 0.12);
    background: rgba(244, 241, 232, 0.95);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    color: var(--ink);
    text-decoration: none;
}

.wordmark > span,
.login-mark {
    display: grid;
    place-items: center;
    color: white;
    background: var(--ink);
    border-radius: 50%;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

.wordmark > span {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.wordmark strong {
    font-size: 16px;
    letter-spacing: -0.01em;
}

.wordmark > img {
    display: block;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: contain;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions form {
    margin: 0;
}

.demo-badge {
    padding: 5px 9px;
    color: #783113;
    border: 1px solid #e8b69d;
    border-radius: 999px;
    background: var(--orange-soft);
    font-size: 12px;
    font-weight: 700;
}

.text-button,
.sheet-close {
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    color: var(--muted);
    border: 0;
    background: transparent;
    cursor: pointer;
}

.header-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.app-main {
    width: min(100%, 780px);
    margin: 0 auto;
    padding: 36px 20px calc(96px + var(--content-bottom-clearance) + env(safe-area-inset-bottom));
}

.page-intro h1 {
    max-width: 12ch;
    margin: 0 0 12px;
    font-family: Georgia, "Songti SC", serif;
    font-size: 38px;
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.page-intro p {
    max-width: 39rem;
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.demo-notice {
    display: grid;
    gap: 3px;
    margin: 28px 0 22px;
    padding: 14px 16px;
    color: #703417;
    border: 1px solid #e5bba5;
    border-radius: 12px;
    background: var(--orange-soft);
    font-size: 14px;
}

.demo-notice strong {
    font-size: 13px;
}

.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #e9e5dc;
}

.mode-switch button {
    min-height: 44px;
    padding: 8px 12px;
    color: var(--muted);
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-weight: 700;
    cursor: pointer;
}

.mode-switch button.is-active {
    color: var(--ink);
    background: var(--paper-raised);
    box-shadow: 0 3px 10px rgba(23, 37, 61, 0.09);
}

.composer {
    margin-top: 12px;
    border: 1px solid #b9b4a9;
    border-radius: var(--radius);
    background: var(--paper-raised);
    box-shadow: 0 7px 24px rgba(23, 37, 61, 0.07);
    overflow: hidden;
}

.composer:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-soft), 0 9px 26px rgba(23, 37, 61, 0.08);
}

.composer textarea {
    display: block;
    width: 100%;
    min-height: 132px;
    padding: 18px;
    color: var(--ink);
    border: 0;
    outline: 0;
    resize: vertical;
    background: transparent;
    font-size: 17px;
    line-height: 1.55;
    caret-color: var(--blue);
}

.composer textarea::placeholder {
    color: #747c87;
}

.recording-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 54px;
    padding: 7px 12px;
    border-top: 1px solid #e2ded4;
}

.recording-bar > span {
    flex: 1 1 170px;
    color: var(--muted);
    font-size: 12px;
}

.voice-button {
    min-height: 44px;
    padding: 8px 13px;
    color: var(--blue-dark);
    border: 1px solid #aab8da;
    border-radius: 11px;
    background: var(--paper-raised);
    font-weight: 750;
    cursor: pointer;
}

.voice-button::first-letter {
    color: var(--orange);
}

.composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 10px 12px 10px 18px;
    border-top: 1px solid #e2ded4;
}

.composer-actions > div {
    display: flex;
    gap: 8px;
}

.draft-status {
    color: var(--muted);
    font-size: 12px;
}

.primary-button,
.secondary-button {
    min-height: 44px;
    padding: 10px 17px;
    border-radius: 11px;
    font-weight: 750;
    cursor: pointer;
    transition: background 180ms ease-out, transform 180ms ease-out, color 180ms ease-out;
}

.primary-button {
    color: white;
    border: 1px solid var(--blue);
    background: var(--blue);
}

.primary-button:hover {
    background: var(--blue-dark);
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.primary-button:disabled {
    color: #e4e8f2;
    border-color: #7085b4;
    background: #7085b4;
    cursor: wait;
}

.secondary-button {
    color: var(--blue-dark);
    border: 1px solid #9aabd5;
    background: var(--paper-raised);
}

.secondary-button:hover {
    background: var(--blue-soft);
}

.result-region {
    min-height: 210px;
    margin-top: 34px;
}

.empty-result {
    display: grid;
    place-items: center;
    min-height: 210px;
    padding: 32px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.empty-result span {
    color: var(--ink);
    font-family: Georgia, serif;
    font-size: 28px;
    font-weight: 700;
}

.empty-result p {
    max-width: 29rem;
    margin: 0;
}

.result-loading {
    padding: 24px 0;
}

.loading-line {
    width: 100%;
    height: 16px;
    margin-bottom: 12px;
    border-radius: 7px;
    background: #dfdbd1;
    animation: loading-pulse 1.4s ease-in-out infinite alternate;
}

.loading-line:first-child {
    width: 76%;
    height: 34px;
}

.loading-line:last-child {
    width: 58%;
}

@keyframes loading-pulse {
    to { opacity: 0.45; }
}

.result-meta,
.section-heading,
.result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-meta {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}

.result-meta strong {
    color: var(--blue-dark);
}

.main-sentence {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    line-height: 1.28;
    letter-spacing: -0.02em;
}

.token-button {
    display: inline;
    padding: 2px 1px;
    color: inherit;
    border: 0;
    border-bottom: 1px solid #99abd2;
    background: transparent;
    font: inherit;
    line-height: inherit;
    cursor: pointer;
}

.token-button:hover,
.token-button:focus-visible {
    color: var(--blue-dark);
    background: var(--blue-soft);
}

.result-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 20px 0 28px;
}

.inline-action {
    min-height: 44px;
    padding: 8px 13px;
    color: var(--blue-dark);
    border: 1px solid #b0bddc;
    border-radius: 999px;
    background: transparent;
    font-weight: 700;
    cursor: pointer;
}

.result-section {
    padding: 24px 0;
    border-top: 1px solid var(--line);
}

.result-section h2,
.section-heading h2 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.3;
}

.result-section > p {
    max-width: 65ch;
    margin: 0;
    color: #344157;
}

.learning-points {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.learning-points li {
    display: grid;
    grid-template-columns: minmax(90px, 0.34fr) 1fr;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px dashed #c9c4b9;
}

.learning-points strong {
    color: var(--blue-dark);
}

.learning-points p {
    margin: 0;
    color: #344157;
}

.learning-points .inline-action {
    grid-column: 2;
    justify-self: start;
}

.error-state {
    padding: 22px;
    color: #6f2525;
    border: 1px solid #dfaaaa;
    border-radius: var(--radius);
    background: #fae7e5;
}

.error-state h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.error-state p {
    margin: 0 0 14px;
}

.teacher-thread {
    display: grid;
    gap: 14px;
}

.teacher-message {
    max-width: 88%;
    padding: 14px 16px;
    border-radius: 14px;
}

.teacher-message.user {
    justify-self: end;
    color: white;
    background: var(--blue);
    border-bottom-right-radius: 4px;
}

.teacher-message.george {
    justify-self: start;
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
    background: var(--paper-raised);
}

.teacher-message p {
    margin: 0;
}

.recent-section {
    margin-top: 54px;
}

.section-heading {
    padding-bottom: 10px;
    border-bottom: 2px solid var(--ink);
}

.section-heading span {
    color: var(--muted);
    font-size: 13px;
}

.recent-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.recent-list li {
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.recent-list p {
    margin: 0 0 4px;
    font-family: Georgia, serif;
    font-size: 18px;
}

.recent-list span {
    color: var(--muted);
    font-size: 14px;
}

.bottom-nav {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 6px max(10px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    border-top: 1px solid #c9c4b8;
    background: rgba(255, 253, 247, 0.97);
}

.bottom-nav a {
    display: grid;
    place-items: center;
    min-height: 50px;
    padding: 5px 4px;
    color: var(--muted);
    border-radius: 10px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.bottom-nav a.is-current {
    color: var(--blue-dark);
    background: var(--blue-soft);
}

.bottom-nav a span {
    display: block;
    font-size: 9px;
    font-weight: 500;
}

.bottom-nav a.is-disabled {
    opacity: 0.62;
}

.update-banner {
    position: fixed;
    z-index: 40;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    color: white;
    border-radius: 12px;
    background: var(--ink);
    box-shadow: var(--shadow);
}

.update-banner[hidden] {
    display: none;
}

.update-banner span {
    flex: 1;
    font-size: 13px;
}

.update-banner button {
    min-height: 44px;
    padding: 7px 10px;
    color: white;
    border: 1px solid #71809a;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
}

.update-banner [data-apply-update] {
    color: var(--ink);
    background: var(--paper-raised);
}

.word-sheet {
    width: min(100% - 24px, 520px);
    margin: auto;
    padding: 28px 22px 22px;
    color: var(--ink);
    border: 0;
    border-radius: 16px;
    background: var(--paper-raised);
    box-shadow: var(--shadow);
}

.word-sheet::backdrop {
    background: rgba(13, 24, 42, 0.5);
}

.word-sheet[open] {
    animation: sheet-in 180ms ease-out;
}

@keyframes sheet-in {
    from { transform: translateY(24px); opacity: 0.5; }
}

.sheet-close {
    position: absolute;
    top: 10px;
    right: 12px;
}

.word-pos {
    margin: 12px 0 4px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.word-sheet h2 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 34px;
}

.word-ipa {
    margin: 4px 0 20px;
    color: var(--blue-dark);
}

.word-meaning {
    margin: 0 0 20px;
    font-size: 17px;
}

.provider-source {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.sheet-actions,
.learning-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.card-feedback {
    min-height: 1.4em;
    margin: 10px 0 0;
    color: var(--success);
    font-size: 13px;
}

.library-intro h1 {
    max-width: 16ch;
}

.eyebrow {
    margin: 0 0 7px !important;
    color: var(--blue-dark) !important;
    font-size: 12px !important;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.library-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 30px 0 42px;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--line);
}

.library-summary > button {
    background: transparent;
    color: inherit;
    border: 0;
    cursor: pointer;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    padding: 16px 8px;
    border-right: 1px solid var(--line);
}

.library-summary > button:last-child {
    border-right: 0;
}

.library-summary strong {
    font-family: Georgia, serif;
    font-size: 28px;
}

.library-summary button[aria-pressed="true"] { background: var(--blue-soft); box-shadow: inset 0 -3px var(--blue); }
.pronunciation-row { display: flex; align-items: center; gap: 6px; }
.pronunciation-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.speaker-button.inline-action, .speaker-button.secondary-button { flex: 0 0 44px; min-width: 44px; min-height: 44px; padding: 10px; border: 0; background: transparent; color: var(--blue); box-shadow: none; }
.speaker-button svg { width: 18px; height: 18px; }
.ipa-badge, .word-ipa { display: inline-block; border-radius: 999px; background: #f0f1f3; padding: 6px 12px; color: var(--ink); }
.history-token { font: inherit; padding: 0; min-height: 0; height: auto; vertical-align: baseline; }
#date-tasks, #calendar-panel { scroll-margin-top: 150px; }
.calendar-day.is-selected { outline: 2px solid var(--blue); outline-offset: -2px; background: var(--blue-soft); }

.library-summary span {
    color: var(--muted);
    font-size: 12px;
}

.library-empty {
    display: grid;
    justify-items: start;
    padding: 32px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.library-empty > span {
    font-family: Georgia, serif;
    font-size: 40px;
}

.library-empty h2 {
    margin: 12px 0 4px;
}

.library-empty p {
    max-width: 34rem;
    margin: 0 0 20px;
    color: var(--muted);
}

.primary-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 9px 16px;
    color: white;
    border-radius: 11px;
    background: var(--blue);
    text-decoration: none;
    font-weight: 750;
}

.library-group + .library-group {
    margin-top: 52px;
}

.learning-list {
    display: grid;
}

.learning-card {
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}

.learning-card-topline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.status-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 800;
}

.status-pending {
    color: #784017;
    background: var(--orange-soft);
}

.status-learning {
    color: #184e3c;
    background: #dceee7;
}

.status-paused {
    color: var(--muted);
    background: #e6e3db;
}

.learning-card h3 {
    margin: 12px 0 1px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 27px;
}

.learning-meaning {
    margin: 0;
    color: #344157;
}

.learning-card blockquote {
    margin: 15px 0;
    padding-left: 13px;
    color: var(--muted);
    border-left: 2px solid #aab8da;
    font-family: Georgia, serif;
}

.notes-editor {
    margin: 14px 0;
}

.notes-editor summary {
    min-height: 44px;
    padding: 10px 0;
    color: var(--blue-dark);
    cursor: pointer;
}

.notes-editor label {
    display: block;
    margin: 4px 0;
    font-size: 13px;
    font-weight: 700;
}

.notes-editor textarea {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid #aaa79f;
    border-radius: 10px;
    background: var(--paper-raised);
}

.text-danger {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
    color: var(--danger);
    border: 0;
    background: transparent;
    font-weight: 700;
    cursor: pointer;
}

.review-intro h1 {
    max-width: 13ch;
}

.due-banner {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 14px;
    margin: 28px 0 34px;
    padding: 16px;
    color: white;
    background: var(--ink);
}

.due-banner > div {
    display: grid;
}

.due-banner strong {
    font-family: Georgia, serif;
    font-size: 28px;
}

.due-banner span {
    color: #cbd4e2;
    font-size: 12px;
}

.due-banner .primary-link {
    color: var(--ink);
    background: var(--paper-raised);
}

.calendar-panel {
    margin-top: 38px;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--line);
}

.calendar-heading {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    padding: 10px 0;
}

.calendar-heading h2 {
    margin: 0;
    text-align: center;
    font-family: Georgia, serif;
    font-size: 22px;
}

.calendar-heading a {
    display: grid;
    place-items: center;
    min-height: 44px;
    color: var(--blue-dark);
    text-decoration: none;
    font-size: 23px;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-weekdays span {
    padding: 7px 0;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    text-align: center;
    font-size: 11px;
}

.calendar-day {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 54px;
    color: var(--ink);
    border-right: 1px solid #e2ded4;
    border-bottom: 1px solid #e2ded4;
    text-decoration: none;
    font-size: 13px;
}

.calendar-day:nth-child(7n) {
    border-right: 0;
}

.calendar-day.is-outside {
    color: #9b9b96;
}

.calendar-day.is-today > span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: white;
    border-radius: 50%;
    background: var(--blue);
}

.calendar-day strong {
    position: absolute;
    right: 4px;
    bottom: 3px;
    min-width: 17px;
    padding: 1px 4px;
    color: #713213;
    border-radius: 999px;
    background: var(--orange-soft);
    text-align: center;
    font-size: 9px;
}

.date-tasks {
    margin-top: 38px;
}

.review-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 68px;
    padding: 12px 0;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}

.review-row > span:first-child {
    display: grid;
    min-width: 0;
    overflow-wrap: anywhere;
}

.review-row > span:last-child { flex-shrink: 0; white-space: nowrap; }
.review-row .review-row-trailing { display: flex; align-items: center; gap: 8px; }
.review-state { font-size: 11px; line-height: 1.6; padding: 3px 6px; border-radius: 4px; color: #77501f; background: #f5e7ce; }
.review-state.is-reviewed { color: #245b4a; background: #e0eee6; }
.review-finished { grid-column: 1 / -1; margin: 0; font-size: 14px; }

.review-row small,
.review-row > span:last-child,
.quiet-empty {
    color: var(--muted);
    font-size: 13px;
}

.quiet-empty {
    padding: 22px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--blue-dark);
    text-decoration: none;
    font-weight: 700;
}

.recall-progress {
    display: flex;
    justify-content: space-between;
    margin: 16px 0 42px;
    padding-top: 12px;
    color: var(--muted);
    border-top: 2px solid var(--ink);
    font-size: 13px;
}

.recall-prompt h1 {
    max-width: 18ch;
    margin: 8px 0 30px;
    font-family: Georgia, "Songti SC", serif;
    font-size: 36px;
    line-height: 1.2;
}

.recall-prompt label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
}

.recall-prompt textarea {
    width: 100%;
    min-height: 96px;
    padding: 12px;
    border: 1px solid #aaa79f;
    border-radius: 12px;
    background: var(--paper-raised);
}

.reveal-answer {
    width: 100%;
    margin-top: 12px;
}

.recall-answer {
    padding-top: 8px;
}

.recall-answer h2 {
    margin: 8px 0 4px;
    font-family: Georgia, serif;
    font-size: 38px;
}

.recall-answer blockquote {
    margin: 22px 0;
    padding-left: 14px;
    color: var(--muted);
    border-left: 2px solid #aab8da;
}

.personal-note {
    padding: 12px;
    color: #70401f;
    background: var(--orange-soft);
}

.rating-fieldset {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    margin: 34px 0 0;
    padding: 18px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.rating-fieldset legend {
    padding: 0;
    font-weight: 800;
}

.rating-fieldset button {
    display: grid;
    gap: 2px;
    min-height: 66px;
    padding: 10px;
    color: var(--ink);
    border: 1px solid #aaa79f;
    border-radius: 11px;
    background: var(--paper-raised);
    cursor: pointer;
}

.rating-fieldset button:nth-of-type(1) {
    color: var(--danger);
    border-color: #d8a7a7;
}

.rating-fieldset button:nth-of-type(4) {
    color: var(--success);
    border-color: #92b8a8;
}

.rating-fieldset span {
    color: var(--muted);
    font-size: 11px;
}

.review-complete {
    padding: 34px 0;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--line);
}

.review-complete h2 {
    margin: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: 31px;
}

.review-complete p {
    margin: 8px 0 22px;
    color: var(--muted);
}

.login-page .app-main {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding-top: 40px;
    padding-bottom: 40px;
}

.login-panel {
    width: min(calc(100% - 32px), 320px);
    margin-inline: auto;
}

.login-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: transparent;
    object-fit: contain;
}

.login-panel h1 {
    margin: 0 0 28px;
    text-align: center;
    font-size: 24px;
    line-height: 1.4;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.stack-form > label:not(.checkbox-row) {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
}

.stack-form > input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    color: var(--ink);
    border: 1px solid #aaa79f;
    border-radius: 11px;
    background: var(--paper-raised);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--muted);
    font-size: 14px;
}

.checkbox-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--blue);
}

.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 14px;
}

.eyebrow,
.section-number {
    margin: 0 0 8px;
    color: var(--orange);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.settings-intro h1 {
    max-width: 15ch;
}

.data-counts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 34px 0 46px;
    padding: 0;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--line);
}

.data-counts div {
    padding: 16px 10px 18px 0;
}

.data-counts dt {
    color: var(--muted);
    font-size: 12px;
}

.data-counts dd {
    margin: 2px 0 0;
    font-family: Georgia, serif;
    font-size: 30px;
}

.settings-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 30px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
}

.settings-section h2 {
    margin: 0 0 6px;
    font-family: Georgia, "Songti SC", serif;
    font-size: 26px;
}

.settings-section p:not(.section-number):not(.form-status) {
    max-width: 34rem;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.settings-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-decoration: none;
}

.import-form {
    display: grid;
    width: min(100%, 330px);
    gap: 10px;
}

.import-form > label:first-child {
    font-size: 13px;
    font-weight: 800;
}

.import-form input[type="file"] {
    width: 100%;
    min-height: 48px;
    padding: 8px;
    border: 1px solid #aaa79f;
    border-radius: 10px;
    background: var(--paper-raised);
    font-size: 13px;
}

.danger-confirm {
    align-items: flex-start;
    color: #71312f;
    line-height: 1.4;
}

.danger-button {
    background: var(--danger);
}

.form-status {
    min-height: 22px;
    margin: 0;
    font-size: 13px;
}

.form-status.is-success {
    color: var(--success);
}

.form-status.is-error {
    color: var(--danger);
}

.form-status a {
    color: inherit;
    font-weight: 800;
}

.command-chip {
    display: block;
    padding: 12px 14px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #e9e5dc;
    white-space: nowrap;
}

.settings-footnote {
    margin: 18px 0 0;
    padding-top: 18px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 13px;
}

@media (min-width: 760px) {
    .app-header {
        padding-right: 32px;
        padding-left: 32px;
    }

    .app-main {
        padding-top: 54px;
    }

    .page-intro h1 {
        font-size: 48px;
    }

    .main-sentence {
        font-size: 42px;
    }

    .bottom-nav {
        right: 24px;
        bottom: 20px;
        left: auto;
        width: 450px;
        padding: 5px;
        border: 1px solid #c9c4b8;
        border-radius: 14px;
        box-shadow: var(--shadow);
    }

    .update-banner {
        right: 24px;
        bottom: 92px;
        left: auto;
        width: 420px;
    }

    .word-sheet {
        margin: auto;
        border-radius: 16px;
    }
}

@media (max-width: 420px) {
    .app-main {
        padding: 26px 16px calc(96px + var(--content-bottom-clearance) + env(safe-area-inset-bottom));
    }

    .page-intro h1 {
        font-size: 34px;
    }

    .main-sentence {
        font-size: 30px;
    }

    .composer-actions {
        align-items: flex-end;
    }

    .draft-status {
        max-width: 110px;
    }

    .learning-points li {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .learning-points .inline-action {
        grid-column: 1;
    }

    .due-banner {
        grid-template-columns: 1fr 1fr;
    }

    .due-banner .primary-link {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .app-header {
        padding-right: 10px;
        padding-left: 12px;
    }

    .wordmark {
        gap: 7px;
    }

    .wordmark strong {
        display: none;
    }

    .header-actions {
        gap: 0;
    }

    .settings-section {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .settings-action,
    .import-form {
        width: 100%;
    }

    .command-chip {
        overflow-x: auto;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Compact reading surfaces: small glyphs, generous touch targets. */
[hidden] { display: none !important; }
body { font-size: 14px; }
.page-intro { margin: 12px 0 20px; }
.page-intro h1, .calendar-heading h2, .section-heading h2 { font-size: 18px; line-height: 1.4; }
.main-sentence, .recent-list p, .learning-card h3, .recall-answer h2,
.word-sheet h2, .review-row strong { font-size: 18px; line-height: 1.6; letter-spacing: 0; }
.composer textarea { font-size: 16px; min-height: 120px; padding: 16px; }
.mode-switch button, .primary-button, .secondary-button { font-size: 14px; }
.result-region:empty { display: none; }
.result-region { margin-top: 20px; }
.result-meta { display: none; }
.recent-section { margin-top: 28px; }
.expression-page #recent-title { font-size: 14px; }
.expression-page .recent-section .section-heading > span { font-size: 12px; }
.library-summary { margin: 12px 0 22px; border-top: 0; gap: 6px; border-bottom: 0; }
.library-summary > button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 3px; min-height: 48px; font-size: 13px; }
.library-summary > button:last-child { border-right: 1px solid var(--line); }
.library-summary strong { font: inherit; }
.library-summary span { color: inherit; font-size: 12px; }
.library-summary button[aria-pressed="true"] { color: var(--blue-dark); border-color: var(--blue); box-shadow: none; }
.library-group + .library-group { margin-top: 28px; }
.learning-card { padding: 16px 0; }
.learning-actions { justify-content: flex-end; gap: 16px; }
.learning-actions .text-danger { font-size: 12px; color: var(--muted); padding: 10px; min-height: 44px; }
.ipa-badge, .word-ipa { font-size: 14px; padding: 3px 8px; margin: 4px 0; }
.speaker-button svg { width: 16px; height: 16px; }
.pronunciation-row { gap: 4px; }
.speech-controls { position: static; width: 100%; padding: 4px 0; margin: 4px 0 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.speech-speed-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-start; }
.speech-speed-row .inline-action { font-size: 12px; min-width: 44px; min-height: 44px; padding: 6px; border: 0; }
.speech-speed-row output { font-size: 13px; min-width: 42px; font-variant-numeric: tabular-nums; }
.speech-controls p:empty, .card-feedback:empty { display: none; }
.due-banner { padding: 14px; margin: 16px 0; }
.due-banner strong { font-size: 20px; }
.recall-prompt h1, .review-complete h2 { font-size: 20px; }
#date-tasks, #calendar-panel { scroll-margin-top: 16px; }

/* All learning text shares one quiet, readable scale. */
.main-sentence, .recent-list p, .learning-card h3, .recall-answer h2,
.word-sheet h2, .review-row strong, .learning-points, .result-section p,
.teacher-message p, .learning-card blockquote, .learning-meaning, .word-meaning,
.pronunciation-row p { font-size: 14px; line-height: 1.6; letter-spacing: normal; }
.token-button, .lookup-word { border: 0; text-decoration: none; font: inherit; line-height: inherit; color: inherit; padding: 0; cursor: pointer; }
.lookup-word:focus-visible, .token-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

/* Playback feedback uses the actual audio state, not the request state. */
.speaker-button { transition: color 140ms ease, background-color 140ms ease; }
.speaker-button svg { overflow: visible; transition: transform 120ms cubic-bezier(.16,1,.3,1); }
.speaker-button:active svg { transform: scale(.82); }
.speaker-button:active { background-color: transparent; }
.speaker-button.is-playing { color: var(--speaker-playing); }
/* Fill only the speaker body; sound waves stay outlined and animated. */
.speaker-button.is-playing svg > path:not(.speaker-wave) { fill: currentColor; }
.speaker-button.is-playing .speaker-wave { animation: speaker-wave-out 950ms ease-out infinite; }
.speaker-button.is-playing .speaker-wave-far { animation-delay: 180ms; }
@keyframes speaker-wave-out {
    0% { opacity: .2; transform: translateX(-1px); }
    35% { opacity: 1; }
    100% { opacity: .15; transform: translateX(2px); }
}
@media (prefers-reduced-motion: reduce) {
    .speaker-button.is-playing .speaker-wave { animation: none; opacity: 1; transform: none; }
    .speaker-button:active svg { transform: none; }
}

.word-sheet { inset: 0; max-height: calc(100dvh - 48px); overflow-y: auto; }
.word-sheet h2 { padding-right: 40px; }
.word-sheet h2:focus { outline: none; }
.sheet-close { display: grid; place-items: center; padding: 0; border-radius: 6px; }
.sheet-close:focus:not(:focus-visible) { outline: none; }
.sheet-close:focus-visible { outline: 2px solid var(--blue); outline-offset: -4px; }
.recent-list li { padding: 12px 0; }
.recent-list .history-sentence { line-height: 1.5; }

/* Compact learning cards: status/actions, word/IPA, meaning, source. */
.learning-card-topline { flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
.learning-card-topline [data-learning-round] { white-space: nowrap; }
.learning-card-topline .learning-actions { margin: 0; gap: 8px; }
.learning-card-topline .learning-actions button { font-size: 12px; padding: 6px 8px; }
.learning-word-line { flex-wrap: wrap; column-gap: 0; row-gap: 0; }
.learning-card .learning-word-line h3 { margin: 0; }
.learning-word-line .ipa-badge { margin: 0; padding: 2px 6px; }
.learning-card blockquote { margin: 6px 0 0; }
.learning-card { padding: 10px 0; }

/* Listening first: small labels with comfortable touch areas. */
.translation-disclosure > summary, .source-disclosure > summary { cursor: pointer; color: var(--muted, #64748b); font-size: 12px; min-height: 44px; align-content: center; }
.translation-disclosure > div { padding-bottom: 8px; }
.pronunciation-row > div, .source-disclosure { min-width: 0; flex: 1; }
.review-copy { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.review-row a { color: inherit; text-decoration: none; }
.review-row-trailing > a { min-width: 44px; min-height: 44px; display: grid; place-items: center; }

/* Compact disclosure rows share one touch-height instead of stacking controls. */
.history-extras { padding-top: 44px; margin-top: 0; min-height: 44px; }
.history-extras > .translation-disclosure > summary { position: absolute; top: 0; left: 0; min-width: 44px; }
.history-extras > .history-learning > summary { position: absolute; top: 0; left: 60px; max-width: calc(100% - 140px); }
.history-extras > .history-learning > summary span { white-space: nowrap; }
.history-extras > .history-scene-button { font-size: 12px; }
.history-learning-content { padding: 0 0 4px; }
.recent-list > li { padding: 8px 0 4px; }
.history-extras > .translation-disclosure > div { padding: 0 0 4px; }
.learning-reveal-controls, .learning-listen-only, .learning-listen-only > span { display: flex; align-items: center; gap: 4px; }
.learning-reveal-controls { flex-wrap: wrap; }
.learning-reveal-controls > button { min-width: 44px; min-height: 44px; padding: 0 4px; font-size: 12px; color: var(--muted); }
.learning-reveal-controls > button[aria-expanded="true"] { color: var(--blue-dark); }
.learning-listen-only { margin-left: auto; flex-wrap: wrap; gap: 8px; }
.learning-listen-only .speaker-button { flex-basis: auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding-inline: 2px; white-space: nowrap; }
.learning-word-line > .speaker-button { display: inline-flex; align-items: center; justify-content: flex-start; padding-left: 5px; }
.learning-listen-only small { font-size: 11px; font-weight: 400; color: var(--muted); }
.learning-card [data-learning-sentences] p { margin: 4px 0; font-size: 14px; line-height: 1.6; }
.learning-card .learning-example { border-left: 1px solid var(--line); padding-left: 12px; margin-top: 8px; }
.learning-card [data-learning-translation] { color: var(--muted); margin: 0 0 4px; }
.scene-entry-toolbar { position: relative; padding-top: 44px; }
.scene-entry-toolbar > .translation-disclosure > summary { position: absolute; top: 0; left: 0; min-width: 44px; }
.scenes-page .scene-shell .scene-entry-toolbar > .scene-entry-actions { position: absolute; top: 0; right: 0; gap: 8px; }
.scenes-page .scene-shell .scene-entry-toolbar > .scene-entry-actions > button { min-height: 44px; }
.scene-entry-toolbar > .translation-disclosure > div { padding: 0 0 4px; }
.scenes-page .scene-expressions > li { padding: 4px 0; }
html[lang="en"] .history-extras > .history-learning > summary { left: 80px; max-width: calc(100% - 170px); }

/* Expanded controls stay identifiable without competing with the reading text. */
.app-main details[open] > summary,
.app-main button[aria-expanded="true"] {
    background: #e8edf3;
    color: #53647a;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: none;
}
.app-main details[open] > summary { padding-left: 6px; padding-right: 6px; }
.app-main details[open] > summary > span { color: inherit; }
.app-main details[open] > summary:focus-visible,
.app-main button[aria-expanded="true"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.section-heading + .speech-controls { position: static; margin: 8px 0 12px; }

.review-playback-heading { border-bottom: 1px solid var(--line); }
.review-playback-heading > .section-heading { border-bottom: 0; }
.review-playback-heading > .speech-controls { margin-top: 0; }

/* Learning dates use the same seven-column layout as review dates. */
.library-time-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.library-time-filters button { min-height: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.library-time-filters button[aria-pressed="true"], .library-time-filters button[aria-expanded="true"] { color: white; background: var(--blue-dark); border-color: var(--blue-dark); }
.learning-calendar { margin: 0 0 12px; }
.learning-calendar .calendar-heading > button { border: 0; background: transparent; min-height: 44px; color: var(--blue-dark); font-size: 23px; cursor: pointer; }
.learning-calendar .calendar-heading h2 button { min-height: 44px; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; }
.learning-calendar .calendar-day { border-top: 0; border-left: 0; background: transparent; cursor: pointer; font-family: inherit; }
.learning-calendar .calendar-day.is-selected { background: var(--blue-soft); }
.learning-calendar .calendar-day[data-learning-progress="learning"] strong { background: var(--blue); color: white; }
.learning-calendar .calendar-day[data-learning-progress="completed"] strong { background: #267148; color: white; }
.learning-calendar .calendar-day[data-learning-progress="pending"] strong { background: #f6d7aa; color: #713b08; }
.learning-calendar .calendar-legend [data-learning-progress="learning"]::before { background: var(--blue); }
.learning-calendar .calendar-legend [data-learning-progress="completed"]::before { background: #267148; }
.learning-calendar .calendar-legend [data-learning-progress="pending"]::before { background: #dc902e; }
.learning-month-picker { display: flex; align-items: end; gap: 10px; padding: 0 6px 12px; }
.learning-month-picker label { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.learning-month-picker select { display: block; width: 100%; min-height: 44px; margin-top: 4px; }
.library-date-label { margin: 8px 0; color: var(--muted); font-size: 12px; }
.learning-page .library-status-filters { display: grid; grid-template-columns: minmax(0, 1.15fr) repeat(3, minmax(0, 1fr)); gap: 2px; margin-bottom: 12px; }
.learning-page .library-status-filters button { display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 44px; padding: 4px 2px; font-size: 11px; white-space: nowrap; }
.learning-page .library-status-filters [data-status-count] { font-size: 10px; font-variant-numeric: tabular-nums; }
html[lang="en"] .learning-page .library-status-filters { grid-template-columns: minmax(0, .65fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.2fr); }
@media (max-width: 420px) { html[lang="en"] .learning-page .library-status-filters button { font-size: 10px; gap: 2px; } }
.learning-page .library-status-filters button[aria-pressed="true"] { background: var(--blue-dark); color: white; }

.account-settings { max-width: 740px; margin: 0 auto 32px; }
.account-settings h1 { font-size: 22px; }
.account-settings h2 { font-size: 17px; margin: 22px 0 12px; }
.account-note { color: var(--muted); font-size: 13px; line-height: 1.6; }
.account-card { margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-raised); overflow-wrap: anywhere; }
.account-card > summary { padding: 12px; cursor: pointer; min-height: 44px; }
.account-card > summary small { display: inline; color: var(--muted); font-size: 12px; }
.account-card[open] > summary { background: var(--blue-dark); color: white; }
.account-card[open] > summary small { color: white; }
.account-form { padding: 16px; }
.account-form input:not([type=checkbox]) { min-width: 0; width: 100%; }
.account-form small { color: var(--muted); font-size: 12px; }
.account-status-form { padding: 0 16px 16px; }
.account-delete { border-top: 1px solid var(--line); padding: 12px 16px; }
.account-delete > summary { min-height: 44px; cursor: pointer; padding: 10px 0; }
.account-delete .account-form { padding: 0; }
.account-success { padding: 12px; border-radius: 6px; background: #e8f3ed; color: #22633e; }

.queue-pause-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; min-width: 44px; min-height: 44px; padding: 10px; border: 0; border-radius: 6px; background: transparent; color: var(--blue-dark); cursor: pointer; }
.queue-pause-button[data-paused="true"] { background: var(--blue-soft); }
.queue-pause-button .queue-resume-icon, .queue-pause-button[data-paused="true"] .queue-pause-icon { display: none; }
.queue-pause-button[data-paused="true"] .queue-resume-icon { display: block; }

/* Dense reading lists: preserve 44px controls while removing inter-row whitespace. */
.learning-card { padding: 4px 0; }
.learning-card-topline { column-gap: 8px; }
.learning-card-topline .learning-actions { gap: 2px; }
.learning-card-topline .learning-actions button { padding-inline: 5px; }
.learning-word-line { margin: 0; }
.learning-card-topline .status-badge { padding: 2px 6px; }
.library-group + .library-group { margin-top: 28px; }
.review-row { align-items: start; gap: 8px; padding-block: 6px; }
.review-row strong { font-size: 14px; line-height: 1.5; }
.review-row-side { align-self: stretch; justify-content: space-between; display: flex; flex-direction: column; align-items: flex-end; gap: 0; flex: 0 0 auto; max-width: 42%; }
.review-row-side .review-row-trailing { min-height: 44px; margin-top: auto; }
.review-row .review-overdue { display: block; margin: 0; padding: 2px 0; font-size: 10px; line-height: 1.5; color: var(--muted); text-align: right; }
.review-overdue-label { color: #a45116; }
.review-row > .review-row-trailing { align-self: end; }

/* Content hierarchy: target language, supporting examples, then explanations.
   Keep controls and the user's white-on-blue chat bubble outside these rules. */
.main-sentence, .history-sentence,
.scene-expressions > li > .pronunciation-row > p,
.scene-drag-preview > .pronunciation-row > p,
.learning-source .pronunciation-row p, .review-practice [data-original-text] p,
.learning-card .learning-word-line h3, .review-copy strong,
.review-practice .practice-original > .practice-target, .word-sheet h2,
.learning-points > li > strong, .history-learning-content .history-point h3 {
    color: var(--study-core);
}
.learning-card .learning-word-line h3, .word-sheet h2,
.learning-points > li > strong, .history-learning-content .history-point h3 {
    font-weight: 700;
}
.learning-card blockquote, .learning-example .pronunciation-row p,
.result-section .pronunciation-row p, .teacher-message.george .pronunciation-row p,
.history-learning-content .history-example p,
.review-practice .pronunciation-row p {
    color: var(--study-example);
}
.result-section > p, .learning-points > li > p,
.teacher-message.george > p, .history-learning-content > p, .history-point > p,
.translation-disclosure > div, .learning-card [data-learning-translation],
.word-meaning, [data-lookup-meaning],
.practice-original > details > p, .practice-history-entry > p,
[data-critique-result] > p:not(.practice-target) {
    color: var(--study-explanation);
}
.history-point > .study-structure, .practice-original > details > .study-structure {
    color: var(--study-core);
    font-weight: 600;
}

/* Lookup wrappers must retain the reading level of their sentence. */
.recent-list .lookup-word { color: inherit; font: inherit; }

/* A compact reading scale: 14px targets, 13px support, 11px controls.
   Compress spacing around controls, never their touch targets. */
.recent-list > li, .learning-list > .learning-card { padding-block: 10px; }
.scene-expressions > li, .scenes-page .scene-expressions > li,
.scene-list > li, .scenes-page .scene-list > li { padding-block: 10px; }
.review-row { padding-block: 10px; }
.recent-list .history-sentence, .learning-card .learning-word-line h3,
.scene-expressions > li > .pronunciation-row > p, .scene-drag-preview > .pronunciation-row > p,
.review-row strong { line-height: 1.4; }
.history-point { margin-top: 8px; }
.history-learning-content p, .recent-list .history-learning-content p,
.learning-card [data-learning-sentences] p,
.translation-disclosure > div, .learning-card [data-learning-translation],
.review-practice .practice-original > details > p,
.review-practice .practice-history-entry p,
.review-practice [data-critique-result] > p:not(.practice-target),
.review-practice [data-critique-result] .pronunciation-row p {
    font-size: 13px; line-height: 1.5;
}
.history-learning-content p, .recent-list .history-learning-content p,
.learning-card [data-learning-sentences] p { margin-block: 2px; }
.learning-card .learning-example { margin-top: 4px; padding-left: 8px; }
.translation-disclosure > div { padding-bottom: 4px; }
.learning-card-topline { font-size: 11px; gap: 0 6px; }
.learning-card-topline .status-badge { font-size: 11px; font-weight: 500; padding: 1px 5px; }
.learning-word-line .ipa-badge { font-size: 11px; padding: 1px 4px; }
.learning-card-topline .learning-actions button,
.learning-reveal-controls > button,
.history-extras > .history-scene-button,
.history-learning > summary, .translation-disclosure > summary,
.scenes-page .scene-shell .scene-entry-actions > button {
    font-size: 11px; font-weight: 400; color: var(--muted);
    min-height: 44px;
}
.history-learning > summary { gap: 3px; }
.recent-list .history-learning > summary span,
.recent-list .history-scene-button span { color: inherit; font-size: inherit; }
.scenes-page .scene-shell .scene-entry-actions > button { border-color: transparent; padding-inline: 6px; }
.learning-card-topline .learning-actions .primary-button { color: #53647a; background: #e8edf3; border-color: transparent; box-shadow: none; }
.learning-card-topline .status-badge { color: #626e7d; background: #f0f3f6; }
.review-row .review-state { font-size: 11px; padding: 2px 5px; color: #626e7d; background: #f0f3f6; }
.review-row-trailing > a { color: var(--muted); }
/* Selected controls retain a quiet surface after the base label rules above. */
.app-main .history-learning[open] > summary,
.app-main .translation-disclosure[open] > summary,
.app-main .learning-reveal-controls > button[aria-expanded="true"] { color: #53647a; font-weight: 500; }
.review-practice .practice-actions > [data-toggle-original],
.review-practice .practice-original > details > summary,
.review-practice .practice-history > summary {
    font-size: 11px; font-weight: 400; color: var(--muted); min-height: 44px;
}
.review-practice .practice-actions > [data-toggle-original] { border-color: transparent; }
.app-main .review-practice [data-toggle-original][aria-expanded="true"],
.app-main .review-practice details[open] > summary { color: #53647a; font-weight: 500; }

/* Balance the content block inside each card; tighten between rows, not at edges. */
.recent-sentence-row { align-items: center; gap: 4px; }
.recent-list .history-sentence { margin: 0; }
.scene-expressions > li > .pronunciation-row > p,
.scene-drag-preview > .pronunciation-row > p { margin-block: 0; }
.history-extras, .scene-entry-toolbar { margin-top: 0; }
.review-copy > a { display: flex; align-items: center; min-height: 32px; }
.review-row .review-overdue { min-height: 32px; align-content: center; padding-block: 0; }
.history-extras > .translation-disclosure > div,
.scene-entry-toolbar > .translation-disclosure > div { padding-bottom: 0; }
.history-learning-content { padding-bottom: 0; }
.history-learning-content > :last-child,
.history-point > :last-child,
.learning-card [data-learning-sentences] > :last-child > :last-child,
.learning-card > [id^="learning-material-"] > :last-child { margin-bottom: 0; }

.icp-footer {
    padding: 16px 8px;
    text-align: center;
    font-size: 11px;
    line-height: 1.5;
    color: #64748b;
}
.icp-footer a { color: inherit; }

/* A fixed player never reflows the clicked row or the cards that follow it. */
:root { --content-bottom-clearance: 180px; }
body .speech-controls {
    /* An accent surface separates the player from reading cards in either theme. */
    --ink: #f8fbff;
    --muted: #e1edf9;
    --blue: #ffffff;
    --blue-dark: #ffffff;
    --blue-soft: rgb(255 255 255 / 14%);
    --line: rgb(255 255 255 / 22%);
    --control-line: rgb(255 255 255 / 28%);
    color: var(--ink);
    position: fixed;
    z-index: 35;
    top: auto;
    left: 50%;
    /* 63px navigation bar plus an 8px breathing gap. */
    bottom: calc(71px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(calc(100% - 24px), 280px);
    max-height: min(180px, 35dvh);
    overflow-y: auto;
    margin: 0;
    padding: 5px 8px;
    background: rgb(22 49 82 / 86%);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgb(255 255 255 / 38%);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 6px 22px rgb(23 53 89 / 28%);
}
.study-card-document body .speech-controls { bottom: 8px; }
body dialog .speech-controls { bottom: 12px; }
body .speech-controls .speech-speed-row { justify-content: center; gap: 8px; flex-wrap: nowrap; }
body .speech-controls p { text-align: center; }
.speech-transport { display: inline-flex; align-items: center; justify-content: center; }
.speech-transport .transport-play, .speech-transport[data-paused="true"] .transport-pause { display: none; }
.speech-transport[data-paused="true"] .transport-play { display: block; }
html[data-theme="dark"] body .speech-controls {
    background: rgb(32 58 82 / 84%);
    border-color: rgb(179 215 246 / 48%);
    box-shadow: inset 0 1px 0 rgb(223 241 255 / 14%), 0 6px 22px rgb(0 0 0 / 38%);
}
@media (prefers-reduced-transparency: reduce) {
    body .speech-controls { background: #163152; backdrop-filter: none; -webkit-backdrop-filter: none; }
    html[data-theme="dark"] body .speech-controls { background: #203a52; }
}
/* Reserve the existing pause button's slot even before a queue starts. */
.queue-pause-button[hidden] { display: inline-flex !important; visibility: hidden; pointer-events: none; }

/* Keep the player's 44px hit areas while making each press perceptible. */
body .speech-controls .speech-speed-row button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 100ms ease-out, background-color 100ms ease-out, box-shadow 100ms ease-out;
}
body .speech-controls .speech-speed-row button:enabled:active {
    transform: scale(.92);
    background-color: rgb(255 255 255 / 28%);
    box-shadow: inset 0 1px 3px rgb(0 0 0 / 18%);
}
@media (prefers-reduced-motion: reduce) {
    body .speech-controls .speech-speed-row button { transition: none; }
    body .speech-controls .speech-speed-row button:enabled:active { transform: none; }
}

/* Original input stays secondary to the corrected expression. */
.source-input { color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }
.history-point-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.history-point-heading h3 { min-width: 0; margin: 8px 0; }
.history-point-heading .learning-membership-button { flex: none; color: var(--study-utility, var(--muted)); }
.app-main .learning-membership-button,
.app-main .save-learning-action,
.app-main .result-reclassify .inline-action,
.app-main [data-ask-about-sentence],
.word-sheet [data-save-word] { font-size: 11px; font-weight: 400; min-height: 44px; padding: 6px 8px; color: var(--muted); border: 0; background: transparent; box-shadow: none; }
.app-main .learning-membership-button:disabled, .app-main .save-learning-action:disabled { opacity: 1; cursor: default; }
.app-main .save-learning-action, .word-sheet [data-save-word] { background: var(--blue-soft); border-bottom: 2px solid var(--blue); border-radius: 5px; min-height: 32px; margin-block: 6px; }
.app-main .result-reclassify .inline-action, .app-main [data-ask-about-sentence] { border-bottom: 2px solid #b89a69; background: var(--paper-raised); border-radius: 5px; min-height: 32px; margin-block: 6px; }

/* Keep the established reading size; use the phrase headings’ sans-serif face. */
.app-main .result-region .main-sentence,
.learning-card .learning-word-line h3 { font-size: 14px; line-height: 1.4; font-weight: 700; }
.app-main .result-region .main-sentence { font-family: inherit; }
.app-main .result-region .result-section > h2 { font-size: 14px; font-weight: 600; }
.app-main .result-region .result-actions > [data-add-scene] { font-size: 11px; font-weight: 400; min-height: 32px; padding: 6px 8px; margin-block: 6px; border: 0; border-bottom: 2px solid currentColor; border-radius: 5px; background: var(--paper-raised); }

.history-extras .translation-disclosure .history-translation-note,
.history-extras .history-point .history-translation-note { font-size: 11px; line-height: 1.6; font-weight: 400; color: var(--study-utility); margin: 8px 0 0; }

/* Adjacent months slide inside the calendar without moving the surrounding page. */
.calendar-panel { touch-action: pan-y pinch-zoom; }
.calendar-month-viewport { position: relative; overflow: hidden; }
.calendar-month-viewport > .calendar-grid { width: 100%; }
.calendar-month-outgoing { position: absolute; inset: 0; pointer-events: none; }

/* Saved and available labels share one centered status column in history cards. */
.history-extras .history-scene-button,
.history-extras .history-point-heading .learning-membership-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 76px;
    width: 76px;
    padding-inline: 0;
    text-align: center;
}

.review-practice [data-critique-result] > .practice-submitted-sentence {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--study-core);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 12px 0;
}

/* Compact review reference material while keeping disclosure rows easy to tap. */
.review-practice .practice-original > .practice-actions { margin-block: 0; }
.review-practice .practice-original > details,
.review-practice .practice-history { margin-block: 0; }
.review-practice .practice-original > details > summary,
.review-practice .practice-history > summary {
    min-height: 44px;
    line-height: 20px;
    padding-block: 12px;
}
.review-practice .practice-original > details > p,
.review-practice [data-original-text] > p,
.review-practice .practice-history-entry p { margin-block: 4px; }
.review-practice .practice-original > details > :last-child:not(summary) { margin-bottom: 6px; }
.review-practice .practice-history-entry { padding-block: 6px; }
.review-practice .practice-history-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.review-practice .practice-history-entry .pronunciation-row { margin-block: 0; }
.review-practice .practice-application { margin-top: 8px; padding-top: 0; }
.review-practice .practice-application > h2 { margin-top: 8px; }

.review-practice .practice-history-entry .practice-recommended-sentence { font-weight: 600; }
