/* Small-screen exercise pages behave like focused app screens: one fixed viewport,
   no page swipe/zoom, with only the exercise's own step and chapter controls. */
@media(max-width:720px){
  html,body{width:100%;height:100%;min-height:0;overscroll-behavior:none;scrollbar-width:none}
  html::-webkit-scrollbar,body::-webkit-scrollbar{display:none}
  body.daily-practice-app-mode,body.episode-practice-app-mode{height:var(--practice-vh,100dvh);max-height:var(--practice-vh,100dvh);overflow:hidden;padding-bottom:0!important;touch-action:manipulation}
  body.daily-practice-app-mode .millers-global-header,body.daily-practice-app-mode .millers-global-footer,body.daily-practice-app-mode .millers-global-mobile,
  body.episode-practice-app-mode .millers-global-header,body.episode-practice-app-mode .millers-global-footer,body.episode-practice-app-mode .millers-global-mobile{display:none!important}

  /* Daily Sentence */
  body.daily-practice-app-mode .grow-topbar{position:relative;z-index:2;flex:0 0 52px;width:100%;height:52px;padding:5px 13px;grid-template-columns:36px minmax(0,1fr) auto;gap:10px}
  body.daily-practice-app-mode .grow-topbar>a{width:40px;height:40px}
  body.daily-practice-app-mode .grow-topbar>span{font-size:11px}
  body.daily-practice-app-mode .grow-stage{width:100%;height:calc(var(--practice-vh,100dvh) - 52px);min-height:0;margin:0;padding:0 12px 8px;overflow:hidden;display:flex;flex-direction:column}
  body.daily-practice-app-mode #growLesson{min-height:0;height:100%;display:flex;flex-direction:column;gap:6px;overflow:hidden}
  body.daily-practice-app-mode .grow-heading{flex:none;display:flex;align-items:center;gap:8px;min-width:0}
  body.daily-practice-app-mode .grow-heading p{flex:none;font-size:9px;letter-spacing:.04em}
  body.daily-practice-app-mode .grow-heading h1{min-width:0;margin:0;font-size:17px;line-height:1.25;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.daily-practice-app-mode .seed-card,body.daily-practice-app-mode .grown-history{display:none!important}
  body.daily-practice-app-mode .grow-step-head{flex:none;min-height:42px;margin:0;gap:8px}
  body.daily-practice-app-mode .grow-steps{gap:5px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;padding:2px 0}
  body.daily-practice-app-mode .grow-steps::-webkit-scrollbar{display:none}
  body.daily-practice-app-mode .grow-step{width:28px;height:28px;font-size:10px}
  body.daily-practice-app-mode .grow-step.current{width:34px;height:34px}
  body.daily-practice-app-mode .grow-step-head>button{min-height:36px;padding:0 9px;font-size:11px}
  body.daily-practice-app-mode .grow-task{min-height:0;flex:1;margin:0;padding:12px 13px 10px;display:flex;flex-direction:column;gap:4px;overflow:hidden;border-radius:16px}
  body.daily-practice-app-mode .grow-task>p:first-child{flex:none;font-size:9px;line-height:1.2;letter-spacing:.07em}
  body.daily-practice-app-mode .grow-task h2{flex:none;max-height:2.7em;margin:1px 0 0;font-size:clamp(15px,4.2vw,18px);line-height:1.35;overflow:hidden}
  body.daily-practice-app-mode .grow-task .word-stage-label{display:none}
  body.daily-practice-app-mode .grow-task .word-stage{flex:0 0 auto;min-height:clamp(82px,17dvh,120px);max-height:120px;margin:4px 0 0;padding:10px 7px;gap:9px 6px;overflow:hidden;align-content:center}
  body.daily-practice-app-mode .grow-task .growth-word{font-size:clamp(19px,5.8vw,25px);padding:1px 2px 5px;border-bottom-width:2px}
  body.daily-practice-app-mode .grow-task #growthZh{flex:none;max-height:2.7em;margin:1px 0 0;font-size:11px;line-height:1.35;overflow:hidden}
  body.daily-practice-app-mode .grow-task .growth-feedback{flex:none;min-height:24px;max-height:2.5em;padding-top:3px;font-size:11px;line-height:1.35;overflow:hidden}
  body.daily-practice-app-mode .grow-task .grow-actions{flex:none;margin-top:auto;gap:6px;display:flex;flex-direction:column}
  body.daily-practice-app-mode .grow-task .grow-shortcut-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  body.daily-practice-app-mode .grow-task .shortcut-action{min-width:0;min-height:43px;padding:5px 4px;align-items:center;gap:0;text-align:center;font-size:11px}
  body.daily-practice-app-mode .grow-task .action-shortcut{display:none}
  body.daily-practice-app-mode .grow-task #checkGrowth{min-height:42px;padding:8px 12px}
  body.daily-practice-app-mode .grow-task .grow-audio-status{flex:none;min-height:16px;max-height:16px;margin-top:2px;font-size:10px;line-height:1.4;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  body.daily-practice-app-mode .grow-task .browser-voice-trigger{flex:none;min-height:29px;align-self:flex-start;margin:0;padding:4px 8px;font-size:10px}
  body.daily-practice-app-mode .grow-finish{margin:8px 0 0;padding:18px}
  body.daily-practice-app-mode .grow-finish h2{font-size:22px}
  body.daily-practice-app-mode .grow-finish p{font-size:12px}
  body.daily-practice-app-mode.keyboard-open .grow-heading,body.daily-practice-app-mode.keyboard-open .grow-step-head{display:none}
  body.daily-practice-app-mode.keyboard-open .grow-stage{height:calc(var(--practice-vh,100dvh) - 52px)}
  body.daily-practice-app-mode.keyboard-open .grow-task{padding:8px 10px}
  body.daily-practice-app-mode.keyboard-open .grow-task>p:first-child,body.daily-practice-app-mode.keyboard-open .grow-task h2,body.daily-practice-app-mode.keyboard-open .grow-task .growth-feedback,body.daily-practice-app-mode.keyboard-open .grow-task .grow-audio-status,body.daily-practice-app-mode.keyboard-open .grow-task .browser-voice-trigger{display:none}
  body.daily-practice-app-mode.keyboard-open .grow-task #growthZh{display:block;flex:none;max-height:2.7em;margin:0;font-size:10px;line-height:1.3;overflow:hidden}
  body.daily-practice-app-mode.keyboard-open .grow-task .word-stage{min-height:58px;max-height:72px;margin:0;padding:6px;gap:6px}
  body.daily-practice-app-mode.keyboard-open .grow-task .growth-word{font-size:19px}

  /* Scenario English: compact the history and sentence, remove the inner vertical scroller. */
  body.episode-practice-app-mode .topbar{flex:none;padding:6px 12px 0}
  body.episode-practice-app-mode .hud{align-items:center;gap:8px;padding-bottom:6px;font-size:11px}
  body.episode-practice-app-mode .hud-left{min-width:0;gap:6px}
  body.episode-practice-app-mode .hud-back{font-size:11px}
  body.episode-practice-app-mode .hud-unit{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.episode-practice-app-mode .hud-right{gap:8px}
  body.episode-practice-app-mode #settingsPanel{position:fixed;top:52px;right:10px;left:auto}
  body.episode-practice-app-mode #main{min-height:0;padding:0 10px;overflow:hidden}
  body.episode-practice-app-mode #history{flex:0 0 27px;max-height:27px;padding:3px 0;overflow:hidden}
  body.episode-practice-app-mode .hist-line{display:none}
  body.episode-practice-app-mode .hist-line:last-child{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:10px;padding:1px 0}
  body.episode-practice-app-mode #stage{min-height:0;padding:0;gap:8px;overflow:hidden;justify-content:center}
  body.episode-practice-app-mode .a-line{margin:0 0 5px}
  body.episode-practice-app-mode .a-line .speaker{margin-bottom:3px;font-size:10px}
  body.episode-practice-app-mode .chips{gap:7px 5px}
  body.episode-practice-app-mode .chip,body.episode-practice-app-mode .typed,body.episode-practice-app-mode .blank{font-size:clamp(18px,5.5vw,24px);border-bottom-width:3px}
  body.episode-practice-app-mode .blank{width:clamp(20px,7vw,34px)}
  body.episode-practice-app-mode .ref-chunk{font-size:clamp(16px,4.8vw,20px);padding:1px 3px 3px}
  body.episode-practice-app-mode .ref-sentence{gap:4px 5px}
  body.episode-practice-app-mode .s-en{font-size:clamp(17px,5vw,23px);padding:1px 1px 3px;border-bottom-width:3px}
  body.episode-practice-app-mode .s-chunk{padding:2px 3px}
  body.episode-practice-app-mode .s-role{margin-top:3px;font-size:9px}
  body.episode-practice-app-mode .s-zh{font-size:13px;line-height:1.35}
  body.episode-practice-app-mode .s-details{grid-template-columns:1fr;gap:6px;max-height:72px;overflow:hidden}
  body.episode-practice-app-mode .s-detail{display:none;padding:7px 9px;font-size:11px}
  body.episode-practice-app-mode .s-detail.mobile-open{display:block}
  body.episode-practice-app-mode .sd-head{margin-bottom:3px;font-size:12px}
  body.episode-practice-app-mode .sd-row{padding:1px 0;font-size:10px}
  body.episode-practice-app-mode #prompt .p-line{margin-bottom:3px;font-size:clamp(13px,3.8vw,16px);line-height:1.4}
  body.episode-practice-app-mode #prompt .speaker{font-size:10px}
  body.episode-practice-app-mode #controls{flex:none;min-height:54px;gap:5px;flex-wrap:nowrap;padding:5px 8px calc(5px + env(safe-area-inset-bottom))}
  body.episode-practice-app-mode #controls button{min-height:42px;flex:1;justify-content:center;gap:3px;padding:5px 4px;font-size:12px;white-space:nowrap}
  body.episode-practice-app-mode #controls kbd{display:none}
  body.episode-practice-app-mode.keyboard-open #history{display:none}
  body.episode-practice-app-mode.keyboard-open #stage{gap:4px}

  /* Topic exercise: the chapter, mode, current sentence and actions share one screen. */
  body.topic-practice-app-mode{height:var(--practice-vh,100dvh);max-height:var(--practice-vh,100dvh);overflow:hidden;padding-bottom:0!important;overscroll-behavior:none;touch-action:manipulation}
  body.topic-practice-app-mode>#topicPracticeApp{height:100%;min-height:0;overflow:hidden}
  body.topic-practice-app-mode .site-shell{height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden}
  body.topic-practice-app-mode .site-shell>.site-header,body.topic-practice-app-mode .site-shell>.site-footer,body.topic-practice-app-mode .site-shell>.mobile-nav{display:none!important}
  body.topic-practice-app-mode .site-shell>#mainContent{min-height:0;flex:1;overflow:hidden;padding:0}
  body.topic-practice-app-mode .topic-practice-page{width:min(100% - 20px,920px);height:100%;margin:0 auto;padding:9px 0;display:flex;flex-direction:column;overflow:hidden}
  body.topic-practice-app-mode .topic-practice-top{flex:none;gap:7px;margin:0 0 8px}
  body.topic-practice-app-mode .topic-practice-top .button{flex:1;min-height:40px;padding:0 8px;font-size:12px}
  body.topic-practice-app-mode .topic-practice-card{min-height:0;flex:1;padding:12px;display:flex;flex-direction:column;overflow:hidden;border-radius:16px}
  body.topic-practice-app-mode .topic-practice-title{flex:none;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 8px}
  body.topic-practice-app-mode .topic-practice-title .eyebrow{grid-column:1/-1;font-size:8px}
  body.topic-practice-app-mode .topic-practice-title h1{min-width:0;margin:0;font-size:clamp(17px,4.8vw,21px);line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.topic-practice-app-mode .topic-practice-title label{display:none}
  body.topic-practice-app-mode .topic-practice-title select{width:min(42vw,185px);min-height:38px;padding:5px 7px;font-size:11px}
  body.topic-practice-app-mode .topic-practice-modes{flex:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:9px 0}
  body.topic-practice-app-mode .topic-practice-modes .button{min-height:39px;padding:0 5px;font-size:11px;white-space:nowrap}
  body.topic-practice-app-mode .topic-practice-question{min-height:0;flex:1;padding:10px;gap:5px;overflow:hidden}
  body.topic-practice-app-mode .topic-practice-meta{flex:none;font-size:10px}
  body.topic-practice-app-mode .topic-practice-reference{flex:none;max-height:2.8em;padding:8px 10px;font-size:15px;line-height:1.4;overflow:hidden}
  body.topic-practice-app-mode .topic-practice-question>p{flex:none;margin:1px 0;font-size:11px;line-height:1.35}
  body.topic-practice-app-mode .topic-practice-translation{max-height:2.7em;overflow:hidden}
  body.topic-practice-app-mode .topic-practice-question .word-stage{flex:1 1 68px;min-height:68px;max-height:110px;margin:1px 0;padding:8px 6px;gap:9px 6px;overflow:hidden;align-content:center}
  body.topic-practice-app-mode .topic-practice-question .growth-word{font-size:clamp(18px,5.2vw,23px);padding:1px 2px 4px;border-bottom-width:2px}
  body.topic-practice-app-mode .topic-practice-question .growth-feedback{flex:none;min-height:20px;max-height:2.5em;padding:1px 0;font-size:10px;line-height:1.3;overflow:hidden}
  body.topic-practice-app-mode .topic-practice-question .grow-actions{flex:none;margin:2px 0 0}
  body.topic-practice-app-mode .topic-practice-question .grow-shortcut-actions{display:grid;width:100%;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  body.topic-practice-app-mode .topic-practice-question .shortcut-action{min-width:0;min-height:40px;padding:4px 2px;align-items:center;gap:0;text-align:center;font-size:10px}
  body.topic-practice-app-mode .topic-practice-question .action-shortcut{display:none}
  body.topic-practice-app-mode .topic-practice-question .topic-practice-actions{flex:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  body.topic-practice-app-mode .topic-practice-actions .button{min-height:40px;padding:0 7px;font-size:11px}
  body.topic-practice-app-mode .topic-practice-audio-status{flex:none;min-height:15px;margin:1px 0 0;font-size:9px;line-height:1.3;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  body.topic-practice-app-mode.keyboard-open .topic-practice-page{padding:4px 0}
  body.topic-practice-app-mode.keyboard-open .topic-practice-top{display:none}
  body.topic-practice-app-mode.keyboard-open .topic-practice-title .eyebrow,body.topic-practice-app-mode.keyboard-open .topic-practice-title h1{display:none}
  body.topic-practice-app-mode.keyboard-open .topic-practice-modes{margin:5px 0}
  body.topic-practice-app-mode.keyboard-open .topic-practice-question{padding:7px}
  body.topic-practice-app-mode.keyboard-open .topic-practice-reference,body.topic-practice-app-mode.keyboard-open .topic-practice-question>p:not(.growth-feedback):not(.topic-practice-translation),body.topic-practice-app-mode.keyboard-open .topic-practice-audio-status{display:none}
  body.topic-practice-app-mode.keyboard-open .topic-practice-translation{display:block;flex:none;max-height:2.6em;margin:0;font-size:10px;line-height:1.3;overflow:hidden}
  body.topic-practice-app-mode.keyboard-open .topic-practice-question .word-stage{min-height:52px;max-height:64px}
  body.topic-practice-app-mode.keyboard-open .topic-practice-question .shortcut-action{min-height:34px}
}

@media(max-width:390px){
  body.daily-practice-app-mode .grow-task{padding:9px 10px 8px}
  body.daily-practice-app-mode .grow-task .word-stage{min-height:72px;gap:7px 4px}
  body.episode-practice-app-mode .chips{gap:5px 4px}
  body.topic-practice-app-mode .topic-practice-page{width:calc(100% - 12px)}
  body.topic-practice-app-mode .topic-practice-card{padding:9px}
  body.topic-practice-app-mode .topic-practice-question{padding:8px}
}

@media(max-height:680px) and (max-width:720px){
  body.daily-practice-app-mode .grow-heading{display:none}
  body.daily-practice-app-mode #growLesson{gap:4px}
  body.daily-practice-app-mode .grow-step-head{min-height:36px}
  body.daily-practice-app-mode .grow-task{padding:8px 10px}
  body.daily-practice-app-mode .grow-task .word-stage{min-height:68px;max-height:90px}
  body.episode-practice-app-mode .topbar{padding-top:3px}
  body.episode-practice-app-mode #history{flex-basis:19px;max-height:19px}
  body.episode-practice-app-mode #controls{min-height:48px;padding-top:2px}
  body.topic-practice-app-mode .topic-practice-page{padding:4px 0}
  body.topic-practice-app-mode .topic-practice-top{margin-bottom:4px}
  body.topic-practice-app-mode .topic-practice-card{padding:8px}
  body.topic-practice-app-mode .topic-practice-modes{margin:5px 0}
  body.topic-practice-app-mode .topic-practice-question{padding:7px;gap:3px}
  body.topic-practice-app-mode .topic-practice-reference{padding:5px 8px;font-size:13px}
  body.topic-practice-app-mode .topic-practice-question .word-stage{min-height:56px;max-height:76px}
}
