/* =====================================================================
   OVERLORD :: tactical defense — stylesheet
   Aesthetic: dark command-center, amber + cyan + signal-red,
   monospace technical with a sliced display face.
   ===================================================================== */

:root {
  --bg-0: #07090d;
  --bg-1: #0d1218;
  --bg-2: #141b25;
  --bg-3: #1c2532;
  --line: #233044;
  --line-bright: #3a5070;

  --ink: #e8eef7;
  --ink-dim: #9aabc1;
  --ink-mute: #5b6e88;

  --amber: #ffb44a;
  --amber-bright: #ffce7a;
  --cyan: #58e0ff;
  --cyan-bright: #a5efff;
  --signal: #ff4858;
  --signal-bright: #ff7a86;
  --green: #6df09a;
  --violet: #c78cff;

  --font-display: 'Syncopate', 'Arial Black', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow-deep: 0 16px 60px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* Prevent the browser from interpreting touch gestures (page scroll, pinch-zoom)
     on the canvas — we handle those ourselves for camera control. */
  touch-action: none;
}

button { font-family: var(--font-mono); cursor: pointer; }
.hidden { display: none !important; }

/* ===================================================================
   Speed button (top-left)
   =================================================================== */

.speed-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 18px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  color: var(--ink);
  box-shadow: var(--shadow-deep);
  position: fixed;
  transition: all 0.12s;
}

.speed-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--green);
  opacity: 0.35;
}

.speed-btn:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.speed-btn--fast::before {
  background: var(--amber);
  opacity: 1;
  animation: pulse-bar 0.6s infinite;
}
.speed-btn--fast {
  border-color: var(--amber);
  box-shadow: var(--shadow-deep), 0 0 16px rgba(255, 180, 74, 0.35);
}

@keyframes pulse-bar {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.speed-btn__label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
}

.speed-btn__value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.speed-btn--fast .speed-btn__value { color: var(--amber-bright); }

/* ===================================================================
   HUD (top-right)
   =================================================================== */

.hud {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.hud-row {
  display: flex;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line-bright);
  padding: 1px;
  box-shadow: var(--shadow-deep);
}

.hud-stat {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  padding: 10px 18px 12px;
  min-width: 110px;
  position: relative;
}

.hud-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--amber);
  opacity: 0.35;
}

.hud-stat:nth-child(2)::before { background: var(--cyan); }
.hud-stat:nth-child(3)::before { background: var(--violet); }

.hud-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  margin-bottom: 4px;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.05em;
  font-feature-settings: 'tnum' 1;
}

.next-wave-btn {
  background: linear-gradient(180deg, var(--green) 0%, #4ec97c 100%);
  color: var(--bg-0);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.15em;
  border: 1px solid #2da45c;
  padding: 12px 20px;
  text-transform: uppercase;
  transition: filter 0.15s;
  box-shadow: var(--shadow-deep);
}
.next-wave-btn:hover { filter: brightness(1.15); }

.next-wave-btn--early {
  background: linear-gradient(180deg, var(--amber) 0%, #d68a32 100%);
  border-color: #b87425;
  box-shadow: var(--shadow-deep), 0 0 16px rgba(255, 180, 74, 0.45);
  animation: early-pulse 1.4s infinite;
}
@keyframes early-pulse {
  0%, 100% { box-shadow: var(--shadow-deep), 0 0 12px rgba(255, 180, 74, 0.35); }
  50% { box-shadow: var(--shadow-deep), 0 0 22px rgba(255, 180, 74, 0.65); }
}

/* ===================================================================
   Wave banner
   =================================================================== */

.wave-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wave-banner.shown {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.banner-inner {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-1) 100%);
  border: 1px solid var(--signal);
  border-left: 4px solid var(--signal);
  border-right: 4px solid var(--signal);
  padding: 14px 36px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  box-shadow: var(--shadow-deep), 0 0 30px rgba(255, 72, 88, 0.25);
}

.banner-prefix {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--signal-bright);
}

.banner-text {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.1em;
}

/* ===================================================================
   Turret bar (bottom-center)
   =================================================================== */

.turret-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  box-shadow: var(--shadow-deep);
  /* On narrow screens, the bar may not fit all 8 buttons — allow horizontal scroll.
     `max-width: calc(100vw - 24px)` keeps the bar within viewport with margin. */
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--line-bright) transparent;
  /* iOS smooth scrolling */
  -webkit-overflow-scrolling: touch;
}
.turret-bar::-webkit-scrollbar { height: 4px; }
.turret-bar::-webkit-scrollbar-track { background: transparent; }
.turret-bar::-webkit-scrollbar-thumb { background: var(--line-bright); }

