/* The sealion activity retains readable evidence and controls on narrow phones. */
@media(max-width:700px){
 .game-page #expedition.space-active:has(#activity[data-step="6"]){height:auto;min-height:100dvh;display:block;overflow:visible;padding:12px 16px}
 .game-page #expedition:has(#activity[data-step="6"]) .activity-bar{display:flex;flex-wrap:wrap;height:auto;margin-bottom:12px}
 .game-page #expedition:has(#activity[data-step="6"]) .space-title{flex:1 1 calc(100% - 52px);font-size:26px!important;line-height:1.2!important}
 .game-page #expedition:has(#activity[data-step="6"]) .space-actions{flex:1 1 100%;justify-content:flex-end}
 .game-page .space-active #activity[data-step="6"]{height:auto!important;display:block;overflow:visible}
 .game-page .space-active #activity[data-step="6"] > *{margin-bottom:12px!important}
 .game-page .space-active #activity[data-step="6"] .sealion-layout{display:flex;flex-direction:column;max-height:none;gap:12px}
 .game-page .space-active #activity[data-step="6"] .sealion-source{height:auto;max-height:none;overflow:visible}
 .game-page .space-active #activity[data-step="6"] .sealion-source img{display:block;width:100%;height:auto;max-height:none}
 .game-page .space-active #activity[data-step="6"] .action-row{display:flex;position:static;flex-direction:column;align-items:stretch;min-height:0}
 .game-page .space-active #activity[data-step="6"] .action-row .primary{width:100%;margin:0}
}

.sealion-source{justify-content:center;gap:10px}.sealion-source img{height:auto;max-height:80%;object-fit:contain}

.sealion-source figcaption,.sealion-evidence p,.sealion-evidence h2,.sealion-answers button{word-break:keep-all;overflow-wrap:normal}

