/* ============================================================
   CUBICLE CAPER — corporate memo meets CRT arcade
   manila paper · alarm red · fluorescent teal · toner black
   ============================================================ */
:root {
  --manila: #e8dcb8;
  --manila-dim: #d4c79e;
  --paper: #f4ecd4;
  --toner: #1a1812;
  --alarm: #d63422;
  --teal: #2ee6c8;
  --teal-dim: #1a8f7d;
  --coffee: #7a4a21;
  --gold: #e8b830;
  --stress: #e0541e;
  --font-pixel: 'VT323', monospace;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow: hidden; height: 100%; }

body {
  background: #11100c;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(46,230,200,0.06), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.25) 2px 4px);
  font-family: var(--font-mono);
  color: var(--manila);
  min-height: 100vh;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#app { width: 100%; display: flex; justify-content: center; }

#game-frame {
  position: relative;
  width: min(96vw, calc(96vh * 1.625));
  aspect-ratio: 1248 / 768;
  border: 4px solid var(--toner);
  outline: 2px solid var(--teal-dim);
  box-shadow: 0 0 60px rgba(46,230,200,0.18), 0 24px 80px rgba(0,0,0,0.7);
  background: var(--toner);
  overflow: hidden;
}

#game-frame { touch-action: none; }
#swipe-zone {
  display: none;
  position: absolute; inset: 0; z-index: 5;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.touch-device.playing #swipe-zone { display: block; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
body.high-contrast #scanlines { display: none; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