.turret-btn {
  width: 96px;
  height: 96px;
  flex-shrink: 0; /* prevent buttons from squishing when bar overflows */
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 6px;
  position: relative;
  transition: all 0.12s;
  color: var(--ink);
}

.turret-btn:hover { border-color: var(--cyan); transform: translateY(-2px); }
.turret-btn.selected {
  background: linear-gradient(180deg, #1f3a5c 0%, #16263d 100%);
  border-color: var(--cyan-bright);
  box-shadow: 0 0 0 1px var(--cyan-bright), 0 0 18px rgba(88, 224, 255, 0.4);
}
.turret-btn.unaffordable {
  opacity: 0.5;
  cursor: not-allowed;
}

.turret-btn__lock {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.78);
  color: var(--signal);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.15em;
  align-items: center;
  justify-content: center;
}

.turret-btn--locked {
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.turret-btn--locked .turret-btn__lock {
  display: flex;
}

.turret-btn--locked .turret-btn__icon,
.turret-btn--locked .turret-btn__name,
.turret-btn--locked .turret-btn__cost {
  opacity: 0.3;
}

.turret-btn__icon {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.turret-btn__name {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.1;
}

.turret-btn__cost {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--amber-bright);
  letter-spacing: 0.05em;
}

/* ===================================================================
   Side panels (upgrade + enemy info)
   =================================================================== */

.side-panel {
  position: fixed;
  bottom: 20px;
  width: 380px;
  height: 540px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  box-shadow: var(--shadow-deep);
  display: flex;
  flex-direction: column;
  z-index: 22;
}

.side-panel--right { right: 20px; }

.side-panel__header {
  background: linear-gradient(180deg, #1f2c40 0%, #15202f 100%);
  border-bottom: 1px solid var(--line-bright);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.side-panel__header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; height: 2px; width: 100%;
  background: var(--cyan);
}

.side-panel__header--enemy::before {
  background: var(--signal);
}

.side-panel__header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.side-panel__close {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  width: 28px; height: 28px;
  font-size: 14px;
  transition: all 0.15s;
}
.side-panel__close:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.side-panel__desc {
  padding: 12px 18px;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.5;
  border-bottom: 1px solid var(--line);
}

.side-panel__subtitle {
  padding: 4px 18px 12px;
  font-size: 11px;
  color: var(--signal-bright);
  letter-spacing: 0.15em;
}

/* Upgrade rows */
.upgrade-rows {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upgrade-rows::-webkit-scrollbar { width: 6px; }
.upgrade-rows::-webkit-scrollbar-track { background: var(--bg-1); }
.upgrade-rows::-webkit-scrollbar-thumb { background: var(--line-bright); }

.upgrade-row {
  background: linear-gradient(180deg, var(--bg-3) 0%, #18202c 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 4px 12px;
  font-size: 11px;
}

.upgrade-row--maxed { border-left-color: var(--green); opacity: 0.85; }

.upgrade-row__name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.05em;
}
.upgrade-row__desc {
  color: var(--ink-dim);
  line-height: 1.4;
  grid-column: 1 / 2;
}
.upgrade-row__status {
  color: var(--green);
  font-size: 10px;
  letter-spacing: 0.1em;
  grid-column: 1 / 2;
}
.upgrade-row__btn {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  align-self: stretch;
  background: linear-gradient(180deg, #2a8a4a 0%, #1d6a37 100%);
  border: 1px solid #3aab5c;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  padding: 0 16px;
  min-width: 90px;
  letter-spacing: 0.05em;
  transition: filter 0.12s;
}
.upgrade-row__btn:hover { filter: brightness(1.18); }
.upgrade-row__btn--cant {
  background: linear-gradient(180deg, #5a2a2a 0%, #3a1818 100%);
  border-color: #804040;
  cursor: not-allowed;
  color: var(--ink-mute);
}
.upgrade-row__btn--maxed {
  background: transparent;
  border-color: var(--green);
  color: var(--green);
  cursor: default;
}

/* Enemy stats grid */
.hp-track {
  margin: 12px 18px;
  height: 28px;
  background: #2a1010;
  border: 1px solid var(--signal);
  position: relative;
  overflow: hidden;
}
.hp-track__fill {
  height: 100%;
  background: linear-gradient(180deg, var(--signal-bright) 0%, var(--signal) 100%);
  transition: width 0.15s;
}
.hp-track__text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

.stats-grid {
  margin: 0 18px;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.stats-grid__row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.stats-grid__row:last-child { border-bottom: none; }
.stats-grid__row span:first-child { color: var(--ink-mute); }
.stats-grid__row span:last-child {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
}

.tactical-note {
  margin: 12px 18px 18px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
}
.tactical-note__title {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--amber-bright);
  margin-bottom: 6px;
}
.tactical-note p {
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 1.5;
}

/* ===================================================================
   Comm panel (bottom-left)
   =================================================================== */

.comm-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 380px;
  height: 540px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  box-shadow: var(--shadow-deep);
  display: flex;
  flex-direction: column;
  z-index: 22;
}

.comm-panel__header {
  background: linear-gradient(180deg, #1d2a3e 0%, #131c2a 100%);
  border-bottom: 1px solid var(--line-bright);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  position: relative;
}
.comm-panel__header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; height: 2px; width: 100%;
  background: var(--amber);
}
.comm-panel--alert .comm-panel__header::before { background: var(--signal); }
.comm-panel--victory .comm-panel__header::before { background: var(--green); }

.comm-panel__live {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(109, 240, 154, 0.6); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(109, 240, 154, 0); }
}

.comm-panel__label { flex: 1; }
.comm-panel__signal { color: var(--cyan); font-size: 10px; }

/* Portrait — built procedurally from divs */
.comm-panel__portrait {
  height: 200px;
  margin: 12px;
  background: linear-gradient(180deg, #1a2b48 0%, #0a131f 100%);
  border: 1px solid var(--line-bright);
  position: relative;
  overflow: hidden;
}
.comm-panel--alert .comm-panel__portrait { border-color: var(--signal); }
.comm-panel--victory .comm-panel__portrait { border-color: var(--green); }

/* Scanline */
.comm-panel__portrait::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: scanline 3.5s linear infinite;
  pointer-events: none;
}
@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(200px); }
}

/* Officer info under portrait */
.comm-panel__officer {
  padding: 0 16px 8px;
  text-align: center;
}
.comm-panel__name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.comm-panel__rank {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.15em;
  margin-top: 2px;
}

.comm-panel__message {
  margin: 0 12px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
}

.comm-panel__choices {
  margin: 8px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comm-choice {
  background: linear-gradient(180deg, #1f3552 0%, #142337 100%);
  border: 1px solid var(--line-bright);
  color: var(--ink);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  transition: all 0.12s;
}
.comm-choice:hover { border-color: var(--cyan); color: var(--cyan-bright); }

.comm-panel__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  cursor: pointer;
}
.comm-toggle input { display: none; }
.comm-toggle__box {
  width: 18px; height: 18px;
  border: 1px solid var(--line-bright);
  background: var(--bg-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--green);
}
.comm-toggle input:checked + .comm-toggle__box::after { content: '✓'; }

.comm-panel__close {
  background: linear-gradient(180deg, #5a2a2a 0%, #3a1818 100%);
  color: var(--ink);
  border: 1px solid #804040;
  padding: 6px 14px;
  font-size: 11px;
  letter-spacing: 0.15em;
  font-weight: 700;
}
.comm-panel__close:hover { filter: brightness(1.2); }

/* Comm tab (minimized) */
.comm-tab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 200px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-deep);
  z-index: 22;
}
.comm-tab__notif {
  width: 10px; height: 10px;
  background: var(--signal);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

/* ===================================================================
   Overlays (start menu, level select, end screen)
   =================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--bg-0) 0%, #0a1118 50%, var(--bg-0) 100%);
  /* `display: grid` with `align-content: safe center` is the magic combo:
     it vertically centers content that fits the viewport, but when content
     overflows, it falls back to top-alignment instead of stranding the top
     of the content above the viewport (which is what `flex justify-content: center`
     does, breaking scrollability). */
  display: grid;
  align-content: safe center;
  justify-items: center;
  padding: clamp(20px, 4vh, 60px) 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

/* Level select: use simple block layout for maximum mobile scroll reliability.
   The grid + safe-center pattern on .overlay caused scroll-position issues on
   some mobile browsers when transitioning from display:none back to visible.
   Block layout avoids those edge cases entirely. */
#level-select {
  display: block;
  /* Override the centering — content always tops out and scrolls naturally */
}
#level-select > * {
  /* Make sure each direct child is laid out as a block from the top */
  margin-left: auto;
  margin-right: auto;
}

