/* Readable desktop typography; phone and landscape-touch layouts keep their sizes. */
@media (min-width:900px) and (pointer:fine) {
  body{font-size:17px}
  #app{max-width:1240px;padding:0 30px}
  .brand{font-size:18px}.brand small{font-size:12px;letter-spacing:2px}
  .edition{font-size:13px;letter-spacing:1px}
  nav button{font-size:14px;min-height:42px;padding:9px 12px}
  #help{font-size:22px;min-width:42px}#full{font-size:25px}
  .heading{padding:20px 0 24px}.heading h1{font-size:44px}
  .eyebrow,.heading .eyebrow{font-size:13px;letter-spacing:1px}
  .heading>p{font-size:15px;line-height:1.6}
  .arena{grid-template-columns:minmax(190px,230px) minmax(272px,320px) minmax(190px,220px);gap:24px}
  .tank-column{width:100%}.tank-label{font-size:13px;letter-spacing:.4px;padding-bottom:12px}
  .tank-bottom{font-size:12px;line-height:1.5;letter-spacing:0}
  .host-panel,.score-panel{padding-top:28px}
  .host-frame .eyebrow{font-size:12px;letter-spacing:0}
  .host-frame h2{font-size:29px}.host-frame>p:last-child{font-size:14px;line-height:1.6}
  .wanted>.eyebrow{font-size:12px}.wanted>div{gap:12px;margin-top:15px}
  .wanted>div>span{font-size:18px}.wanted small{font-size:11px;letter-spacing:0;line-height:1.5}
  .host-footnote{font-size:13px;line-height:1.6}
  .score-panel{gap:10px}.score-panel section{padding:12px 14px}
  .score-card>strong{font-size:40px}.record{font-size:13px}
  .bug-card>strong{font-size:44px;margin:8px 0 12px}
  .bug-card>p:last-child{font-size:12px;letter-spacing:0;line-height:1.5}
  .next-card canvas{width:156px;max-width:100%;margin:auto}
  .chain-card span{font-size:12px;letter-spacing:0}.chain-card strong{font-size:26px}
  .rail-button{font-size:14px;min-height:44px}
  .control-deck{margin-top:18px}.control-deck button{width:76px;height:62px;gap:5px;font-size:26px}
  .control-deck small{font-size:12px;letter-spacing:0}.control-deck .drop{width:86px}
  footer{font-size:12px;line-height:1.8;letter-spacing:0;flex-wrap:wrap}
  .board-overlay{padding:16px}.board-overlay .eyebrow{font-size:12px;letter-spacing:.5px;line-height:1.5;margin:0 0 8px}
  .board-overlay h2{font-size:38px;margin:12px 0}
  .board-overlay p{font-size:15px;line-height:1.5;margin:10px 0}
  .board-overlay label{font-size:13px;margin-top:12px;letter-spacing:.5px}
  .board-overlay select{font-size:15px;min-height:44px;padding:10px}
  .gold,.board-overlay .gold{font-size:14px;letter-spacing:.4px;min-height:46px;margin-top:12px;padding:12px 10px}
  .link-button,.board-overlay .link-button{font-size:13px;letter-spacing:.3px;padding:12px 3px}
  .board-overlay .big-score{font-size:36px}.board-overlay.intro .seal{display:none}
  .modal-panel{width:min(680px,100%);padding:34px}.modal-panel .eyebrow{font-size:13px}
  .modal-panel h2{font-size:36px}.modal-panel h3{font-size:25px}
  .modal-panel p{font-size:17px;line-height:1.7}.modal-panel .gold{max-width:290px}
  .gesture-diagram{font-size:14px;max-width:370px}.gesture-diagram b{font-size:20px}
  .gesture-diagram>div:last-child{font-size:13px}.toast{font-size:15px}
}

/* Size the board from available height, not just desktop width. No clipping:
   very short windows can still scroll to every control. */
