/* Normal play fills the available window. The stage is fitted without cropping. */
body.playing{overflow:hidden}
body.playing .topbar{height:54px;min-height:54px;padding:7px 20px;gap:22px;flex-wrap:nowrap}
body.playing main{max-width:none;width:100%;height:calc(100dvh - 54px);padding:12px 20px 14px}
body.playing #gameView{height:100%;min-height:0;display:grid;grid-template-rows:36px 29px auto minmax(0,1fr);gap:8px;max-width:1900px;margin:0 auto}
body.playing #gameView:fullscreen{max-width:none;padding:14px 20px;background:var(--bg);height:100dvh}
body.playing .game-heading{margin:0;align-items:center}
body.playing .game-heading h1{font-size:26px;margin:0}
body.playing .game-heading .eyebrow{display:none}
body.playing .game-tools{gap:9px}
body.playing .game-tools .mini-button{font-size:12px;padding:8px 12px}
body.playing .level-strip{padding:0;font-size:12px;gap:16px;flex-wrap:nowrap;min-width:0}
body.playing .level-strip progress{height:8px;max-width:280px;min-width:40px}
body.playing #comboLabel{margin-left:auto;font-size:12px}
body.playing .next-step{margin:0;min-height:42px;padding:9px 14px;font-size:14px}
body.playing .pixel-layout{min-height:0;height:100%;display:grid;grid-template-columns:minmax(0,1fr) clamp(250px,23vw,330px);gap:16px}
body.playing .cabinet{height:100%;min-height:0;display:grid;grid-template-rows:28px minmax(0,1fr) auto 66px;align-self:stretch;overflow:hidden;border-width:2px;box-shadow:3px 3px 0 #0d1020}
body.playing .cabinet-header{padding:7px 12px;font-size:11px;line-height:12px;border-bottom-width:2px}
.stage-viewport{display:flex;align-items:center;justify-content:center;overflow:hidden;min-height:0;min-width:0;background:#211f32}
/* Playing on a phone: holding a finger down does not select text or open the copy menu, and a double tap does not zoom
   (fields to type in stay normal). */
body.playing{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
body.playing *{touch-action:manipulation}
body.playing :is(input,textarea){-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
body.playing :is(#shopCanvas,#escapeCanvas){display:block;margin:0;object-fit:fill;flex:none;aspect-ratio:8/5;touch-action:none}
body.playing .interaction-bar{min-height:43px;padding:7px 12px;flex-direction:row;gap:12px;border-top-width:2px}
body.playing .interaction-bar>span{font-size:13px;line-height:1.4;flex:1}
body.playing .interaction-bar .button{width:auto;max-width:55%;font-size:12px;padding:9px 15px;min-height:31px;white-space:normal}
body.playing .touch-controls{padding:5px 13px;gap:18px;justify-content:flex-start}
body.playing .touch-controls p{font-size:11px;line-height:1.6}
body.playing .order-panel{display:block;min-height:0;height:100%;align-self:stretch;padding:15px 17px;overflow:auto;scrollbar-width:thin;scrollbar-color:#715970 #292337}
.score-heading,.rules-heading{font:700 11px monospace;letter-spacing:.12em;color:#e9cfb0;margin:0 0 10px}
body.playing .hud{display:grid;grid-template-columns:1fr 1fr;border:0;gap:8px;background:none;margin:0 0 10px;border-radius:0}
body.playing .hud>div{padding:9px 11px;background:#1f1c30;border:1px solid #59465f;display:block}
body.playing .hud span{display:block;font:10px monospace;color:#b9a8bf;margin-bottom:4px}
body.playing .hud strong{display:block;font-size:24px;line-height:1.2;letter-spacing:-.03em;margin:0}
body.playing .hud #score{color:#5ef29a}
body.playing .hud #lives{font-size:23px}
.level-reward{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 0 13px;margin-bottom:15px;border-bottom:1px solid #59465f;font-size:12px;color:#c7b9ca}
.level-reward strong{color:#5ef29a;font-size:18px}
body.playing .order-panel>.eyebrow{font-size:11px;margin:0 0 8px}
body.playing .selected-person{margin:0 0 12px;gap:10px}
body.playing .selected-person canvas{width:48px;height:48px;flex:none}
body.playing .selected-person strong{font-size:15px}
body.playing .selected-person p{font-size:12px;margin:4px 0 0}
body.playing .order-list>div{font-size:13px;padding:8px 0}
body.playing .order-list>div>span{font-size:11px}
body.playing .tray-heading{font-size:11px;margin-top:10px;padding-top:12px}
body.playing .tray-list{font-size:12px;line-height:1.55;margin:9px 0 12px}
body.playing #gameMessage{font-size:12px;padding:10px;margin:0 0 16px}
body.playing .pixel-instructions{display:block;margin:0;padding-left:17px;font-size:12px;line-height:1.5}
body.playing .pixel-instructions li{margin:0 0 6px}
body.playing .order-panel>.fine{display:block;font-size:11px;margin:12px 0;line-height:1.55;color:#b9a8bf}
.sound-samples{border-top:1px solid #59465f;margin-top:14px;padding-top:12px;font-size:12px;color:#d2bfcc}
.sound-samples summary{cursor:pointer}
.sound-samples>div{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:10px}
.sound-samples button{padding:9px 6px;border:1px solid #75586e;background:#3d2c48;font-size:12px}
@media(min-width:1800px){body.playing .order-panel{padding:20px 22px}body.playing .hud strong{font-size:30px}body.playing .pixel-instructions,body.playing .tray-list,body.playing #gameMessage{font-size:14px}}
@media(max-width:1050px) and (min-width:701px){body.playing .pixel-layout{grid-template-columns:minmax(0,1fr) 235px;gap:12px}body.playing main{padding:10px 14px}body.playing .order-panel{padding:13px}body.playing .hud strong{font-size:21px}body.playing .topbar{padding-left:14px;padding-right:14px}}
@media(max-width:700px){body.playing{overflow:auto}body.playing .topbar{height:auto;min-height:48px;padding:6px 12px;gap:8px}body.playing main{height:auto;min-height:calc(100dvh - 48px);padding:10px 12px}body.playing #gameView{height:auto;display:flex;flex-direction:column;gap:9px}body.playing .game-heading h1{font-size:23px}body.playing .game-tools{gap:5px}body.playing .game-tools .mini-button{font-size:10px;padding:7px}body.playing .level-strip{flex-wrap:wrap;gap:8px;font-size:11px}body.playing #comboLabel{font-size:10px}body.playing .next-step{font-size:12px;padding:9px 11px}body.playing .pixel-layout{display:flex;flex-direction:column;height:auto;gap:12px}body.playing .cabinet{height:auto;display:grid;grid-template-rows:28px auto auto 72px}.stage-viewport{height:auto;aspect-ratio:8/5;width:100%}body.playing .interaction-bar>span{font-size:11px}body.playing .interaction-bar .button{font-size:11px;padding:8px}body.playing .order-panel{height:auto;overflow:visible;display:block;padding:16px}body.playing .hud{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}body.playing .hud>div{padding:9px 7px}body.playing .hud strong,body.playing .hud #lives{font-size:20px}body.playing .hud span{font-size:9px}body.playing .topbar .account-button{font-size:11px}body.playing #gameView:fullscreen{overflow:auto;padding:10px 12px;height:100dvh}}
.brand-mark{font-size:21px;letter-spacing:-.06em;padding:0}.playing .brand-mark{font-size:18px;padding:0}.home-subtitle{display:block;font-size:.46em;letter-spacing:-.035em;margin-top:12px;font-weight:500}.daily-copy .challenge-heading{font-size:clamp(1.8rem,2.7vw,2.7rem);line-height:1.12}.challenge-heading>strong{font-size:1.2em}.challenge-heading>span{font-size:.72em;font-weight:400}.challenge-heading>span b{font-weight:700}.challenge-tracker{border:1px solid #6f6750;background:#393628;padding:11px;margin-bottom:15px;display:grid;gap:7px}.challenge-tracker>span{font:10px monospace;color:#5ef29a}.challenge-tracker>strong{font-size:14px;color:#f1e4b5}.challenge-tracker progress{width:100%;height:7px;accent-color:#2fe07a}.sound-samples button:hover{background:#66465e}

/* Touch-first layout: the whole scene and live score stay above the instructions. */
.mobile-hud,.touch-help,#touchPadToggle{display:none}
@media(max-width:700px){
 body.playing main{padding:8px max(8px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
 body.playing .topbar{padding-top:max(6px,env(safe-area-inset-top))}
 body.playing .game-heading{flex-wrap:nowrap;gap:5px;min-width:0}
 body.playing .game-heading h1{font-size:23px;white-space:nowrap}
 body.playing .game-tools{gap:5px;flex-shrink:0}
 body.playing .game-tools button{min-height:44px;min-width:44px;padding:8px;font-size:12px}
 body.playing .next-step{min-height:42px;line-height:1.3;margin:0}
 body.playing .level-strip{padding:0}
 body.playing .mobile-hud{display:grid;grid-template-columns:1.2fr 1.2fr 1fr;gap:6px}
 .mobile-hud>span{background:#292337;border:1px solid #59465f;padding:6px 10px;font:9px monospace;color:#c7b9ca}
 .mobile-hud strong{display:block;margin-top:3px;font:700 19px monospace;color:#5ef29a}
 .mobile-hud #mobileLives{color:#ef82b2}
 body.playing .cabinet{grid-template-rows:24px auto auto auto}
 body.playing .cabinet-header{font-size:10px;padding:6px 8px}
 body.playing .interaction-bar{min-height:60px;padding:6px 9px;gap:8px}
 body.playing .interaction-bar>span{font-size:12px}
 body.playing .interaction-bar .button{min-height:48px;min-width:130px;max-width:60%;font-size:14px;touch-action:manipulation}
 body.playing .touch-controls{flex-wrap:wrap;min-height:64px;padding:8px 10px;gap:10px;justify-content:space-between}
 body.playing .touch-controls .keyboard-help{display:none}
 body.playing .touch-controls .touch-help{display:block;flex:1;margin:0;font-size:11px;line-height:1.5}
 body.playing #touchPadToggle{display:block;min-height:44px;max-width:110px;padding:7px 10px;white-space:normal;font-size:12px;touch-action:manipulation}
 body.playing.show-dpad .touch-help{min-width:100px;max-width:150px}
 body.playing .order-panel .score-heading,body.playing .order-panel .hud{display:none}
 body.playing .order-panel{padding:14px}
 body.playing .order-panel .level-reward{margin-bottom:12px}
 body.playing .topbar .profile{max-width:110px;overflow:hidden}
 body.playing #playerName{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body.playing .topbar .account-button{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body.playing #toast{bottom:max(12px,env(safe-area-inset-bottom));font-size:12px;padding:10px 14px;pointer-events:none}
 .sound-samples button{min-height:44px}
}
@media(pointer:coarse) and (min-width:701px){body.playing .touch-controls .keyboard-help{display:none}body.playing .touch-controls .touch-help{display:block;font-size:12px;margin:0}body.playing .interaction-bar .button{min-height:48px;min-width:150px}}

.open-orders{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:12px}.open-orders button{text-align:left;min-height:48px;padding:8px;border:1px solid #71576d;background:#33283f;border-radius:5px}.open-orders button[aria-pressed=true]{border-color:#2fe07a;background:#554254}.open-orders strong,.open-orders span{display:block;font-size:11px;line-height:1.5}.open-orders span{color:#2fe07a}.station-status-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:16px}.station-status-grid>span{font-size:11px;padding:7px;background:#1f1c30;border:1px solid #4d4256}.station-status-grid b{display:block;margin-top:4px;font-size:10px;color:#ada1b4}.station-status-grid .ready b{color:#d6ec98}.station-status-grid .working b{color:#f0c978}

/* Drawer tabs and play tips: only shown where they apply (tabs in the landscape drawer, tips on touch screens). */
.drawer-tabs,.drawer-toggle,.drawer-close{display:none}
.tab-badge{display:inline-block;min-width:16px;height:16px;margin-left:5px;padding:0 4px;border-radius:8px;background:var(--purple);color:#fff;font:700 10px/16px system-ui;text-align:center;vertical-align:1px}
.play-tip{display:flex;align-items:center;gap:10px;padding:8px 10px;background:#2b2638;border:1px solid #5fb3e0;color:#dff2f7;font-size:12px;line-height:1.4}
.play-tip[hidden]{display:none}.play-tip span{flex:1}.play-tip button{min-width:36px;min-height:36px;border:0;background:none;color:#dff2f7;font-size:20px}
.quick-chat{display:flex;flex-wrap:wrap;gap:5px;margin:6px 0 0}.quick-chat button{padding:6px 8px;border:1px solid #71576d;background:#33283f;color:#f4efe6;font-size:12px;border-radius:14px;min-height:32px}

/* Landscape on phones: the usual for games where you walk around. The stage fills the screen under a thin top bar
   (panel button, clock, what to do now, tools); you tap where to go and the action button floats on the thumb; the side panel
   becomes a drawer with tabs. The canvas also widens (see fitStage) so more of the map shows instead of black bars. */
@media (orientation:landscape) and (max-height:520px){
 body.playing{overflow:hidden}
 body.playing .topbar,body.playing .level-strip,body.playing .cabinet-header,body.playing .play-tip,body.playing .game-heading>div:first-child,
 body.playing .touch-controls .keyboard-help,body.playing .touch-controls .touch-help,body.playing #touchPadToggle,body.playing footer{display:none!important}
 body.playing main{padding:0;height:100dvh;min-height:0;max-width:none}
 body.playing #gameView,body.playing #gameView:fullscreen{display:grid;height:100dvh;max-width:none;margin:0;padding:0;gap:0;
  grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:38px minmax(0,1fr);grid-template-areas:"hud now tools" "stage stage stage";background:#16151c}
 body.playing .mobile-hud:not([hidden]){grid-area:hud;display:flex;gap:4px;align-items:center;padding:3px 6px 3px max(8px,env(safe-area-inset-left))}
 body.playing .mobile-hud>span{padding:2px 7px;font:8px monospace}
 body.playing .mobile-hud strong{margin-top:1px;font-size:13px}
 body.playing .next-step{grid-area:now;margin:3px 6px;min-height:0;padding:4px 10px;font-size:11px;line-height:1.25;gap:6px;overflow:hidden;cursor:pointer}
 body.playing .next-step>span{font-size:8px}
 body.playing .next-step strong{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 
 body.playing .game-heading{grid-area:tools;margin:0;padding:3px max(8px,env(safe-area-inset-right)) 3px 0;align-items:center}
 body.playing .game-tools{gap:5px}
 body.playing .game-tools .mini-button,body.playing .game-tools .text-button{min-height:32px;min-width:36px;padding:4px 8px;font-size:12px}
 body.playing .drawer-toggle{display:inline-flex;align-items:center;justify-content:center;font-size:16px}
 body.playing .pixel-layout{grid-area:stage;display:block;height:auto;min-height:0;position:relative}
 body.playing .cabinet{position:absolute;inset:0;height:auto;display:block;border:0;box-shadow:none;background:#16151c}
 body.playing .stage-viewport{position:absolute;inset:0;height:auto;width:auto;aspect-ratio:auto}
 body.playing .interaction-bar{position:fixed;z-index:5;right:max(12px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom));
  display:flex;flex-direction:column;align-items:flex-end;gap:6px;min-height:0;padding:0;background:none;border:0;max-width:42vw}
 body.playing .interaction-bar>span{flex:none;font-size:11px;line-height:1.3;padding:3px 8px;background:#1b1a2acc;border-radius:4px;text-align:right}
 body.playing .interaction-bar .button{min-width:118px;min-height:54px;max-width:none;font-size:14px;border-radius:27px;box-shadow:0 3px 0 #0008;opacity:.95}
 /* One way to move on a phone: tap where to go (or hold the finger to steer). The pad only if you turn it on. */
 body.playing:not(.show-dpad) .touch-controls{display:none!important}
 body.playing.show-dpad .touch-controls{position:fixed;z-index:5;left:max(12px,env(safe-area-inset-left));bottom:max(12px,env(safe-area-inset-bottom));min-height:0;padding:0;background:none;border:0}
 /* The side panel slides in from the right; only the active tab shows. */
 body.playing .order-panel:not([hidden]){display:block;position:fixed;z-index:8;top:38px;right:0;bottom:0;height:auto;width:min(380px,50vw);
  padding:10px max(14px,env(safe-area-inset-right)) 14px 14px;overflow:auto;background:#241f31;
  border-left:2px solid #59465f;box-shadow:-8px 0 20px #000b;transform:translateX(105%);transition:transform .18s ease-out}
 body.playing.drawer-open .order-panel:not([hidden]){transform:none}
 body.playing.drawer-open .drawer-toggle{background:#2fe07a;color:#0b2e18;border-color:#2fe07a}
 body.playing .drawer-close{display:flex;align-items:center;justify-content:center;gap:4px;margin:0 0 8px auto;min-height:36px;padding:4px 12px;border:1px solid #59465f;border-radius:4px;background:#1b1924;color:#f4efe6;font-size:13px;font-weight:700}
 body.playing .drawer-tabs .drawer-close{flex:none;margin:0}
 body.playing .order-panel .score-heading,body.playing .order-panel .hud{display:block}
 body.playing .order-panel .hud{display:grid}
 body.playing .drawer-tabs{display:flex;gap:4px;position:sticky;top:-10px;z-index:1;margin:-2px -4px 10px;padding:4px;background:#241f31}
 body.playing .drawer-tabs button{flex:1;min-height:36px;padding:4px 6px;border:1px solid #59465f;background:#1b1924;color:#d4c6d8;font-size:12px}
 body.playing .drawer-tabs button[aria-selected=true]{background:#2fe07a;color:#2b2735;border-color:#2fe07a}
 body.playing .escape-panel [data-pane]:not(.active){display:none}
 /* In the team tab the message box goes first, so the keyboard never covers it. */
 body.playing .team-panel:not([hidden]){display:flex;flex-direction:column}
 body.playing .team-panel .chat-form{order:-1;margin-top:0}body.playing .team-panel .quick-chat{order:-1;margin-bottom:8px}
 body.playing .team-chat{max-height:none}
 body.playing #toast{top:44px;bottom:auto;font-size:12px;padding:8px 12px;pointer-events:none}
 dialog{max-height:92dvh;overflow:auto}
}
/* Portrait on a touch screen: the tips (turn the phone; on iPhone, add it to the home screen) sit above the stage. */
@media (orientation:portrait) and (pointer:coarse){body.playing .play-tip:not([hidden]){display:flex}}
.dpad-option{display:none}@media(pointer:coarse){.dpad-option{display:flex;align-items:center;gap:8px;margin:0 0 12px;font-size:13px}}

/* El cajón cerrado no captura toques ni entra en la navegación por teclado. */
@media (orientation:landscape) and (max-height:520px){
 body.playing .order-panel:not([hidden]){visibility:hidden;pointer-events:none}
 body.playing.drawer-open .order-panel:not([hidden]){visibility:visible;pointer-events:auto}
 body.playing.drawer-open .interaction-bar{visibility:hidden;pointer-events:none}
}
body.playing .temp-box{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
body.playing.show-dpad .touch-help{visibility:hidden}