.overlay__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(58, 80, 112, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 80, 112, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 100%);
}

/* Start menu */
.start-menu__inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: clamp(20px, 4vw, 40px);
  max-width: 700px;
  margin: 0 auto;
}
.start-menu__brand-line {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--amber);
  margin: 8px 0;
}
.start-menu__title {
  font-family: var(--font-display);
  /* Scale fluidly: 48px on tiny phones up to 96px on desktop, never overflowing.
     Uses vw so the title scales with viewport width and never wraps. */
  font-size: clamp(40px, 14vw, 96px);
  font-weight: 700;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--ink) 0%, var(--cyan) 50%, #2a608a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Fallback color in case background-clip text isn't supported — at least
     the letters are still readable rather than invisible. */
  color: var(--cyan);
  margin: 12px 0;
  text-shadow: 0 0 60px rgba(88, 224, 255, 0.3);
  position: relative;
  /* Keep the title intrinsic to its content so the gradient and the ::after
     ghost-text both span the full rendered text width. */
  display: inline-block;
  white-space: nowrap;
  /* Hard upper width on the title to prevent it ever exceeding viewport */
  max-width: 100%;
}
.start-menu__title::after {
  content: 'OVERLORD';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 180, 74, 0.2);
  letter-spacing: inherit;
  white-space: inherit;
}
.start-menu__tagline {
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
  line-height: 1.7;
  margin: 30px 0 40px;
}
.start-menu__footer {
  margin-top: 30px;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--ink-mute);
}

