/* Shared Chinese desk, using the approved lower-primary studio shell. */
.cn-game{--cn-good:#2f7d4f;--cn-bad:#c0392b;--cn-soft:#fbe7e4;--ink:#17223b}
.cn-game [hidden],.cn-game .hidden,.cn-hidden-instruction,.cn-hidden-control,.cn-legacy-progress{display:none!important}
.cn-game>.wrap{display:contents}.cn-game>.wrap:empty{display:none}.cn-game>.wrap>.bar{display:none}
.cn-game .cn-desk{height:100%;min-height:0;display:flex;flex-direction:column;gap:12px;color:var(--ink);overflow:visible}
.cn-game .cn-desk>main,.cn-game .cn-desk>div.app{margin:0;padding:0;width:100%;max-width:none;min-height:0;height:100%;background:transparent;box-shadow:none;border:0}
.cn-game .cn-desk :is(.card,.panel){background:transparent;border:0;border-radius:0;box-shadow:none;margin:0;padding:0;color:var(--ink)}
.cn-game .cn-desk :is(button,select,input){font-family:var(--sans)}
.cn-game .cn-desk button{color:var(--ink);background:#fff;border:1.5px solid var(--ink);border-radius:14px;min-height:64px;padding:10px 18px;font-size:18px;cursor:pointer;line-height:1.35;max-width:100%}
.cn-game .cn-desk button:disabled{cursor:default;opacity:.65}
.cn-game .cn-desk :is(.opt,.ans,.choice,.material,.bopt,.token,.sent,.scene,.big,.hz,.casefile){font-size:32px;line-height:1.65;color:var(--ink)}
.cn-game .cn-desk ruby rt{font-size:.5em;line-height:1.2}
.cn-game .cn-desk .sg-options{gap:12px;container-type:inline-size}
.cn-game .cn-desk :is(.opt,.ans){background:#fff;font-size:clamp(32px,4vw,48px);line-height:1.4;min-height:80px}
.cn-game .cn-desk :is(.right,.good){background:#e3f3e8!important;border-color:var(--cn-good)!important}
.cn-game .cn-desk :is(.wrong,.bad){background:#fbe7e4!important;border-color:var(--cn-bad)!important}
.cn-game .cn-desk :is(.py,rt){color:#626675}.cn-game .cn-desk .en{font-size:17px;line-height:1.5;color:#626675}
.cn-game.cn-no-py :is(.opts small,rt,.py),.cn-game.cn-no-en :is(.english,.en){display:none!important}
.cn-game .cn-hud{display:flex;gap:10px;font-size:17px}.cn-game .cn-hud .home{display:none}
.cn-game .cn-desk :is(.topics,.themes,.grid,.levels,.modes){display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.cn-game .cn-desk :is(.topics,.themes,.grid,.levels,.modes)>button{min-width:0}
.cn-game .cn-desk :is(.topic,.theme,.pick,.mode) small{display:block;font-size:15px;line-height:1.4}
.cn-game .cn-desk .row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.cn-game .cn-desk :is(.fb,.feedback,.msg){font-size:18px;line-height:1.45}.cn-game .cn-desk .fb:empty,.cn-game .cn-desk .feedback:empty{display:none}
.cn-game .cn-desk .tools{display:flex;gap:12px;flex-wrap:wrap}
.cn-game .cn-desk :is(canvas){max-width:100%;touch-action:none}
.cn-game .game-help .cn-help-content>header h1,.cn-game .game-help .toplinks,.cn-game .game-help #enBtn,.cn-game .game-help #topicBtn{display:none}
.cn-game[data-cn-reading] .g{height:auto;min-height:calc(var(--game-viewport-h,100dvh) - var(--game-header-h))}
.cn-game[data-cn-reading] .game-stage{flex:none}.cn-game[data-cn-reading] .cn-desk,.cn-game[data-cn-reading] .cn-desk>main{height:auto}
/* Upper primary: original clue and consequence remain visible in the desk. */
.cn-game[data-cn-kind=upper] #main>.card{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:12px 24px;align-content:center;height:100%}
.cn-game[data-cn-kind=upper] #main .sent{grid-column:1;grid-row:1;margin:0;font-size:32px}
.cn-game[data-cn-kind=upper] #main .tools{grid-column:1;grid-row:2}
.cn-game[data-cn-kind=upper] #main .opts{grid-column:2;grid-row:1/3;display:grid;grid-template-columns:1fr 1fr;gap:12px}
.cn-game[data-cn-kind=upper] #main .opt small{font-size:18px;display:block}
.cn-game[data-cn-kind=upper] #fb{grid-column:1/-1;max-width:100%;display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:8px 20px}
.cn-game[data-cn-kind=upper] #fb .said{font-size:24px;margin:6px 0}.cn-game[data-cn-kind=upper] #fb .emo{display:none}
.cn-game[data-cn-kind=upper] #fb .def{font-size:18px}.cn-game[data-cn-kind=upper] #fb .rant{font-size:16px}.cn-game[data-cn-kind=upper] #fb .row{justify-content:flex-end}
.cn-game[data-cn-kind=upper] #main>.card:has(.topics){display:block}.cn-game[data-cn-kind=upper] .topics .topic>span{display:none}
/* Year6 and dictation retain their original modes and handwriting. */
.cn-game[data-cn-kind=year6] #quiz{height:100%;display:flex;flex-direction:column;justify-content:center;gap:12px}
.cn-game[data-cn-kind=year6] #body{min-height:0}.cn-game[data-cn-kind=year6] .padbox{height:150px}.cn-game[data-cn-kind=year6] #pad{height:150px}
.cn-game[data-cn-kind=year6] .write .big{font-size:48px}.cn-game[data-cn-kind=year6] #topics{grid-template-columns:repeat(6,minmax(0,1fr))}
.cn-game[data-cn-kind=dictation] #app{display:flex;flex-direction:column;justify-content:center;gap:16px}
.cn-game[data-cn-kind=dictation] .big{font-size:64px;text-align:center}.cn-game[data-cn-kind=dictation] .opts{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.cn-game[data-cn-kind=dictation] .boxes{justify-content:center;gap:8px}.cn-game[data-cn-kind=dictation] .cell{--s:120px;max-height:130px;max-width:130px}
.cn-game[data-cn-kind=dictation] .word{border:1px solid var(--ink);border-radius:14px;padding:16px}
/* Detective: sentence and choices on paper, clues stay available. */
.cn-game[data-cn-kind=detective] #play{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:10px 24px;align-items:center}
.cn-game[data-cn-kind=detective] #play .sent{margin:0;grid-column:1}.cn-game[data-cn-kind=detective] #play #opts{grid-column:2;grid-row:1/3}
.cn-game[data-cn-kind=detective] .clue{grid-column:1/-1;font-size:18px}.cn-game[data-cn-kind=detective] .clue .wd{font-size:26px}
.cn-game[data-cn-kind=detective] .card#game{height:100%;display:flex;flex-direction:column;justify-content:center}
/* Original Level1 browse and prototype read passage may scroll; questions use the desk. */
.cn-game[data-cn-kind=measure] .controls{display:flex;gap:12px;margin:0 0 12px}.cn-game[data-cn-kind=measure] .structure-tabs{margin:0 0 12px;gap:8px}
.cn-game[data-cn-kind=measure] #practice{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:12px 28px;align-content:center}
.cn-game[data-cn-kind=measure] #prompt{grid-column:1;grid-row:1/3;text-align:center}.cn-game[data-cn-kind=measure] #choices{grid-column:2;display:grid;grid-template-columns:1fr 1fr;gap:12px}
.cn-game[data-cn-kind=measure] #assembled,.cn-game[data-cn-kind=measure] #feedback,.cn-game[data-cn-kind=measure] .actions{grid-column:1/-1}
.cn-game[data-cn-kind=measure] .picture img{max-height:140px;max-width:100%;object-fit:contain}
.cn-game[data-cn-kind=measure] #practice .learning{font-size:32px}.cn-game[data-cn-kind=measure] .structure-frame{min-height:0;height:100%;border-radius:0}
.cn-panel-active .ghead,.cn-panel-active .gdo,.cn-panel-active .gfoot,.cn-panel-active>.g>.game-stage>.learning-controls{display:none!important}
.cn-panel-active .desk{padding:12px;background:transparent;border:0}.cn-panel-active .cn-desk>main,.cn-panel-active .cn-desk>main>section:has(iframe){height:100%}
.cn-game[data-cn-kind=prototype] .panel{height:100%;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:12px 24px}
.cn-game[data-cn-kind=prototype] #app{height:100%;display:flex;flex-direction:column;justify-content:center;gap:12px}
.cn-game[data-cn-kind=prototype] .noun-card img{max-height:140px;object-fit:contain}.cn-game[data-cn-kind=prototype] .homes{display:flex;gap:12px;flex-wrap:wrap;justify-content:center}
.cn-game[data-cn-kind=prototype] .picture-count img,.cn-game[data-cn-kind=prototype] .order-item img{max-height:72px}
.cn-game[data-cn-kind=prototype] .order{display:flex;gap:16px}.cn-game[data-cn-kind=prototype] .story{font-size:32px;line-height:1.8}.cn-game[data-cn-kind=prototype] .story p{margin:12px 0}
/* Logic Lab keeps combination/handwriting checks and its original Teacher engine. */
.cn-game[data-cn-kind=logic] .controls{display:flex;gap:12px;flex-wrap:wrap;margin:0 0 12px}
.cn-game[data-cn-kind=logic] #musicBtn{display:none}.cn-game[data-cn-kind=logic] .modes{grid-template-columns:repeat(6,minmax(0,1fr));margin:0 0 12px;gap:8px}
.cn-game[data-cn-kind=logic] .modes button{padding:8px;font-size:15px}.cn-game[data-cn-kind=logic] .modes small{font-size:12px}
.cn-game[data-cn-kind=logic] .casefile{padding:12px;font-size:32px;margin:0 0 12px}.cn-game[data-cn-kind=logic] .options{display:flex;flex-wrap:wrap;gap:12px}
.cn-game[data-cn-kind=logic] .options button{font-size:32px;flex:1}.cn-game[data-cn-kind=logic] .build-zone{min-height:70px}
/* Mandarin Words list/search stays a reading view; cards and voice use one desk. */
.cn-game[data-cn-kind=review] .g{width:min(1000px,94%)}
.cn-game[data-cn-kind=review] #topicBar{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:18px}.cn-game[data-cn-kind=review] #topicBar[hidden]{display:none}
.cn-game[data-cn-kind=review] #view>.row{border:1px solid var(--ink);border-radius:14px;background:#fff;padding:18px;margin:12px 0;justify-content:space-between}
.cn-game[data-cn-kind=review] #view .hz{font-size:32px}.cn-game[data-cn-kind=review] #view .act{display:flex;gap:8px}
.cn-game[data-cn-kind=review] #view .fc,.cn-game[data-cn-kind=review] #view .hf{background:transparent;border:0;box-shadow:none;padding:16px;margin:0}
.cn-game[data-cn-kind=review] .q{font-size:40px}.cn-game[data-cn-kind=review] .cn-desk main>p:last-child{display:none}
/* Reading host: one global menu and independently sized single-game frames. */
.cn-portal .cn-portal-main{max-width:1000px;margin:auto;padding:32px 24px}.cn-portal #topbar{position:static;background:transparent;border:0;padding:0;display:flex;gap:12px;align-items:center}
.cn-portal #topbar .tabs{flex:1;border-bottom:1px solid var(--gold-faint)}.cn-portal .tab{background:transparent;border:0;border-radius:0;color:var(--soft);padding:10px 12px;font-size:16px}
.cn-portal .tab.active{color:var(--gold);border-bottom:2px solid var(--gold)}.cn-portal .frames{height:calc(100dvh - 250px);min-height:620px;margin-top:20px;background:transparent}
.cn-portal .frames iframe{height:100%;border:0;width:100%}.cn-portal .gear{border:1px solid var(--gold-line);color:var(--gold);background:transparent;font-size:14px}
@media(max-width:600px){
 .cn-game .cn-desk{padding:52px 16px 16px}.cn-game .cn-desk :is(.topics,.themes,.grid,.levels,.modes){grid-template-columns:1fr 1fr}
 .cn-game .cn-desk :is(.opt,.ans,.choice,.material,.bopt,.token,.sent,.scene,.big,.hz,.casefile){font-size:22px}.cn-game .cn-desk button{min-height:48px;font-size:17px;padding:8px 12px}
 .cn-game .cn-desk :is(.opt,.ans){font-size:26px;min-height:68px}.cn-game .cn-desk .en{font-size:14px}
 .cn-game[data-cn-kind=upper] #main>.card{display:flex;flex-direction:column;align-items:stretch}.cn-game[data-cn-kind=upper] #main .sent{font-size:26px}.cn-game[data-cn-kind=upper] #fb{display:block}
 .cn-game[data-cn-kind=upper] #main .opt small{font-size:16px}.cn-game[data-cn-kind=upper] #fb .said{font-size:22px}
 .cn-game[data-cn-kind=year6] #topics{grid-template-columns:1fr 1fr}.cn-game[data-cn-kind=year6] #quiz{height:auto}
 .cn-game[data-cn-kind=dictation] .big{font-size:44px}.cn-game[data-cn-kind=dictation] .cell{max-height:90px;max-width:90px}
 .cn-game[data-cn-kind=detective] #play{display:flex;flex-direction:column;align-items:stretch}
 .cn-game[data-cn-kind=measure] #practice{display:flex;flex-direction:column}.cn-game[data-cn-kind=measure] .controls{flex-wrap:wrap}
 .cn-game[data-cn-kind=prototype] .story{font-size:24px}.cn-game[data-cn-kind=prototype] .panel{height:auto}
 .cn-game[data-cn-kind=logic] .modes{grid-template-columns:repeat(3,minmax(0,1fr))}.cn-game[data-cn-kind=logic] .modes small{display:none}
 .cn-game[data-cn-kind=review] #view .hz{font-size:26px}.cn-game[data-cn-kind=review] .g{width:100%}
 .cn-portal .cn-portal-main{padding:24px 16px}.cn-portal .frames{min-height:844px;height:100dvh}.cn-portal #gear{min-width:48px}
}
.cn-game>header.bar{margin:0;border-radius:0;overflow:visible;background:rgba(12,14,34,.92);border:0;border-bottom:1px solid var(--gold-faint)}
.cn-game[data-cn-kind=measure][data-game-phase=question] .controls,.cn-game[data-cn-kind=measure][data-game-phase=question] .structure-tabs{display:none}
.cn-game[data-cn-kind=measure] #practice{min-height:0;height:100%;padding:0;border:0;background:transparent;grid-template-rows:auto auto auto}
.cn-game[data-cn-kind=measure] #prompt{grid-column:1;grid-row:1}.cn-game[data-cn-kind=measure] #assembled{grid-column:1;grid-row:2}.cn-game[data-cn-kind=measure] #feedback{grid-column:1;grid-row:3}
.cn-game[data-cn-kind=measure] #choices{grid-column:2;grid-row:1/3;margin:0}.cn-game[data-cn-kind=measure] .actions{grid-column:2;grid-row:3;margin:0;justify-content:flex-end}
.cn-game[data-cn-kind=measure] #choices button{min-height:80px}.cn-game[data-cn-kind=measure] .picture{min-height:80px}.cn-game[data-cn-kind=measure] .picture img{height:80px;width:80px}
.cn-game[data-cn-kind=measure] #assembled:empty,.cn-game[data-cn-kind=measure] #feedback:empty{display:none}
.cn-game[data-cn-kind=dictation] .choices{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:600px){.cn-game[data-cn-kind=measure] #practice{display:flex;height:auto}.cn-game[data-cn-kind=measure] #choices{width:100%}}
.cn-game[data-cn-kind=logic][data-game-phase=question] .cn-desk .controls,.cn-game[data-cn-kind=logic][data-game-phase=question] .cn-desk .modes{display:none}
.cn-game[data-cn-kind=logic][data-game-phase=question] .cn-desk>.app{display:flex;flex-direction:column;justify-content:center}
.cn-game[data-cn-kind=logic] #play{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:center}
.cn-game[data-cn-kind=logic] #play>.casefile,.cn-game[data-cn-kind=logic] #play>.options{width:100%;margin:0}
.cn-game[data-cn-kind=logic] .options{justify-content:center}.cn-game[data-cn-kind=logic] .options .bopt{flex:1 1 22%;font-size:32px;min-height:80px}
.cn-game .learning-controls select{background:transparent;color:var(--ink);font-size:13px;border:1px solid var(--ink-soft);border-radius:12px;height:30px;max-width:160px}
.cn-game[data-cn-kind=dictation] .speed{position:absolute;right:24px;top:14px}.cn-game[data-cn-kind=dictation] .speed button{min-height:30px;height:30px;padding:2px 12px;font-size:14px}
@media(max-width:600px){.cn-game .learning-controls select{max-width:110px;font-size:11px}.cn-game[data-cn-kind=logic] .options .bopt{flex:1 1 40%;font-size:22px}.cn-game[data-cn-kind=dictation] .speed{right:18px;top:12px}}
/* Legacy page-wide button/link rules must not repaint the shared chrome. */
.cn-game>header.bar a,.cn-game .ghead .back,.cn-game .gfoot button{background:transparent;border:0;min-height:0;padding:0;border-radius:0;box-shadow:none;max-width:none}
.cn-game>header.bar .menu-btn{background:transparent;border:1px solid var(--gold-line);height:44px;min-height:44px;padding:0 16px;border-radius:999px;color:var(--star)}
.cn-game>header.bar nav a{padding:10px 14px;border-radius:999px}.cn-game>header.bar a.brand{color:var(--star)}
.cn-game .ghead .back{color:var(--gold);font-size:15px}.cn-game .gfoot button{color:var(--gold);font-size:16px;border-bottom:1px solid var(--gold-line)}
.cn-portal{height:auto!important;min-height:100dvh;overflow:auto!important}.cn-portal .frames{position:static;inset:auto}
@media(min-width:601px){
 .cn-game[data-cn-kind=dictation] #app:has(.big){display:grid;grid-template-columns:minmax(0,.7fr) minmax(0,1.5fr);grid-template-rows:1fr auto;gap:16px 28px;align-content:center;align-items:center}
 .cn-game[data-cn-kind=dictation] #app:has(.big)>.row:has(.prog){display:none}
 .cn-game[data-cn-kind=dictation] #app>.big{grid-column:1;grid-row:1}.cn-game[data-cn-kind=dictation] #app>.choices{grid-column:2;grid-row:1}
 .cn-game[data-cn-kind=dictation] #app>.fb{grid-column:1;grid-row:2}.cn-game[data-cn-kind=dictation] #app>.row:has(#nx){grid-column:2;grid-row:2;margin:0!important;justify-content:flex-end}
 .cn-game[data-cn-kind=dictation] .choices button{font-size:32px;min-height:88px}
}
@media(max-width:600px){.cn-game[data-cn-kind=dictation] .choices button{font-size:22px}}
/* Once native feedback has highlighted the clues, its reveal button is redundant. */
@media(min-width:601px){
 .cn-game[data-cn-kind=upper] #qcard:has(.fb){grid-template-rows:minmax(0,1fr) auto;gap:8px 24px}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb) .tools{display:none}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb) .opts{grid-row:1}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb) .opt{font-size:32px;min-height:80px;padding:8px}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb) .opt small{font-size:16px}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb) #fb{grid-row:2}
}
/* Full eight-paragraph reading stays accessible in a keyboard-scrollable pane. */
.cn-game[data-cn-kind=prototype] .panel:has(.story){flex-wrap:nowrap;flex-direction:column;align-items:stretch;justify-content:flex-start}
.cn-game[data-cn-kind=prototype] .panel>.story{flex:1;min-height:0;overflow:auto;margin:0;width:100%;padding:0 12px;overscroll-behavior:contain}
.cn-game[data-cn-kind=prototype] .panel>#readStart{flex:none;align-self:center}
@media(min-width:601px){
 .cn-game[data-cn-kind=prototype] .panel:has(.order){display:grid;grid-template-columns:1fr 1fr;align-content:center}
 .cn-game[data-cn-kind=prototype] .order{grid-column:1;grid-row:1;flex-wrap:wrap;justify-content:center}
 .cn-game[data-cn-kind=prototype] #showAnswer,.cn-game[data-cn-kind=prototype] #answer{grid-column:2;grid-row:1}
 .cn-game[data-cn-kind=prototype] #showAnswer:disabled{display:none}
 .cn-game[data-cn-kind=prototype] .panel:has(.order) .actions{grid-column:2;grid-row:2;margin:0}
 .cn-game[data-cn-kind=prototype] .panel:has(.order) #feedback{grid-column:1;grid-row:2}
 .cn-game[data-cn-kind=prototype] .answer p{margin:4px 0}.cn-game[data-cn-kind=prototype] .self-check{display:flex;gap:8px}
}
.cn-game[data-cn-teacher] .cn-desk .controls{display:flex!important}.cn-game[data-cn-teacher] .cn-desk .modes{display:grid!important}
@media(min-width:601px){
 .cn-game[data-cn-kind=prototype] .panel:has(.order){grid-template-rows:auto auto auto auto}
 .cn-game[data-cn-kind=prototype] .panel:has(.order)>.hint{display:block!important;grid-column:1/-1;grid-row:1;font-size:18px;margin:0}
 .cn-game[data-cn-kind=prototype] .order{grid-row:2}
 .cn-game[data-cn-kind=prototype] #answer,.cn-game[data-cn-kind=prototype] #showAnswer{grid-row:2/5}
 .cn-game[data-cn-kind=prototype] .panel:has(.order) #feedback{grid-row:3}
 .cn-game[data-cn-kind=prototype] .panel:has(.order) .actions{grid-column:1;grid-row:4}
 .cn-game[data-cn-kind=prototype] .panel:has([data-choice]){display:grid;grid-template-columns:1fr 1.4fr;align-content:center}
 .cn-game[data-cn-kind=prototype] .panel:has([data-choice])>h3{grid-column:1;grid-row:1;margin:0}
 .cn-game[data-cn-kind=prototype] .panel:has([data-choice])>details{grid-column:1;grid-row:2}
 .cn-game[data-cn-kind=prototype] .panel:has([data-choice])>.choices{grid-column:2;grid-row:1/3;display:grid;grid-template-columns:1fr 1fr;gap:12px}
 .cn-game[data-cn-kind=prototype] .panel:has([data-choice])>.actions{grid-column:2;grid-row:3;margin:0}
 .cn-game[data-cn-kind=prototype] .panel:has([data-choice])>#feedback{grid-column:1;grid-row:3}
 .cn-game[data-cn-kind=prototype] details .story{max-height:180px;overflow:auto}
}
/* The retained prototype gets the entire host viewport under the ONE global bar. */
.cn-panel-active .g{width:100%;padding:0;height:calc(var(--game-viewport-h,100dvh) - var(--game-header-h));min-height:0}
.cn-panel-active .game-stage,.cn-panel-active .cn-desk,.cn-panel-active .cn-desk>main,.cn-panel-active .cn-desk>main>section:has(iframe){height:100%;min-height:0}
.cn-panel-active .desk{padding:0;border:0}.cn-panel-active .structure-tabs{display:none}
.cn-panel-active .structure-frame{height:100%;min-height:0}
/* The native wrong-sentence reconstruction already contains the whole question. */
@media(min-width:601px){
 .cn-game[data-cn-kind=upper] #qcard:has(.fb.no){grid-template-rows:1fr}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb.no)>.sent{display:none}
 .cn-game[data-cn-kind=upper] #qcard:has(.fb.no)>#fb{grid-column:1;grid-row:1;display:block}
 .cn-game[data-cn-kind=upper] #fb .said{font-size:32px}
}
/* Browse is a reading page; cards/voice return to the very same game desk. */
.cn-reading-heading{display:none}
.cn-game[data-cn-kind=review][data-cn-reading] .cn-reading-heading{display:block;margin-bottom:4px}
.cn-game[data-cn-kind=review][data-cn-reading] .cn-reading-heading h1{font-size:32px;color:var(--star);line-height:1.25;margin:0}
.cn-game[data-cn-kind=review][data-cn-reading] .ghead{display:none}
.cn-game[data-cn-kind=review][data-cn-reading] .g{max-width:1000px;padding-top:32px}
.cn-game[data-cn-kind=review][data-cn-reading] .gdo{font-size:18px;margin:10px 0 22px}
.cn-game[data-cn-kind=review][data-cn-reading] .cn-desk{padding:0;background:transparent;border:0;border-radius:0}
.cn-game[data-cn-kind=review][data-cn-reading] .learning-controls{position:static;justify-content:flex-end;margin-left:auto;gap:12px}
.cn-game[data-cn-kind=review][data-cn-reading] .learn-switch{color:var(--star)}
.cn-game[data-cn-kind=review][data-cn-reading] #topicBar{align-items:center}
.cn-game[data-cn-kind=review][data-cn-reading] #topicBar button{min-height:44px;font-size:15px;padding:8px 14px}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) .g{width:94%;max-width:none}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #topicBar{display:none!important}
@media(max-width:600px){.cn-game[data-cn-kind=review][data-cn-reading] .g,.cn-game[data-cn-kind=review]:not([data-cn-reading]) .g{width:100%}.cn-game[data-cn-kind=review][data-cn-reading] .g{padding-top:24px}}
/* Preserve Logic Lab's existing A-/A/A+ preference on its learning content. */
.cn-game[data-cn-kind=logic] .casefile,.cn-game[data-cn-kind=logic] .options .bopt{font-size:calc(32px * var(--ml-scale,1))}
@media(max-width:600px){.cn-game[data-cn-kind=logic] .casefile,.cn-game[data-cn-kind=logic] .options .bopt{font-size:calc(22px * var(--ml-scale,1))}}

/* Keep topic/mode buttons below the paper’s learning switches. */
.cn-game[data-cn-kind=logic][data-game-phase=home] .cn-desk,.cn-game[data-cn-kind=logic][data-cn-teacher] .cn-desk{padding-top:64px}
/* Legacy light input panels keep readable dark text inside the night shell. */
.cn-portal .codebar,.cn-portal .panel{color:var(--ink)}
.cn-portal #gear{flex-basis:94px;width:94px;line-height:1.25;padding:5px 8px}
/* Cards/voice keep the native controls inside the available desktop paper. */
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #view{height:100%;min-height:0;display:flex;flex-direction:column;gap:8px}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #view>.bar{margin:0;flex:none}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #view :is(.fc,.hf){min-height:0;flex:1;padding:0;gap:4px}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #view .fcbtns{margin:0;flex:none;gap:8px}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #view :is(.bar,.fcbtns) button{min-height:44px;padding:6px 12px;font-size:16px}
.cn-game[data-cn-kind=review]:not([data-cn-reading]) #view .hfhelp{max-height:80px;overflow:auto;flex:none}
.cn-game[data-cn-kind=review] .cn-desk :is(.tz,.tn,.count,.note){color:var(--ink-soft)}
/* Year 6 receives its original text zoom on html, rather than body. */
.cn-game[data-cn-kind=year6] .g{height:calc(var(--game-viewport-h,100dvh) / var(--cn-root-zoom,1) - var(--game-header-h))}
/* Muted captions remain dark enough on paper; night-shell lavender is for the sky. */
.cn-game .cn-desk small{color:var(--ink-soft)}
/* #510 review: scrollable full labels, with all global actions in Menu. */
.cn-portal #topbar{height:auto;min-height:48px;padding:0!important;display:block}
.cn-portal .cn-tab-rail{position:relative;width:100%;min-width:0}
.cn-portal #topbar .tabs{width:100%;overflow-x:auto;scrollbar-width:thin;gap:8px;padding-right:24px}
.cn-portal #topbar .tab{flex:0 0 auto;width:auto;min-width:max-content;overflow:visible;text-overflow:clip;padding:12px;white-space:nowrap}
.cn-tab-rail.has-more::after{content:"";position:absolute;right:0;top:0;bottom:3px;width:32px;pointer-events:none;background:linear-gradient(90deg,transparent,#15182f)}
.cn-menu-tools{display:flex;flex-wrap:wrap;gap:12px;margin:16px 0;padding-top:16px;border-top:1px solid var(--gold-line)}
.cn-portal .cn-menu-tools .gear{width:auto;flex:none;min-height:44px;border:1px solid var(--gold-line);color:var(--gold);background:transparent;padding:8px 14px}
.cn-portal #panel,.cn-portal #fbPanel{position:fixed;z-index:60;top:80px}.cn-portal #shade{position:fixed;z-index:55}
/* Chinese subject names are learning text; their secondary caption follows MLLang. */
.cn-game .cn-desk .cn-topic-name{display:block!important;font-size:24px;font-weight:700;color:var(--ink);line-height:1.4}
.cn-game .cn-desk .cn-topic-meta{display:block;color:var(--ink-soft);font-size:15px;margin-top:4px;line-height:1.4}
.cn-game .cn-desk button:has(.cn-topic-name){text-align:left;background:#fff;box-shadow:none;overflow:hidden}
.cn-game[data-game-phase=home] .cn-desk :is(#app,#main>.card,#home){justify-content:flex-start;align-content:start}
.cn-game[data-cn-kind=upper] #main:has(.topics){display:block;height:100%}
.cn-game[data-cn-kind=year6][data-game-phase=home] .cn-hud{display:none}
.cn-game[data-cn-kind=year6] .learning-controls .cn-hud{font-size:15px;margin:0;gap:10px;color:var(--ink)}
.cn-game[data-cn-kind=year6] #modes .pick{border:1.5px solid var(--ink);border-radius:14px;background:#fff;box-shadow:none;padding:16px;min-height:80px}
.cn-game[data-cn-kind=year6] #modes .pick::before,.cn-game[data-cn-kind=year6] #modes .pick::after{display:none;content:none}
/* Browse has a paper toolbar: one unframed three-button mode row and dark switches. */
.cn-game[data-cn-kind=review][data-cn-browse-topic] .cn-desk{background:var(--paper);border:1px solid var(--ink);border-radius:18px;padding:56px 20px 20px}
.cn-game[data-cn-kind=review][data-cn-reading] .learning-controls{position:absolute;top:14px;right:24px;margin:0;color:var(--ink)}
.cn-game[data-cn-kind=review][data-cn-reading] .learn-switch{color:var(--ink-soft)}
.cn-game[data-cn-kind=review] #topicBar .seg.modes{display:flex;flex:1 0 100%;width:100%;border:0;border-radius:0;box-shadow:none;background:transparent;padding:0;gap:8px}
.cn-game[data-cn-kind=review] #topicBar .seg.modes button{flex:1;min-width:0;width:auto}
.cn-game[data-cn-kind=detective] #play>p.ask{display:none}
@media(max-width:600px){
 .cn-game .cn-desk .cn-topic-name{font-size:22px}
 .cn-game[data-cn-kind=logic] .options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;width:100%}
 .cn-game[data-cn-kind=logic] .options>button{width:100%;min-width:0;flex:none;padding:8px 4px;min-height:64px;font-size:22px;word-break:normal;overflow-wrap:normal}
 .cn-game[data-cn-kind=logic] .learning-controls{gap:8px;right:18px;left:18px;justify-content:flex-end}
 .cn-game[data-cn-kind=logic] .learning-controls select{max-width:98px;width:98px;font-size:12px;padding:2px 4px;min-height:30px}
 .cn-game[data-cn-kind=review][data-cn-browse-topic] .cn-desk{padding:56px 16px 16px}
 .cn-game[data-cn-kind=review][data-cn-reading] .learning-controls{right:18px;top:12px;gap:12px}
 .cn-game[data-cn-kind=year6] .ghead{gap:8px}.cn-game[data-cn-kind=year6] .gname{white-space:normal;overflow:visible;text-overflow:clip;flex:1}
}
/* Long existing theme collections start at the paper top and stay inside it. */
.cn-game[data-cn-kind=year6] #home{height:100%;min-height:0;overflow:auto;padding-right:4px}
.cn-game[data-cn-kind=year6] #home>h2{display:none}
.cn-game[data-cn-kind=year6] .pick{box-shadow:none!important;background:#fff;border:1.5px solid var(--ink);border-radius:14px}
.cn-game[data-cn-kind=year6] .pick::before,.cn-game[data-cn-kind=year6] .pick::after{display:none;content:none}
.cn-game[data-cn-kind=year6] .special-tools{margin:0;padding:0;border:0;background:transparent;box-shadow:none}
.cn-game[data-cn-kind=year6] .special-tools h3{margin:0 0 6px;font-size:14px;line-height:1.3}
@media(min-width:1024px){
 .cn-game[data-cn-kind=year6] #topics{gap:8px}
 .cn-game[data-cn-kind=year6] #topics .lowgrid{grid-template-columns:repeat(8,minmax(0,1fr));gap:8px}
 .cn-game[data-cn-kind=year6] #topics .pick{padding:6px 8px;min-height:76px}
 .cn-game[data-cn-kind=year6] #topics .cn-topic-name{font-size:22px;line-height:1.2}
 .cn-game[data-cn-kind=year6] #topics .cn-topic-meta{font-size:14px;line-height:1.3}
}
.cn-game[data-cn-kind=review][data-cn-reading] .cn-desk h2{color:var(--ink-soft)}
@media(max-width:600px){
 .cn-game[data-cn-kind=logic] .options .choice-py{max-width:none;width:100%;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}
}
/* The legacy Year6 skin used !important; explicitly retire that card face here. */
.cn-game[data-cn-kind=year6] .pick{border:1.5px solid var(--ink)!important;border-radius:14px!important;background:#fff!important;box-shadow:none!important;transform:none!important}
