/* 0.9.0: visible-viewport layout. No fixed/sticky ad, no disabled zoom/scroll. */
.game-total{display:none}
/* Remove only our optional caption, never Google's creative or disclosure. */
.ad-zone>.ad-label,.ad-label{display:none!important}
body.viewport-game{--ad-gap:24px;--clue-height:150px;--card-budget:400px;--screen-height:100svh;--task-gap:6px;line-height:1.35}
body.viewport-game .brand,body.viewport-game .lab-note,body.viewport-game .profile-head,body.viewport-game .card>.eyebrow,body.viewport-game .account-actions,body.viewport-game footer{display:none!important}
body.viewport-game .shell{display:flex;flex-direction:column;width:100%;max-width:1120px;min-height:var(--screen-height);margin:0 auto;padding:max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));gap:0}
body.viewport-game .card{flex:1 0 auto;display:flex;flex-direction:column;width:100%;min-height:var(--card-budget);height:auto;padding:10px 12px 8px;border-radius:18px;overflow:visible;box-shadow:none}
body.viewport-game #tablet-app{flex:1;display:flex;flex-direction:column;min-width:0}
body.viewport-game #game-view:not([hidden]){flex:1;display:flex;flex-direction:column;min-width:0}
body.viewport-game .game-toolbar{flex:0 0 auto;display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;gap:7px;margin:0 0 4px;min-height:44px}
body.viewport-game .game-toolbar #back-map{margin:0;width:44px;height:44px;min-height:44px;padding:10px;border-radius:12px}
body.viewport-game .game-toolbar #district-label{margin:0;font-size:18px;line-height:1.18;font-weight:760;letter-spacing:-.015em;overflow-wrap:anywhere}
body.viewport-game .game-total{display:flex;gap:5px;align-items:center;padding:6px 9px;background:#fff5d8;border:1px solid #f6e8b6;border-radius:12px;color:#805907;min-height:44px;max-width:132px;font-variant-numeric:tabular-nums}
body.viewport-game .game-total>span:first-child{font-size:23px;color:#d59713}
body.viewport-game .game-total b{display:block;font-size:20px;line-height:1.1;overflow-wrap:anywhere}
body.viewport-game .game-total small{display:block;font-size:10px;line-height:1.1;color:#755e2b;text-align:center;margin-top:1px}
body.viewport-game .game-stats{flex:0 0 auto;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;max-width:100%;margin:0;padding:0}
body.viewport-game .game-stat{min-height:34px;padding:6px 6px;gap:5px;border-radius:10px}
body.viewport-game .game-stat b{font-size:17px;line-height:1.1}
body.viewport-game .game-stat>.ui-icon{width:17px;height:17px}
body.viewport-game .game-stat .stat-label{display:inline;font-size:10px;line-height:1.1;margin:0 0 0 4px}
body.viewport-game .game-stat>span{display:flex;align-items:center;flex-wrap:wrap;justify-content:center}
body.viewport-game .game-stats #speaking-stat{flex-direction:row;gap:8px}
body.viewport-game .stat-speaking b,body.viewport-game .stat-speaking small{font-size:12px}
body.viewport-game .stat-speaking .ui-icon{width:14px;height:14px}
body.viewport-game #game-notices{flex:0 0 auto;min-width:0}
body.viewport-game #game-notices .save-status{min-height:12px;margin:2px 0 3px;padding:0;background:none;font-size:9px;line-height:1.2;max-width:100%}
body.viewport-game #game-notices .save-status.problem{background:#fff0e8;border:1px solid #dda78e;padding:8px;font-size:13px;text-align:left;line-height:1.4}
body.viewport-game #game-notices #retry-box{margin:4px 0;padding:8px;line-height:1.4}
body.viewport-game #classic-panel:not([hidden]),body.viewport-game #teach-panel:not([hidden]),body.viewport-game #speaking-panel:not([hidden]){display:flex;flex:1 0 auto;flex-direction:column;justify-content:center;min-width:0}
body.viewport-game #question-view:not([hidden]){display:block;min-width:0}
body.viewport-game .game-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;width:100%;max-width:340px;min-width:0;margin:4px auto 6px}
body.viewport-game .game-actions .icon-button{width:100%;min-height:44px;height:44px;padding:5px;border-radius:11px}
body.viewport-game .game-actions .ui-icon{width:23px;height:23px}
body.viewport-game .game-actions .hint-cost{font-size:10px}
body.viewport-game #game-view .clue.has-image{height:var(--clue-height);min-height:0;width:100%;max-width:360px;padding:4px;margin:6px auto;aspect-ratio:auto;border-radius:16px}
body.viewport-game #game-view #clue.has-image{max-width:300px}
body.viewport-game #game-view #speaking-clue.has-image{max-width:330px}
body.viewport-game #game-view .clue.has-image img{height:100%;width:100%;object-fit:contain}
body.viewport-game #game-view .clue.has-text{width:100%;height:auto;min-height:70px;padding:10px 8px;margin:4px auto;border-radius:16px}
body.viewport-game #game-view .meaning{font-size:26px;line-height:1.15}
body.viewport-game #game-view .meaning small{font-size:11px;line-height:1.25;margin-bottom:5px}
body.viewport-game #slots{min-height:36px;margin:7px 0 5px;gap:4px 10px}
body.viewport-game #slots .slot-word{gap:3px}
body.viewport-game #slots button{min-height:36px;height:36px;font-size:20px}
body.viewport-game #letters{margin:6px auto 4px;gap:var(--letter-gap,6px)}
body.viewport-game #letters button{min-height:44px;height:46px;font-size:23px;border-radius:11px}
body.viewport-game #game-view .word-feedback{font-size:12px;line-height:1.35;min-height:0;margin:4px 0 0;overflow-wrap:anywhere}
body.viewport-game #game-view .word-feedback:empty,body.viewport-game #speaking-heard:empty{display:none}
body.viewport-game #game-view .auto-next-note{font-size:10px;line-height:1.2;min-height:0;margin:3px 0 0;text-align:center}
body.viewport-game #teach-question-view:not([hidden]){display:flex;flex-direction:column;min-width:0}
body.viewport-game #teach-question-view .teach-prompt{font-size:11px;line-height:1.2;margin:2px 0 3px;order:-1}
body.viewport-game #teach-panel .teach-options{grid-template-columns:1fr;gap:6px;margin:5px 0 0}
body.viewport-game #teach-panel .teach-choice{min-height:44px;height:auto;padding:8px 10px;font-size:17px;line-height:1.25;border-radius:12px;margin:0}
body.viewport-game #speaking-question-view:not([hidden]){display:flex;flex-direction:column;align-items:stretch;min-width:0}
body.viewport-game #speaking-panel .speaking-word{font-size:12px;line-height:1.1;margin:3px 0 5px}
body.viewport-game #speaking-panel .speaking-word strong{font-size:31px;line-height:1.1;margin-top:2px}
body.viewport-game #speaking-panel .speaking-actions{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:16px;margin:4px 0}
body.viewport-game #speaking-listen{min-height:56px;height:56px;flex:0 0 60px;width:60px;padding:5px;border-radius:16px}
body.viewport-game #speaking-mic{min-height:72px;height:72px;flex:0 0 122px;width:122px;padding:6px;gap:1px;border-radius:22px}
body.viewport-game #speaking-mic .ui-icon{width:28px;height:28px}
body.viewport-game #speaking-mic-label{font-size:15px}
body.viewport-game #speaking-listen .listen-caption{font-size:10px}
body.viewport-game #speaking-panel .speaking-heard{font-size:11px;line-height:1.25;min-height:0;margin:3px 0 0}
body.viewport-game #speaking-panel #speaking-support{font-size:10px;line-height:1.2;margin:3px 0 0}
body.viewport-game .complete{padding:10px 0;line-height:1.3}
body.viewport-game .complete .medal{font-size:42px}
body.viewport-game .complete h2{font-size:23px;margin:5px 0}
body.viewport-game .complete p{font-size:13px;line-height:1.3;margin:5px 0}
body.viewport-game .complete button{min-height:44px;padding:9px;margin-top:7px}
body.viewport-game .celebration{inset:0;border-radius:18px;overflow:hidden}
body.viewport-game .celebration-message{top:85px;padding:9px 15px;font-size:22px;max-width:90%}
/* Non-interactive separation retained; the only ad is an in-flow final region. */
body.viewport-game .ad-zone{position:static;flex:0 0 auto;align-self:center;display:flex;align-items:center;justify-content:center;flex-direction:column;min-height:50px;height:auto;width:100%;margin:var(--ad-gap) auto 0;padding:0 0 max(6px,env(safe-area-inset-bottom));overflow:visible;clear:both}
body.viewport-game .ad-zone[hidden]{display:none!important}
body.viewport-game .ktsv-ad{display:inline-block;width:320px;height:50px;min-height:50px;max-width:none;flex:none}
body.viewport-game .ad-preview-box{width:320px;height:50px;min-height:50px;max-width:100%;padding:4px;margin:0;flex:none}
body.viewport-game .ad-preview-box small{font-size:9px}
body.viewport-game[data-viewport-density="tight"] .game-toolbar #district-label{font-size:17px}
body.viewport-game[data-viewport-density="tight"] #game-view .meaning{font-size:24px}
body.viewport-game[data-viewport-density="tight"] #slots button{height:34px;min-height:34px}
body.viewport-game[data-viewport-density="tight"] #letters button{height:44px;min-height:44px}
/* Larger portrait/tablets: increase the task rather than adding a profile header. */
@media(min-width:600px){
 body.viewport-game .card{padding:12px 18px}
 body.viewport-game .game-toolbar #district-label{font-size:22px}
 body.viewport-game .game-total b{font-size:22px}
 body.viewport-game .game-stat{min-height:36px}
 body.viewport-game #game-view .meaning{font-size:32px}
 body.viewport-game #teach-panel .teach-choice{min-height:52px;font-size:20px}
 body.viewport-game #speaking-panel .speaking-word strong{font-size:40px}
}
/* Wide task board: clue and answers differ by game; ad stays below the entire game. */
@media(min-width:700px), (min-width:560px) and (orientation:landscape){
 body.viewport-game #question-view:not([hidden]){display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:6px 18px;align-items:center}
 body.viewport-game #question-view .game-actions{grid-column:1/-1;grid-row:1;margin-bottom:3px}
 body.viewport-game #clue{grid-column:1;grid-row:2}
 body.viewport-game #classic-answer{grid-column:2;grid-row:2}
 body.viewport-game #teach-question-view:not([hidden]){display:grid;grid-template-columns:1fr 1fr;gap:6px 18px;align-items:center}
 body.viewport-game #teach-question-view .teach-prompt{grid-column:1/-1;grid-row:1;margin:0}
 body.viewport-game #teach-clue{grid-column:1;grid-row:2}
 body.viewport-game #teach-options{grid-column:2;grid-row:2;margin:0}
 body.viewport-game #teach-feedback{grid-column:1/-1;grid-row:3}
 body.viewport-game #speaking-question-view:not([hidden]){display:grid;grid-template-columns:1fr 1fr;gap:4px 18px;align-items:center}
 body.viewport-game #speaking-clue{grid-column:1;grid-row:1/6}
 body.viewport-game #speaking-panel .speaking-word{grid-column:2;grid-row:1}
 body.viewport-game .speaking-actions{grid-column:2;grid-row:2}
 body.viewport-game #speaking-heard{grid-column:2;grid-row:3}
 body.viewport-game #speaking-feedback{grid-column:2;grid-row:4}
 body.viewport-game #speaking-support{grid-column:2;grid-row:5}
 body.viewport-game #speaking-restart{grid-column:2;grid-row:6}
}
@media(max-width:359px){body.viewport-game .game-toolbar{gap:5px}body.viewport-game .game-total{padding:5px}.game-total small{font-size:9px}body.viewport-game .game-total b{font-size:16px}body.viewport-game .game-stat .stat-label{font-size:8px}}
/* A genuine 320 px slot fits edge-to-edge on a 320–339 px screen; never scale it. */
@media(min-width:320px) and (max-width:339px){
 body.playing .ad-zone.ad-live:not([hidden]){display:flex!important;width:320px;max-width:none;align-self:center;margin-left:0;margin-right:0}
 body.playing .ad-zone.ad-live[hidden]{display:none!important}
}

@media(max-width:480px) and (max-height:860px){
 body.viewport-game{--ad-gap:18px}
 body.viewport-game .game-toolbar{margin-bottom:6px}
 body.viewport-game .game-total{min-height:42px;max-width:128px}
 body.viewport-game .game-total b{font-size:19px}
 body.viewport-game #game-view .clue.has-image{margin:8px auto 6px}
}
@media(max-width:420px){
 body.viewport-game .game-toolbar #district-label{font-size:19px}
 body.viewport-game .game-stat b{font-size:18px}
 body.viewport-game .game-stat .stat-label{font-size:10px}
}