.big-btn {
  background: linear-gradient(180deg, var(--amber) 0%, #d68a32 100%);
  color: var(--bg-0);
  border: 1px solid #b87425;
  padding: 18px 56px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.25em;
  transition: all 0.15s;
  box-shadow: 0 6px 30px rgba(255, 180, 74, 0.3);
}
.big-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(255, 180, 74, 0.4);
}

.big-btn--ghost {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  box-shadow: none;
}
.big-btn--ghost:hover {
  background: rgba(88, 224, 255, 0.08);
  box-shadow: 0 0 30px rgba(88, 224, 255, 0.2);
}

/* Level select */
.back-btn {
  position: fixed;
  top: 24px; left: 24px;
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.2em;
  z-index: 110;
}
.back-btn:hover { border-color: var(--cyan); color: var(--cyan); }

.level-select__header {
  position: relative; z-index: 1;
  text-align: center;
  margin: 0 auto clamp(20px, 4vw, 36px);
  padding: 0 clamp(16px, 4vw, 40px);
  /* Leave room for the back button on mobile so the title doesn't overlap */
  padding-top: clamp(56px, 8vh, 80px);
  max-width: 1240px;
  width: 100%;
  box-sizing: border-box;
}
.level-select__sub {
  font-size: clamp(10px, 1.6vw, 11px);
  letter-spacing: 0.4em;
  color: var(--amber);
  margin-bottom: 6px;
}
.level-select__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--ink);
}

.level-grid {
  position: relative; z-index: 1;
  display: grid;
  /* On phones, fall back to single column with smaller minmax */
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: clamp(12px, 2vw, 18px);
  padding: 0 clamp(16px, 4vw, 60px) clamp(20px, 4vw, 40px);
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.level-card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.18s;
  position: relative;
}
.level-card:hover { border-color: var(--cyan); transform: translateY(-3px); }
.level-card--locked {
  border-color: var(--bg-3);
  background: linear-gradient(180deg, #150f0f 0%, #0d0808 100%);
  cursor: not-allowed;
}
.level-card--locked:hover { transform: none; border-color: var(--bg-3); }
.level-card--complete {
  border-left: 3px solid var(--green);
}

.level-card__index {
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.15em;
}

.level-card__thumb {
  height: clamp(80px, 14vw, 130px);
  background: linear-gradient(135deg, #1a2540 0%, #0a1018 100%);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 4vw, 36px);
  color: rgba(255, 255, 255, 0.08);
  letter-spacing: 0.1em;
  position: relative;
  overflow: hidden;
}
.level-card__thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 8px, transparent 8px 16px);
  pointer-events: none;
}

.level-card__name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.level-card__map {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--cyan);
}

