@font-face {
    font-family: "Flashcard Noto";
    font-style: normal;
    font-weight: 400 800;
    font-display: block;
    src: url("assets/fonts/flashcard-noto-sans-sc-subset.woff2") format("woff2");
}

* {
    box-sizing: border-box;
}

:root {
    --ink: #142033;
    --muted: #667085;
    --teal: #0d9a7a;
    --teal-dark: #08745e;
    --teal-deep: #06594a;
    --wash: #eaf7f2;
    --line: #d5dbe3;
    --bad: #b42318;
    --good: #067647;
    --coral: #ef7b45;
    --blue: #368ded;
    --purple: #8a61dc;
    --pink: #df638e;
    --yellow: #f3c54a;
    --card: #fff;
    --bg: #f1f8f5;
    --shadow: 0 10px 26px -16px rgba(9, 90, 74, .34);
    --font: "Flashcard Noto", sans-serif;
    --ipa-font: Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
}

button, input, select, a {
    font-family: var(--font);
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.app-shell {
    width: min(1220px, calc(100% - 28px));
    margin: 0 auto;
    padding: 7px 0 6px;
}

.topbar {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.brand-logo {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #12aa86, #078969);
    box-shadow: 0 7px 14px -8px rgba(13,154,122,.8);
}

.brand-logo svg {
    width: 21px;
    height: 21px;
}

.eyebrow {
    margin: 0 0 1px;
    color: var(--teal-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.topbar h1 {
    margin: 0;
    color: var(--teal-deep);
    font-size: 27px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .01em;
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.wordlist-picker {
    flex: 0 0 auto;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px 4px 10px;
    border: 1.5px solid #c9d4e0;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.wordlist-picker select {
    width: 132px;
    min-width: 132px;
    max-width: 150px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--teal-dark);
    font: inherit;
    cursor: pointer;
}

.text-button, .context-chip {
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    border: 1.5px solid #c9d4e0;
    font-size: 12px;
    font-weight: 700;
}

.text-button {
    cursor: pointer;
}

.context-chip {
    display: inline-flex;
    align-items: center;
    cursor: default;
    user-select: none;
}

.context-chip {
    color: var(--teal-dark);
    border-color: var(--teal);
    background: var(--wash);
}

.text-button:hover {
    border-color: var(--teal);
    color: var(--teal-dark);
    background: var(--wash);
}

/* Desktop: base progress, compact stage map, and three metrics share one row. */
.progress-panel {
    min-height: 66px;
    display: grid;
    grid-template-columns: minmax(330px,360px) minmax(320px,350px) minmax(330px,360px);
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 8px 14px;
    margin-bottom: 5px;
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.stat-question {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    white-space: nowrap;
}

.stat-label, .stat-chip span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.q-count {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid #f0d891;
    border-radius: 9px;
    color: #835700;
    background: #fff5df;
    font-size: 15px;
}

.qbar {
    --progress: 0%;
    position: relative;
    flex: 1 1 250px;
    width: min(260px,100%);
    min-width: 150px;
    height: 9px;
    border-radius: 999px;
    background: #e3ebf2;
}

.qbar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--progress);
    border-radius: inherit;
    background: var(--teal);
    transition: width .2s ease;
}

.qbar-dot {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: var(--progress);
    width: 13px;
    height: 13px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 1px 5px rgba(181,83,35,.35);
    transform: translate(-50%,-50%);
    transition: left .2s ease;
}

.qbar-tick {
    position: absolute;
    z-index: 1;
    top: -2px;
    width: 1px;
    height: 13px;
    background: #9eafb9;
    opacity: .78;
}

.qbar-tick.t20 { left:20% }
.qbar-tick.t40 { left:40% }
.qbar-tick.t60 { left:60% }
.qbar-tick.t80 { left:80% }

.stage-progress {
    flex: 0 0 auto;
    color: var(--teal-dark);
    font-size: 12px;
    white-space: nowrap
}

.extra-practice {
    flex: 0 0 auto;
    color: #8a5a00;
    background: #fff3db;
    border: 1px solid #f0d999;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
}

.extra-practice.active {
    color: #7a3500;
    border-color: var(--coral);
    background: #ffe8da;
    box-shadow: 0 0 0 2px rgba(239,123,69,.12)
}

.reward-track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5,1fr);
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: min(350px,100%);
    max-width: 350px;
    min-width: 320px;
    color: #707c89;
    font-size: 13px;
}

.reward-node {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    align-items: center;
    gap: 1px;
    white-space: nowrap;
}

.reward-node i {
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border: 1.5px solid #c4d1cb;
    border-radius: 50%;
    background: #fff;
    color: #9aa6a2;
    font-size: 15px;
    font-style: normal;
}

.reward-node span {
    color: #52606c;
    font-size: 11px;
    font-weight: 700
}

.reward-node .stage-status {
    min-height: 12px;
    color: #7c8792;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.1
}

.reward-node .stage-status {
    display: none;
}

.reward-node.current i {
    color: #a44b1e;
    border-color: var(--coral);
    box-shadow: 0 0 0 3px rgba(239,123,69,.14)
}

.reward-node.current .stage-status { color:#9b461c }

.reward-node.complete i {
    color: #08745e;
    border-color: #67b7a4;
    background: #dcf4ed
}

.reward-node.complete .stage-status { color:#08745e }

.reward-node.perfect i {
    color: #714900;
    border-color: #d89b16;
    background: #f7c948;
    box-shadow: 0 0 0 3px rgba(216,155,22,.15)
}

.reward-node.perfect .stage-status { color:#8a5a00 }

.reward-node.warning i { border-color:var(--coral) }
.reward-node.warning .stage-status { color:#a24118;font-size:12px }

.progress-stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    justify-self: end;
}

.stat-chip {
    display: grid;
    gap: 1px;
    min-width: 96px;
    padding-left: 9px;
    border-left: 1px solid #d9e3df;
}

.stat-chip strong {
    color: var(--teal-dark);
    font-size: 16px;
    line-height: 1.1;
    font-weight: 800;
    white-space: nowrap;
}

.star-number {
    color: #a86600 !important;
}

.practice-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 354px;
    padding: 10px 22px 10px;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    text-align: center;
    overflow: visible;
}

.mascot-cue {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px) scale(.94);
    pointer-events: none;
}

.mascot-cue.is-visible {
    visibility: visible;
    animation: mascot-cue 2500ms cubic-bezier(.2,.78,.25,1) both;
}

.mascot {
    width: 74px;
    height: 74px;
    border: 2px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 7px 15px -8px rgba(13,154,122,.7);
}

.mascot-bubble {
    max-width: min(230px,calc(100vw - 118px));
    padding: 7px 11px;
    border: 1px solid #d8e6e0;
    border-radius: 10px 10px 4px 10px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 5px 10px -8px rgba(20,32,51,.4);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
}

@keyframes mascot-cue {
    0% { opacity: 0; transform: translateY(12px) scale(.94); }
    15%, 76% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-9px) scale(1.02); }
}

.mascot-bubble.blue {
    background: #eef6ff;
    border-color: #cee2fb;
    color: #1c6dbd;
}

.mascot-bubble.green {
    background: #eaf8f1;
    border-color: #bfe9d8;
    color: #08745e;
}

.mascot-bubble.red {
    background: #fff1ef;
    border-color: #ffc7c4;
    color: var(--bad);
}

.mode-pill {
    position: relative;
    top: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    min-width: 102px;
    min-height: 28px;
    padding: 4px 13px;
    border-radius: 999px;
    color: #fff;
    background: var(--teal);
    box-shadow: 0 5px 11px -7px rgba(13,154,122,.8);
    font-size: 15px;
    font-weight: 800;
}

.mode-pill[data-mode="syllable"] {
    background: var(--blue);
}

.mode-pill[data-mode="missing"] {
    background: var(--purple);
}

.mode-pill[data-mode="build"] {
    background: var(--coral);
}

.mode-pill[data-mode="spell"] {
    background: var(--pink);
}

.practice-card h2 {
    max-width: min(700px, calc(100% - 170px));
    margin: 5px auto 2px;
    color: var(--ink);
    font-size: 18px;
    line-height: 1.28;
    font-weight: 800;
}

.helper {
    min-height: 18px;
    margin: 0 auto 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.play-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 76px;
    margin: 10px auto;
}

.play-button {
    position: relative;
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    padding: 0px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg,#12aa86,#078969);
    color: #fff;
    box-shadow: 0 10px 20px -9px rgba(13,154,122,.65), inset 0 -4px 0 rgba(0,0,0,.07);
    cursor: pointer;
    transition: transform .15s ease;
}

