/* The full playing surface fits the visible viewport on phones and computers. */
.field-wrap{grid-area:field;min-width:0}.field-wrap #canvas{grid-area:auto}
#goal-details-button{flex:none;min-width:44px;min-height:44px;padding:5px;font-size:19px}
#play-tools-button{display:none}
.goal-details,.queue-details,.play-tools-panel{grid-column:1/-1;width:100%;min-width:0}
.detail-goals{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:8px;margin:12px 0}
.detail-goals .goal-order{min-width:0}
.queue-details p,.goal-details>p{font-size:13px;line-height:1.5}
.queue-detail-pieces{display:grid;grid-template-columns:repeat(auto-fit,minmax(75px,1fr));gap:8px;margin:12px 0}
.queue-detail-pieces>span{border:1px solid var(--line);border-radius:9px;padding:6px;text-align:center;font-size:11px}
.queue-detail-pieces canvas{display:block;width:80px;max-width:100%;height:60px;margin:auto;object-fit:contain}
.queue-detail-pieces small{display:block;font-size:10px}
.play-tools-panel{display:grid;gap:10px;max-width:480px;margin:auto}
.play-tools-panel .action{min-height:48px}.play-tools-panel small{font-size:12px;line-height:1.5}
 body.play-screen{overflow:hidden;overscroll-behavior:none}
 body.play-screen .shell{position:fixed;top:var(--play-viewport-top,0px);left:0;right:0;height:var(--play-viewport-height,100dvh);max-width:none;margin:0;padding:max(3px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left))}
 body.play-screen header,body.play-screen .title-row,body.play-screen .mode-row,body.play-screen .progress-overview,body.play-screen #v5-home,body.play-screen .mission-bar,body.play-screen .layout>aside,body.play-screen .keyboard,body.play-screen #fact-strip,body.play-screen .mobile-links,body.play-screen footer,body.play-screen #ego-home-mobile,body.play-screen #gift-banner{display:none!important}
 body.play-screen .layout{display:block;height:100%;max-width:700px;margin:auto;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
 body.play-screen main{height:100%;min-height:var(--play-min-layout-height,680px);display:flex;flex-direction:column}
 body.play-screen .board{height:100%;flex:1;min-height:0;display:flex;flex-direction:column;border-radius:12px;box-shadow:none}
 body.play-screen .goal-card{display:grid;grid-template-columns:minmax(0,1fr) auto 44px;grid-template-rows:17px 36px;gap:1px 5px;padding:3px 5px;flex:none;min-height:60px}
 body.play-screen .goal-card>div{display:contents}
 body.play-screen #goal-context{grid-column:1;grid-row:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:9px;line-height:17px;letter-spacing:.3px}
 body.play-screen #goal-progress{grid-column:2;grid-row:1;font-size:10px;line-height:17px;margin:0;white-space:nowrap}
 body.play-screen #goal-details-button{grid-column:3;grid-row:1/3;align-self:center;min-height:44px;border:0;background:#fffaf06b}
 body.play-screen .goal-card #goal-preview,body.play-screen #goal-title,body.play-screen #exact-shape-rule,body.play-screen .goal-card .progress{display:none!important}
 body.play-screen #goal-list{display:flex;grid-column:1/3;grid-row:2;gap:3px;min-width:0;overflow-x:auto;margin:0;align-items:stretch}
 body.play-screen .goal-card .goal-order{display:grid;grid-template-columns:12px minmax(0,1fr) 8px;gap:1px;align-items:center;flex:1 1 0;min-width:35px;padding:1px 2px;border:1px solid #b9cbb3;border-radius:6px;min-height:34px}
 body.play-screen .goal-card .goal-order>b{width:12px;height:16px;font-size:8px;border-radius:4px}
 body.play-screen .goal-card .goal-order>canvas{width:100%;height:27px;min-width:0;object-fit:contain}
 body.play-screen .goal-card .goal-order>span{display:none}
 body.play-screen .goal-card .goal-order::after{content:'·';font-size:15px;line-height:1;color:#70644e}
 body.play-screen .goal-card .goal-order[data-goal-action="flush"]::after{content:'↻';font-size:11px;color:#275f47}
 body.play-screen .goal-card .goal-order[data-goal-action="exit"]::after{content:'↗';font-size:11px;color:#784124}
 body.play-screen .goal-card .goal-order.ready::after,body.play-screen .goal-card .goal-order.done::after{content:'✓';font-size:10px;color:#275f47}
 body.play-screen .goal-card .goal-order.lost::after{content:'!';color:#a33b25;font-weight:900}
 body.play-screen .goal-card:has(#goal-list[hidden]) #goal-title{display:block!important;grid-row:2;grid-column:1/3;font-size:12px;line-height:1.3;align-self:center;overflow:hidden}
 body.play-screen .hud{flex:none;min-height:36px;padding:0 6px;gap:16px;align-items:center}
 body.play-screen .hud small{font-size:9px;line-height:1.1}.play-screen .hud strong{font-size:18px;line-height:1.1}
 body.play-screen .hud .inline-next{flex-direction:row;flex-wrap:nowrap;max-width:none;gap:3px}
 body.play-screen .hud .inline-next>small{display:none}
 body.play-screen .hud .inline-next canvas{width:54px;height:25px;margin:0}
 body.play-screen .hud #queue-button{min-height:32px;padding:3px 5px;font-size:10px}
 body.play-screen #queue-strip{display:none!important}
 body.play-screen #merge-chain-button{flex:none;min-height:46px;border-radius:0;border-left:0;border-right:0;background:#f5efdf}
 body.play-screen .play-stage,body.play-screen .play-stage:not(:has(.coach .speaker:not([hidden]))){display:grid;grid-template-columns:44px minmax(58px,1fr) minmax(70px,1.4fr) 44px 44px;grid-template-rows:minmax(var(--play-min-scene-height,400px),1fr) 56px;grid-template-areas:'field field field field field' 'left hold drop water right';gap:4px 3px;flex:1;min-height:calc(var(--play-min-scene-height,400px) + 60px);padding:0 3px;order:1}
 body.play-screen .field-wrap{grid-area:field;min-height:0;min-width:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
 body.play-screen #canvas,body.play-screen:has(#guide:not([hidden])) #canvas{flex:none;max-width:100%;max-height:100%;margin:0;object-fit:contain;aspect-ratio:500/802}
 body.play-screen .rotation-row,body.play-screen .controls{display:contents}
 body.play-screen #rotate-left{grid-area:left}body.play-screen #rotate-right{grid-area:right}
 body.play-screen #hold{grid-area:hold;min-width:0;display:grid;grid-template-columns:28px minmax(0,1fr);grid-template-rows:12px minmax(0,1fr);gap:0 3px;padding:3px;justify-content:center;align-items:center}
 body.play-screen #drop{grid-area:drop}body.play-screen #water{grid-area:water;min-width:0}
 body.play-screen #rotate-left,body.play-screen #rotate-right,body.play-screen .controls .action{min-height:44px;margin:2px 0;padding:3px;border-radius:8px;font-size:11px}
 body.play-screen #rotate-left,body.play-screen #rotate-right{min-width:44px;font-size:23px}
 body.play-screen #hold small{grid-column:1/-1;grid-row:1;font-size:10px;margin:0}body.play-screen #held-name{grid-column:2;grid-row:2;font-size:11px;line-height:1.1;text-align:center;overflow-wrap:anywhere}
 body.play-screen #held-preview{grid-column:1;grid-row:2;width:28px;height:19px;margin:0}
 body.play-screen #held-preview[hidden]+#held-name{grid-column:1/-1}
 body.play-screen #piece-trait{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 body.play-screen .play-stage:has(#water[hidden]){grid-template-columns:44px minmax(58px,1fr) minmax(70px,1.4fr) 0 44px}
 body.play-screen .play-stage:has(#hold[hidden]) #drop{grid-column:2/4}
 body.play-screen .coach{flex:none;padding:0 5px;min-width:0}
 body.play-screen .coach:not(:has(.speaker:not([hidden]))){display:none}
 body.play-screen .coach .speaker{margin:0;gap:5px;padding:2px 0}
 body.play-screen .coach #play-speaker{height:58px;min-height:58px}
 body.play-screen .coach canvas{width:40px;height:48px}
 body.play-screen .coach .speech-bubble{font-size:12px!important;line-height:1.25;padding:6px!important;max-height:95px;overflow:auto}
 body.play-screen #play-quip{max-height:56px}
 body.play-screen .coach .small{min-height:36px;padding:5px 10px}
 body.play-screen .mini-row{order:2;flex:none;min-height:44px;min-width:0;display:flex;justify-content:space-between;align-items:stretch;gap:4px;padding:0}
 body.play-screen #puzzle-actions>#skip-v5,body.play-screen #puzzle-actions>#finish{display:none!important}
 body.play-screen #pause-button,body.play-screen #help-button,body.play-screen #play-tools-button,body.play-screen #blast-v5{display:block;min-height:44px;min-width:44px;margin:0;padding:5px;font-size:11px;flex:1;border-radius:7px}
 body.play-screen #blast-v5{background:#f4dfba;color:#784124;border-color:#c89856}
 body.play-screen #play-tools-button{flex:0 0 44px;font-size:18px}
 body.play-screen .overlay{min-height:0;max-height:100%;justify-content:flex-start;overscroll-behavior:contain;padding:12px;overflow-y:auto}
 body.play-screen .overlay .speaker img{width:66px;height:79px}body.play-screen .overlay .speaker{margin:4px}
 body.play-screen .modal{top:var(--play-viewport-top,0px);bottom:auto;height:var(--play-viewport-height,100dvh);padding:max(8px,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))}
 body.play-screen .modal-inner{max-height:100%;overflow:auto;overscroll-behavior:contain;padding:15px}
 body.play-screen .modal-head{position:sticky;top:-15px;z-index:2;background:var(--cream);padding:8px 0}
 body.play-screen .modal-head .small{min-height:44px;min-width:44px}

/* The sidebar is a normal flow on phones; desktop gives it the whole right column. */
#play-sidebar,#play-sidebar-content{display:contents}
body.play-screen .coach{max-height:min(150px,22dvh);overflow:auto;overscroll-behavior:contain}
body.play-screen .coach #play-speaker{height:auto;min-height:52px}
body.play-screen .coach .speech-bubble{max-height:none;overflow:visible;margin:3px 0}
body.play-screen #merge-chain-strip{order:-1;flex:none;border-bottom:1px solid var(--line);border-radius:10px 10px 0 0}
body.play-screen #merge-chain-button{min-height:32px;width:auto;border:1px solid #b8b995;border-radius:7px;background:#fffaf0}
body.play-screen .play-stage{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
body.play-screen #canvas{touch-action:none}
body.play-screen #held-preview{width:34px;height:25px}
body.play-screen #hold{grid-template-columns:34px minmax(0,1fr)}
body.play-screen .coach:has(#play-action-coach:not([hidden])) #guide{display:none}
/* Two deliberate regions, with all play controls directly below the basin. */
@media(min-width:851px),(min-width:600px) and (min-aspect-ratio:11/10){
 body.play-screen .shell{padding:max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
 body.play-screen .layout{width:100%;max-width:var(--play-layout-width,1000px)}
 body.play-screen .board{display:grid;grid-template-columns:minmax(0,1fr) var(--play-rail-width,300px);grid-template-rows:auto minmax(0,1fr);gap:8px 12px;padding:6px 8px;min-width:0}
 body.play-screen #merge-chain-strip{grid-column:1/-1;grid-row:1;order:0;border:1px solid var(--line);border-radius:10px}
 body.play-screen #play-sidebar{grid-column:2;grid-row:2;min-height:0;min-width:0;display:flex;flex-direction:column;gap:4px;overflow:hidden;padding:0}
 body.play-screen #play-sidebar-content{display:flex;flex:1;min-height:0;min-width:0;flex-direction:column;gap:10px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:0 3px 3px}
 body.play-screen #play-sidebar .mini-row{order:0;border-top:1px solid var(--line);padding-top:2px}
 body.play-screen .goal-card{position:relative;display:block;flex:none;min-height:0;max-height:none;overflow:visible;border:1px solid #bacab4;border-radius:10px;padding:10px}
 body.play-screen .goal-card>div{display:flex;flex-direction:column;gap:0;min-width:0}
 body.play-screen #goal-context{display:block;grid-area:auto;font-size:11px;line-height:1.4;white-space:normal;letter-spacing:.2px;padding-right:40px;overflow:visible}
 body.play-screen .goal-card #goal-title,body.play-screen .goal-card:has(#goal-list[hidden]) #goal-title{display:block!important;grid-area:auto;font-size:15px;line-height:1.3;padding:0;margin:7px 0 9px;white-space:normal;overflow:visible}
 body.play-screen #goal-progress{grid-area:auto;font-size:12px;line-height:1.4;white-space:normal;margin:8px 0 0}
 body.play-screen #goal-details-button{position:absolute;right:5px;top:5px;border:0;background:transparent}
 body.play-screen #goal-list{display:flex;flex-direction:column;grid-area:auto;gap:7px;margin:0;overflow:visible}
 body.play-screen .goal-card .goal-order{display:grid;grid-template-columns:22px 66px minmax(0,1fr);flex:none;min-height:60px;min-width:0;padding:5px;gap:5px}
 body.play-screen .goal-card .goal-order>b{width:22px;height:25px;font-size:12px}
 body.play-screen .goal-card .goal-order>canvas{width:66px;height:44px;object-fit:contain}
 body.play-screen .goal-card .goal-order>span{display:block;margin:0;min-width:0}
 body.play-screen .goal-card .goal-order>span strong{display:none}
 body.play-screen .goal-card .goal-order>span small{font-size:13px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
 body.play-screen .goal-card .goal-order .goal-rule{display:none}
 body.play-screen .goal-card .goal-order::after{display:none}
 body.play-screen .hud{flex:none;min-height:46px;padding:2px 5px;gap:12px;justify-content:space-between}
 body.play-screen .hud strong{font-size:24px}body.play-screen .hud small{font-size:11px}
 body.play-screen .hud .inline-next canvas{width:66px;height:32px}
 body.play-screen .hud #queue-button{min-height:40px;font-size:11px}
 body.play-screen .play-stage,body.play-screen .play-stage:not(:has(.coach .speaker:not([hidden]))){grid-column:1;grid-row:2;display:grid;grid-template-columns:44px minmax(60px,1fr) minmax(90px,1.5fr) 48px 44px;grid-template-rows:minmax(400px,1fr) 56px;grid-template-areas:'field field field field field' 'left hold drop water right';gap:4px;min-height:460px;padding:0;order:0}
 body.play-screen .play-stage:has(#water[hidden]){grid-template-columns:44px minmax(60px,1fr) minmax(90px,1.5fr) 0 44px}
 body.play-screen .field-wrap{align-items:center;grid-area:field}
 body.play-screen .rotation-row,body.play-screen .controls{display:contents}
 body.play-screen .controls .action{font-size:13px;min-height:48px}
 body.play-screen #hold{grid-template-columns:38px minmax(0,1fr)}
 body.play-screen #held-preview{width:38px;height:27px}
 body.play-screen #held-name{font-size:12px;line-height:1.2}
 body.play-screen #piece-trait{position:absolute;clip-path:inset(50%);width:1px;height:1px}
 body.play-screen .coach{flex:none;max-height:none;padding:0;overflow:visible}
 body.play-screen .coach .speaker,body.play-screen .coach #play-speaker{min-height:0;height:auto;display:flex;flex-direction:row;align-items:center;gap:9px}
 body.play-screen .coach canvas{width:85px;height:102px;flex:none}
 body.play-screen .coach .speech-bubble{font-size:13px!important;line-height:1.45;padding:10px!important;flex:1;min-width:0}
 body.play-screen #play-action-coach .hands-on-portrait{flex-basis:60px;width:60px;height:76px}
 body.play-screen #play-action-coach .hands-on-copy>strong{font-size:14px}
 body.play-screen #play-action-coach .hands-on-copy>p{font-size:13px;line-height:1.4}
}
/* Minimum scene sizes are measured with the actual chrome; short windows scroll. */
@media(max-width:400px){
 body.play-screen #hold{display:flex;flex-direction:column;gap:0}
 body.play-screen #hold small{font-size:9px;line-height:11px}
 body.play-screen #held-preview{width:32px;height:16px;flex:none}
 body.play-screen #held-name{font-size:10px;line-height:11px}
}
body.play-screen.large-text .layout{overflow-y:auto}
body.play-screen.large-text main{min-height:var(--play-min-layout-height,720px)}