.level-card__desc {
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 1.5;
  flex: 1;
}

.level-card__btn {
  background: linear-gradient(180deg, var(--amber) 0%, #d68a32 100%);
  color: var(--bg-0);
  border: none;
  padding: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
}
.level-card__btn:hover { filter: brightness(1.15); }

.level-card__locked {
  text-align: center;
  padding: 12px 0;
  color: var(--signal);
  font-size: 11px;
  letter-spacing: 0.3em;
  border-top: 1px dashed var(--line-bright);
  margin-top: auto;
}

/* End screen */
.end-screen__inner {
  position: relative; z-index: 1;
  text-align: center;
  padding: clamp(20px, 4vw, 40px);
  max-width: 700px;
  margin: 0 auto;
}
.end-screen__sub {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--amber);
  margin-bottom: 14px;
}
.end-screen__title {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 24px;
}
.end-screen__title.victory { color: var(--green); text-shadow: 0 0 40px rgba(109, 240, 154, 0.5); }
.end-screen__title.defeat { color: var(--signal); text-shadow: 0 0 40px rgba(255, 72, 88, 0.5); }
.end-screen__msg {
  font-size: 14px;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 40px;
}
.end-screen__buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* ===================================================================
   Mission complete announcement (between wave-clear and post-cinematic)
   =================================================================== */

.mission-complete {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 12, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: mc-fadein 0.35s ease-out;
}
@keyframes mc-fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mission-complete__inner {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--green);
  border-top: 3px solid var(--green);
  padding: clamp(24px, 4vw, 40px) clamp(28px, 5vw, 56px);
  text-align: center;
  max-width: min(560px, 92vw);
  box-shadow: var(--shadow-deep), 0 0 60px rgba(109, 240, 154, 0.25);
  animation: mc-slide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mc-slide {
  from { transform: translateY(40px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.mission-complete__sub {
  font-size: clamp(10px, 1.6vw, 12px);
  letter-spacing: 0.3em;
  color: var(--green);
  margin-bottom: clamp(8px, 1.5vw, 14px);
}

.mission-complete__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-shadow: 0 0 30px rgba(109, 240, 154, 0.4);
  margin-bottom: clamp(14px, 2.5vw, 22px);
}

.mission-complete__msg {
  font-size: clamp(12px, 1.7vw, 14px);
  color: var(--ink-dim);
  line-height: 1.6;
  letter-spacing: 0.04em;
  margin-bottom: clamp(20px, 3vw, 32px);
}

.mission-complete__btn {
  background: linear-gradient(180deg, var(--green) 0%, #4ec97c 100%);
  color: var(--bg-0);
  border: 1px solid #2da45c;
  padding: clamp(12px, 2vw, 16px) clamp(28px, 5vw, 48px);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(13px, 2vw, 16px);
  letter-spacing: 0.22em;
  transition: all 0.15s;
  box-shadow: 0 4px 18px rgba(109, 240, 154, 0.3);
}
.mission-complete__btn:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(109, 240, 154, 0.45);
}

/* ===================================================================
   Cinematics — fully responsive, scales from mobile portrait to ultrawide.
   Typography uses clamp() so it grows smoothly with viewport size.
   =================================================================== */

.cinematic {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, #0c1620 0%, #050709 80%, #000 100%);
}

.cinematic::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(88, 224, 255, 0.025) 2px,
    rgba(88, 224, 255, 0.025) 3px
  );
  pointer-events: none;
}

.cinematic__viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0; /* allow flex shrinking */
}

.cinematic-illustration {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cinematic-illustration svg {
  width: 100%;
  height: 100%;
  /* meet rather than slice so corner HUD readouts stay visible */
}

/* Terminal-style speaker for terminal/scientist beats.
   On desktop: positioned bottom-left of viewport, anchored.
   On mobile: stretches full width above the bottom panel. */
.cinematic-speaker {
  position: absolute;
  left: 4%;
  right: auto;
  bottom: 4%;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  padding: clamp(12px, 2vw, 18px);
  box-shadow: var(--shadow-deep);
  max-width: min(540px, 92vw);
  box-sizing: border-box;
}
.cinematic-speaker::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 2px; width: 100%;
  background: var(--amber);
}
.cinematic-speaker--scientist::before {
  background: var(--cyan);
}