.play-button:hover {
    transform: scale(1.035);
}

.play-button:active {
    transform: scale(.97);
}

.play-button svg {
    width: 34px;
    height: 34px;
    margin-left: 3px;
}

.play-ring {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(13,154,122,.36);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.play-button.playing .play-ring {
    animation: play-ring 1.8s ease-out infinite;
}

.play-button.playing .play-ring.r2 {
    animation-delay: .9s;
}

@keyframes play-ring {
    0% {
        opacity: .72;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.28);
    }
}

.audio-toast {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 4;
    width: max-content;
    max-width: 210px;
    transform: translateY(-50%);
    padding: 6px 9px;
    border: 1px solid #f3c7c1;
    border-radius: 9px;
    background: #fff5f3;
    color: var(--bad);
    box-shadow: 0 6px 13px -9px rgba(180,35,24,.55);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

.audio-toast.fade {
    opacity: 0;
    transition: opacity .25s ease;
}

.question-area {
    display: grid;
    align-content: center;
    gap: 7px;
    width: 100%;
    min-height: 64px;
    max-width: 760px;
    margin: 3px auto 2px;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
    width: min(640px,100%);
    margin: 10px auto;
}

.option, .chunk, .letter, .count-option {
    border: 2px solid #c9d4e0;
    border-radius: 12px;
    background: #fff;
    color: var(--teal-dark);
    font-family: var(--font);
    font-weight: 800;
    cursor: pointer;
    transition: background .15s ease,border-color .15s ease,transform .15s ease;
}

.option {
    min-height: 62px;
    padding: 9px 15px;
    font-size: 21px;
}

.chunk {
    min-height: 52px;
    padding: 8px 15px;
    font-size: 18px;
}

.letter {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 9px;
    font-size: 18px;
    text-transform: lowercase;
}

.count-option {
    min-width: 72px;
    min-height: 50px;
    padding: 7px 14px;
    font-size: 19px;
}

.option:hover, .chunk:hover, .letter:hover, .count-option:hover {
    border-color: var(--teal);
    background: var(--wash);
    transform: translateY(-1px);
}

.option:disabled, .chunk:disabled, .letter:disabled, .count-option:disabled, .action-slot button:disabled {
    border-color: #d5dbe2;
    background: #f4f6f8;
    color: #98a2b3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.selected {
    border-color: var(--teal) !important;
    background: var(--wash) !important;
    box-shadow: 0 0 0 3px rgba(13,154,122,.13) !important;
}

.count-row, .chunk-bank {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.chunk.used,.letter.used {
    opacity: .35;
    cursor: default;
}

.build-line {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: min(500px,100%);
    min-height: 42px;
    padding: 4px 9px;
    border-bottom: 2px solid #8aa4b8;
    color: var(--teal-deep);
    font-family: var(--font);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .04em;
    cursor: pointer;
}

.word-shape {
    color: var(--teal-deep);
    font-family: var(--font);
    font-size: 29px;
    font-weight: 800;
    letter-spacing: normal;
}

.word-shape-spelling {
    letter-spacing: .08em;
}

.word-shape-ipa,
.feedback-ipa {
    font-family: var(--ipa-font);
    letter-spacing: normal;
}

.feedback {
    display: none;
    grid-column: 2;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid #e0ece7;
    border-radius: 10px;
    background: #f4f8f6;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.48;
    text-align: center;
}

.feedback:not(:empty) {
    display: block;
}

.feedback strong {
    font-size: 20px;
}

.feedback-result {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 4px 8px;
}

.feedback-result > span {
    font-size: 14px;
    font-weight: 600;
}

.feedback-word {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 5px 9px;
    margin-top: 4px;
}

.feedback-word b {
    color: var(--teal-deep);
    font-size: 23px;
    letter-spacing: .01em;
}

.feedback-ipa {
    font-size: 16px;
    font-weight: 700;
}

.feedback-meaning {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.74);
    color: inherit;
    font-size: 18px;
    font-weight: 800;
}

.feedback-focus {
    margin-top: 3px;
    font-size: 14px;
    font-weight: 600;
}

.feedback.good {
    background: #e8f7f0;
    border-color: #bfe9d8;
    color: var(--good);
}

.feedback.bad {
    background: #fff0ef;
    border-color: #ffc7c4;
    color: var(--bad);
}

.feedback.repair {
    background: #fff6dc;
    border-color: #f0dc9e;
}

.feedback.repair strong {
    color: #8a5a00;
}

.response-row {
    display: grid;
    grid-template-columns: 120px minmax(0,1fr) 120px;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin-top: auto;
}

.action-slot {
    display: flex;
    align-items: center;
}

.action-slot-start {
    grid-column: 1;
    justify-content: flex-start;
}

.action-slot-end {
    grid-column: 3;
    display: grid;
    grid-template-areas: "control";
    justify-items: end;
    justify-content: flex-end;
}

.action-slot-end > button {
    grid-area: control;
}

.action-slot button, .summary button {
    min-width: 120px;
    min-height: 48px;
    padding: 8px 15px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.secondary {
    border: 1.5px solid #aeb8c4;
    background: #fff;
    color: var(--ink);
}

.secondary:hover {
    border-color: var(--teal);
    color: var(--teal-dark);
    background: var(--wash);
}

.primary {
    border: 0;
    background: linear-gradient(135deg,#12a982,#07916f);
    color: #fff;
    box-shadow: 0 7px 14px -9px rgba(13,154,122,.7);
}

.primary:disabled {
    background: #c9d4e0;
    box-shadow: none;
}

.mode-rail {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5,1fr);
    max-width: 600px;
    height: 48px;
    margin: 18px auto 0;
    font-size: 14px;
}

.mode-rail::before {
    position: absolute;
    top: 12px;
    right: 10%;
    left: 10%;
    z-index: 0;
    height: 2px;
    border-radius: 99px;
    background: #dce7e2;
    content: "";
}

.mode-rail div {
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 24px 14px;
    justify-items: center;
    align-items: center;
    color: #5a6b78;
    font-weight: 700;
}

.mode-rail i {
    position: relative;
    grid-row: 1;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 2px solid #c3cfd9;
    border-radius: 50%;
    background: #fff;
}

.mode-rail i svg {
    width: 13px;
    height: 13px;
}

.mode-rail span {
    grid-row: 2;
    white-space: nowrap;
}

.mode-state {
    display: none!important;
}

.mode-rail div[data-mode="sound"] {
    --m: var(--teal)
}

.mode-rail div[data-mode="syllable"] {
    --m: var(--blue)
}

.mode-rail div[data-mode="missing"] {
    --m: var(--purple)
}

.mode-rail div[data-mode="build"] {
    --m: var(--coral)
}

.mode-rail div[data-mode="spell"] {
    --m: var(--pink)
}

.mode-rail div i {
    color: var(--m)
}

.mode-rail div.active,.mode-rail div.complete {
    color: var(--m)
}

.mode-rail div.active i,.mode-rail div.complete i {
    color: #fff;
    background: var(--m);
    border-color: var(--m)
}

.mode-rail div.active i::after,.mode-rail div.complete i::after {
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 12px;
    height: 12px;
    display: grid;
    place-items: center;
    border: 1px solid #fff;
    border-radius: 50%;
    background: #263d50;
    color: #fff;
    font-size: 9px;
    font-style: normal;
    line-height: 1;
    content: "✓";
}

.mode-rail div.active i::after {
    content: "•";
    font-size: 15px;
    line-height: 8px;
}

.star-burst {
    position: absolute;
    top: 72px;
    left: 50%;
    z-index: 5;
    width: 140px;
    height: 75px;
    transform: translateX(-50%);
    pointer-events: none;
}

.star-burst span {
    position: absolute;
    color: #f1b928;
    font-size: 24px;
    opacity: 0
}

.star-burst span:nth-child(1) {
    left: 14%;
    top: 42%
}

.star-burst span:nth-child(2) {
    left: 43%;
    top: 2%;
    font-size: 31px
}

.star-burst span:nth-child(3) {
    right: 12%;
    top: 47%
}

.star-burst.play span {
    animation: star-pop 780ms ease-out both
}

.star-burst.play span:nth-child(2) {
    animation-delay: 70ms
}

.star-burst.play span:nth-child(3) {
    animation-delay: 140ms
}

.streak-toast {
    position: absolute;
    top: 6px;
    left: calc(50% + 96px);
    z-index: 7;
    padding: 6px 14px;
    border: 1px solid #e3a718;
    border-radius: 999px;
    color: #704700;
    background: #fff3c7;
    box-shadow: 0 5px 14px rgba(192, 125, 0, .16);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
}

.streak-toast.play {
    animation: streak-toast 1500ms ease-out both;
}

@keyframes streak-toast {
    0% { opacity: 0; transform: translateY(7px); }
    18%, 72% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

@keyframes star-pop {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(.45) rotate(-15deg)
    }

    35% {
        opacity: 1;
        transform: translateY(-8px) scale(1.12) rotate(5deg)
    }

    100% {
        opacity: 0;
        transform: translateY(-25px) scale(.9) rotate(10deg)
    }
}

@media (prefers-reduced-motion: reduce) {
    .streak-toast.play {
        animation-name: streak-toast-reduced;
    }

    @keyframes streak-toast-reduced {
        0%, 80% { opacity: 1; }
        100% { opacity: 0; }
    }
}

@media (max-width: 820px) {
    .streak-toast {
        top: 6px;
        left: calc(50% + 82px);
        font-size: 15px;
    }
}

.summary {
    margin-top: 5px;
    padding: 16px 24px;
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
    text-align: center;
}

.summary h2 {
    margin: 4px 0 9px;
    color: var(--teal-deep);
    font-size: 25px
}

.summary p {
    color: var(--muted);
    font-size: 13px
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 10px;
    max-width: 620px;
    margin: 0 auto 10px
}

.summary-grid>div {
    display: grid;
    gap: 2px;
    padding: 9px 12px;
    border-radius: 11px;
    background: var(--wash)
}

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

.summary-grid strong {
    color: var(--teal-dark);
    font-size: 24px
}

.summary-grid small {
    color: #4f5b69;
    font-size: 11px
}

.summary-list {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    max-width: 620px;
    margin: 5px auto;
    padding: 6px 10px;
    border-bottom: 1px solid #e7eaee;
    text-align: left
}

.summary-list strong {
    font-size: 14px
}

.summary-unresolved,.history-unresolved {
    border: 1px solid #c76a1b;
    background: #fff0dd;
    color: #4b2507;
    text-align: left
}

.summary-unresolved {
    max-width: 620px;
    margin: 7px auto;
    padding: 9px 12px;
    border-radius: 11px
}

.summary-unresolved>span,.history-unresolved>b {
    display: block;
    margin-bottom: 4px;
    color: #7a3500;
    font-weight: 700
}

.summary-unresolved>div,.history-unresolved p {
    margin: 0;
    color: #20252c;
    font-size: 14px;
    line-height: 1.55
}

.history-unresolved {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 12px
}

.summary-milestones {
    margin: 7px 0
}

.summary-actions {
    display: flex;
    justify-content: center;
    gap: 8px
}

.app-dialog {
    width: min(620px,calc(100% - 24px));
    max-height: min(88vh,760px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    color: var(--ink);
    box-shadow: 0 24px 80px rgba(20,32,51,.24);
}

.app-dialog::backdrop {
    background: rgba(20,32,51,.42)
}

.dialog-card {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 20px;
    background: #fff
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px
}

.dialog-heading h2 {
    margin: 0;
    color: var(--teal-deep);
    font-size: 22px
}

.dialog-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px
}

.dialog-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f1f4f6;
    color: #536273;
    font-size: 23px;
    line-height: 1;
    cursor: pointer
}

.dialog-card label {
    display: grid;
    gap: 5px;
    color: #344054;
    font-size: 13px;
    font-weight: 700
}

.dialog-card input,.dialog-card select {
    width: 100%;
    min-height: 42px;
    border: 1.5px solid #c8d0da;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    padding: 8px 11px;
    font: 15px/1.2 var(--font)
}

.privacy-note,.local-boundary,.report-status {
    margin: 0;
    padding: 9px 11px;
    border-radius: 9px;
    background: #f5f7f8;
    color: #536273;
    font-size: 12px;
    line-height: 1.55
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px
}

.dialog-actions button,.dialog-actions a {
    min-width: 108px;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: normal;
    text-align: center;
    text-decoration: none;
    cursor: pointer
}

.dialog-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box
}

