/* Mobile-only layout. Color and geometry tokens are owned by style.css. */
.lesson-section-picker{display:none}
.mobile-today-hero,.mobile-account-settings,.mobile-focus-bar,.mobile-card-actions,.mobile-swipe-hint,.mobile-passive-toggle,.mobile-add-word,.mobile-notebook-games,.mobile-notebook-tools-toggle,.mobile-dialog-focushead,.mobile-feedback-open,.writing-mode-bar{display:none}
.mobile-home-stats{display:contents}.mobile-home-stats>summary{display:none}
html[data-theme=dark] body.studio-enabled :is(.drawer,.drawer-head,.drawer-body){background:var(--surface);color:var(--ink)}
details.drawer-group:not([open])>.drawer-group-content{display:none!important}
#notebookFactory>details:not([open])>:not(summary){display:none!important}
.mobile-ux-sheet{width:min(640px,calc(100% - 32px));max-height:90dvh;box-sizing:border-box;overflow:auto;overscroll-behavior:contain;padding:20px;background:var(--surface);color:var(--ink);border:1px solid var(--line-dark);border-radius:var(--radius-dialog);box-shadow:var(--shadow)}
.mobile-ux-sheet::backdrop{background:var(--mobile-backdrop);backdrop-filter:blur(4px)}
.mobile-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:-20px;z-index:2;background:var(--surface);padding-block:12px}
.mobile-sheet-head h2{font-size:20px;margin:0}.mobile-sheet-head button{min-height:44px}
#mobileFeedbackSheet p{white-space:pre-line;line-height:1.7;overflow-wrap:anywhere}#mobileFeedbackSheet li{margin:14px 0;line-height:1.7}
.mobile-notebook-optional{grid-column:1/-1}.mobile-notebook-optional>summary{cursor:pointer;min-height:44px;padding-block:10px}.mobile-notebook-optional label{margin-bottom:12px}
@media(max-width:720px), (orientation:landscape) and (max-height:500px) and (pointer:coarse){
 body.mobile-ux .topbar{gap:10px;padding-inline:16px;min-height:64px;flex-basis:64px}
 body.mobile-ux .topbar .menu-btn,body.mobile-ux #headerSearch{display:none!important}
 body.mobile-ux .topbar-title{min-width:0;flex:1}body.mobile-ux #activeTitle{font-size:17px;line-height:1.3;white-space:normal}
 body.mobile-ux .topbar-actions{gap:8px;flex:none}body.mobile-ux .level-pill{min-height:44px;min-width:76px;padding:8px 10px;font-size:13px}
 body.mobile-ux .level-pill::after{content:'⌄';margin-left:5px}body.mobile-ux .avatar-button{width:44px;height:44px;min-height:44px;display:grid;place-items:center;padding:10px}
 body.mobile-ux .mobile-account-settings{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:14px;margin:0 0 16px;border:1px solid var(--line);border-radius:var(--radius-card)}
 body.mobile-ux .mobile-account-settings h3{flex-basis:100%;width:100%;font-size:16px;margin:0;line-height:1.4}
 body.mobile-ux .mobile-account-settings>button{flex:1 1 150px;min-width:0;min-height:48px;height:auto;padding:12px;line-height:1.4;white-space:normal;overflow-wrap:break-word}
 body.mobile-ux .mobile-account-settings #themeToggle{display:flex;align-items:center;justify-content:center;gap:8px;width:auto;min-width:0;height:auto;flex:1 1 120px;padding:12px;line-height:1.4}
 body.mobile-ux .mobile-account-settings #themeToggle svg{flex:none;width:21px;height:21px}
 .mobile-account-settings #themeToggle::after{content:'Sáng / Tối';font-size:14px;line-height:1.4;white-space:nowrap}
 body.mobile-ux .topbar{height:auto;flex:0 0 auto;padding-block:10px}
 body.mobile-ux .topbar-inner{height:auto;min-width:0}
 body.mobile-ux :is(.mobile-hero-top h2,.plan-task>div,.account-detail,.account-metric,.hub-content,.notebook-row,.section-row>div){min-width:0;overflow-wrap:break-word}
 body.mobile-ux :is(.plan-task button,.mobile-hero-top button,.notebook-actions button,.mobile-card-actions button,.writing-mode-bar button){height:auto;white-space:normal;line-height:1.4;overflow-wrap:break-word}
 body.mobile-ux :is(.section-row,.mobile-hero-top){flex-wrap:wrap}
 body.mobile-ux .mobile-hero-top h2{flex:1 1 150px}
 body.mobile-ux .mobile-card-actions{align-items:stretch}
 body.mobile-ux .account-progress-heading{flex-wrap:wrap;gap:8px;align-items:baseline}
 body.mobile-ux .account-progress-heading :is(span,strong){min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
 body.mobile-ux .account-week{grid-template-columns:repeat(7,minmax(0,1fr))}
 body.mobile-ux .account-day{min-width:0;padding-inline:2px;white-space:normal;overflow-wrap:anywhere}
 body.mobile-ux .about-hero>div{min-width:0;overflow-wrap:anywhere}
 body.mobile-ux .about-hero .about-logo{flex:none}
 body.mobile-ux .bottom-nav{gap:4px}
 body.mobile-ux .bottom-nav button{box-sizing:border-box;min-width:0;width:100%;height:auto;white-space:normal;line-height:1.3;padding:10px 6px;border-radius:var(--radius-btn);background-clip:border-box;-webkit-tap-highlight-color:var(--palette-clear)}
 body.mobile-ux .speech-status{bottom:calc(var(--mobile-dock-height,72px) + 12px)}
 body.mobile-ux .mobile-dock-label{display:block;width:100%;min-width:0;white-space:normal;overflow-wrap:break-word;line-height:1.3;text-wrap:balance}
 body.mobile-ux .mobile-today-hero{display:block;background:linear-gradient(130deg,var(--accent),var(--navy));color:var(--palette-white);padding:22px;border-radius:var(--radius-card);margin:0 0 20px}
 .mobile-hero-top{display:flex;align-items:start;gap:8px;justify-content:space-between}.mobile-hero-top h2{margin:0;line-height:1.3;font-size:24px;color:inherit!important}.mobile-hero-top button{font-size:12px;min-height:44px;padding:8px;flex:none}
 .mobile-today-hero>p{color:inherit!important;font-size:15px!important;margin:14px 0 18px;line-height:1.5}
 .mobile-today-hero .mobile-hero-cta{width:100%;min-height:52px;font-weight:750;font-size:16px;padding:12px}
 .mobile-today-hero .mobile-hero-result{margin-top:10px;min-height:44px;font-size:12px;padding:6px 10px}
 body.mobile-ux #placementEntry{display:none!important}body.mobile-ux #planToday{border:0;background:var(--palette-clear);padding:0;margin:0 0 20px}
 body.mobile-ux #planToday>.section-row #planContinue{display:none}body.mobile-ux #planTodayMeta{font-size:13px}
 body.mobile-ux .plan-task{padding:12px;margin-bottom:8px;gap:12px;min-height:0;border-radius:var(--radius-btn)}body.mobile-ux .plan-task p{margin:4px 0 0;font-size:13px;line-height:1.5}
 body.mobile-ux #homePlanSettings{padding:0;border:0;margin:0;background:var(--surface)}body.mobile-ux #homePlanSettings>summary{display:none}
 body.mobile-ux #studioHome .feature-hero,body.mobile-ux #studioHome .pathway,body.mobile-ux #studioHome .pathway-head,body.mobile-ux #studioHome .review-reminder{display:none!important}
 body.mobile-ux #studioHome .side-card:not(.today-card){padding:16px}body.mobile-ux #studioHome .shortcut{min-height:150px;padding:16px}
 body.mobile-ux #studioHome .shortcut strong{font-size:17px}body.mobile-ux #studioHome .shortcut p{font-size:13px;margin-top:8px}
 .mobile-ux-sheet{width:100%;max-width:100%;margin:auto 0 0;max-height:90dvh;border-radius:var(--radius-22px-22px-0-0);padding:18px 18px calc(18px + env(safe-area-inset-bottom))}
 body.mobile-ux .mobile-focus-bar:not([hidden]){display:grid;grid-template-columns:44px minmax(0,1fr);align-items:center;gap:6px 10px;flex:none;padding:8px 16px;background:var(--surface);border-bottom:1px solid var(--line)}
 .mobile-focus-bar button{width:44px;min-height:44px;font-size:24px;padding:0}.mobile-focus-bar strong{font-size:13px;line-height:1.4}.mobile-focus-bar progress{grid-column:1/-1;width:100%;height:3px;accent-color:var(--accent)}
 body.mobile-ux.mobile-focus .topbar,body.mobile-ux.mobile-focus .mobile-dock{display:none!important}
 body.mobile-ux.mobile-focus .app-shell{inset:var(--safe-t) 0 0!important}body.mobile-focus main.workspace{padding-top:16px!important;padding-bottom:100px!important}
 body.mobile-focus #quizForm,body.mobile-focus #quizPanel>h2,body.mobile-focus #quizPoolPreview{display:none!important}
 body.mobile-focus #quizNext:not([hidden]),body.mobile-focus #examNext:not([hidden]),body.mobile-focus #examCheck:not([hidden]),body.mobile-focus #examWritingReview{position:sticky;bottom:0;z-index:3;min-height:48px;width:100%;box-shadow:var(--shadow);margin-block:12px}
 body.mobile-focus .mobile-feedback-open{display:block;min-height:48px;width:100%;margin-block:12px}
 body.mobile-focus #quizFeedback,body.mobile-focus #examFeedback{max-height:3.4em;overflow:hidden;line-height:1.7}
 .mobile-focused-dialog .mobile-dialog-focushead{display:flex;gap:12px;justify-content:space-between;align-items:center;position:sticky;top:-16px;background:var(--surface);z-index:3;padding-block:8px;border-bottom:2px solid var(--accent);margin-bottom:12px}
 .mobile-dialog-focushead strong{font-size:13px;line-height:1.4;min-width:0;overflow-wrap:anywhere}.mobile-dialog-focushead button{min-width:44px;min-height:44px;font-size:20px;flex:none;padding:6px 10px;line-height:1}
 #writingPractice.mobile-focused-dialog,#placementDialog.mobile-focused-dialog{width:100%;max-width:100%;height:100dvh;max-height:100dvh;margin:0;padding:calc(16px + var(--safe-t)) 16px calc(20px + var(--safe-b));border-radius:var(--radius-none)}
 .mobile-focused-dialog>h2,.mobile-focused-dialog>button{display:none!important}
 body.mobile-ux.mobile-card-mode main.workspace{padding-bottom:110px!important}
 body.mobile-ux .mobile-card-actions:not([hidden]){position:fixed;left:0;right:0;bottom:var(--mobile-dock-height,72px);z-index:13;display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;padding:10px 12px;background:var(--surface);border-top:1px solid var(--line)}
 .mobile-card-actions button{min-height:48px;font-size:13px;padding:8px 4px;white-space:normal}
 body.mobile-ux #flashcard{height:360px!important;min-height:360px;touch-action:pan-y pinch-zoom}body.mobile-ux #flashcard .inner{height:100%;min-height:0}
 body.mobile-ux #flashcard .face{min-height:0;padding:52px 18px 22px;overflow-y:auto;overscroll-behavior:contain}
 body.mobile-ux #flashcard .mastery-tools,body.mobile-ux #flashcard .mastery-btn{display:none!important}body.mobile-ux #flashcard .mean{max-height:none;overflow:visible;flex:none}
 body.mobile-ux .mobile-swipe-hint{display:block;font-size:12px;line-height:1.5;color:var(--sub);margin:10px 0}
 body.mobile-swipe-known #flashcard{outline:3px solid var(--green)}body.mobile-swipe-unknown #flashcard{outline:3px solid var(--mobile-review-ink)}
 body.mobile-ux .lesson-section-nav{position:static;display:block;overflow:visible;background:var(--surface);padding:8px 0}
 body.mobile-ux .lesson-section-nav button{flex:none;min-height:44px;white-space:nowrap;padding:8px 14px;border-radius:var(--radius-pill)}
 body.mobile-ux .lesson-section-nav button[data-complete=true]::after{content:'●';font-size:8px;margin-left:6px}
 body.mobile-ux .lesson-chat-button{width:auto;max-width:calc(100% - 32px);height:auto;min-height:44px;padding:10px 14px;font-size:13px;border-radius:var(--radius-pill);bottom:calc(var(--mobile-dock-height,72px) + 12px)}
 body.mobile-ux .lesson-chat-panel{left:0;right:0;bottom:0;width:100%;height:52dvh;max-height:calc(100dvh - 80px);border-radius:var(--radius-22px-22px-0-0);padding-bottom:var(--safe-b);z-index:30;animation:mobile-sheet-enter 180ms ease-out}
 body.mobile-ux #notebookPanel{display:flex;flex-direction:column;gap:12px}body.mobile-ux #notebookPanel>.hub-intro{order:0}body.mobile-ux #notebookPanel>.hub-intro+.hint{display:none}
 body.mobile-ux #notebookPanel>.mobile-add-word{display:block;order:1;align-self:flex-end;min-height:44px}
 body.mobile-ux #notebookPanel>label:has(#notebook-search){order:2}body.mobile-ux .mobile-notebook-games{order:3;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,110px),1fr));gap:6px}
 .mobile-notebook-games button{min-height:44px;min-width:0;padding:8px 4px;font-size:13px;white-space:normal;overflow-wrap:break-word;line-height:1.4}
 body.mobile-ux #notebookPanel>.notebook-form{display:none}body.mobile-ux #notebookPanel>.notebook-list{order:5;margin:0}body.mobile-ux #notebookPanel>p:not(.hint){order:4;margin:0}
 body.mobile-ux #notebookPanel>#notebookFactory{order:7;border-top:1px solid var(--line);margin-top:12px;padding-top:16px}
 body.mobile-ux #notebookPanel>.mobile-notebook-tools-toggle{display:block;order:6;min-height:44px}
 body.mobile-ux #notebookPanel:not(.mobile-tools-open)>#notebookFactory{display:none}
 body.mobile-ux #notebookPanel>#notebookSession{order:4}
 body.mobile-ux #srsRatings:not([hidden]){position:sticky;bottom:0;z-index:3;background:var(--surface);padding:10px 0;border-top:1px solid var(--line)}
 body.mobile-ux .mobile-home-stats{display:block;border:1px solid var(--line);border-radius:var(--radius-btn);padding:12px;margin-top:12px}body.mobile-ux .mobile-home-stats>summary{display:block;cursor:pointer;min-height:44px;padding:10px;font-weight:600}
 body.mobile-ux #studioHome .stats-card{padding:12px;margin:12px 0}
 body.mobile-ux #studioHome .stats-stack strong{font-size:24px}body.mobile-ux #studioHome .stats-stack small{font-size:12px}
 body.mobile-ux #notebookPanel>.hint{order:4}body.mobile-ux .notebook-dialog .notebook-actions{position:sticky;bottom:calc(-20px - env(safe-area-inset-bottom));background:var(--surface);padding:12px 0 calc(12px + env(safe-area-inset-bottom));z-index:2;flex-wrap:wrap}
 body.mobile-ux .notebook-dialog .notebook-form{gap:12px}body.mobile-ux .notebook-dialog{scroll-padding-bottom:100px}
 body.mobile-ux #handwritingPanel>.handwriting-edit-actions{display:flex;gap:8px;margin:12px 0 8px}body.mobile-ux #handwritingPanel>.handwriting-edit-actions button{flex:1;min-height:44px}
 body.mobile-ux #handwritingPanel>#handwritingCandidates{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:8px;min-height:48px;margin:8px 0}
 body.mobile-ux #handwritingCandidates button{min-width:44px;min-height:44px;flex:none;font-size:24px;padding:4px 8px}
 body.mobile-ux .writing-mode-bar{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:12px 0}.writing-mode-bar button{min-height:44px}
 body.mobile-ux .writing-controls>button:nth-child(-n+2){display:none}body.mobile-ux #writingStage{width:min(100%,360px);max-width:100%;margin:12px auto}
 body.mobile-ux #writingStage>svg{width:100%!important;height:auto!important;max-width:100%;aspect-ratio:1}
 body.mobile-ux #writingPractice .writing-outline{justify-content:flex-end;margin:8px 0;font-size:13px}body.mobile-ux #writingStatus{min-height:2.8em;font-size:14px;margin-block:10px}
 body.mobile-ux .passive-actions{grid-template-columns:1fr 64px 1fr;align-items:center}
 body.mobile-ux .mobile-passive-toggle{display:block!important;width:64px;height:64px;min-height:64px;padding:6px;font-size:13px;border-radius:var(--radius-round);grid-column:2;grid-row:1}
 body.mobile-ux #passivePlay,body.mobile-ux #passivePause{display:none!important}body.mobile-ux .passive-actions>button:nth-last-child(3){grid-column:1;grid-row:1}body.mobile-ux .passive-actions>button:nth-last-child(2){grid-column:3;grid-row:1}
 body.mobile-ux #passiveStop{grid-column:1/3;grid-row:2}body.mobile-ux .passive-status{font-size:15px;font-weight:600}
 html[data-theme=dark] body.mobile-ux .panel-box,html[data-theme=dark] body.mobile-ux .side-card,html[data-theme=dark] body.mobile-ux .dictionary-row{border:1px solid var(--mobile-dark-line);box-shadow:none}
 html[data-theme=dark] body.mobile-ux .pin,html[data-theme=dark] body.mobile-ux .dictionary-row-pinyin,html[data-theme=dark] body.mobile-ux .hsk-tag{color:var(--mobile-dark-accent)!important}
}
@media(orientation:landscape) and (max-height:500px) and (pointer:coarse){
 body.mobile-mini-rail{--mobile-safe-left:env(safe-area-inset-left,0px);--mobile-safe-right:env(safe-area-inset-right,0px);--mobile-rail-width:calc(64px + var(--mobile-safe-right))}
 body.mobile-mini-rail .sidebar{display:none!important}body.mobile-mini-rail .app-shell{position:fixed;inset:0 var(--mobile-rail-width) 0 var(--mobile-safe-left);width:auto;height:auto;min-height:0}
 body.mobile-mini-rail .app-area{display:flex;flex-direction:column;min-height:0;overflow:hidden}body.mobile-mini-rail main.workspace{width:100%;flex:1 1 0;min-height:0;overflow-y:auto;margin:0;padding:16px 20px 24px}
 body.mobile-mini-rail .mobile-dock{display:block;box-sizing:border-box;position:fixed;inset:0 0 0 auto;width:var(--mobile-rail-width);height:100dvh;padding:var(--safe-t) calc(4px + var(--mobile-safe-right)) var(--safe-b) 4px;background:var(--surface);border-right:0;border-left:1px solid var(--line)}
 body.mobile-mini-rail .bottom-nav{display:grid;grid-template-columns:1fr;grid-template-rows:repeat(5,minmax(44px,1fr));height:100%;padding:0;position:relative;inset:auto}
 body.mobile-mini-rail .bottom-nav button{min-height:44px;padding:8px;font-size:0;gap:0}body.mobile-mini-rail .bottom-nav button i{font-size:20px}
 body.mobile-mini-rail .mobile-dock-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 body.mobile-mini-rail .speech-status{bottom:calc(var(--safe-b) + 12px);left:calc((100% + var(--mobile-safe-left) - var(--mobile-rail-width))/2);max-width:calc(100% - var(--mobile-safe-left) - var(--mobile-rail-width) - 24px)}
 body.mobile-mini-rail .mobile-card-actions{left:var(--mobile-safe-left);right:var(--mobile-rail-width);bottom:0}body.mobile-mini-rail #flashcard{height:270px!important;min-height:270px}
 body.mobile-mini-rail.mobile-focus .app-shell{inset:0!important;width:100%}body.mobile-mini-rail .topbar{flex-basis:52px;min-height:52px}
}
@keyframes mobile-sheet-enter{from{transform:translateY(24px);opacity:.5}to{transform:translateY(0);opacity:1}}
@media(prefers-reduced-motion:reduce){.mobile-ux-sheet,.lesson-chat-panel{animation:none!important;scroll-behavior:auto!important}}

/* Task hierarchy: primary learning, quick lookup, optional tools. No data/feature removal. */
body.studio-enabled .clean-home-search{padding:16px;margin-bottom:18px;border:1px solid var(--line);border-radius:var(--radius-card);background:var(--surface)}
.clean-home-search>label{display:block;font-weight:700;margin-bottom:8px;font-size:14px;color:var(--ink)}
.clean-home-search form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
.clean-home-search input{width:100%;min-width:0;min-height:48px;font:inherit;padding:10px;border:1px solid var(--line-dark);border-radius:var(--radius-btn);background:var(--surface);color:var(--ink)}
.clean-home-search button{min-height:44px;padding:10px 12px;line-height:1.4;white-space:normal}
.clean-home-search form button,.clean-home-inputs button{border:1px solid var(--line-dark);border-radius:var(--radius-btn)}
.clean-home-inputs{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}.clean-home-inputs button{flex:1 1 110px}
body.studio-enabled #studioHome .dashboard-grid{grid-template-columns:minmax(0,1fr)}
body.studio-enabled #studioHome :is(.dashboard-side,.today-card,.pathway,.pathway-head){display:none!important}
body.studio-enabled #studioHome .shortcut:is([data-studio-go=srs],[data-studio-go=search]){display:none!important}
body.studio-enabled #studioHome .shortcut-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
body.studio-enabled #studioHome .shortcut{min-height:0;padding:14px;gap:8px}
body.studio-enabled #studioHome .shortcut-icon{width:36px;height:36px;margin:0}
body.studio-enabled #studioHome .shortcut strong{font-size:16px;margin:4px 0 0}body.studio-enabled #studioHome .shortcut small{margin:0;line-height:1.4}
body.studio-enabled #studioHome .shortcut :is(strong,small){min-width:0;max-width:100%;overflow-wrap:anywhere}
body.studio-enabled #studioHome .section-row>button[data-studio-go=notebook]{display:none}
body.studio-enabled .memory-reminder:not(.clean-relevant){display:none!important}
body.studio-enabled .clean-disclosure{display:block;min-width:0;grid-column:1/-1;border:1px solid var(--line);border-radius:var(--radius-btn);margin:12px 0;background:var(--surface);color:var(--ink)}
.clean-disclosure>summary{cursor:pointer;min-height:44px;box-sizing:border-box;padding:12px 14px;font-size:14px;font-weight:650;line-height:1.4;color:var(--ink);overflow-wrap:anywhere}
.clean-disclosure:not([open])>:not(summary){display:none!important}
.clean-disclosure[open]>:not(summary){margin:10px 12px 14px;max-width:calc(100% - 24px)}
.clean-disclosure .source-links{display:flex;gap:8px;flex-wrap:wrap}.clean-disclosure a{overflow-wrap:anywhere}
body.studio-enabled #passiveDisclosure #passiveTitle{display:none}
body.studio-enabled #passiveDisclosure #passiveControls{margin:0;border:0;padding-top:0}
body.studio-enabled #cardOptions[open]{display:flex;gap:8px;flex-wrap:wrap}
body.studio-enabled #cardOptions>summary{width:100%}#cardOptions>button{min-height:44px;flex:1 1 130px}
body.studio-enabled #coachDisclosure .ai-coach-panel{padding:12px;margin:0;border:0}
body.studio-enabled #coachDisclosure .ai-coach-panel>h3{display:none}
body.studio-enabled #aboutPanel .mobile-home-stats{display:block;margin-top:16px;border:1px solid var(--line);border-radius:var(--radius-btn)}
#aboutPanel .mobile-home-stats>summary{display:block;cursor:pointer;padding:14px;min-height:44px}
#aboutPanel .mobile-home-stats:not([open])>:not(summary){display:none!important}
@media(max-width:720px), (orientation:landscape) and (max-height:500px) and (pointer:coarse){
 body.mobile-ux .mobile-today-hero{padding:18px;margin-bottom:14px}
 body.mobile-ux .mobile-hero-top h2{font-size:22px}
 body.mobile-ux .mobile-today-hero>p{margin:10px 0 14px;font-size:14px!important}
 body.mobile-ux .mobile-hero-result{font-size:13px;line-height:1.4;min-height:44px;margin:8px 6px 0 0}
 body.mobile-ux .mobile-hero-top button{font-size:12px}
 body.mobile-ux #planToday{margin-bottom:16px}
 body.mobile-ux #planToday .section-row{margin:0 0 8px}
 body.mobile-ux #planTodayTitle{font-size:16px;line-height:1.4}
 body.mobile-ux #planTodayMeta,body.mobile-ux #planSettingsLink{display:none}
 body.mobile-ux .plan-task{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:10px 12px;margin-bottom:6px}
 body.mobile-ux .plan-task strong{font-size:14px;line-height:1.4}
 body.mobile-ux .plan-task p{font-size:12px;line-height:1.4;margin:3px 0 0}
 body.mobile-ux .plan-task button{min-height:44px;padding:8px 10px}
 body.mobile-ux #studioHome .section-row h3{font-size:16px}
 body.mobile-ux #studioPractice>.hub-intro,body.mobile-ux #learnPanel>.activity-intro,body.mobile-ux #notebookPanel>.hub-intro{display:none}
 body.mobile-ux :is(#accountPanel,#searchPanel,#quizPanel,#srsPanel,#mistakesPanel,#comparePanel,#translatorPanel)>h2{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 body.mobile-ux #searchPanel>.studio-search-tabs{margin-top:0}
 body.mobile-ux #searchPanel #dictionaryModeHint{font-size:12px;line-height:1.4;margin:8px 0 12px}
 body.mobile-ux #searchSummary:empty{display:none}
 body.mobile-ux .clean-home-search{padding:14px;margin-bottom:16px}
 body.mobile-ux #learnPanel .buttons{display:flex;flex-wrap:wrap;gap:8px}
 body.mobile-ux #learnPanel .buttons button{min-height:44px;white-space:normal;padding:8px}
 body.mobile-ux #learnPanel .buttons :is(#prev,#next,#exampleBtn){grid-column:auto;flex:1 1 88px;min-width:min-content;max-width:100%;min-height:44px;font-size:14px;padding:8px 4px;overflow-wrap:normal;line-height:1.4}
 body.mobile-ux #cardOptions{margin-top:8px}
 body.mobile-ux .flash-tools>.tool-card{padding:14px}
}

/* App-like loading screen & stage transitions. */
.hsk-loading-screen{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:20px;border:0;box-sizing:border-box;z-index:9999;display:grid;place-items:center;background:var(--mobile-backdrop);backdrop-filter:blur(6px);pointer-events:none;opacity:0;visibility:hidden;transition:opacity 180ms ease,visibility 180ms ease}
.hsk-loading-screen[hidden]{display:none!important}
.hsk-loading-screen[data-active=true]{opacity:1;visibility:visible}
.hsk-loading-card{display:grid;justify-items:center;gap:10px;width:min(360px,calc(100vw - 36px));box-sizing:border-box;padding:24px 22px 20px;text-align:center;background:var(--surface);color:var(--ink);border:1px solid var(--line-dark);border-radius:var(--radius-card);box-shadow:var(--shadow);transform:translateY(8px) scale(.98);transition:transform 200ms cubic-bezier(.22,1,.36,1)}
.hsk-loading-screen[data-active=true] .hsk-loading-card{transform:translateY(0) scale(1)}
.hsk-loading-emblem{position:relative;width:54px;height:54px;display:grid;place-items:center;margin-bottom:2px}
.hsk-loading-spinner{position:absolute;inset:0;border:3px solid var(--accent-light);border-top-color:var(--accent);border-right-color:var(--accent);border-radius:var(--radius-round);animation:hsk-loader-spin .85s linear infinite}
.hsk-loading-glyph{display:grid;place-items:center;width:36px;height:36px;border-radius:var(--radius-round);background:var(--accent-light);color:var(--accent-ink);font-size:18px;font-weight:800;line-height:1;animation:hsk-loader-pulse 1.4s ease-in-out infinite}
.hsk-loading-title{font-size:16px;font-weight:750;line-height:1.4;color:var(--ink-strong);overflow-wrap:anywhere}
.hsk-loading-sub{font-size:13px;line-height:1.45;color:var(--sub);overflow-wrap:anywhere}
.hsk-loading-bar{width:100%;height:4px;margin-top:4px;background:var(--accent-light);border-radius:var(--radius-pill);overflow:hidden}
.hsk-loading-bar-fill{display:block;width:100%;height:100%;background:var(--accent);border-radius:var(--radius-pill);opacity:.4;animation:hsk-loader-fade 1.6s ease-in-out infinite}
.hsk-stage-enter{animation:hsk-stage-fade 220ms ease-out}
@keyframes hsk-loader-spin{to{transform:rotate(360deg)}}
@keyframes hsk-loader-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
@keyframes hsk-loader-fade{0%,100%{opacity:.28}50%{opacity:.78}}
@keyframes hsk-stage-fade{from{opacity:.38}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.hsk-loading-screen,.hsk-loading-card,.hsk-loading-spinner,.hsk-loading-glyph,.hsk-loading-bar-fill,.hsk-stage-enter{animation:none!important;transition:none!important}}

/* Mobile reading and focus layout. Existing controls keep their handlers and IDs. */
.mobile-profile-summary,.mobile-account-group,.mobile-error-profile,.mobile-fixed-action-backdrop,.mobile-search-image,.lesson-evidence-chips{display:none}
.mobile-lesson-word{position:fixed;inset:auto;margin:0;width:min(310px,calc(100vw - 24px));max-height:45dvh;overflow-y:auto;box-sizing:border-box;padding:14px;background:var(--surface);color:var(--ink);border:1px solid var(--line-dark);border-radius:var(--radius-card);box-shadow:var(--shadow)}
.mobile-lesson-word>div{display:flex;align-items:center;justify-content:space-between;gap:12px}.mobile-lesson-word strong{font-size:26px}.mobile-lesson-word p{font-size:15px;line-height:1.5;overflow-wrap:anywhere;margin:8px 0}.mobile-lesson-word button{min-height:44px;padding:8px 12px;margin:4px 4px 0 0}
@media(max-width:720px),(orientation:landscape) and (max-height:500px) and (pointer:coarse){
 /* The Home header already has no outer horizontal padding. Apply the
    same inset to the four other dock roots. Lessons and Search are core
    tab routes without data-studio-hub, so match their active tab instead of
    expecting a missing hub attribute. Never translate the
    menu button (which would break its touch target and title spacing).
    The inner header's shared padding stays intact on every page. */
 body.mobile-ux:is([data-studio-hub=practice],[data-studio-hub=notebook],:has(.app-tabs [data-mode=lessons].active),:has(.app-tabs [data-mode=search].active)) #studioHeader{padding-inline:0}
 body.mobile-ux #studioHeader #menuBtn{display:inline-flex!important;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;padding:10px}
 body.mobile-ux:not([data-studio-hub=home]) #studioHeader .topbar-inner{width:100%;max-width:none;box-sizing:border-box;gap:6px;flex-wrap:wrap;padding-block:8px;height:auto;min-height:64px}
 body.mobile-ux:not([data-studio-hub=home]) #studioHeader{height:auto;flex-basis:auto}
 body.mobile-ux .topbar-title{min-width:60px}
 body.mobile-ux #searchForm{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px}
 body.mobile-ux #searchForm #searchInput{grid-column:1;grid-row:1;min-width:0;width:100%;font-size:16px;min-height:48px}
 body.mobile-ux #searchForm #handwritingOpen{grid-column:2;grid-row:1;min-height:48px;padding:8px;font-size:12px;white-space:normal}
 body.mobile-ux #searchForm .mobile-search-image{display:block;grid-column:3;grid-row:1;min-height:48px;padding:8px;font-size:12px}
 body.mobile-ux #searchForm button[type=submit]{grid-column:1/-1;grid-row:2;min-height:44px}
 body.mobile-ux .studio-search-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:0 0 14px}
 body.mobile-ux .studio-search-tabs button{min-height:44px;font-size:13px;padding:8px;white-space:normal;line-height:1.4}
 body.mobile-ux #notebookPanel{display:flex;flex-direction:column;gap:12px}
 body.mobile-ux #notebookPanel>.mobile-notebook-games{order:-4;margin:0;grid-template-columns:repeat(3,minmax(0,1fr))}
 body.mobile-ux #notebookPanel>.mobile-add-word{order:-5;align-self:flex-end;margin:0;min-height:44px}
 body.mobile-ux #notebookPanel>label:has(#notebook-search){order:-3;margin:0}
 body.mobile-ux #notebookPanel>.hint{margin:0}
 body.mobile-ux #notebookPanel>[role=status]:empty,body.mobile-ux #accountPanel>:is(#accountBadge,#accountStatus):empty{display:none}
 body.mobile-ux .mobile-notebook-games button{min-width:0;overflow-wrap:anywhere;white-space:normal;line-height:1.4;padding:8px 4px}
 body.mobile-ux #notebookPanel .dictionary-row-summary{grid-template-columns:minmax(52px,auto) minmax(0,1fr);gap:4px 12px;min-height:76px}
 body.mobile-ux #notebookPanel .dictionary-row-han{grid-column:1;grid-row:1;font-size:24px}
 body.mobile-ux #notebookPanel .dictionary-row-pinyin{grid-column:2;grid-row:1;text-align:right;padding-right:8px}
 body.mobile-ux #notebookPanel .dictionary-row-meaning{grid-column:1/-1;grid-row:2;display:block;overflow:visible;font-size:14px;line-height:1.5}
 body.mobile-ux .lesson-mastery{margin:12px 0;padding:12px;border:1px solid var(--line);border-radius:var(--radius-card);background:var(--surface)}
 body.mobile-ux .lesson-evidence-chips{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
 body.mobile-ux .lesson-evidence-chips span{background:var(--accent-light);color:var(--accent-dark);border-radius:var(--radius-btn);padding:5px 8px;font-size:12px;line-height:1.4}
 body.mobile-ux .mobile-mastery-details{margin-top:8px}
 body.mobile-ux .mobile-mastery-details>summary{padding:10px 8px;min-height:44px;font-size:13px;cursor:pointer}
 body.mobile-ux .mobile-mastery-details :is(p,small){font-size:12px!important;line-height:1.6}
 body.mobile-ux .lesson-section-nav{position:static;display:block;overflow:visible;padding:8px 0;background:var(--paper);margin:0 0 12px}
 body.mobile-ux .lesson-section-nav>button{display:none}
 body.mobile-ux .lesson-section-picker{display:grid;gap:6px;width:100%;margin:0;font-size:13px;font-weight:650;color:var(--ink)}
 body.mobile-ux .lesson-section-picker select{appearance:auto;box-sizing:border-box;width:100%;min-width:0;min-height:48px;margin:0;padding:10px 12px;font:inherit;font-size:16px;line-height:1.5;color:var(--ink);background-color:var(--surface);border:1px solid var(--line-dark);border-radius:var(--radius-btn);touch-action:manipulation}
 body.mobile-ux .lesson-section-nav button{flex:none;min-height:44px;padding:10px 14px;border-radius:var(--radius-pill);font-size:13px;white-space:nowrap}
 body.mobile-ux .lesson-tap-word{cursor:pointer;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:5px;border-radius:var(--radius-4px)}
 body.mobile-ux .lesson-tap-word:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
 body.mobile-ux .lesson-step-footer{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px;padding-top:12px;border-top:1px solid var(--line)}
 body.mobile-ux .lesson-step-footer button{min-height:48px;padding:10px 14px;flex:1 1 120px;white-space:normal}
 body.mobile-ux .mobile-profile-summary:not([hidden]){display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0 0 16px}
 body.mobile-ux .mobile-profile-summary article{padding:12px 6px;text-align:center;border:1px solid var(--line);border-radius:var(--radius-card);background:var(--surface);min-width:0}
 body.mobile-ux .mobile-profile-summary strong{display:block;font-size:23px;line-height:1.3;overflow-wrap:anywhere;color:var(--ink)}
 body.mobile-ux .mobile-profile-summary span{display:block;font-size:12px;line-height:1.4;color:var(--sub);margin-top:6px}
 body.mobile-ux .mobile-account-group:not([hidden]){display:block;margin:12px 0;border:1px solid var(--line);border-radius:var(--radius-card);padding:0 12px;background:var(--surface)}
 body.mobile-ux .mobile-account-group>summary{cursor:pointer;padding:14px 0;min-height:48px;font-size:15px;font-weight:650}
 body.mobile-ux .mobile-account-group[open]>:not(summary){margin:8px 0 14px}
 body.mobile-ux .mobile-account-group .studio-account-settings{padding:0;border:0;margin:0}
 body.mobile-ux .mobile-backup-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:stretch}
 body.mobile-ux #accountPanel .mobile-backup-tools :is(#accountBackup,#accountRestore){box-sizing:border-box;width:100%;min-width:0;min-height:64px;height:auto;margin:0;padding:10px 12px;line-height:1.5;white-space:normal;display:flex;align-items:center;justify-content:center;text-align:center}
 body.mobile-ux .mobile-error-profile:not([hidden]){display:block;margin:16px 0}
 body.mobile-ux .mobile-error-profile>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:8px}
 body.mobile-ux .mobile-error-profile h3{font-size:17px;margin:0}
 body.mobile-ux .mobile-error-profile button{min-height:44px;padding:8px 12px;white-space:normal}
 body.mobile-ux .mobile-error-card{padding:14px;border:1px solid var(--line);border-radius:var(--radius-card);margin:10px 0;background:var(--surface);font-size:14px}
 body.mobile-ux .mobile-error-card p{font-size:13px;line-height:1.6;margin:6px 0 10px;color:var(--sub)}
 body.mobile-ux #mobileErrorSheet .ai-coach-panel{border:0;padding:0;margin:12px 0}
 body.mobile-ux #mobileFeedbackSheet{max-height:65dvh}
 body.mobile-ux.mobile-focus main.workspace{padding-bottom:calc(var(--mobile-fixed-action-size,52px) + 40px + var(--safe-b))!important}
 body.mobile-ux.mobile-focus .mobile-card-actions{left:0;bottom:0;right:0;z-index:41;padding-bottom:calc(10px + var(--safe-b))}
 body.mobile-ux.mobile-focus .mobile-fixed-action-backdrop:not([hidden]){display:block;position:fixed;left:0;right:0;bottom:0;z-index:40;min-height:calc(var(--mobile-fixed-action-size,52px) + 24px + var(--safe-b));border-top:1px solid var(--line);background:var(--surface);pointer-events:none}
 body.mobile-ux.mobile-focus :is(#quizNext,#examNext,#examCheck,#srsReveal,#examWritingReview,.mobile-writing-next):not([hidden]){position:fixed!important;left:12px;right:12px;bottom:calc(12px + var(--safe-b));width:calc(100% - 24px);min-height:52px;margin:0!important;z-index:41;padding:12px;box-sizing:border-box;border-radius:var(--radius-btn);white-space:normal;line-height:1.4}
 body.mobile-ux.mobile-focus .exam-stage:has(#examNext:not([hidden])) #examCheck,body.mobile-ux.mobile-focus #examWritingReview:disabled{display:none!important}
 body.mobile-ux.mobile-focus #srsRatings:not([hidden]){position:fixed;left:0;right:0;bottom:0;width:100%;z-index:41;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:0;padding:12px 12px calc(12px + var(--safe-b));box-sizing:border-box}
 body.mobile-ux.mobile-focus #srsRatings button{min-height:52px;padding:8px 3px;font-size:13px;line-height:1.4;min-width:0;white-space:normal}
 body.mobile-ux.mobile-focus #srsRatings small{display:block;font-size:11px;line-height:1.3}
 body.mobile-ux[data-mobile-focus-kind=srs] #srsPanel>:is(.push-settings,.memory-options,.memory-schedule,.field-row,p.hint,#srsStats){display:none!important}
 body.mobile-ux .quiz-options button,body.mobile-ux .exam-option{min-height:52px}
}



/* A progress ring remains legible without decorative pulsing. */
.hsk-loading-spinner{border-radius:var(--radius-round);will-change:transform}
.hsk-loading-glyph{animation:none}
@media(prefers-reduced-motion:reduce){.hsk-loading-spinner{animation:hsk-loader-spin 2s linear infinite!important}}

/* Mobile drawer mirrors PC destinations; style only the drawer subtree. */
#drawer .drawer-route-nav{display:grid;gap:10px;margin-bottom:16px}
#drawer .drawer-route-nav .nav-group-items{display:grid;gap:4px;padding:4px 8px 12px}
#drawer .drawer-route-nav details:not([open])>.nav-group-items{display:none}
#drawer .drawer-route-nav .drawer-item{width:100%;box-sizing:border-box;min-height:44px;text-align:left}
#drawer .drawer-route-nav :is(summary,button){display:flex;align-items:center;gap:12px}
#drawer .drawer-route-nav :is(summary,button)>i{width:22px;height:22px;flex:none}
#drawer .drawer-route-nav .nav-chevron{margin-left:auto}
#drawer .drawer-route-nav details[open]>summary .nav-chevron{transform:rotate(180deg)}
#drawer .drawer-route-nav .di-lbl{min-width:0;overflow-wrap:anywhere}
#drawer .drawer-route-nav button.active{color:var(--accent);background:var(--accent-light)}
#drawer .drawer-legacy-hooks[hidden]{display:none!important}

/* Only the phone drawer is simplified; the header pill owns the native filter. */
@media(max-width:720px),(orientation:landscape) and (max-height:500px) and (pointer:coarse){
 #drawer :is(.drawer-filter-group,.drawer-about-group){display:none}
 dialog.mobile-hsk-filter{width:calc(100% - 32px);max-width:420px;max-height:calc(100dvh - 120px);margin:calc(80px + env(safe-area-inset-top)) auto auto;border-radius:var(--radius-dialog);padding:20px}
 #mobileHSKFilter .filter-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:16px}
 #mobileHSKFilter .filter-btn{min-height:48px;font-size:16px}
 #mobileHSKFilter .filter-btn[data-filter=all]{grid-column:1/-1}
}
#mobileHSKFilter .filter-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:10px}
#mobileHSKFilter .studio-filter-label{font-size:16px;font-weight:650}
#mobileHSKFilter .studio-filter-count{font-size:12px;font-weight:400}
#mobileHSKFilter .filter-btn:not(.active) .studio-filter-label{color:var(--ink)}
#mobileHSKFilter .filter-btn:not(.active) .studio-filter-count{color:var(--sub)}
#mobileHSKFilter .filter-btn.active :is(.studio-filter-label,.studio-filter-count){color:inherit}
/* One phone entry for text/image translation; OCR-only remains an option inside. */
@media(max-width:720px),(orientation:landscape) and (max-height:500px) and (pointer:coarse){
 html body:not(#_rd).mobile-ux #drawer .drawer-route-nav button[data-nav-action=image]{display:none!important}
 #mobileOCROptions{margin:12px 0}
 #mobileOCROptions > summary{min-height:44px;display:flex;align-items:center;cursor:pointer}
 #mobileOCROptions #ocrRead{width:100%;min-height:44px}
}

/* Desktop header HSK opens its own picker, independently of navigation. */
@media(min-width:721px) and (min-height:501px),(min-width:721px) and (pointer:fine){
 dialog.mobile-hsk-filter{width:min(440px,calc(100% - 32px));margin:auto;padding:24px}
 #mobileHSKFilter .filter-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:16px}
 #mobileHSKFilter .filter-btn{min-height:48px;font-size:16px}
 #mobileHSKFilter .filter-btn[data-filter=all]{grid-column:1/-1}
}