.cinematic-portrait {
  width: clamp(70px, 12vw, 110px);
  aspect-ratio: 11 / 13;
  height: auto;
  background: linear-gradient(180deg, #1a2b48 0%, #0a131f 100%);
  border: 1px solid var(--line-bright);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.cinematic-portrait::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: scanline-cine 3.5s linear infinite;
}
@keyframes scanline-cine {
  0% { transform: translateY(0); }
  100% { transform: translateY(150px); }
}

.cinematic-speaker__info {
  flex: 1;
  min-width: 0; /* allow truncation if needed */
}
.cinematic-speaker__name {
  font-family: var(--font-display);
  font-size: clamp(12px, 2vw, 16px);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  word-break: break-word;
}
.cinematic-speaker__role {
  font-size: clamp(9px, 1.4vw, 10px);
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  margin-top: 4px;
}
.cinematic-speaker--scientist .cinematic-speaker__name {
  color: var(--cyan-bright);
}

/* Overlord garbled transmission — uses percentage insets that shrink on mobile */
.cinematic-overlord {
  position: absolute;
  inset: clamp(20px, 6%, 60px) clamp(16px, 8%, 100px);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 60, 60, 0.05) 0,
      rgba(255, 60, 60, 0.05) 2px,
      transparent 2px,
      transparent 4px
    ),
    radial-gradient(ellipse, #200505 0%, #050000 100%);
  border: 1px solid var(--signal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
  color: var(--signal-bright);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  animation: glitch-shake 2.4s infinite;
  box-shadow: 0 0 60px rgba(255, 60, 60, 0.3), inset 0 0 80px rgba(255, 60, 60, 0.15);
  box-sizing: border-box;
  text-align: center;
}
@keyframes glitch-shake {
  0%, 92%, 100% { transform: translate(0, 0); }
  93% { transform: translate(-2px, 1px); }
  94% { transform: translate(2px, -1px); }
  95% { transform: translate(-1px, -2px); }
  96% { transform: translate(0, 1px); }
  97% { transform: translate(2px, 0); }
  98% { transform: translate(-1px, 1px); }
}

.cinematic-overlord__header {
  font-size: clamp(9px, 1.6vw, 12px);
  letter-spacing: 0.15em;
  margin-bottom: clamp(16px, 3vw, 30px);
  color: var(--signal-bright);
  text-shadow: 0 0 8px rgba(255, 72, 88, 0.7);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}
.cinematic-overlord__live {
  width: 10px; height: 10px;
  background: var(--signal);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}
.cinematic-overlord__source {
  font-size: clamp(9px, 1.4vw, 11px);
  color: var(--signal);
  opacity: 0.6;
  letter-spacing: 0.3em;
  margin-top: clamp(10px, 2vw, 20px);
}

/* Bottom text panel — always visible */
.cinematic__panel {
  background: linear-gradient(180deg, rgba(13,18,24,0.92) 0%, rgba(7,9,13,0.98) 100%);
  border-top: 1px solid var(--line-bright);
  padding: clamp(14px, 2.5vw, 22px) clamp(16px, 4vw, 40px) clamp(16px, 2.5vw, 24px);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  max-height: 50vh;
  overflow-y: auto;
}
.cinematic__panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--amber) 0%, transparent 80%);
}

.cinematic__channel {
  font-size: clamp(9px, 1.3vw, 10px);
  letter-spacing: 0.3em;
  color: var(--amber);
  margin-bottom: clamp(8px, 1.5vw, 14px);
}

.cinematic__text {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.8vw, 16px);
  line-height: 1.55;
  color: var(--ink);
  min-height: clamp(48px, 8vw, 64px);
  letter-spacing: 0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.cinematic__text--overlord {
  color: var(--signal-bright);
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.9vw, 17px);
  letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(255, 72, 88, 0.4);
}
.cinematic__text--illustrated {
  font-style: italic;
  color: var(--cyan-bright);
  letter-spacing: 0.04em;
}

/* Typewriter cursor */
.cinematic__cursor {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  background: var(--amber);
  vertical-align: text-bottom;
  margin-left: 3px;
  animation: blink 0.7s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

.cinematic__controls {
  margin-top: clamp(10px, 1.5vw, 16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1.5vw, 16px);
  flex-wrap: wrap;
}

.cinematic__skip,
.cinematic__advance {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line-bright);
  color: var(--ink);
  padding: clamp(8px, 1.5vw, 10px) clamp(14px, 2.5vw, 22px);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(10px, 1.5vw, 12px);
  letter-spacing: 0.18em;
  transition: all 0.12s;
}
.cinematic__skip:hover { border-color: var(--signal); color: var(--signal-bright); }
.cinematic__advance {
  background: linear-gradient(180deg, var(--amber) 0%, #d68a32 100%);
  border-color: #b87425;
  color: var(--bg-0);
}
.cinematic__advance:hover { filter: brightness(1.15); }
.cinematic__advance--ready {
  animation: advance-pulse 1.4s infinite;
}
@keyframes advance-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 180, 74, 0.4); }
  50% { box-shadow: 0 0 22px 0 rgba(255, 180, 74, 0.6); }
}