.history-list {
    display: grid;
    gap: 8px;
    max-height: 440px;
    overflow-y: auto
}

.history-empty {
    padding: 30px 10px;
    color: var(--muted);
    text-align: center
}

.history-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e0e5ea;
    border-radius: 10px
}

.history-item h3 {
    margin: 0 0 3px;
    font-size: 14px
}

.history-item p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5
}

.history-item button {
    min-width: 86px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer
}

.report-dialog {
    width: min(680px,calc(100% - 18px))
}

.report-dialog .dialog-card {
    max-height: min(88vh,800px);
    overflow-y: auto
}

.report-preview-wrap {
    display: grid;
    place-items: center;
    min-height: 180px;
    border: 1px solid #dfe4e8;
    border-radius: 10px;
    overflow: hidden;
    background: #eef4f2
}

.report-preview-wrap img {
    display: block;
    width: min(100%,440px);
    height: auto;
    background: #fff
}

.report-status.good {
    background: #ecf8f2;
    color: var(--good)
}

.report-status.bad {
    background: #fff2f0;
    color: var(--bad)
}

/* Home mode keeps a larger, tablet-friendly target without exceeding the low-height budget. */
@media (min-width: 681px) {
    body.scene-home .play-button {
        width:86px;
        height: 86px
    }

    body.scene-home .play-wrap {
        min-height: 88px
    }

    body.scene-home .play-button svg {
        width: 39px;
        height: 39px
    }

    body.scene-home .practice-card {
        min-height: 378px;
        padding: 12px 25px
    }

    body.scene-home .option,body.scene-home .chunk,body.scene-home .count-option {
        min-height: 64px
    }

    body.scene-home .letter {
        min-width: 50px;
        min-height: 50px
    }

    body.scene-home .action-slot button {
        min-height: 50px
    }
}

@media (max-width: 1150px) {
    .progress-panel {
        grid-template-columns: minmax(0,1fr) max-content;
        gap: 7px 12px
    }

    .stat-question {
        min-width: 0
    }

    .reward-track {
        grid-column: 1 / -1;
        grid-row: 2;
        width: min(290px,100%);
        min-width: 260px;
        max-width: 290px;
        margin-inline: auto;
        justify-self: center;
        justify-content: center
    }

    .progress-stats {
        justify-self: end;
        justify-content: flex-end;
        gap: 3px
    }

    .stat-chip {
        min-width: 82px;
        padding-left: 5px
    }

    .stat-chip span {
        font-size: 10px
    }

    .stat-chip strong {
        font-size: 14px
    }

    .practice-card h2 {
        max-width: 100%
    }
}

@media (max-width: 820px) {
    .reward-track {
        width: min(260px,100%);
        min-width: 230px;
        max-width: 260px
    }

    .qbar { max-width:220px }
}

@media (min-width: 681px) and (max-height: 660px) {
    .app-shell {
        padding-top:5px
    }

    .eyebrow {
        display: none
    }

    .topbar {
        min-height: 38px;
        margin-bottom: 4px
    }

    .progress-panel {
        min-height: 64px;
        margin-bottom: 4px
    }

    .practice-card {
        min-height: 350px;
        padding-top: 8px;
        padding-bottom: 8px
    }

    .mode-rail {
        margin-top: 17px;
    }

    .app-dialog {
        max-height: 94vh
    }

    .dialog-card {
        padding: 14px 18px;
        gap: 9px
    }

    .history-list {
        max-height: 300px
    }

    body.scene-home .practice-card {
        min-height: 368px
    }
}