/* v3 phone layouts: allow each activity to flow and keep its observation surface usable. */
@media(max-width:700px){
 .game-page #expedition.space-active:not(.at-welcome){height:auto;min-height:100dvh;display:block;overflow:visible;padding:12px 16px}
 .game-page #expedition.space-active:not(.at-welcome) .activity-bar{display:flex;flex-wrap:wrap;height:auto;margin-bottom:12px}
 .game-page #expedition.space-active:not(.at-welcome) .space-title{flex:1 1 calc(100% - 52px);font-size:26px!important;line-height:1.2!important}
 .game-page #expedition.space-active:not(.at-welcome) .space-actions{flex:1 1 100%;justify-content:flex-end;flex-wrap:wrap}
 .game-page .space-active #activity{height:auto!important;min-height:0!important;display:block;overflow:visible}
 .game-page .space-active #activity > *{margin-bottom:12px!important}
 .game-page .space-active .route-layout,.game-page .space-active .photo-workspace,.game-page .space-active .habitat-layout{grid-template-columns:minmax(0,1fr)!important;gap:12px}
 .game-page .space-active .route-layout .geo-map{height:auto;aspect-ratio:1.6;min-height:0}
 .game-page .space-active .puzzle-layout{grid-template-rows:auto}
 .game-page .space-active .puzzle-frame{height:auto;width:100%;aspect-ratio:1.5}
 .game-page .space-active .photo-space{height:auto;width:100%;max-height:none;aspect-ratio:4/3}
 .game-page .space-active .habitat-scene{height:auto;width:100%;aspect-ratio:1.5;min-height:0}
 .game-page .space-active .viewfinder{padding:16px}
 .game-page .space-active .action-row{position:static;min-height:0}
}
/* Keep the explorer behind numbered choices, and give notebook text room on phones. */
.game-page .habitat-scene .observer{left:18%;top:85%}
.game-page .habitat-scene .vantage{z-index:4}
@media(max-width:700px){
 .game-page .space-active .history-grid article{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:16px}
 .game-page .space-active .history-grid .dokdo-card-art{width:64px;height:64px;flex:none}
 .game-page .space-active .history-year{font-size:26px}
 .game-page .space-active .history-grid p{font-size:23px;line-height:1.4;margin:8px 0}
 .game-page .space-active .notebook-card{display:block}
 .game-page .space-active .notebook-card>img{height:auto;max-height:220px;object-fit:contain}
 .game-page .space-active .notebook-card h2{margin:12px 0 8px}
 .game-page .space-active .notebook-card p{font-size:23px}
 .game-page .space-active #activity[data-step="8"]>.action-row{display:flex;flex-direction:column;align-items:stretch;gap:10px}
 .game-page .space-active .notebook-tabs{display:flex;flex-wrap:wrap}
 .game-page .space-active .notebook-tabs button{flex:1 1 42%}
 .game-page .space-active #activity[data-step="8"]>.action-row>#extra{display:block}
 .game-page .space-active .notebook-tools{flex-wrap:wrap!important;justify-content:flex-start!important}
}
@media(max-width:360px){.game-page .space-active .notebook-tabs button{font-size:18px;padding:8px 6px}}
@media(min-width:701px) and (max-width:900px) and (orientation:portrait){
 .game-page .space-active .history-grid:has(article:nth-child(2):last-child){grid-template-columns:minmax(0,1fr)}
 .game-page .space-active .history-grid:has(article:nth-child(2):last-child) .history-year{font-size:30px}
 .game-page .space-active .habitat-layout .viewfinder{align-self:start}
}
@media(max-width:700px){
 .game-page .space-active .history-conclusion-screen>.history-next{position:static;display:flex;flex-direction:column;align-items:stretch;margin-top:16px!important}
 .game-page .space-active .history-conclusion-screen #history-feedback{width:100%;line-height:1.4}
}
/* On phones, source reading and the three islands need full-width text and controls. */
@media(max-width:700px){
 .game-page .space-active .history-meaning-board{display:block}
 .game-page .space-active .jurisdiction-heading{display:block}
 .game-page .space-active .jurisdiction-heading h2{font-size:25px;line-height:1.3}
 .game-page .space-active .jurisdiction-heading>span{display:block;font-size:20px;margin-top:4px}
 .game-page .space-active .jurisdiction-islands{grid-template-columns:minmax(0,1fr);gap:8px}
 .game-page .space-active .jurisdiction-islands figure{grid-template-columns:100px minmax(0,1fr);grid-template-rows:auto;align-items:center;gap:10px;padding:5px}
 .game-page .space-active .territory-art{height:92px;min-height:0;aspect-ratio:1}
 .game-page .space-active .jurisdiction figcaption span,.game-page .space-active .jurisdiction figcaption p{font-size:19px;line-height:1.3}
 .game-page .space-active .jurisdiction figcaption h3{font-size:24px;line-height:1.25}
 .game-page dialog.occasion-reader[open]{padding:10px;grid-template-rows:auto auto minmax(160px,1fr) auto;gap:8px}
 .game-page .occasion-reader header{gap:8px;align-items:flex-start}
 .game-page .occasion-reader header h1{font-size:21px;line-height:1.3;letter-spacing:-.3px}
 .game-page .occasion-reader button{font-size:19px;min-width:44px;min-height:44px;padding:7px 10px}
 .game-page .occasion-reader nav{gap:6px;min-width:0}
 .game-page .occasion-reader nav>span{display:none}
 .game-page .occasion-reader output{font-size:19px;min-width:48px}
 .game-page .occasion-reader footer{height:auto;display:flex;flex-direction:column;align-items:stretch;gap:8px}
 .game-page .occasion-reader footer>div{display:block;min-width:0}
 .game-page .occasion-reader .reader-label{font-size:20px}
 .game-page .occasion-reader .reader-meaning,.game-page .occasion-reader .reader-feedback{font-size:18px;line-height:1.35;margin:4px 0 0}
 .game-page .occasion-reader .reader-record{min-width:0;width:100%;min-height:48px;font-size:20px}
 .game-page .occasion-reader .reader-dismiss{float:none;margin-top:6px;font-size:17px}
}
@media(prefers-reduced-motion:reduce){
 .game-page .sailor,.game-page .observer,.game-page .lens,.game-page .bird-state,.game-page .observation-photo{transition:none!important}
 .game-page .photo-space.flash{animation:none!important}
}
@media(max-width:700px){.game-page .progress-dialog{word-break:keep-all;overflow-wrap:break-word}}
@media(max-width:700px){.game-page .sealion-source:has(.image-recovery){min-height:220px}}