.cinematic__progress {
  font-family: var(--font-display);
  font-size: clamp(11px, 1.5vw, 13px);
  letter-spacing: 0.15em;
  color: var(--ink-mute);
}

/* ====== Phone-portrait specific overrides ======
   On narrow screens, the speaker panel becomes full-width above the bottom
   panel rather than floating in a corner, which prevents it from being
   visually crowded against the text panel. */
@media (max-width: 600px) {
  .cinematic-speaker {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
    width: auto;
    padding: 10px;
    gap: 12px;
  }
  .cinematic-overlord {
    inset: 12px 12px 12px 12px;
    padding: 14px;
  }
  /* Hide the verbose decorative source line on tiny screens */
  .cinematic-overlord__source {
    display: none;
  }
  /* Stack the controls vertically if they don't fit otherwise */
  .cinematic__controls {
    justify-content: center;
  }
  .cinematic__progress {
    flex-basis: 100%;
    text-align: center;
    order: -1; /* progress first, then buttons */
  }
}

/* Landscape phone — short height. Compact the bottom panel further. */
@media (max-height: 500px) {
  .cinematic__panel {
    padding: 10px 16px 12px;
    max-height: 60vh;
  }
  .cinematic__channel {
    margin-bottom: 6px;
  }
  .cinematic__text {
    min-height: 36px;
  }
  .cinematic__controls {
    margin-top: 8px;
  }
  .cinematic-speaker {
    bottom: 8px;
    padding: 8px 12px;
    gap: 10px;
  }
  .cinematic-portrait {
    width: 60px;
  }
}

/* ===================================================================
   MOBILE & TOUCH RESPONSIVE OVERRIDES
   ───────────────────────────────────────────────────────────────────
   These overrides reshape the gameplay UI for narrow viewports and
   touch input, leaving the desktop layout entirely untouched.
   - Side panels become bottom sheets that don't permanently cover
     half the screen.
   - Comm panel collapses to a thin tab on phones, expandable on tap.
   - HUD shrinks gracefully.
   - Buttons get larger touch targets while staying compact.
   =================================================================== */