@media (max-width: 680px) {
    .app-shell {
        width:min(100% - 20px,560px);
        padding-top: 10px
    }

    .topbar {
        align-items: flex-start;
        gap: 8px
    }

    .brand-logo {
        width: 36px;
        height: 36px
    }

    .topbar h1 {
        font-size: 25px
    }

    .eyebrow {
        display: none
    }

    .top-actions {
        max-width: 330px;
        gap: 4px
    }

    .wordlist-picker {
        min-height: 29px;
        padding: 3px 6px 3px 8px;
        font-size: 10px;
    }

    .wordlist-picker select {
        width: 118px;
        min-width: 118px;
        max-width: 118px;
    }

    .text-button,.context-chip {
        min-height: 30px;
        padding: 5px 8px;
        font-size: 11px
    }

    .progress-panel {
        grid-template-columns: minmax(0,1fr) max-content;
        gap: 6px;
        padding: 9px 10px
    }

    .stat-question {
        gap: 4px
    }

    .stat-label {
        display: none
    }

    .qbar { min-width:90px;max-width:170px }

    .stage-progress { font-size:10px }

    .reward-track {
        grid-column: 1 / -1;
        min-width: 230px;
        width: min(250px,100%);
        max-width: 250px;
        justify-self: center;
        justify-content: center;
        gap: 8px;
        font-size: 9px
    }

    .progress-stats {
        justify-content: flex-end;
        gap: 2px
    }

    .stat-chip {
        min-width: 0;
        padding-left: 4px
    }

    .stat-chip span {
        font-size: 9px
    }

    .stat-chip strong {
        font-size: 13px
    }

    .practice-card {
        min-height: 480px;
        padding: 12px 13px
    }

    .play-button {
        width: 76px;
        height: 76px
    }

    .play-wrap {
        min-height: 78px
    }

    .audio-toast {
        left: calc(100% + 4px);
        max-width: 150px;
        font-size: 11px
    }

    .option-grid {
        grid-template-columns: 1fr;
        width: 100%
    }

    .option {
        min-height: 60px;
        font-size: 20px
    }

    .question-area {
        min-height: 150px
    }

    .action-slot button {
        min-width: 0;
        padding-inline:11px;font-size: 13px
    }

    .mode-rail {
        font-size: 10px
    }

    .mode-rail i {
        width: 23px;
        height: 23px
    }

    .summary {
        padding: 16px 14px
    }

    .summary-list {
        grid-template-columns: 1fr;
        gap: 2px
    }

    .dialog-card {
        padding: 16px
    }

    .history-item {
        grid-template-columns: 1fr
    }

    .history-item button {
        justify-self: start
    }

}