@media(max-width:700px){
 .game-page .space-active .puzzle-photo-route{display:block}
 .game-page .space-active .puzzle-photo-route figure{width:100%;aspect-ratio:4/3;min-height:0}
 .game-page .space-active .puzzle-photo-route img{position:static;display:block;width:100%;height:100%;object-fit:contain}
 .game-page .space-active .puzzle-photo-route figure:has(.image-recovery){min-height:220px}
 .game-page .space-active .puzzle-photo-choices{flex-wrap:wrap;margin-top:12px}
}
@media(max-width:700px){
 .game-page .recovery-anchor:has(.image-recovery)>img{visibility:hidden}
 .game-page .image-recovery p{word-break:keep-all;font-size:20px;line-height:1.3}
}
@media(min-width:701px) and (max-width:1100px) and (orientation:portrait){
 .game-page .space-active .habitat-layout{align-items:start}
 .game-page .space-active .habitat-layout>.scene-fit{height:auto;width:100%;aspect-ratio:1.5;align-self:start}
 .game-page .space-active .habitat-layout .viewfinder{height:auto;align-self:start}
 .game-page .space-active .history-grid{flex:none;grid-template-columns:minmax(0,1fr);grid-auto-rows:minmax(140px,auto);gap:12px}
 .game-page .space-active .history-grid article{min-height:140px;box-sizing:border-box}
}

/* On tall tablets, evidence cards keep their natural height instead of stretching. */
@media(min-width:701px) and (max-width:1100px) and (orientation:portrait){
 .game-page .space-active #activity[data-step="6"] .sealion-layout{align-items:start}
 .game-page .space-active #activity[data-step="6"] .sealion-source{height:auto;justify-content:flex-start}
 .game-page .space-active #activity[data-step="6"] .sealion-source img{height:auto;max-height:36dvh}
 .game-page .space-active .history-intro-body{align-content:start;align-items:start;grid-template-rows:auto auto}
 .game-page .space-active .history-intro-body .record-preview{height:auto}
 .game-page .space-active .history-intro-body .record-preview img{height:auto;flex:none;max-height:32dvh}
}

/* Keep the threshold together at phone and tablet sizes. */
.game-page .sealion-bars{grid-template-columns:max-content minmax(24px,1fr) max-content;column-gap:8px}
.game-page .sealion-bars>div{display:contents}
.game-page .sealion-bars strong{white-space:nowrap}

/* Short landscape tablets need room for the long second question.  Prevent
   the otherwise empty feedback row from intercepting a choice while keeping
   the continue button interactive when it is shown. */
@media (min-width:701px) and (orientation:landscape) and (max-height:760px){
 .game-page .space-active #activity[data-step="6"] .sealion-layout{grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr)}
 .game-page .space-active #activity[data-step="6"] .sealion-evidence{padding:12px;gap:4px}
 .game-page .space-active #activity[data-step="6"] .sealion-evidence p{margin:2px 0}
 .game-page .space-active #activity[data-step="6"] .sealion-bars{gap:4px}
 .game-page .space-active #activity[data-step="6"] .action-row{pointer-events:none}
 .game-page .space-active #activity[data-step="6"] .action-row button{pointer-events:auto}
}