@media (max-width: 900px) {
  /* === HUD: shrink stats and speed button === */
  .hud {
    top: 10px;
    right: 10px;
    gap: 6px;
  }
  .hud-stat {
    padding: 6px 10px 8px;
    min-width: auto;
  }
  .hud-label { font-size: 8px; margin-bottom: 2px; }
  .hud-value { font-size: 16px; }
  .next-wave-btn { padding: 8px 14px; font-size: 11px; letter-spacing: 0.12em; }

  .speed-btn {
    top: 10px;
    left: 10px;
    padding: 6px 12px;
  }
  .speed-btn__label { font-size: 8px; }
  .speed-btn__value { font-size: 14px; }

  /* === Wave banner: smaller, fits viewport === */
  .wave-banner { top: 56px; }
  .banner-inner {
    padding: 10px 18px;
    gap: 10px;
  }
  .banner-prefix { font-size: 9px; letter-spacing: 0.2em; }
  .banner-text { font-size: 18px; letter-spacing: 0.08em; }

  /* === Turret bar: smaller buttons, scrollable === */
  .turret-bar {
    bottom: 10px;
    padding: 6px;
    gap: 4px;
    max-width: calc(100vw - 16px);
  }
  .turret-btn {
    width: 76px;
    height: 76px;
    padding: 6px 3px 4px;
  }
  .turret-btn__icon { font-size: 18px; }
  .turret-btn__name { font-size: 9px; }
  .turret-btn__cost { font-size: 11px; }
  .turret-btn__lock { font-size: 9px; }

  /* === Side panels: bottom sheets that don't cover half the screen === */
  .side-panel {
    /* Anchor full-width to the bottom, slide up over turret bar */
    left: 8px;
    right: 8px;
    bottom: 100px; /* clear the turret bar + a bit of gap */
    width: auto;
    height: auto;
    max-height: 60vh;
  }
  .side-panel--right { right: 8px; }
  .side-panel__header { padding: 10px 14px; }
  .side-panel__header h2 { font-size: 14px; }
  .side-panel__desc { padding: 8px 14px; font-size: 11px; }
  .side-panel__subtitle { padding: 4px 14px 8px; font-size: 10px; }

  /* Upgrade rows: compact */
  .upgrade-rows { padding: 6px 8px; gap: 4px; }
  .upgrade-row {
    padding: 8px 10px;
    gap: 2px 8px;
    font-size: 10px;
  }
  .upgrade-row__name { font-size: 11px; }
  .upgrade-row__btn {
    min-width: 70px;
    padding: 0 12px;
    font-size: 12px;
  }

  /* Enemy info: compact */
  .hp-track { margin: 8px 14px; height: 22px; }
  .hp-track__text { font-size: 11px; }
  .stats-grid { margin: 0 14px; }
  .stats-grid__row { padding: 6px 12px; font-size: 10px; }
  .tactical-note { margin: 8px 14px 14px; padding: 10px 12px; }
  .tactical-note__title { font-size: 9px; }
  .tactical-note p { font-size: 10px; }

  /* === Comm panel: thin floating tab on phones, expandable === */
  .comm-panel {
    left: 8px;
    right: 8px;
    bottom: 100px;
    width: auto;
    height: auto;
    max-height: 70vh;
  }
  .comm-panel__portrait {
    height: 130px;
    margin: 8px;
  }
  .comm-panel__name { font-size: 13px; }
  .comm-panel__rank { font-size: 9px; }
  .comm-panel__message {
    margin: 0 8px;
    padding: 10px 12px;
    font-size: 11px;
    min-height: 70px;
  }
  .comm-panel__footer { padding: 8px 12px; }

  .comm-tab {
    bottom: 100px;
    left: 8px;
    width: auto;
    min-width: 160px;
    padding: 8px 12px;
  }
}

/* === Phone portrait — extra-narrow viewport === */
@media (max-width: 600px) {
  /* Comm panel: become an icon-tab in the top-left when minimized,
     a full-width modal-ish thing when maximized */
  .comm-panel {
    bottom: 90px;
    max-height: 55vh;
  }
  .comm-panel__portrait {
    height: 100px;
    margin: 6px;
  }
  .comm-panel__message { min-height: 50px; }

  /* Side panels: even tighter */
  .side-panel { bottom: 90px; max-height: 55vh; }

  /* Turret bar uses smaller buttons but stays scrollable */
  .turret-btn {
    width: 64px;
    height: 70px;
  }
  .turret-btn__icon { font-size: 15px; }
  .turret-btn__name { font-size: 8px; line-height: 1.05; }
  .turret-btn__cost { font-size: 10px; }
}

/* === Phone landscape — short height, wide aspect === */
@media (max-width: 900px) and (max-height: 500px) {
  /* In landscape phones, vertical real estate is precious. Make panels squat. */
  .side-panel { max-height: 80vh; bottom: 90px; }
  .comm-panel { max-height: 80vh; bottom: 90px; }
  .comm-panel__portrait { height: 90px; margin: 6px; }
  .comm-panel__message { min-height: 40px; }
  .turret-bar { bottom: 6px; }
  .turret-btn { width: 64px; height: 64px; }
  .turret-btn__icon { font-size: 14px; }
  .turret-btn__name { font-size: 8px; }
  .turret-btn__cost { font-size: 10px; }
  .hud { top: 6px; right: 6px; }
  .speed-btn { top: 6px; left: 6px; }
  .wave-banner { top: 44px; }
}

/* === Touch-specific: bigger hit areas, no hover lift === */
@media (hover: none) and (pointer: coarse) {
  /* Hover lifts feel weird on touch since they stick after release. */
  .turret-btn:hover { transform: none; }
  .level-card:hover { transform: none; }
  .big-btn:hover { transform: none; }
  .next-wave-btn:hover { filter: none; }

  /* Make all primary buttons have at least 40px touch height */
  .turret-btn { min-height: 70px; }
  .upgrade-row__btn { min-height: 40px; }
  .side-panel__close { width: 36px; height: 36px; font-size: 16px; }
  .comm-toggle__box { width: 24px; height: 24px; }
}