@media (max-width: 680px) {
    .app-shell {
        width: 100%;
        padding: calc(10px + env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
    }

    .topbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .brand {
        justify-self: center;
    }

    .topbar h1 {
        font-size: 24px;
    }

    .top-actions {
        display: grid;
        grid-template-columns: repeat(3,minmax(0,1fr));
        width: 100%;
        max-width: none;
        gap: 6px;
    }

    .wordlist-picker {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: space-between;
        min-height: 36px;
        padding-inline: 12px;
        font-size: 12px;
    }

    .wordlist-picker select {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        max-width: none;
        text-align: right;
    }

    .text-button,.context-chip {
        justify-content: center;
        min-height: 36px;
        padding: 6px 4px;
        font-size: 11px;
    }

    .progress-panel {
        grid-template-columns: minmax(0,1fr);
        gap: 10px;
        padding: 12px 10px;
    }

    .stat-question {
        display: grid;
        grid-template-columns: auto minmax(70px,1fr) auto;
        gap: 6px;
        width: 100%;
    }

    .qbar {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .reward-track {
        grid-column: auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        gap: 2px;
    }

    .reward-node span { font-size: 10px; }
    .reward-node .stage-status { font-size: 8px; }

    .progress-stats {
        display: grid;
        grid-template-columns: repeat(3,minmax(0,1fr));
        justify-self: stretch;
        width: 100%;
        gap: 0;
    }

    .stat-chip {
        min-width: 0;
        padding-left: 7px;
    }

    .stat-chip span { font-size: 10px; }
    .stat-chip strong { font-size: 14px; }

    .practice-card {
        min-height: 0;
        padding: 14px 12px 12px;
        border-radius: 16px;
    }

    .practice-card h2 {
        max-width: 100%;
        margin-top: 7px;
        font-size: 19px;
    }

    .helper {
        font-size: 13px;
    }

    .mascot-cue {
        top: 8px;
        right: 9px;
        gap: 6px;
    }

    .mascot { width: 54px; height: 54px; }

    .mascot-bubble {
        max-width: min(190px,calc(100vw - 88px));
        padding: 5px 8px;
        font-size: 14px;
    }

    .response-row {
        grid-template-columns: 1fr auto;
        grid-template-areas: "feedback feedback" "back action";
        gap: 9px;
        margin-top: 10px;
    }

    .feedback {
        grid-area: feedback;
        grid-column: auto;
        padding: 12px;
        font-size: 16px;
    }

    .feedback strong { font-size: 20px; }
    .feedback-word b { font-size: 24px; }
    .feedback-meaning { font-size: 18px; }

    .action-slot-start { grid-area: back; grid-column: auto; }
    .action-slot-end { grid-area: action; grid-column: auto; }
    .action-slot button { min-width: 112px; min-height: 46px; }

    .mode-rail {
        width: 100%;
        max-width: none;
        height: 52px;
        margin-top: 14px;
        font-size: 10px;
    }

    .mode-rail div { grid-template-rows: 26px 15px; min-width: 0; }
    .mode-rail i { width: 26px; height: 26px; }
    .mode-rail span { font-size: 10px; letter-spacing: -.03em; }
}

/* Let the active exercise own the remaining desktop height instead of leaving a blank lower page. */
@media (min-width: 681px) {
    .app-shell {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .practice-card:not([hidden]),.summary:not([hidden]) {
        flex: 1 1 auto;
        min-height: 0;
    }

    .practice-card {
        padding: 18px 28px 16px;
    }

    .practice-card h2 {
        margin-top: 8px;
        font-size: 21px;
    }

    .helper { font-size: 14px; }

    .play-wrap {
        min-height: 92px;
        margin: 14px auto;
    }

    .play-button {
        width: 86px;
        height: 86px;
    }

    .play-button svg {
        width: 39px;
        height: 39px;
    }

    .question-area {
        flex: 1 1 auto;
        min-height: 0;
        align-content: center;
    }

    .option {
        min-height: 70px;
        font-size: 23px;
    }

    .feedback {
        padding: 13px 16px;
        font-size: 17px;
    }

    .feedback-word b { font-size: 25px; }
    .feedback-meaning { font-size: 19px; }

    .action-slot button,.summary button {
        min-height: 52px;
        font-size: 15px;
    }

    .mode-rail {
        flex: 0 0 58px;
        height: 54px;
        margin-top: 12px;
    }
}

/* A landscape tablet has enough width for a single concise progress row; keep height for the exercise. */
@media (min-width: 681px) and (max-width: 1100px) and (orientation: landscape) {
    .topbar h1 { font-size: 25px; }

    .progress-panel {
        grid-template-columns: minmax(215px,1fr) minmax(255px,1.15fr) minmax(215px,1fr);
        gap: 8px;
        min-height: 70px;
        padding: 7px 10px;
    }

    .reward-track {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .progress-stats {
        justify-self: stretch;
        gap: 2px;
    }

    .stat-chip {
        min-width: 0;
        padding-left: 6px;
    }

    .stat-chip span { font-size: 10px; }
    .stat-chip strong { font-size: 14px; }

    .practice-card {
        padding: 10px 20px;
    }

    .play-wrap {
        min-height: 76px;
        margin: 8px auto;
    }

    .play-button { width: 74px; height: 74px; }
    .play-button svg { width: 34px; height: 34px; }
    .option { min-height: 60px; }

    .mode-rail {
        flex-basis: 52px;
        height: 48px;
        margin-top: 6px;
    }
}

/* Phone: every submitted question, including its answer reveal and navigation, fits in one normal portrait view. */
@media (max-width: 680px) {
    .app-shell {
        min-height: auto;
        display: block;
        padding-top: max(6px,env(safe-area-inset-top));
        padding-bottom: max(8px,env(safe-area-inset-bottom));
    }

    .topbar {
        grid-template-columns: minmax(145px,.95fr) minmax(170px,1.25fr);
        align-items: center;
        gap: 7px;
        margin-bottom: 4px;
    }

    .brand { justify-self: start; gap: 6px; }
    .brand-logo { width: 32px; height: 32px; border-radius: 10px; }
    .brand-logo svg { width: 18px; height: 18px; }
    .topbar h1 { font-size: 17px; line-height: 1.05; }

    .top-actions {
        grid-column: 2;
        grid-row: 1;
        grid-template-columns: repeat(3,minmax(0,1fr));
        gap: 4px;
    }

    .wordlist-picker {
        grid-column: 1 / -1;
        min-height: 31px;
        padding: 3px 8px;
        font-size: 10px;
    }

    .text-button,.context-chip {
        min-height: 28px;
        padding: 4px 2px;
        font-size: 9px;
        white-space: nowrap;
    }

    .progress-panel {
        gap: 5px;
        padding: 8px 9px;
        margin-bottom: 4px;
        border-radius: 13px;
    }

    .q-count {
        padding: 4px 6px;
        font-size: 13px;
    }

    .stat-question { gap: 5px; }
    .stage-progress { font-size: 9px; }
    .reward-track { min-height: 37px; }
    .reward-node { gap: 0; }
    .reward-node i { width: 20px; height: 20px; font-size: 13px; }
    .reward-node span { font-size: 9px; }
    .reward-node .stage-status { display: none; }
    .progress-stats { min-height: 33px; }
    .stat-chip { padding-left: 6px; }
    .stat-chip span { font-size: 9px; }
    .stat-chip strong { font-size: 13px; }

    .practice-card {
        padding: 9px 11px 10px;
        border-radius: 14px;
    }

    .mode-pill {
        min-height: 24px;
        padding: 3px 11px;
        font-size: 13px;
    }

    .practice-card h2 {
        margin: 4px auto 1px;
        font-size: 18px;
        line-height: 1.22;
    }

    .helper {
        min-height: 0;
        margin-bottom: 0;
        font-size: 11px;
    }

    .play-wrap {
        min-height: 66px;
        margin: 7px auto;
    }

    .play-button { width: 62px; height: 62px; }
    .play-button svg { width: 29px; height: 29px; }

    .question-area {
        min-height: 0;
        gap: 5px;
        margin: 0 auto;
    }

    .option-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 7px;
        margin: 4px auto;
    }

    .option {
        min-height: 54px;
        padding: 7px 5px;
        font-size: 17px;
    }

    .response-row {
        gap: 6px;
        margin-top: 6px;
    }

    .feedback {
        grid-column: 1 / -1;
        padding: 9px 10px;
        font-size: 14px;
        line-height: 1.35;
        text-align: center;
    }

    .feedback-result,.feedback-word {
        justify-content: center;
    }

    .feedback-result { gap: 2px 6px; }
    .feedback strong { font-size: 18px; }
    .feedback-result > span { font-size: 11px; }
    .feedback-word { gap: 3px 7px; margin-top: 2px; }
    .feedback-word b { font-size: 22px; }
    .feedback-ipa { font-size: 14px; }
    .feedback-meaning { padding: 1px 7px; font-size: 16px; }
    .feedback-focus { margin-top: 2px; font-size: 11px; }

    .action-slot button {
        min-width: 100px;
        min-height: 40px;
        font-size: 13px;
    }

    .mode-rail {
        height: 43px;
        margin-top: 8px;
    }

    .mode-rail::before { top: 10px; }
    .mode-rail div { grid-template-rows: 22px 14px; }
    .mode-rail i { width: 22px; height: 22px; }
    .mode-rail i svg { width: 12px; height: 12px; }
    .mode-rail span { font-size: 9px; }
}

@media (max-width: 680px) and (max-height: 800px) {
    .topbar h1 { font-size: 19px; }
    .progress-panel { padding-block: 6px; }
    .play-wrap { min-height: 60px; margin: 5px auto; }
    .play-button { width: 58px; height: 58px; }
    .option { min-height: 50px; }
    .mode-rail { margin-top: 5px; }
}

/* Desktop-only answer celebration: deliberately large and central so the praise is noticed. */
@media (min-width: 681px) {
    .mascot-cue {
        top: 50%;
        right: auto;
        left: 50%;
        gap: 16px;
        transform: translate(-50%,-50%) scale(.88);
        z-index: 9;
    }

    .mascot-cue.is-visible {
        animation: mascot-cue-desktop 3800ms cubic-bezier(.2,.78,.25,1) both;
    }

    .mascot {
        width: 126px;
        height: 126px;
        border-width: 4px;
        box-shadow: 0 15px 30px -13px rgba(13,154,122,.75);
    }

    .mascot-bubble {
        max-width: none;
        padding: 12px 18px;
        border-width: 2px;
        border-radius: 17px 17px 6px 17px;
        box-shadow: 0 12px 25px -14px rgba(20,32,51,.48);
        font-size: 24px;
        font-weight: 800;
    }

    @keyframes mascot-cue-desktop {
        0% { opacity: 0; transform: translate(-50%,calc(-50% + 30px)) scale(.72); }
        13%, 80% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
        100% { opacity: 0; transform: translate(-50%,calc(-50% - 18px)) scale(1.04); }
    }
}

/* Desktop landscape: a deliberate learning-path composition.  Keep this out
   of the tablet and phone breakpoints: their compact rails solve a different
   space problem. */
@media (min-width: 1101px) {
    .app-shell {
        min-height: 0;
        display: block;
        padding: 12px 0;
    }

    .topbar {
        min-height: 48px;
        margin-bottom: 8px;
    }

    .progress-panel {
        min-height: 76px;
        margin-bottom: 8px;
    }

    .practice-card {
        min-height: 420px;
        padding: 16px 28px 14px;
        justify-content: center;
    }

    .practice-card:not([hidden]),.summary:not([hidden]) {
        flex: none;
        min-height: 420px;
    }

    .practice-card h2 {
        margin-top: 5px;
        font-size: 20px;
    }

    .helper {
        font-size: 13px;
    }

    .play-wrap {
        min-height: 68px;
        margin: 8px auto;
    }

    .play-button {
        width: 64px;
        height: 64px;
    }

    .play-button svg {
        width: 24px;
        height: 24px;
        display: block;
        margin-left: 0;
    }

    .question-area {
        flex: 0 0 auto;
        min-height: 0;
        margin: 2px auto;
    }

    .option-grid {
        margin: 6px auto;
    }

    .option {
        min-height: 62px;
        font-size: 22px;
    }

    .response-row {
        margin-top: 10px;
    }

    .feedback {
        padding: 12px 16px;
    }

    .mode-rail {
        width: 100%;
        max-width: none;
        height: 84px;
        margin: 12px 0 0;
        padding: 9px clamp(56px,10vw,150px);
        border-radius: 18px;
        background: var(--card);
        box-shadow: var(--shadow);
        font-size: 15px;
    }

    .mode-rail::before {
        top: 27px;
        right: 12%;
        left: 12%;
    }

    .mode-rail div {
        grid-template-rows: 38px 20px;
    }

    .mode-rail i {
        width: 34px;
        height: 34px;
    }

    .mode-rail i svg {
        width: 18px;
        height: 18px;
    }
}

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

    .mascot-cue.is-visible {
        visibility: visible;
        opacity: 1;
        transform: none;
        animation: none;
    }
}

.phone-copy { display: none; }

/* Phone portrait revision: readable controls and answer reveal; wider layouts retain their baseline. */
@media (max-width: 680px) and (orientation: portrait) {
    .app-shell { padding: max(6px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)); }
    .topbar { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin-bottom: 6px; }
    .brand { grid-column: 1 / 4; grid-row: 1; gap: 8px; }
    .brand-logo { width: 32px; height: 32px; }
    .topbar h1 { font-size: 21px; line-height: 1.2; }
    .top-actions { display: contents; }
    .context-chip { grid-column: 4; grid-row: 1; min-height: 32px; font-size: 12px; padding: 4px; }
    .wordlist-picker { grid-column: 1 / 3; grid-row: 2; min-height: 44px; padding: 6px 8px; font-size: 13px; gap: 4px; }
    .wordlist-picker select { width: 100%; min-width: 0; max-width: none; text-align: left; }
    .text-button { min-height: 44px; padding: 6px 4px; font-size: 13px; }
    #historyBtn { grid-column: 3; grid-row: 2; }
    #resetBtn { grid-column: 4; grid-row: 2; }

    .progress-panel { grid-template-columns: minmax(0,1fr); gap: 5px; padding: 7px 10px; margin-bottom: 6px; }
    .stat-question { grid-template-columns: auto minmax(0,1fr) auto; gap: 7px; }
    .q-count { padding: 3px 6px; font-size: 13px; gap: 2px; }
    .qbar { min-width: 0; width: 100%; max-width: none; }
    .stage-progress { font-size: 12px; }
    .extra-practice { grid-area: extra; justify-self: center; align-self: center; font-size: 13px; padding: 5px 7px; white-space: nowrap; }
    .reward-track { grid-column: 1; grid-row: 2; min-width: 0; width: 100%; max-width: none; min-height: 38px; gap: 3px; }
    .reward-node { gap: 2px; }
    .reward-node i { width: 22px; height: 22px; font-size: 15px; }
    .reward-node span { font-size: 12px; line-height: 1.2; }
    .reward-node .stage-status { display: none; }
    .progress-stats { min-height: 33px; gap: 4px; }
    .stat-chip { padding-left: 7px; gap: 2px; }
    .stat-chip span { font-size: 12px; line-height: 1.2; }
    .stat-chip strong { font-size: 16px; line-height: 1.2; }
    .stat-chip strong span { font-size: inherit; color: inherit; }

    .practice-card { min-height: 0; padding: 8px 12px; border-radius: 16px; }
    .mode-pill { top: 0; align-self: flex-start; min-height: 26px; margin: 13px 0; padding: 3px 12px; font-size: 14px; }
    .phone-copy { display: inline; }
    .full-copy { display: none; }
    .practice-card h2 { max-width: 100%; margin: 4px 0 2px; font-size: 19px; line-height: 1.3; text-wrap: balance; }
    .helper { min-height: 18px; margin: 0; font-size: 13px; line-height: 1.4; }
    .play-wrap { position: absolute; top: 8px; right: 12px; min-height: 52px; margin: 0; }
    .play-button { width: 52px; height: 52px; }
    .play-button svg { width: 29px; height: 29px; display: block; margin-left: 0; transform: translateX(-3px); }
    .audio-toast { left: auto; right: 0; top: 0; transform: none; max-width: calc(100vw - 44px); width: max-content; font-size: 13px; text-align: center; pointer-events: none; }
    .question-area { min-height: 0; gap: 6px; margin: 0 auto; }
    .option-grid { gap: 8px; margin: 4px auto; }
    .option { min-height: 54px; padding: 8px 6px; font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
    .count-row,.chunk-bank { gap: 6px; }
    .count-option { min-width: 60px; min-height: 46px; padding: 6px 10px; font-size: 19px; }
    .chunk { min-height: 46px; padding: 6px 12px; font-size: 19px; }
    .letter { min-width: 44px; min-height: 44px; padding: 5px 8px; font-size: 19px; }
    .word-shape { font-size: 25px; line-height: 1.3; overflow-wrap: anywhere; }
    .word-shape-spelling { letter-spacing: .03em; }
    .build-line { min-height: 36px; padding: 3px 5px; font-size: 21px; line-height: 1.3; letter-spacing: .02em; overflow-wrap: anywhere; }
    .response-row { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); grid-template-areas: 'feedback feedback feedback' 'back extra action'; gap: 6px; margin-top: 6px; }
    .feedback { padding: 8px 10px; font-size: 15px; line-height: 1.35; }
    .feedback-result { gap: 3px; }
    .feedback-result > span { font-size: 13px; line-height: 1.4; }
    .feedback-word { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: baseline; gap: 2px 8px; margin-top: 0; }
    .feedback-word b { max-width: 100%; font-size: 25px; line-height: 1.25; overflow-wrap: anywhere; }
    .feedback-ipa { font-size: 16px; line-height: 1.3; }
    .feedback-meaning { grid-column: 1 / -1; justify-self: center; max-width: 100%; padding: 0 7px; font-size: 18px; line-height: 1.3; border-radius: 6px; }
    .feedback-focus { margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--ink); font-weight: 400; }
    .action-slot button { min-width: 110px; min-height: 44px; padding: 7px 14px; font-size: 15px; }

    /* Praise floats over the playback region only, never over answers or feedback. */
    .mascot-cue { top: var(--phone-cue-top,100px); right: 12px; left: auto; width: max-content; max-width: calc(100% - 136px); gap: 6px; transform: none; }
    .mascot-cue.is-visible { animation: mascot-cue-phone 2500ms ease both; }
    .mascot { flex: 0 0 52px; width: 52px; height: 52px; }
    .mascot-bubble { max-width: 230px; padding: 7px 10px; font-size: 16px; white-space: normal; }
    .star-burst { top: var(--phone-cue-top,100px); }
    .streak-toast { top: 4px; right: 4px; left: auto; padding: 4px 7px; font-size: 12px; }
    @keyframes mascot-cue-phone {
        0% { opacity: 0; transform: translateY(8px) scale(.94); }
        15%,76% { opacity: 1; transform: translateY(0) scale(1); }
        100% { opacity: 0; transform: translateY(-6px); }
    }

    .mode-rail { width: 100%; max-width: none; height: 46px; margin-top: 6px; padding: 0; }
    .mode-rail::before { top: 13px; }
    .mode-rail div { min-width: 0; grid-template-rows: 28px 18px; }
    .mode-rail i { width: 26px; height: 26px; }
    .mode-rail i svg { width: 14px; height: 14px; }
    .mode-rail span { font-size: 12px; line-height: 1.4; letter-spacing: 0; }

    .summary { padding: 14px 12px; }
    .summary-grid { grid-template-columns: 1fr; gap: 7px; }
    .summary-grid > div { grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; padding: 9px 12px; text-align: left; }
    .summary-grid span { font-size: 14px; }
    .summary-grid strong { grid-column: 2; grid-row: 1 / 3; font-size: 23px; }
    .summary-grid small { font-size: 13px; }
    .summary-list { gap: 4px; overflow-wrap: anywhere; }
    .summary-list span,.summary p,.summary-unresolved { font-size: 14px; line-height: 1.5; }
    .summary-list strong { font-size: 16px; }
    .summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
    .summary button { min-width: 0; min-height: 44px; padding: 8px; font-size: 15px; }
    .app-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
    .dialog-card { min-width: 0; padding: 14px; gap: 12px; }
    .dialog-heading { gap: 8px; }
    .dialog-heading > div { min-width: 0; }
    .dialog-heading h2 { font-size: 21px; }
    .dialog-heading p,.privacy-note,.local-boundary,.report-status { font-size: 14px; line-height: 1.5; }
    .dialog-close { flex: 0 0 44px; width: 44px; height: 44px; }
    .dialog-card input,.dialog-card select { min-height: 44px; font-size: 16px; }
    .dialog-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .dialog-actions button,.dialog-actions a { min-width: 0; min-height: 44px; padding: 8px; font-size: 14px; }
    .report-actions { grid-template-columns: 1fr; }
    .report-dialog .dialog-card { max-height: none; overflow: visible; }
    .history-list { max-height: none; overflow: visible; }
    .history-item { min-width: 0; gap: 9px; padding: 10px; }
    .history-item h3 { font-size: 15px; line-height: 1.4; }
    .history-item p,.history-unresolved { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
    .history-item button { justify-self: stretch; min-height: 44px; font-size: 14px; }
}
@media (max-width: 680px) and (orientation: portrait) and (prefers-reduced-motion: reduce) {
    .mascot-cue.is-visible { transform: none; animation: none; opacity: 1; }
}

/* Landscape workspace: retain the existing narrow-tablet range, and include wider
   touch-capable viewports. Height governs spacing; no device names or UA checks. */
@media (min-width: 681px) and (max-width: 1100px) and (orientation: landscape), (min-width: 1101px) and (orientation: landscape) and (any-pointer: coarse) {
    .app-shell { width: min(1320px,calc(100% - 28px)); min-height: 0; display: flex; flex-direction: column; padding: max(8px,env(safe-area-inset-top)) 0 max(8px,env(safe-area-inset-bottom)); }
    .topbar { min-height: 44px; margin-bottom: 6px; gap: 12px; flex-wrap: wrap; }
    .eyebrow { display: none; }
    .topbar h1 { font-size: 25px; line-height: 1.15; }
    .top-actions { flex-wrap: nowrap; gap: 7px; }
    .wordlist-picker,.text-button,.context-chip { min-height: 44px; padding: 7px 12px; font-size: 14px; }
    .wordlist-picker select { width: 150px; min-width: 0; max-width: 180px; }
    .context-chip { min-height: 36px; }
    .progress-panel { grid-template-columns: minmax(270px,1fr) minmax(260px,1fr) minmax(240px,.9fr); gap: 12px; min-height: 70px; padding: 8px 14px; margin-bottom: 6px; }
    .stat-question { display: grid; grid-template-columns: auto minmax(50px,1fr) auto; gap: 5px 8px; }
    .q-count { padding: 4px 7px; font-size: 15px; gap: 2px; }
    .qbar { width: 100%; min-width: 0; max-width: none; }
    .stage-progress { font-size: 13px; }
    .practice-card > .extra-practice { position: absolute; top: 10px; left: 18px; z-index: 2; max-width: 210px; padding: 6px 12px; font-size: 14px; line-height: 1.3; white-space: nowrap; }
    .reward-track { grid-column: auto; grid-row: auto; width: 100%; min-width: 0; max-width: none; gap: 6px; }
    .reward-node i { width: 26px; height: 26px; font-size: 17px; }
    .reward-node span { font-size: 12px; line-height: 1.3; }
    .reward-node .stage-status { display: none; }
    .progress-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); justify-self: stretch; gap: 6px; }
    .stat-chip { min-width: 0; padding-left: 8px; gap: 3px; }
    .stat-chip span { font-size: 12px; line-height: 1.2; }
    .stat-chip strong { font-size: 18px; line-height: 1.2; }
    .stat-chip strong span { font-size: inherit; color: inherit; }

    .practice-card:not([hidden]),body.scene-home .practice-card:not([hidden]) { flex: 0 0 auto; min-height: clamp(300px,calc(100dvh - 280px),360px); }
    .practice-card { display: grid; grid-template-columns: minmax(0,1fr); align-content: center; justify-content: stretch; padding: 10px 20px; }
    .mode-pill { grid-column: 1 / -1; grid-row: 1; justify-self: center; top: 0; min-height: 28px; padding: 3px 14px; font-size: 15px; }
    .practice-card h2 { grid-column: 1 / -1; grid-row: 2; max-width: min(700px,calc(100% - 440px)); margin: 5px auto 2px; font-size: 22px; line-height: 1.25; }
    .helper { grid-column: 1 / -1; grid-row: 3; max-width: calc(100% - 400px); min-height: 0; margin: 0 auto; font-size: 14px; line-height: 1.4; }
    .play-wrap { position: static; grid-column: 1; grid-row: 4; justify-self: center; align-self: center; min-height: 72px; margin: 6px auto; }
    .play-button,body.scene-home .play-button { width: 72px; height: 72px; }
    body.scene-home .play-wrap { min-height: 72px; }
    .play-button svg,body.scene-home .play-button svg { width: 34px; height: 34px; display: block; margin-left: 0; transform: translateX(-3.5px); }
    .audio-toast { left: 18px; top: 10px; transform: none; max-width: 220px; font-size: 14px; }
    .question-area { grid-column: 1; grid-row: 5; flex: none; align-self: center; min-height: 0; width: 100%; max-width: 740px; gap: 6px; margin: 0 auto 6px; }
    .option-grid { width: min(660px,100%); gap: 10px; margin: 0 auto; }
    .option,body.scene-home .option { min-height: 60px; padding: 8px 12px; font-size: 23px; line-height: 1.3; overflow-wrap: anywhere; }
    .count-row,.chunk-bank { gap: 8px; }
    .count-option,body.scene-home .count-option { min-width: 68px; min-height: 50px; padding: 7px 12px; font-size: 21px; }
    .chunk,body.scene-home .chunk { min-height: 50px; padding: 7px 14px; font-size: 21px; }
    .letter,body.scene-home .letter { min-width: 46px; min-height: 46px; padding: 6px 10px; font-size: 20px; }
    .word-shape { font-size: 28px; line-height: 1.25; overflow-wrap: anywhere; }
    .build-line { min-height: 38px; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
    .response-row { grid-column: 1 / -1; grid-row: 6; grid-template-columns: 120px minmax(0,1fr) 120px; justify-self: center; max-width: 1100px; gap: 12px; margin-top: 8px; }
    .feedback { padding: 8px 14px; font-size: 16px; line-height: 1.3; }
    .feedback-result { gap: 3px 8px; }
    .feedback-result > span { font-size: 14px; line-height: 1.4; }
    .feedback-word { margin-top: 0; gap: 4px 10px; align-items: baseline; }
    .feedback-word b { font-size: 28px; line-height: 1.2; overflow-wrap: anywhere; }
    .feedback-ipa { font-size: 18px; line-height: 1.3; }
    .feedback-meaning { max-width: 100%; padding: 1px 9px; font-size: 20px; line-height: 1.3; }
    .feedback-focus { margin-top: 4px; font-size: 15px; line-height: 1.4; font-weight: 400; overflow-wrap: anywhere; }
    .action-slot button,body.scene-home .action-slot button { min-height: 48px; font-size: 16px; }

    /* The corner is clear of the centered heading and the answer workspace. */
    .mascot-cue { --cue-duration-ms: 2500; top: 10px; right: 18px; left: auto; max-width: 220px; gap: 9px; transform: none; }
    .mascot-cue.is-visible { animation: mascot-cue-tablet 2500ms ease both; }
    .mascot { flex: 0 0 72px; width: 72px; height: 72px; border-width: 2px; }
    .mascot-bubble { max-width: 140px; padding: 8px 11px; font-size: 18px; line-height: 1.3; white-space: normal; }
    .star-burst { top: 8px; left: 95px; width: 130px; height: 62px; }
    .streak-toast { top: 12px; left: 18px; max-width: 210px; padding: 6px 10px; font-size: 16px; }
    .practice-card > .extra-practice:not([hidden]) ~ .streak-toast { top: 52px; }
    .practice-card > .extra-practice:not([hidden]) ~ .star-burst { top: 48px; }
    .practice-card > .extra-practice:not([hidden]) ~ .play-wrap .audio-toast { top: 94px; }
    @keyframes mascot-cue-tablet {
        0% { opacity: 0; transform: translateY(8px) scale(.96); }
        15%,76% { opacity: 1; transform: none; }
        100% { opacity: 0; transform: translateY(-6px); }
    }

    .mode-rail { flex: 0 0 auto; width: 100%; max-width: none; height: 72px; margin: 8px 0 0; padding: 6px clamp(20px,5vw,70px); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
    .mode-rail::before { top: 24px; left: 10%; right: 10%; }
    .mode-rail div { min-width: 0; grid-template-rows: 36px 22px; }
    .mode-rail i { width: 34px; height: 34px; }
    .mode-rail i svg { width: 18px; height: 18px; }
    .mode-rail span { font-size: 15px; line-height: 1.4; letter-spacing: 0; }

    .summary:not([hidden]) { flex: 0 0 auto; min-height: 0; }
    .summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr); gap: 6px 12px; margin-top: 8px; padding: 14px 20px; }
    .summary h2 { grid-column: 1 / -1; margin: 0 0 2px; font-size: 24px; line-height: 1.3; }
    .summary-targets,.summary-grid,.summary-milestones,.summary-actions { grid-column: 1 / -1; width: 100%; }
    .summary-targets { justify-self: center; margin-block: 0; }
    .summary-grid { margin: 0 auto; }
    .summary-repaired { grid-column: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; margin: 0; padding: 10px 12px; border-radius: 11px; background: var(--wash); border-bottom: 0; }
    .summary-unresolved { grid-column: 2; width: 100%; margin: 0; padding: 10px 12px; }
    .summary-milestones { margin: 0; line-height: 1.5; }
    .summary-grid { max-width: 900px; gap: 12px; }
    .summary-grid span,.summary-list span { font-size: 14px; }
    .summary-grid small,.summary p { font-size: 14px; }
    .summary-list,.summary-unresolved { max-width: 900px; }
    .summary-list strong { font-size: 16px; overflow-wrap: anywhere; }
    .summary button { min-height: 48px; font-size: 16px; }
    .app-dialog { width: min(800px,calc(100% - 32px)); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
    .dialog-card { padding: 16px 20px; gap: 12px; }
    .dialog-heading { gap: 12px; }
    .dialog-heading > div { min-width: 0; }
    .dialog-heading p,.privacy-note,.local-boundary,.report-status { font-size: 14px; line-height: 1.5; }
    .dialog-close { flex: 0 0 44px; width: 44px; height: 44px; }
    .dialog-actions button,.dialog-actions a { min-height: 44px; font-size: 15px; }
    #settingsForm { grid-template-columns: repeat(2,minmax(0,1fr)); }
    #settingsForm .dialog-heading,#settingsForm .privacy-note,#settingsForm .dialog-actions { grid-column: 1 / -1; }
    .history-list { max-height: none; overflow: visible; }
    .history-item h3 { font-size: 16px; }
    .history-item p { font-size: 14px; }
    .history-item button { min-height: 44px; font-size: 15px; }
    .report-dialog { width: min(900px,calc(100% - 32px)); }
    .report-dialog .dialog-card { grid-template-columns: minmax(0,1.3fr) minmax(230px,.8fr); max-height: none; overflow: visible; }
    .report-dialog .dialog-heading { grid-column: 1 / -1; }
    .report-preview-wrap { grid-column: 1; grid-row: 2 / 4; min-height: 0; align-self: start; }
    .report-preview-wrap img { width: auto; max-width: 100%; max-height: calc(100dvh - 126px); object-fit: contain; }
    .report-status { grid-column: 2; grid-row: 2; align-self: end; }
    .report-actions { grid-column: 2; grid-row: 3; align-self: start; display: grid; grid-template-columns: 1fr; }
}
@media (min-width: 681px) and (max-width: 900px) and (orientation: landscape) {
    .top-actions { flex-wrap: wrap; }
    .progress-panel { grid-template-columns: minmax(0,1fr) minmax(230px,.9fr); }
    .reward-track { grid-column: 1 / -1; grid-row: 2; width: min(500px,100%); }
    .practice-card h2 { max-width: calc(100% - 440px); }
    .mascot { flex-basis: 60px; width: 60px; height: 60px; }
    .mascot-bubble { font-size: 16px; max-width: 120px; }
}
@media (min-width: 681px) and (max-width: 1100px) and (orientation: landscape) and (prefers-reduced-motion: reduce),
       (min-width: 1101px) and (orientation: landscape) and (any-pointer: coarse) and (prefers-reduced-motion: reduce) {
    .mascot-cue.is-visible { animation: none; transform: none; opacity: 1; }
}

