/* H51: use the available activity bounds instead of subtracting a guessed title height. */
.space-active .activity-bar{display:flex;align-items:center;gap:12px;min-height:52px;margin:0;min-width:0}
.space-active .space-title{font-size:30px!important;line-height:1.2!important;letter-spacing:-.7px;margin:0!important;flex:1;min-width:0;word-break:keep-all}
.space-active .space-actions{display:flex;gap:8px;align-items:center;flex:none}
.space-active .space-actions>button{font-size:20px;line-height:1.2;min-height:48px;padding:8px 12px;border:1px solid #cfc1df;border-radius:14px;background:#fffaf0;color:#60418e;white-space:nowrap}
.space-active .space-original-restart,.space-active .activity-heading>h1,.space-active .activity-heading>.eyebrow,.space-active .activity-heading>.help,.space-active .activity-title .chapter-kicker,.space-active .activity-title>.help{display:none!important}
.space-active.space-expanded .activity-heading,.space-active.space-expanded .activity-title{display:none!important}
.space-active .activity-heading,.space-active .activity-title{padding:0;margin:0!important}
.student .space-active>header>strong,.student .space-active>header>.progress,.game-page .space-active .chapter-progress,.game-page .space-active .brand span{display:none}
.game-page .space-active .brand img{width:40px;height:44px}
.game-page #expedition.space-active{height:100dvh;min-height:0;max-width:none;padding:10px 16px;display:grid;grid-template-rows:auto minmax(0,1fr);gap:8px;box-sizing:border-box}
.game-page .space-active #activity{height:100%!important;min-height:0!important;position:relative;display:grid;grid-template-rows:auto minmax(0,1fr) 76px;gap:8px}
.game-page .space-active #activity[data-step="3"],.game-page .space-active #activity[data-step="4"]{grid-template-rows:auto minmax(0,1fr)}
.game-page .space-expanded #activity{grid-template-rows:minmax(0,1fr) 76px}
.game-page .space-expanded #activity[data-step="3"],.game-page .space-expanded #activity[data-step="4"]{grid-template-rows:minmax(0,1fr)}
.space-active .action-row,.space-active .history-next{min-height:0;margin:0!important;gap:12px}
.space-active .help-panel:not([hidden]){position:absolute;z-index:30;top:0;left:0;right:0;margin:0;box-shadow:0 8px 24px #30244444}
.game-page .space-active .puzzle-layout{width:100%;max-width:none;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);justify-content:center}
.game-page .space-active .puzzle-frame{height:100%;width:auto;max-width:100%;max-height:100%;aspect-ratio:1.5;justify-self:center;align-self:center}
.game-page .space-active .puzzle-frame canvas{margin:0!important}
.game-page .space-active .puzzle-side{display:none}
.game-page .space-active .route-layout{grid-template-columns:minmax(0,1fr) 270px!important;min-height:0;gap:16px;align-items:stretch}
.game-page .space-active .route-layout .geo-map{height:100%;width:100%;aspect-ratio:auto;min-height:0;margin:0}
.game-page .space-active .photo-workspace{grid-template-columns:minmax(0,1fr) 300px;gap:16px;min-height:0;align-items:stretch;justify-content:stretch}
.game-page .space-active .photo-space{width:100%;height:100%;max-height:100%;aspect-ratio:4/3;object-fit:contain}
.game-page .space-active .habitat-layout{grid-template-columns:minmax(0,1fr) 270px;gap:16px;justify-content:stretch;min-height:0}
.game-page .space-active .habitat-scene{max-width:100%;width:100%;height:100%;aspect-ratio:auto;min-height:0}
.game-page .space-active .cleanup-scene{width:100%;height:100%;min-height:0;max-width:none;aspect-ratio:auto;margin:0}
.game-page .space-active .history-meaning-board{grid-template-rows:minmax(0,1fr) auto;gap:8px}
.game-page .space-active .jurisdiction{padding:12px;gap:8px}
.game-page .space-active .jurisdiction-islands{min-height:0;gap:12px}
.game-page .space-active .jurisdiction-islands figure{grid-template-rows:minmax(120px,1fr) auto;padding:4px;gap:6px}
.game-page .space-active .territory-art{min-height:120px}
.student #expedition.space-active{grid-template-rows:auto auto minmax(0,1fr) 76px;gap:8px;padding:10px 16px}
.student #expedition.space-active.space-expanded{grid-template-rows:auto minmax(0,1fr) 76px}
.student .space-active .activity-heading>p{line-height:1.3}
.student .space-active .activity-heading{min-height:0}
.student .space-active .footer{min-height:0;gap:16px}
.student .space-active .footer .primary{min-height:60px}
.student .space-active .workspace{min-height:0}
.space-active .source-thumb{cursor:zoom-in}
.archive-return{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:20px;min-height:0}.archive-return figure{margin:0;min-height:0}.archive-return figure img{height:100%;width:100%;object-fit:contain}.archive-return aside{display:flex;flex-direction:column;justify-content:center;gap:16px;padding:20px;background:#fffaf0;border-radius:20px}.archive-return h2{font-size:30px;margin:0}.archive-return p{font-size:28px;margin:0;line-height:1.4}
.occasion-reader{position:fixed;inset:0;box-sizing:border-box;width:100dvw;height:100dvh;max-width:none;max-height:none;margin:0;border:0;padding:12px 16px;background:#f5effb;color:#302444;display:none;font-family:inherit;grid-template-rows:auto 52px minmax(0,1fr) auto;gap:8px;overflow:hidden}
.occasion-reader[open]{display:grid}.occasion-reader::backdrop{background:#302444aa}
.occasion-reader header{display:flex;align-items:center;gap:16px}.occasion-reader h1{font-size:28px;line-height:1.25;margin:0;flex:1;word-break:keep-all}
.occasion-reader button{font:inherit;font-size:23px;line-height:1.2;min-width:52px;min-height:48px;padding:8px 14px;border:1px solid #bda5d6;border-radius:12px;background:#fffaf0;color:#563b7c;touch-action:manipulation}
.occasion-reader nav{display:flex;gap:10px;align-items:center}.occasion-reader output{font-size:24px;min-width:70px;text-align:center}.occasion-reader nav>span{font-size:22px;margin-left:8px}
.reader-viewport{position:relative;overflow:hidden;min-height:0;background:#e0d3ec;border-radius:14px;touch-action:none;cursor:grab}.reader-viewport:active{cursor:grabbing}
.reader-paper{position:absolute;left:0;top:0;transform-origin:0 0;user-select:none}.reader-paper>img{display:block;width:100%;height:100%;max-width:none;pointer-events:none;user-select:none}
.reader-area{position:absolute;border:2px dashed #8a4ca9;box-sizing:border-box;background:#b88ce133;pointer-events:none}
.reader-mark{position:absolute;width:36px;height:42px;transform:translate(-50%,-50%);border:2px solid #69329a;border-radius:6px;background:#ffffff44;pointer-events:none}
.occasion-reader footer{display:flex;gap:20px;align-items:center;min-height:0}.occasion-reader footer>div{flex:1;min-width:0}.reader-label{font-size:28px}.reader-meaning,.reader-feedback{font-size:26px;line-height:1.3;margin:4px 0 0;word-break:keep-all}.reader-feedback:empty{display:none}.occasion-reader .reader-record{font-size:26px;min-width:224px;background:#7047ad;color:#fff;flex:none}
@media(orientation:portrait){.space-active .space-title{font-size:28px!important}.space-active .space-actions{gap:5px}.space-active .space-actions>button{padding:8px;font-size:19px}.game-page .space-active .route-layout{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr) auto}.game-page .space-active .puzzle-frame{width:100%;height:auto;max-height:100%}.game-page .space-active .photo-workspace{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto}.game-page .space-active .jurisdiction-islands figure{grid-template-columns:40% minmax(0,1fr);grid-template-rows:minmax(120px,1fr)}.occasion-reader footer{align-items:stretch}.reader-meaning{font-size:26px}.occasion-reader .reader-record{min-width:200px}}

/* Feedback is always in the footer, never a layer over the answer surface. */
.space-active .feedback[role=status]{cursor:pointer}
.feedback-dismiss{flex:none;min-height:48px;font-size:20px;padding:8px 12px;background:#fffaf0;color:#60418e;border:1px solid #cfc1df;border-radius:12px}
.occasion-reader .reader-dismiss{font-size:19px;min-height:40px;padding:5px 10px;float:right}
.student dialog.occasion-reader{max-width:none;border:0;border-radius:0;padding:12px 16px}
.game-page .space-active .photo-space{width:auto;height:100%;justify-self:center;align-self:center;min-width:0}
.game-page .space-active .habitat-scene{width:auto;height:100%;aspect-ratio:1.5;justify-self:center}
@media(orientation:portrait){.game-page .space-active .photo-space{width:100%;height:auto}.game-page .space-active .habitat-scene{width:100%;height:auto}}
@media(orientation:landscape){.student .space-active .planner-board .board-content{padding:10px;gap:8px;grid-template-rows:128px minmax(0,1fr) 54px}.student .space-active .planner-board .year-plan-options{gap:8px}.student .space-active .planner-board .year-goals{gap:10px}}
/* Reserve a stable explanation strip so feedback never shifts the source under a finger. */
.occasion-reader footer{height:136px}.occasion-reader footer>div{display:grid;grid-template-columns:minmax(0,1fr) auto;align-content:center;gap:4px 8px}.occasion-reader .reader-label,.occasion-reader .reader-meaning{grid-column:1/-1}.occasion-reader footer:has(.reader-feedback:not(:empty)) .reader-meaning{display:none}.occasion-reader .reader-feedback{margin:0}.occasion-reader .reader-dismiss{grid-column:2;grid-row:2;align-self:center;float:none}

.student .space-active .tools:has(.compact-facts){padding:12px;gap:10px}.student .space-active .compact-facts{gap:6px}.student .space-active .compact-facts p{margin:0;line-height:1.3}.student .space-active .tools:has(.compact-facts) .note-chip{margin:0;padding:10px;line-height:1.3}

.space-active .activity-title h1{display:none}

.game-page .space-active .end-heading h1{display:none}.game-page .space-active .end-heading{margin:0;text-align:left}.game-page .space-active .end-heading .chapter-kicker{display:none}.game-page .space-active .end-heading p{font-size:28px;margin:0;line-height:1.3}
.game-page .space-active #activity[data-step="8"]{grid-template-rows:auto minmax(0,1fr) 64px;gap:10px}
.game-page .space-active .history-notes{display:flex;flex-direction:column;gap:10px;min-height:0;margin:0}.game-page .space-active .history-notes h2{font-size:28px;margin:0}.game-page .space-active .history-grid{flex:1;min-height:0}.game-page .space-active .history-notes>button{align-self:flex-start;font-size:22px;min-height:48px;padding:8px 16px}
.game-page .space-active .notebook-grid{height:100%;min-height:0;grid-template-columns:1fr}.game-page .space-active .notebook-card{display:grid;grid-template-columns:60% minmax(0,1fr);grid-template-rows:auto 1fr;gap:12px 24px;min-height:0;padding:16px}.game-page .space-active .notebook-card>img{grid-row:1/3;width:100%;height:100%;object-fit:contain;min-height:0}.game-page .space-active .notebook-card h2{font-size:30px;margin:0;align-self:end}.game-page .space-active .notebook-card p{font-size:28px;margin:0;line-height:1.4}
.notebook-tabs{display:flex;gap:8px;flex:1}.notebook-tabs button{font-size:22px;min-height:48px;padding:8px 12px;background:#fffaf0;color:#60418e;border:1px solid #bda5d6;border-radius:12px}.notebook-tabs button[aria-pressed=true]{background:#7047ad;color:white}.game-page .space-active #extra{font-size:20px;min-height:48px;padding:8px 12px}
.space-active .space-title br{display:none}
@media(orientation:landscape){.game-page .space-active .history-grid:has(article:nth-child(3)){grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:12px}.game-page .space-active .history-grid:has(article:nth-child(3)) article{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:12px;gap:8px;min-height:0}.game-page .space-active .history-grid:has(article:nth-child(3)) .dokdo-card-art{width:64px;height:64px}.game-page .space-active .history-grid:has(article:nth-child(3)) p{margin:4px 0;font-size:28px;line-height:1.3}.game-page .space-active .history-grid:has(article:nth-child(3)) .history-year{font-size:28px}}
@media(orientation:portrait){.student #expedition.space-active{grid-template-rows:auto auto minmax(0,1fr) auto}.student #expedition.space-active.space-expanded{grid-template-rows:auto minmax(0,1fr) auto}.student .space-active .footer{min-height:76px}}
@media(orientation:portrait){.student .space-active .footer{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;gap:8px;align-items:center}.student .space-active .footer .feedback{grid-column:1;grid-row:1}.student .space-active .footer .feedback-dismiss{grid-column:2;grid-row:1}.student .space-active .footer>.primary,.student .space-active .footer>.secondary{grid-column:1/-1;grid-row:2;min-height:56px}}

.occasion-reader.reader-reference{grid-template-rows:auto 52px minmax(0,1fr)}.occasion-reader.reader-reference footer{display:none}

@media(orientation:portrait){.occasion-reader footer{height:192px}}

.game-page .space-active .scene-fit{display:grid;place-items:center;align-self:stretch;justify-self:stretch;min-width:0;min-height:0;overflow:hidden}

/* H52: empty trays must not reserve most of the board after a sequence is finished. */
.student .space-active .sequence-board .board-content{grid-template-rows:148px minmax(0,1fr);align-content:stretch}
.student .space-active .sequence-board:not(:has(.year-sequence article)) .board-content{grid-template-rows:64px minmax(0,1fr)}
.student .space-active .sequence-board .sequence-start{padding:8px;margin:0;font-size:28px}
.student .space-active .sequence-board:not(:has(.tray>button)) .board-content{display:grid;grid-template-rows:minmax(0,1fr)}
.student .space-active .sequence-board .tray:empty{display:none}
.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence{height:100%;counter-reset:sequence-step;align-items:stretch}
.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence article{position:relative;display:flex!important;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:16px;padding:44px 12px 16px;min-width:0;min-height:0}
.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence article::before{counter-increment:sequence-step;content:counter(sequence-step);position:absolute;top:10px;left:12px;width:36px;height:36px;display:grid;place-items:center;border-radius:50%;background:#7047ad;color:#fff;font-size:24px;font-weight:700}
.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence article>.card-art{width:min(100%,220px);height:auto;aspect-ratio:1;flex-shrink:1;min-height:90px}
.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence .visual-card-copy{flex:none;width:100%}
.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence strong{font-size:28px;line-height:1.35}
@media(orientation:portrait){.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(0,1fr)}.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence article>.card-art{width:150px;max-width:100%;min-height:70px}.student .space-active .sequence-board:not(:has(.tray>button)) .year-sequence article{gap:8px;padding-top:44px}}
.student .space-active .exhibit-board:not(:has(.tray>button)) .board-content{grid-template-rows:minmax(0,1fr) 54px}
.student .space-active .exhibit-board:not(:has(.tray>button)) .year-sequence article{gap:8px;padding:44px 10px 10px}
.student .space-active .exhibit-board:not(:has(.tray>button)) .year-sequence article>.card-art{width:140px;min-height:70px}
.student .space-active .exhibit-board .year-sequence p{font-size:28px;line-height:1.3;margin:6px 0 0}
.student .space-active .exhibit-board .board-content>button{min-height:54px;padding:8px 16px;font-size:28px;justify-self:center}
.student .space-active .proposal-board .board-content{align-content:stretch;grid-template-rows:minmax(0,1fr)}
.student .space-active .proposal-board .board-content>section{display:flex;flex-direction:column;gap:12px;min-height:0}
.student .space-active .proposal-board .choice-grid{flex:1;min-height:0}
.student .space-active .proposal-board .visual-choice{display:flex;flex-direction:column;justify-content:center;gap:16px;text-align:center;min-height:0}
.student .space-active .proposal-board .card-art{width:min(100%,180px);height:auto;aspect-ratio:1;max-height:180px}
.student .space-active .sharing-board .board-content{display:grid;grid-template-rows:auto minmax(0,1fr)}
.student .space-active .sharing-board .people-grid{min-height:0}
.student .space-active .sharing-board .person-card{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:12px;min-height:0}
.student .space-active .sharing-board .person-card>.card-art{width:120px;height:120px}
.student .space-active .sharing-board .visual-card-copy{width:100%;text-align:center}
@media(orientation:portrait){.student .space-active .proposal-board .board-content{grid-template-rows:repeat(2,minmax(0,1fr))}.student .space-active .proposal-board .visual-choice{gap:8px}.student .space-active .sharing-board .person-card{flex-direction:row}.student .space-active .sharing-board .person-card>.card-art{width:100px;height:100px}.student .space-active .sharing-board .visual-card-copy{width:auto;flex:1}.student .space-active .exhibit-board:not(:has(.tray>button)) .year-sequence{grid-template-columns:repeat(3,minmax(0,1fr))}}
.student .space-active .exhibit-board:has(.tray>button) .year-sequence p{display:none}
.student .space-active .sharing-board .board-content{grid-template-columns:minmax(0,1fr);justify-content:stretch}
/* Keep source metadata and the quoted passage inside the source card, not over the question. */
.student .space-active .year-source:has(img){align-content:stretch;grid-template-rows:auto minmax(70px,1fr) auto auto}
.student .space-active .year-source:has(img)>img{height:100%;min-height:0;max-height:none}
.student .space-active .year-source .eyebrow{margin:0;line-height:1.3}
@media(orientation:landscape){.student .space-active .workspace:has(.year-source){grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}}

/* H52: the assembled character and its sound controls use the whole board. */
.student .space-active .hangul-board .board-content{grid-template-columns:minmax(0,1fr);justify-content:stretch}
.student .space-active .hangul-workspace{width:100%;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);align-items:stretch;gap:24px}
.student .space-active .hangul-board .syllable{display:grid;place-items:center;min-height:0;font-size:clamp(150px,19vw,240px);padding:12px}
.student .space-active .hangul-controls{display:grid;grid-template-rows:repeat(3,minmax(0,1fr));gap:10px;min-height:0}
.student .space-active .hangul-controls>div{display:grid;grid-template-rows:auto minmax(0,1fr);gap:4px;min-height:0}
.student .space-active .hangul-controls>div>strong{margin:0;line-height:1.15}
.student .space-active .hangul-controls>div>div{display:flex;gap:10px;min-height:0}
.student .space-active .hangul-controls .choice{flex:1;min-width:0;height:100%;min-height:48px;font-size:36px;padding:4px 8px;justify-content:center;text-align:center}
@media(orientation:portrait){.student .space-active .hangul-workspace{grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr);gap:16px}.student .space-active .hangul-board .syllable{font-size:clamp(150px,24vw,220px)}.student .space-active .hangul-controls .choice{font-size:32px}}
.student .space-active .water-use-board .board-content{grid-template-columns:minmax(0,1fr);justify-content:stretch}
@media(orientation:landscape){.student .space-active .workspace:has(.challenge-tools>.note-chip),.student .space-active .workspace:has(.year-question>.note-chip):not(:has(.year-source)){grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}.student .space-active .challenge-tools .note-chip{line-height:1.35}.student .space-active .challenge-scene:has(+.challenge-tools>.note-chip) figcaption{display:none}}
.student .space-active .archive-open{position:absolute;inset:0;width:100%;height:100%;padding:0;background:transparent;border:0;border-radius:0;cursor:zoom-in}
.occasion-reader .reader-dismiss{min-height:48px}
/* H53: failed bird photos must not grow the grid or reserve an empty footer. */
.game-page .space-active #activity[data-step="5"]{grid-template-rows:auto minmax(0,1fr)}
.game-page .space-expanded #activity[data-step="5"]{grid-template-rows:minmax(0,1fr)}
.game-page .space-active .habitat-layout{grid-template-rows:minmax(0,1fr)}
.game-page .space-active .habitat-layout .viewfinder{display:flex;flex-direction:column;gap:8px;min-height:0;height:100%;padding:16px;box-sizing:border-box;align-self:stretch}
.game-page .space-active .viewfinder .lens{flex:1;min-height:70px;height:auto;max-height:150px}
.game-page .space-active .viewfinder h2{font-size:28px;line-height:1.2;margin:0}
.game-page .space-active .viewfinder .zoom-tools{margin:0;flex:none}
.game-page .space-active .viewfinder .action-row{margin:0!important;gap:8px;flex:none}
.game-page .space-active .viewfinder .feedback,.game-page .space-active .viewfinder #distance-message{font-size:24px;line-height:1.3;margin:0}
.game-page .space-active .viewfinder .capture-tools{margin:0;flex:none}
.game-page .space-active .viewfinder .capture-button{font-size:26px;min-height:60px;padding:10px}
.game-page .space-active .viewfinder:has(.feedback:not(:empty)) #distance-message{display:none}
@media(orientation:portrait){
 .game-page .space-active #activity{grid-template-rows:auto minmax(0,1fr) auto}
 .game-page .space-expanded #activity{grid-template-rows:minmax(0,1fr) auto}
 .game-page .space-active #activity>.action-row{display:flex;flex-direction:column;align-items:stretch;gap:8px}
 .game-page .space-active #activity>.action-row .feedback{margin:0;font-size:26px;line-height:1.3}
 .game-page .space-active #activity>.action-row .feedback:empty{display:none}
 .game-page .space-active #activity>.action-row .primary{align-self:flex-end}
 .game-page .space-active .photo-workspace .field-notes{grid-template-columns:minmax(0,1fr) 230px;grid-template-rows:auto auto auto;gap:8px 16px;padding:16px}
 .game-page .space-active .photo-workspace .field-notes ol{grid-column:1;grid-row:1 / span 3;margin:0}
 .game-page .space-active .photo-workspace .field-notes .stamp{grid-column:1;grid-row:4}
 .game-page .space-active .photo-workspace .field-notes .capture-tools{grid-column:2;grid-row:1;align-self:start}
 .game-page .space-active .photo-workspace .field-notes .action-row{grid-column:2;grid-row:2;align-self:start;margin:0!important}
 .game-page .space-active .photo-workspace .field-notes .feedback{font-size:24px;line-height:1.3;margin:0}
 .game-page .space-active .photo-workspace .beak-detail{grid-column:2;grid-row:3}
 .game-page .space-active #activity[data-step="8"]{grid-template-rows:auto minmax(0,1fr) auto}
 .game-page .space-active #activity[data-step="8"]>.action-row{flex-direction:row;flex-wrap:wrap}
 .game-page .space-active .history-grid:has(article:nth-child(3)){grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(3,minmax(0,1fr))}
 .game-page .space-active .history-grid:has(article:nth-child(3)) article{display:flex;align-items:center;gap:16px;padding:12px;min-height:0}
 .game-page .space-active .history-grid:has(article:nth-child(3)) p{font-size:26px;line-height:1.3;margin:6px 0 0}
 .game-page .space-active .history-grid:has(article:nth-child(3)) .history-year{font-size:28px;line-height:1.2}
}