.hud-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 14px; gap: 12px;
}
.hud-panel {
  background: rgba(26,24,18,0.82);
  border: 2px solid var(--manila-dim);
  padding: 8px 12px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.45);
}
body.high-contrast .hud-panel { background: #000; border-color: #fff; }

.hud-stat { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.hud-label {
  font-family: var(--font-pixel); font-size: 18px; width: 72px;
  color: var(--manila); letter-spacing: 1px;
}
.bar {
  width: 150px; height: 12px; background: #2a261c;
  border: 1px solid var(--manila-dim); overflow: hidden;
}
.bar-fill { height: 100%; width: 100%; transition: width 0.15s ease-out; }
.bar-fill.energy { background: linear-gradient(90deg, #2e7d32, #4caf50, #81c784); }
.bar-fill.stress { background: linear-gradient(90deg, #8f3010, #e0541e, #d63422); width: 0%; }
.bar-fill.coffee { background: linear-gradient(90deg, #7a4a21, #b8860b, #e8b830); width: 0%; }

.hud-center { text-align: center; }
#episode-name {
  font-family: var(--font-pixel); font-size: 22px; color: var(--gold); letter-spacing: 2px;
}
#objective-text { font-size: 15px; color: var(--paper); margin-top: 2px; min-height: 18px; }
#timer-text { font-family: var(--font-pixel); font-size: 26px; color: var(--teal); }
#timer-text.urgent { color: var(--alarm); animation: blink 0.5s steps(2) infinite; }

.hud-right { text-align: right; }
#score-text { font-family: var(--font-pixel); font-size: 24px; color: var(--paper); }
#combo-text { font-family: var(--font-pixel); font-size: 28px; color: var(--gold); }
#combo-text.hot { color: var(--alarm); text-shadow: 0 0 8px var(--alarm); }
#powerup-text { font-size: 12px; color: var(--teal); }

#boss-bar-wrap {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  width: 60%; text-align: center;
}
#boss-name {
  font-family: var(--font-pixel); font-size: 24px; color: var(--alarm);
  text-shadow: 2px 2px 0 #000; letter-spacing: 3px;
}
.bar.boss { width: 100%; height: 18px; border: 2px solid var(--alarm); background: #1a0a08; }
.bar-fill.boss { background: linear-gradient(90deg, #7a1408, var(--alarm)); }

#event-banner {
  position: absolute; top: 110px; left: 50%; transform: translateX(-50%);
  background: var(--alarm); color: var(--paper);
  font-family: var(--font-pixel); font-size: 26px; letter-spacing: 2px;
  padding: 6px 28px; border: 3px solid var(--paper);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.5);
  animation: bannerIn 0.3s ease-out;
}
@keyframes bannerIn { from { transform: translateX(-50%) scale(2); opacity: 0; } }

/* ---------------- SCREENS ---------------- */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(46,230,200,0.08), transparent 60%),
    linear-gradient(rgba(12,10,7,0.86), rgba(12,10,7,0.86)),
    url('splash-bg.jpg') center/cover no-repeat #11100c;
  padding: 24px;
}
.hidden { display: none !important; }

.game-title {
  font-family: var(--font-pixel);
  font-size: clamp(60px, 11vw, 130px);
  line-height: 0.85;
  color: var(--manila);
  text-shadow: 5px 5px 0 var(--alarm), 10px 10px 0 rgba(0,0,0,0.6);
  letter-spacing: 6px;
  animation: titleFloat 3s ease-in-out infinite;
}
@keyframes titleFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
body.reduced-motion .game-title { animation: none; }

.subtitle {
  font-family: var(--font-pixel); font-size: clamp(18px, 2.6vw, 30px);
  color: var(--teal); letter-spacing: 8px;
}

.tagline {
  font-size: 15px; color: var(--paper); max-width: 540px;
  background: rgba(46,230,200,0.08);
  border-top: 1px solid var(--teal-dim); border-bottom: 1px solid var(--teal-dim);
  padding: 6px 18px;
}

.goal-card {
  background: var(--paper); color: var(--toner);
  border: 3px solid var(--toner); box-shadow: 8px 8px 0 rgba(0,0,0,0.55);
  padding: 18px 34px; transform: rotate(-1deg);
  max-width: 620px; text-align: left;
}
.goal-heading {
  font-family: var(--font-pixel); font-size: 24px; letter-spacing: 2px;
  border-bottom: 2px dashed var(--toner); margin-bottom: 10px;
}
.goal-list { list-style: none; }
.goal-list li { font-size: 15px; padding: 4px 0; }
.goal-list li::before { content: '☐ '; color: var(--alarm); font-weight: 700; }
.goal-list b { color: var(--alarm); }

.memo-stamp {
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  letter-spacing: 3px; color: var(--toner);
  background: var(--manila); padding: 4px 16px;
  transform: rotate(-2deg);
  border: 2px dashed var(--toner);
}
.memo-stamp.red { background: var(--alarm); color: var(--paper); border-color: var(--paper); }
.memo-stamp.gold { background: var(--gold); border-color: var(--toner); }

.screen-title {
  font-family: var(--font-pixel); font-size: clamp(36px, 6vw, 64px);
  color: var(--paper); letter-spacing: 4px;
  text-shadow: 4px 4px 0 var(--teal-dim);
}

.quote { font-style: italic; color: var(--manila-dim); font-size: 15px; max-width: 560px; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.btn {
  font-family: var(--font-pixel); font-size: 24px; letter-spacing: 2px;
  background: var(--manila); color: var(--toner);
  border: 3px solid var(--toner);
  box-shadow: 5px 5px 0 var(--teal-dim);
  padding: 8px 32px; cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--alarm); background: var(--paper); }
.btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--teal-dim); }
.btn.big { font-size: 32px; background: var(--gold); }

.title-footer {
  display: flex; gap: 32px; font-family: var(--font-pixel); font-size: 18px;
  color: var(--manila-dim);
}
#title-tip { color: var(--teal-dim); animation: blink 2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.settings-row { display: flex; gap: 24px; font-size: 12px; color: var(--manila-dim); }
.settings-row label { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.settings-row input { accent-color: var(--teal); }
.btn.music-btn { font-size: 12px; letter-spacing: 1px; padding: 5px 14px; box-shadow: 3px 3px 0 var(--teal-dim); border-width: 2px; color: var(--toner); }
.btn.music-btn:hover { box-shadow: 4px 4px 0 var(--alarm); }

.howto-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 36px;
  font-size: 14px; text-align: left; max-width: 720px;
  background: rgba(232,220,184,0.07); border: 2px solid var(--manila-dim);
  padding: 22px 28px;
}
.howto-grid b { color: var(--teal); }

.stats-block {
  font-family: var(--font-pixel); font-size: 22px; line-height: 1.5;
  color: var(--paper); background: rgba(0,0,0,0.4);
  border: 2px solid var(--manila-dim); padding: 12px 36px;
  min-width: 340px;
}
.stats-block .stat-val { color: var(--gold); }

.upgrade-label {
  font-family: var(--font-pixel); font-size: 20px; color: var(--teal); letter-spacing: 3px;
}
.upgrade-cards { display: flex; gap: 18px; }
.upgrade-card {
  width: 210px; padding: 18px 14px; cursor: pointer;
  background: var(--manila); color: var(--toner);
  border: 3px solid var(--toner); box-shadow: 6px 6px 0 rgba(0,0,0,0.5);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.12s, box-shadow 0.12s;
  text-align: center;
}
.upgrade-card:nth-child(1) { --tilt: -2deg; }
.upgrade-card:nth-child(3) { --tilt: 2deg; }
.upgrade-card:hover {
  transform: rotate(0deg) translateY(-8px) scale(1.05);
  box-shadow: 8px 10px 0 var(--alarm);
  background: var(--paper);
}
.upgrade-card .up-icon { font-size: 38px; }
.upgrade-card .up-name { font-family: var(--font-pixel); font-size: 22px; margin: 6px 0 4px; }
.upgrade-card .up-desc { font-size: 12px; color: #4a4435; }

/* ---------------- ACHIEVEMENT TOAST ---------------- */
#achievement-toast {
  position: absolute; bottom: 24px; right: 24px; z-index: 40;
  background: var(--gold); color: var(--toner);
  border: 3px solid var(--toner); box-shadow: 5px 5px 0 rgba(0,0,0,0.6);
  padding: 10px 20px; display: flex; flex-direction: column;
  animation: toastIn 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes toastIn { from { transform: translateX(120%); } }
.toast-label { font-size: 10px; letter-spacing: 3px; font-weight: 700; }
#achievement-name { font-family: var(--font-pixel); font-size: 24px; }

body.high-contrast .screen { background: rgba(0,0,0,0.96); }
body.high-contrast .quote { color: #fff; }

/* ---------------- GAME OVER CTA ---------------- */
.gameover-cta {
  font-size: 14px; color: var(--teal); max-width: 480px;
  line-height: 1.6; margin: 4px 0;
}
.gameover-cta a {
  color: var(--gold); text-decoration: underline;
  font-weight: 700; font-size: 16px;
}
.gameover-cta a:hover { color: #fff; }

/* ---------------- HIRE FORM ---------------- */
.hire-form {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--manila); color: var(--toner);
  border: 3px solid var(--toner); box-shadow: 6px 6px 0 rgba(0,0,0,0.5);
  padding: 18px 28px; max-width: 440px; width: 100%;
  transform: rotate(-1deg);
  animation: formSlideIn 0.3s ease-out;
}
@keyframes formSlideIn { from { transform: rotate(-1deg) translateY(20px); opacity: 0; } }

.hire-form-title {
  font-family: var(--font-pixel); font-size: 26px; letter-spacing: 3px;
  border-bottom: 2px dashed var(--toner); padding-bottom: 6px; width: 100%;
}

.form-field {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left;
}
.form-field label {
  font-family: var(--font-pixel); font-size: 16px; letter-spacing: 2px;
}
.form-field input, .form-field textarea {
  font-family: var(--font-mono); font-size: 14px;
  padding: 6px 10px; border: 2px solid var(--toner);
  background: var(--paper); color: var(--toner);
}
.form-field input:focus, .form-field textarea:focus {
  outline: none; border-color: var(--teal-dim);
  box-shadow: 0 0 0 2px rgba(46,230,200,0.3);
}
.form-field textarea { resize: vertical; }

.hire-submit { margin-top: 6px; }

.hire-status {
  font-family: var(--font-pixel); font-size: 18px;
  min-height: 24px; letter-spacing: 1px;
}
.hire-status.success { color: var(--teal); }
.hire-status.error { color: var(--alarm); }

/* ---------------- COPYRIGHT FOOTER ---------------- */
#copyright {
  position: absolute; bottom: 6px; left: 0; right: 0;
  text-align: center; z-index: 60; pointer-events: none;
  font-size: 11px; color: rgba(232,220,184,0.35);
  font-family: var(--font-mono); letter-spacing: 1px;
}

/* ---------------- SPLASH SCREEN ---------------- */
#splash-screen {
  gap: 24px;
  animation: splashFadeIn 0.6s ease-out;
}
@keyframes splashFadeIn { from { opacity: 0; } }

.splash-game-name {
  font-family: var(--font-pixel);
  font-size: clamp(48px, 10vw, 96px);
  color: var(--manila);
  text-shadow: 4px 4px 0 var(--alarm), 8px 8px 0 rgba(0,0,0,0.5);
  letter-spacing: 6px;
}

.splash-sub {
  font-family: var(--font-pixel);
  font-size: clamp(16px, 2.5vw, 24px);
  color: var(--teal); letter-spacing: 4px;
}

.splash-keys {
  display: flex; flex-direction: column; gap: 16px;
  margin-top: 10px;
}

.key-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}

.key-group {
  display: flex; gap: 6px;
}

.key-cap {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 46px; padding: 0 10px;
  font-family: var(--font-pixel); font-size: 24px;
  color: var(--toner);
  background: var(--manila);
  border: 3px solid var(--toner);
  border-bottom-width: 5px;
  box-shadow: 2px 3px 0 rgba(0,0,0,0.4);
  border-radius: 6px;
}
.key-cap.sm { min-width: 36px; height: 36px; font-size: 20px; }
.key-cap.wide { min-width: 120px; }

.key-label {
  font-family: var(--font-pixel); font-size: 20px;
  color: var(--paper); letter-spacing: 2px;
}

.splash-tips {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: 14px;
  color: var(--manila-dim);
  margin-top: 6px;
}

.splash-press {
  font-family: var(--font-pixel); font-size: 26px;
  color: var(--gold);
  letter-spacing: 3px;
  animation: splashPulse 1.2s ease-in-out infinite;
  margin-top: 12px;
}
@keyframes splashPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------- TOUCH DEVICE DETECTION ---------------- */
.touch-device .splash-keys { display: none; }
.touch-device .key-row { display: none; }
.touch-show { display: none; }
.touch-device .touch-show { display: block; }
.splash-touch-tips { display: none; font-family: var(--font-mono); font-size: 16px; color: var(--manila-dim); }
.touch-device .splash-touch-tips { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

/* ---------------- TOUCH CONTROLS ---------------- */
#touch-controls {
  display: none;
  position: absolute; inset: 0; z-index: 20;
  pointer-events: none;
}
.touch-device.playing #touch-controls { display: block; }

.touch-buttons {
  position: absolute; right: 14px; bottom: 16px;
  display: flex; gap: 14px; align-items: flex-end;
  pointer-events: auto;
}
.touch-btn {
  width: 72px; height: 72px; border-radius: 50%;
  border: 3px solid rgba(232,220,184,0.5);
  background: rgba(26,24,18,0.4);
  color: var(--manila);
  font-family: var(--font-pixel); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn.active { background: rgba(232,220,184,0.4); border-color: var(--teal); }

/* DASH button pulses to draw the thumb's attention while playing */
@keyframes dashPulse {
  0%   { box-shadow: 0 0 0 0 rgba(46,230,200,0.55); transform: scale(1); }
  70%  { box-shadow: 0 0 0 12px rgba(46,230,200,0); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(46,230,200,0); transform: scale(1); }
}
.touch-device.playing #touch-dash { animation: dashPulse 1.3s ease-out infinite; }
.touch-device.playing #touch-dash.active { animation: none; }
body.reduced-motion .touch-device.playing #touch-dash { animation: none; }

.touch-pause {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(232,220,184,0.4);
  background: rgba(26,24,18,0.5);
  color: var(--manila); font-family: var(--font-pixel); font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto; touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- PORTRAIT ROTATION OVERLAY ---------------- */
#rotate-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: var(--toner); color: var(--manila);
  flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  font-family: var(--font-pixel); font-size: 24px; text-align: center;
}
/* Portrait play is supported (letterboxed). The overlay above stays inert
   (its base display:none) rather than blocking rotation. */

/* ---------------- IN-APP BROWSER ESCAPE (WhatsApp / Instagram / FB …) ---- */
#webview-escape {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(12,10,7,0.94);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  font-family: var(--font-mono); text-align: center;
  animation: splashFadeIn 0.25s ease-out;
}
.wve-card {
  background: var(--paper); color: var(--toner);
  border: 4px solid var(--toner); box-shadow: 8px 8px 0 var(--teal-dim);
  padding: 22px 24px; max-width: 360px; width: 100%; transform: rotate(-1deg);
}
.wve-title { font-family: var(--font-pixel); font-size: 30px; letter-spacing: 3px; color: var(--alarm); }
.wve-body { font-size: 13px; line-height: 1.55; margin: 10px 0 16px; }
.wve-body b { color: var(--alarm); }
.wve-btn {
  font-family: var(--font-pixel); font-size: 24px; letter-spacing: 2px;
  background: var(--gold); color: var(--toner);
  border: 3px solid var(--toner); box-shadow: 4px 4px 0 var(--teal-dim);
  padding: 10px 24px; cursor: pointer; width: 100%;
  transition: transform 0.08s, box-shadow 0.08s;
}
.wve-btn:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--teal-dim); }
.wve-skip { display: block; margin-top: 12px; font-size: 12px; color: #6a6450; text-decoration: underline; cursor: pointer; }

/* ---------------- RESPONSIVE — SMALL SCREENS ---------------- */

/* Phones / touch / narrow windows: full-bleed frame, letterboxed canvas.
   The canvas keeps its native 1248/768 aspect (no distortion) and is
   centered in the viewport; its element box equals the visible play band,
   so getBoundingClientRect() stays accurate for input mapping. */
@media (pointer: coarse), (max-width: 820px) {
  html, body { height: 100dvh; }
  #app { width: 100%; height: 100dvh; }
  #game-frame {
    width: 100vw;
    height: 100vh;
    height: 100dvh;            /* dvh accounts for mobile browser chrome */
    aspect-ratio: auto;
    border: none;
    outline: none;
    box-shadow: none;
  }
  /* Canvas fills the full-bleed frame. A following camera (game.js) zooms the
     office to fill the screen and reserves a top band for the HUD (plus a
     bottom band for thumb controls in portrait) so stats never cover the
     playfield. Desktop keeps its bordered frame + whole-room view (the JS
     disables the reserves when the screen is large/fine-pointer). */
  #game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

  /* Compact HUD so it fits the reserved top band in both orientations. */
  .hud-top { padding: 4px 8px; gap: 8px; }
  .hud-panel { padding: 4px 10px; box-shadow: 3px 3px 0 rgba(0,0,0,0.45); }
  .hud-stat { margin: 1px 0; gap: 6px; }
  .hud-label { font-size: 13px; width: 50px; letter-spacing: 0.5px; }
  .bar { height: 8px; }
  #episode-name { font-size: 15px; letter-spacing: 1px; }
  #objective-text { font-size: 12px; min-height: 14px; margin-top: 1px; }
  #timer-text { font-size: 20px; }
  #score-text { font-size: 18px; }
  #combo-text { font-size: 20px; }
  #powerup-text { font-size: 11px; }
  #boss-bar-wrap { bottom: 12px; }
}