@media (min-width: 681px) and (max-width: 1100px) and (orientation: landscape) and (max-height: 560px),
       (min-width: 1101px) and (orientation: landscape) and (any-pointer: coarse) and (max-height: 560px) {
    .app-shell { padding-block: 6px; }
    .practice-card:not([hidden]),body.scene-home .practice-card:not([hidden]) { min-height: 0; }
    .mode-rail { height: 68px; padding-block: 4px; }
    .mode-rail::before { top: 22px; }
}

/* Ordinary mouse landscape only: touch-capable wide tablets keep the rules above. */
@media (min-width: 1101px) and (orientation: landscape) and (any-pointer: fine) and (not (any-pointer: coarse)) {
    .practice-card > .extra-practice { position: absolute; top: 10px; left: 18px; z-index: 2; max-width: 210px; padding: 6px 12px; font-size: 14px; line-height: 1.3; white-space: nowrap; }
    .mascot-cue { --cue-duration-ms: 2500; top: 10px; right: 18px; left: auto; max-width: 220px; gap: 9px; transform: none; }
    .mascot-cue.is-visible { animation: mascot-cue-computer-corner 2500ms ease both; }
    .mascot { flex: 0 0 72px; width: 72px; height: 72px; border-width: 2px; }
    .mascot-bubble { max-width: 140px; padding: 8px 11px; font-size: 18px; line-height: 1.3; white-space: normal; }
    .streak-toast { top: 12px; left: 18px; max-width: 210px; padding: 6px 10px; font-size: 16px; }
    .star-burst { top: 8px; left: 95px; width: 130px; height: 62px; }
    .practice-card > .extra-practice:not([hidden]) ~ .streak-toast { top: 52px; }
    .practice-card > .extra-practice:not([hidden]) ~ .star-burst { top: 48px; }
    @keyframes mascot-cue-computer-corner {
        0% { opacity: 0; transform: translateY(8px) scale(.96); }
        15%,76% { opacity: 1; transform: none; }
        100% { opacity: 0; transform: translateY(-6px); }
    }
}
@media (min-width: 1101px) and (orientation: landscape) and (any-pointer: fine) and (not (any-pointer: coarse)) and (prefers-reduced-motion: reduce) {
    .mascot-cue.is-visible { animation: none; transform: none; opacity: 1; }
}