@media (min-width:900px) and (pointer:fine) {
  #app{--board-width:clamp(140px,calc((100svh - 294px)*.5074627),320px)}
  .masthead{height:60px}
  .heading{height:80px;padding:10px 0}.heading h1{font-size:38px}
  .heading .eyebrow{font-size:12px;line-height:1.4;margin-bottom:6px}
  .heading>p{font-size:14px}
  .arena{grid-template-columns:230px var(--board-width) 260px;gap:24px}
  .arena>*{min-width:0}
  .tank-column{max-width:none}
  .tank-label{height:24px;padding:0 2px 8px;gap:8px;font-size:12px;letter-spacing:0;white-space:nowrap}
  .tank-label>span:first-child{overflow:hidden;text-overflow:ellipsis;min-width:0}
  .tank-label>span:last-child{flex-shrink:0}
  .tank-bottom{height:24px;padding:4px 2px;font-size:11px;white-space:nowrap;gap:4px}
  #phase-label{overflow:hidden;text-overflow:ellipsis}
  .tank-bottom .signal{flex-shrink:0;margin-right:0}
  .host-panel,.score-panel{padding-top:24px}
  .host-frame{padding:10px 12px}.host-frame .eyebrow{line-height:1.4}
  .host-frame h2{font-size:26px}
  .host-frame canvas{height:100px;object-fit:contain;margin:4px 0}
  .host-frame>p:last-child{font-size:13px;line-height:1.5;min-height:0}
  .wanted{padding:12px 4px 0}.wanted>div{gap:9px;margin-top:8px}
  .wanted>div>span{font-size:16px}.wanted small{font-size:11px;margin-top:2px;line-height:1.3}
  .wanted canvas{flex-shrink:0}.host-footnote{display:none}
  .score-panel{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .score-panel section{min-width:0;padding:10px}
  .score-panel .eyebrow{font-size:12px;letter-spacing:0;line-height:1.5}
  .score-card>strong{font-size:26px;letter-spacing:0}
  .record{font-size:12px;gap:3px;flex-wrap:wrap;margin-top:8px;padding-top:8px}
  .bug-card>strong{font-size:36px;margin:6px 0 8px}
  .bug-card>p:last-child{font-size:12px}
  .next-card canvas{width:104px;max-width:100%}
  .chain-card{flex-direction:column;justify-content:center;gap:8px;text-align:center}
  .chain-card span{font-size:12px}.chain-card strong{font-size:30px}
  .round-dots{grid-column:1/-1}
  .rail-button{font-size:13px;letter-spacing:0;padding:9px 4px;min-height:44px}
  .control-deck{margin:8px auto 4px;gap:16px}
  .control-deck button{width:66px;height:54px;font-size:23px;gap:4px}
  .control-deck .drop{width:76px}
  footer{padding:6px 0;min-height:32px;line-height:20px;font-size:12px;flex-wrap:wrap}
}
@media (min-width:900px) and (max-height:740px) and (pointer:fine) {
  .host-frame canvas{height:64px}.host-frame>p:last-child,.wanted>.eyebrow{display:none}
  .wanted{padding-top:4px}.wanted>div{margin-top:6px}
  .wanted>div>span{font-size:15px}.wanted small{font-size:11px}
  .score-panel{gap:6px}.score-panel section{padding:8px}
  .score-panel .eyebrow{margin-bottom:4px}
  .next-card canvas{width:88px}.bug-card>strong{font-size:32px;margin:4px 0 6px}
  .record{margin-top:6px;padding-top:6px}
}

/* Menus have their own readable width instead of being squeezed into a narrow
   board. Long help dialogs retain scrolling; play itself stays in view. */
.board-overlay{position:fixed;inset:auto;top:50%;left:50%;transform:translate(-50%,-50%);width:min(360px,calc(100% - 32px));max-height:calc(100svh - 32px);padding:20px;background:#122d35f7;box-shadow:0 12px 70px #0008;overscroll-behavior:contain}
.board-overlay .seal{display:none}
.board-overlay .eyebrow{font-size:12px;line-height:1.4;letter-spacing:.5px;margin:0 0 8px}
.board-overlay h2{font-size:34px;margin:10px 0}
.board-overlay p{font-size:15px;line-height:1.5;margin:10px 0}
.board-overlay label{font-size:12px;letter-spacing:.5px;margin:12px 0 6px}
.board-overlay select{font-size:16px;min-height:44px;padding:10px}
.board-overlay .gold{font-size:13px;letter-spacing:.4px;min-height:44px;margin-top:12px;padding:12px 10px}
.board-overlay .link-button{font-size:12px;letter-spacing:.3px;min-height:44px;padding:12px 3px}
.board-overlay .big-score{font-size:32px}

/* Phone text stays legible without widening the puzzle beyond the screen. */
@media (max-width:899px) {
  #app{padding:0 12px}
  .masthead{height:auto;min-height:64px;gap:8px;padding:8px 0;flex-wrap:wrap}
  .brand{font-size:12px;letter-spacing:.5px;gap:6px}.brand small{display:block;font-size:10px;letter-spacing:1px}
  .crest{width:28px;height:34px;font-size:24px}.edition{display:none}
  nav{gap:4px}nav button{font-size:11px;letter-spacing:0;min-height:40px;padding:7px}
  #help{font-size:20px;min-width:36px}#full{font-size:22px}
  .heading{padding:12px 0}.heading .eyebrow{font-size:10px;line-height:1.5;letter-spacing:.5px;margin-bottom:5px}
  .heading h1{font-size:30px}.heading>p{display:none}
  .touch-guide{display:block;font-size:11px;line-height:1.5;letter-spacing:0;min-height:40px;margin:0 0 10px;padding:7px}
  .arena{grid-template-columns:minmax(0,min(300px,calc((100svh - 290px)*.5074627))) 106px;gap:10px;justify-content:center}
  .host-panel{display:none}.tank-column{width:100%;max-width:none}
  .tank-label{font-size:11px;letter-spacing:0;gap:5px;padding:0 1px 8px;white-space:nowrap}
  .tank-label>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis}
  .tank-label>span:last-child{flex-shrink:0}
  .tank-bottom{padding:6px 1px;font-size:10px;line-height:1.5;letter-spacing:0;gap:4px}
  .tank-bottom .signal{flex-shrink:0;margin-right:0}
  .score-panel{padding-top:21px;gap:7px}
  .score-panel section{padding:8px}.score-panel .eyebrow{font-size:11px;line-height:1.4;letter-spacing:0;margin-bottom:5px}
  .score-card>strong{font-size:21px;letter-spacing:0}
  .record{display:flex;flex-wrap:wrap;gap:4px;font-size:10px;margin-top:6px;padding-top:6px}
  .bug-card>strong{font-size:32px;margin:6px 0 8px}
  .bug-card>p:last-child{font-size:10px;line-height:1.4;letter-spacing:0}
  .next-card canvas{width:88px;margin:auto}
  .chain-card{display:flex!important;gap:4px;padding:7px 8px!important}
  .chain-card span{font-size:10px}.chain-card strong{font-size:20px}
  .round-dots{grid-template-columns:repeat(10,1fr);gap:2px}
  .rail-button{font-size:12px;letter-spacing:0;min-height:40px;padding:8px 3px}
  .control-deck{position:static;display:flex;max-width:440px;width:100%;gap:8px;margin:10px auto 4px}
  .control-deck>div{flex:1;gap:4px}.control-deck button,.control-deck .drop{flex:1;min-width:0;width:auto;height:54px;font-size:23px}
  .control-deck small{font-size:10px;letter-spacing:0}
  footer{display:flex;padding:10px 0 16px;font-size:10px;justify-content:center}.keyboard-hint{display:none}
  .board-overlay.intro{padding:20px;inset:auto;top:50%;left:50%}
  .board-overlay.intro .eyebrow{font-size:12px;letter-spacing:.5px}
  .board-overlay.intro h2{font-size:34px}
  .board-overlay.intro p:not(.eyebrow){display:block;font-size:15px}
  .modal-panel{padding:24px 20px}.modal-panel .eyebrow{font-size:11px}
  .modal-panel h2{font-size:28px}.modal-panel h3{font-size:22px}
  .modal-panel p{font-size:16px;line-height:1.65}
  .modal-panel .gold{font-size:13px;min-height:44px}
  .gesture-diagram{font-size:12px;max-width:100%}.gesture-diagram>div:last-child{font-size:11px}
  .touch-feedback{font-size:12px}.touch-drop span{font-size:9px;letter-spacing:0}
}
@media (max-width:899px) and (max-height:740px) and (orientation:portrait) {
  .arena{grid-template-columns:minmax(0,min(300px,calc((100svh - 330px)*.5074627))) 106px}
  .score-panel .record,.score-panel .chain-card{display:none!important}
  .score-panel{gap:6px}.score-panel section{padding:6px 8px}
  .next-card canvas{width:72px}.score-card>strong{font-size:20px}
  footer{display:none}
}
@media (max-width:420px) {.masthead .crest{display:none}.masthead .brand{gap:0}}
/* Landscape phones use the space beside the board for buttons. */
@media (max-width:899px) and (orientation:landscape) and (max-height:550px) {
  #app{--board-width:min(190px,calc((100svh - 132px)*.5074627));--stats-width:clamp(280px,43vw,360px);min-height:360px}
  .masthead{height:44px;min-height:44px;padding:3px 0}.brand small{display:none}
  nav button{min-height:36px;padding:6px;line-height:20px}
  .heading{height:40px;padding:6px 0}.heading .eyebrow{display:none}.heading h1{font-size:25px}
  .touch-guide{position:absolute;top:48px;right:12px;width:53%;max-width:460px;min-height:32px;font-size:11px;margin:0;padding:4px}
  .arena{grid-template-columns:var(--board-width) var(--stats-width);gap:24px}
  .score-panel{grid-template-columns:repeat(3,minmax(0,1fr));padding-top:0;gap:5px}
  .score-card{grid-column:1;grid-row:1}.bug-card{grid-column:2;grid-row:1}.next-card{grid-column:3;grid-row:1}.record{display:none}
  .score-panel .chain-card{grid-column:1;grid-row:2;flex-direction:row}.score-panel .chain-card span{font-size:10px}
  #pause{grid-column:2;grid-row:2}#restart{grid-column:3;grid-row:2}
  .next-card canvas{width:66px;max-width:100%}.score-panel section{padding:5px 8px}
  .round-dots{grid-column:1/-1}.bug-card>strong{font-size:26px;margin:3px 0}
  .control-deck{position:absolute;left:calc(50% + var(--board-width)/2 - var(--stats-width)/2 + 12px);top:max(300px,calc(100svh - 58px));bottom:auto;width:var(--stats-width);max-width:none;display:flex;margin:0}
  .control-deck button,.control-deck .drop{height:44px}.control-deck small{font-size:9px}
  footer{display:none}
}