@media (max-width: 640px) {
  .hud-label { width: 48px; font-size: 14px; }
  .bar { width: 80px; height: 10px; }
  .hud-panel { padding: 4px 6px; }
  .hud-top { padding: 6px 8px; gap: 6px; }
  #episode-name { font-size: 16px; }
  #timer-text { font-size: 20px; }
  #score-text { font-size: 18px; }
  #combo-text { font-size: 22px; }
  #boss-bar-wrap { width: 80%; bottom: 60px; }
  .btn { font-size: 18px; padding: 6px 20px; }
  .btn.big { font-size: 22px; }
  .upgrade-card { width: 140px; padding: 12px 8px; }
  .upgrade-cards { gap: 8px; flex-wrap: wrap; justify-content: center; }
  .stats-block { min-width: 0; width: 90%; font-size: 16px; padding: 10px 16px; }
  .howto-grid { grid-template-columns: 1fr; font-size: 13px; padding: 14px 16px; }
  .memo-stamp { font-size: 10px; padding: 3px 10px; }
  .settings-row { flex-wrap: wrap; gap: 12px; }
  .hire-form { padding: 12px 16px; max-width: 95%; }
  .goal-card { padding: 12px 18px; max-width: 95%; }
  .tagline { font-size: 13px; max-width: 95%; }
}