/* Mouse desktop: reserve the reveal row, then share spare height between four
   module gaps. Keep the prompt and helper together as one heading group. */
@media (min-width: 1101px) and (orientation: landscape) and (any-pointer: fine) and (not (any-pointer: coarse)) {
    .top-actions .wordlist-picker,.top-actions .text-button,.top-actions .context-chip { font-size: 15px; min-height: 36px; }
    .wordlist-picker select { width: 156px; min-width: 156px; max-width: 180px; }
    .progress-panel { grid-template-columns: minmax(290px,1fr) minmax(270px,1fr) minmax(310px,1fr); gap: 12px; }
    .q-count { font-size: 16px; }
    .stage-progress,.reward-node span,.stat-chip span { font-size: 14px; }
    .reward-track { grid-column: auto; grid-row: auto; width: 100%; min-width: 0; max-width: none; }
    .stat-chip strong { font-size: 20px; }
    .stat-chip strong span { font-size: inherit; color: inherit; }

    .app-shell:has(#card:not([hidden])) { display: grid; grid-template-rows: auto auto minmax(min-content,1fr) auto; min-height: 100dvh; padding: 8px 0; gap: 6px; }
    .app-shell:has(#card:not([hidden])) > .topbar,.app-shell:has(#card:not([hidden])) > .progress-panel,.app-shell:has(#card:not([hidden])) > .mode-rail { margin: 0; }
    .practice-card:not([hidden]),body.scene-home .practice-card:not([hidden]) { min-height: 0; flex: none; }
    .practice-card,body.scene-home .practice-card { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto auto minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1fr) auto; align-content: stretch; align-items: start; justify-content: stretch; padding: 16px 28px; }
    .practice-card > :not(.extra-practice):not(.mascot-cue):not(.star-burst):not(.streak-toast) { flex-shrink: 0; }
    .mode-pill { grid-column: 1; grid-row: 1; justify-self: center; top: 0; }
    .practice-card h2 { grid-column: 1; grid-row: 3; margin: 0 auto; }
    .helper { grid-column: 1; grid-row: 4; margin: 2px auto 0; }
    .play-wrap,body.scene-home .play-wrap { grid-column: 1; grid-row: 6; justify-self: center; margin: 0; }
    .question-area { grid-column: 1; grid-row: 8; flex: none; margin: 0 auto; }
    .response-row { grid-column: 1; grid-row: 10; min-height: 112px; margin-top: 0; }
    .feedback { min-height: 112px; }
    .feedback:not(:empty) { display: flex; flex-direction: column; justify-content: center; }
    .feedback:empty { display: block; visibility: hidden; }
}

/* Preserve type and control sizes on low desktop viewports. Reclaim vertical
   padding and line-box whitespace instead of scaling the entire page. */
@media (min-width: 1101px) and (orientation: landscape) and (any-pointer: fine) and (not (any-pointer: coarse)) and (max-height: 640px) {
    .app-shell:has(#card:not([hidden])) { padding: 4px 0; gap: 4px; }
    .topbar { min-height: 38px; }
    .progress-panel { min-height: 58px; padding-block: 6px; }
    .stat-chip { gap: 2px; }
    .stat-chip span { line-height: 1.25; }
    .stat-chip strong { line-height: 1.1; }
    .practice-card,body.scene-home .practice-card { padding: 12px 28px; }
    .practice-card h2 { margin: 0 auto; }
    .helper { margin: 2px auto 0; }
    .play-wrap,body.scene-home .play-wrap { min-height: 64px; margin: 0; }
    .question-area { margin: 0 auto; gap: 4px; }
    .option-grid { margin: 0 auto; }
    .word-shape { line-height: 1.15; }
    .build-line { min-height: 34px; padding-block: 0; line-height: 1.2; }
    .response-row { min-height: 84px; margin-top: 0; }
    .feedback { min-height: 84px; padding: 4px 12px; line-height: 1.3; }
    .feedback-result > span { line-height: 1.3; }
    .feedback-word { margin-top: 0; }
    .feedback-word b { line-height: 1.2; }
    .feedback-ipa { line-height: 1.3; }
    .feedback-meaning { padding-block: 1px; line-height: 1.3; }
    .feedback-focus { margin-top: 2px; line-height: 1.3; }
    .mode-rail { height: 68px; padding-block: 6px; }
    .mode-rail div { grid-template-rows: 34px 20px; }
    .mode-rail::before { top: 23px; }
}
@media (min-width: 1101px) and (orientation: landscape) and (any-pointer: fine) and (not (any-pointer: coarse)) and (max-height: 560px) {
    .practice-card,body.scene-home .practice-card { padding-block: 6px; }
    .play-wrap,body.scene-home .play-wrap { margin-block: 0; }
    .question-area { gap: 3px; }
    .response-row,.feedback { min-height: 80px; }
}