@media (max-width: 480px) {
  .touch-btn { width: 62px; height: 62px; font-size: 16px; }
  .touch-pause { width: 38px; height: 38px; font-size: 16px; top: 6px; right: 6px; }
  .title-footer { flex-direction: column; gap: 8px; }
}

/* ---- Portrait phone: collapse the HUD to one slim row so it fits a narrow
   top reserve (the 3 panels would otherwise stack to ~200px). Touch controls
   live in the bottom reserve so neither covers the playfield. ---- */
.portrait .hud-top {
  flex-wrap: nowrap;
  align-items: stretch;
  padding: max(6px, env(safe-area-inset-top)) 6px;
  gap: 6px;
}
.portrait .hud-panel { padding: 3px 7px; }
.portrait .hud-left { flex-direction: row; gap: 6px; }
.portrait .hud-left .hud-stat { flex-direction: column; align-items: flex-start; gap: 1px; margin: 0; }
.portrait .hud-left .hud-label { width: auto; font-size: 9px; letter-spacing: 0; line-height: 1; }
.portrait .hud-left .bar { width: 42px; height: 6px; }
.portrait .hud-center { text-align: left; min-width: 0; flex: 1 1 auto; }
.portrait #objective-text { display: none; }
.portrait #episode-name { font-size: 12px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portrait #timer-text { font-size: 18px; }
.portrait .hud-right { text-align: right; }
.portrait #score-text { font-size: 15px; }
.portrait #combo-text { font-size: 18px; }
.portrait #powerup-text { display: none; }
/* keep steering within the bottom reserve — swipe zone covers the play area */
/* lift the boss bar clear of the bottom touch buttons */
.portrait #boss-bar-wrap { bottom: 168px; width: 84%; }
.portrait .touch-buttons { bottom: max(16px, env(safe-area-inset-bottom)); }
