@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@700&display=swap');

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

:root {
  --bg-primary: #0a0c10;
  --bg-secondary: #080b12;
  --bg-panel: #0d1117;
  --bg-panel-2: #111827;
  --border-subtle: rgba(255,255,255,0.08);
  --border-mid: rgba(255,255,255,0.12);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --blue: #4f8ef7;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --accent: #6366f1;
}

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Rajdhani', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-secondary);
  overflow: hidden;
}

/* ── HEADER ── */
#header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 14px;
  background: rgba(13,17,23,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
  flex-shrink: 0;
  min-height: 52px;
}

#header .logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--blue);
  text-shadow: 0 0 20px rgba(79,142,247,0.6);
  margin-right: 8px;
}


.stat-block {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

.stat-block .icon {
  font-size: 15px;
}

.stat-block .val {
  color: var(--text-primary);
  font-weight: 600;
  min-width: 28px;
}

#stat-lives .val { color: #f87171; }
#stat-gold .val  { color: #fbbf24; }
#stat-wave .val  { color: var(--text-secondary); }
#stat-score .val { color: var(--green); }

.header-spacer { flex: 1; }

#btn-next-wave {
  padding: 7px 0;
  width: 120px;
  text-align: center;
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 0 16px rgba(79,142,247,0.35);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

#btn-next-wave:hover {
  opacity: 0.9;
  box-shadow: 0 0 24px rgba(79,142,247,0.55);
  transform: translateY(-1px);
}

#btn-next-wave:active { transform: translateY(0); }
#btn-next-wave:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
  transform: none;
}

#btn-menu {
  padding: 4px 12px;
  background: var(--red);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}
#btn-menu:hover {
  opacity: 0.85;
  box-shadow: 0 0 16px rgba(220,38,38,0.45);
  transform: translateY(-1px);
}
#btn-menu:active { transform: translateY(0); }

#btn-mute {
  padding: 0;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}
#btn-mute:hover { opacity: 1; }

#btn-speed {
  padding: 7px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

#btn-speed:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

#btn-speed.active {
  background: rgba(251,191,36,0.15);
  border-color: rgba(251,191,36,0.4);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(251,191,36,0.2);
}

/* ── MAIN AREA ── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
  min-height: 0;
}

/* ── CANVAS AREA ── */
#canvas-outer {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border-subtle);
  background: #000;
}

#canvas-wrap {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
}

#game-canvas {
  display: block;
  cursor: crosshair;
  margin: auto;
}

#canvas-info {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
  z-index: 10;
}

#canvas-zoom {
  position: absolute;
  bottom: 6px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 20;
}
#canvas-zoom button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
#canvas-zoom button:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
#btn-zoom-level {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── SIDEBAR ── */
#sidebar {
  flex-shrink: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 240px;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.panel {
  background: rgba(13,17,23,0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

.panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── TOWER BUTTONS ── */
.tower-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  border-left-width: 3px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  margin-bottom: 6px;
  position: relative;
}

.tower-btn:last-child { margin-bottom: 0; }

.tower-btn:hover {
  background: rgba(255,255,255,0.07);
}

.tower-btn.active {
  background: rgba(255,255,255,0.08);
}

.tower-btn[data-type="bass"]        { border-left-color: #4f8ef7; }
.tower-btn[data-type="pulse"]       { border-left-color: #34d399; }
.tower-btn[data-type="treble"]      { border-left-color: #fbbf24; }
.tower-btn[data-type="cannon"]      { border-left-color: #94a3b8; }
.tower-btn[data-type="machinegun"]  { border-left-color: #fb923c; }
.tower-btn[data-type="laser"]       { border-left-color: #ff3333; }
.tower-btn[data-type="bosslaser"]   { border-left-color: #a855f7; }
.tower-btn[data-type="lighthouse"]  { border-left-color: #facc15; }

.tower-btn[data-type="bass"].active        { box-shadow: 0 0 12px rgba(79,142,247,0.35),  inset 0 0 20px rgba(79,142,247,0.08);  border-color: rgba(79,142,247,0.5); }
.tower-btn[data-type="pulse"].active       { box-shadow: 0 0 12px rgba(52,211,153,0.35),  inset 0 0 20px rgba(52,211,153,0.08);  border-color: rgba(52,211,153,0.5); }
.tower-btn[data-type="treble"].active      { box-shadow: 0 0 12px rgba(251,191,36,0.35),  inset 0 0 20px rgba(251,191,36,0.08);  border-color: rgba(251,191,36,0.5); }
.tower-btn[data-type="cannon"].active      { box-shadow: 0 0 12px rgba(148,163,184,0.35), inset 0 0 20px rgba(148,163,184,0.08); border-color: rgba(148,163,184,0.5); }
.tower-btn[data-type="machinegun"].active  { box-shadow: 0 0 12px rgba(251,146,60,0.35),  inset 0 0 20px rgba(251,146,60,0.08);  border-color: rgba(251,146,60,0.5); }
.tower-btn[data-type="laser"].active       { box-shadow: 0 0 12px rgba(255,51,51,0.45),   inset 0 0 20px rgba(255,51,51,0.10);   border-color: rgba(255,51,51,0.6); }
.tower-btn[data-type="bosslaser"].active   { box-shadow: 0 0 12px rgba(168,85,247,0.45),  inset 0 0 20px rgba(168,85,247,0.10);  border-color: rgba(168,85,247,0.6); }
.tower-btn[data-type="lighthouse"].active  { box-shadow: 0 0 12px rgba(250,204,21,0.35),  inset 0 0 20px rgba(250,204,21,0.08);  border-color: rgba(250,204,21,0.5); }

.tower-btn .t-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.tower-btn[data-type="bass"]        .t-icon { background: rgba(79,142,247,0.15);  color: #4f8ef7; }
.tower-btn[data-type="pulse"]       .t-icon { background: rgba(52,211,153,0.15);  color: #34d399; }
.tower-btn[data-type="treble"]      .t-icon { background: rgba(251,191,36,0.15);  color: #fbbf24; }
.tower-btn[data-type="cannon"]      .t-icon { background: rgba(148,163,184,0.15); color: #94a3b8; }
.tower-btn[data-type="machinegun"]  .t-icon { background: rgba(251,146,60,0.15);  color: #fb923c; }
.tower-btn[data-type="laser"]       .t-icon { background: rgba(255,51,51,0.15);   color: #ff3333; }
.tower-btn[data-type="bosslaser"]   .t-icon { background: rgba(168,85,247,0.15);  color: #a855f7; }
.tower-btn[data-type="lighthouse"]  .t-icon { background: rgba(250,204,21,0.15);  color: #facc15; }

.tower-btn .t-info { flex: 1; }
.tower-btn .t-name { font-weight: 600; font-size: 13px; }
.tower-btn .t-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.tower-btn .t-cost {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251,191,36,0.1);
  border-radius: 4px;
  padding: 2px 6px;
}

.tower-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── COMBO PANEL ── */
.combo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.combo-row:last-child { border-bottom: none; padding-bottom: 0; }

.combo-tags {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.combo-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
.combo-tag.b { background: rgba(79,142,247,0.2); color: #4f8ef7; }
.combo-tag.p { background: rgba(52,211,153,0.2); color: #34d399; }
.combo-tag.t { background: rgba(251,191,36,0.2); color: #fbbf24; }

.combo-effect {
  color: var(--text-secondary);
  font-size: 11px;
  flex: 1;
}
.combo-mult {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: auto;
}

/* ── SELECTED PANEL ── */
#panel-selected { display: none; }

.selected-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.selected-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.selected-name {
  font-weight: 600;
  font-size: 14px;
}

.phase-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

#phase-slider {
  width: 100%;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin-bottom: 12px;
}
#phase-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(79,142,247,0.6);
  cursor: pointer;
}

.selected-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.stat-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
}
.stat-pill .sp-label { color: var(--text-muted); }
.stat-pill .sp-val { font-weight: 600; color: var(--text-primary); }

#enhance-row { margin-bottom: 6px; }
#enhance-tier { text-align: center; }
#btn-enhance {
  width: 100%;
  padding: 8px;
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.25);
  border-radius: 7px;
  color: #34d399;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
#btn-enhance:hover {
  background: rgba(52,211,153,0.2);
  box-shadow: 0 0 12px rgba(52,211,153,0.2);
}
#btn-enhance.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
#btn-enhance.maxed {
  background: rgba(100,100,100,0.1);
  border-color: rgba(100,100,100,0.25);
  color: #888;
  cursor: default;
  pointer-events: none;
}

#btn-sell {
  width: 100%;
  padding: 8px;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: 7px;
  color: #f87171;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
#btn-sell:hover {
  background: rgba(248,113,113,0.2);
  box-shadow: 0 0 12px rgba(248,113,113,0.2);
}

/* ── ENEMY GUIDE ── */
.enemy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
}
.enemy-row:last-child { border-bottom: none; }

.enemy-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}
.enemy-info { flex: 1; }
.enemy-name { font-weight: 600; color: var(--text-primary); }
.enemy-rule { color: var(--text-muted); font-size: 10px; }

/* ── OVERLAYS ── */

#unlock-dialog {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,11,18,0.80);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 300;
}
#unlock-dialog.show { display: flex; }

#confirm-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,11,18,0.75);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 300;
}
#confirm-menu.show { display: flex; }
.confirm-box {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
.confirm-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.confirm-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.confirm-buttons { display: flex; gap: 12px; justify-content: center; }
.confirm-buttons button { min-width: 110px; }
#confirm-yes { background: var(--red); }
#confirm-yes:hover { background: #ef4444; }

#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,11,18,0.88);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#overlay.show { display: flex; }

.overlay-box {
  text-align: center;
  padding: 40px 48px;
  background: #0d1117;
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  max-width: 380px;
}
.overlay-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}
.overlay-title.win  { color: var(--green); text-shadow: 0 0 30px rgba(52,211,153,0.5); }
.overlay-title.lose { color: var(--red);   text-shadow: 0 0 30px rgba(248,113,113,0.5); }

.overlay-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

#btn-restart {
  padding: 10px 32px;
  background: linear-gradient(135deg, #4f8ef7, #6366f1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(79,142,247,0.4);
  transition: all 0.15s;
}
#btn-restart:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── MENU SCREEN ── */
#menu-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #070a0f;
  z-index: 300;
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
}
#menu-screen.show { display: flex; }

.menu-box {
  text-align: center;
  padding: 24px 16px;
  max-width: 640px;
  width: 100%;
  margin: auto;
}
.menu-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(24px, 8vw, 48px);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--blue);
  text-shadow: 0 0 40px rgba(79,142,247,0.65);
  margin-bottom: 6px;
}
.menu-tagline {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 44px;
}
.menu-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}
#level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
#menu-ver {
  margin-top: 24px;
  font-size: 10px;
  color: rgba(255,255,255,0.15);
  text-align: center;
  letter-spacing: 0.1em;
}
.level-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-mid);
  border-radius: 14px;
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
}
.level-card:hover {
  border-color: var(--blue);
  background: rgba(79,142,247,0.08);
  box-shadow: 0 0 28px rgba(79,142,247,0.22);
  transform: translateY(-2px);
}
.level-card:active { transform: translateY(0); }
.lc-number {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.lc-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.lc-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}
.lc-diff { font-size: 15px; color: #fbbf24; letter-spacing: 0.05em; }

/* ── WAVE BANNER ── */
#msg-overlay {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 150;
}
.msg-line {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: opacity 0.1s;
}

#wave-banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#wave-banner.show { opacity: 1; }

#wave-banner-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 90px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #4f8ef7;
  text-shadow: 0 0 40px rgba(79,142,247,0.9), 0 0 80px rgba(79,142,247,0.4);
}

/* ── FLASH ── */
#screen-flash {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  pointer-events: none;
  z-index: 50;
  border-radius: 12px;
  transition: background 0.08s;
}

/* ── SCROLLBAR GLOBAL ── */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }

/* ── MOBILE / RESPONSIVE ── */

/* ── Portrait: canvas on top, sidebar as bottom horizontal bar ── */
@media (orientation: portrait) {
  #main { flex-direction: column; }
  #canvas-outer { border-right: none; border-bottom: 1px solid var(--border-subtle); }
  #sidebar {
    width: 100%;
    flex-shrink: 0;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 8px 12px;
    gap: 10px;
  }
  .panel { min-width: 185px; flex-shrink: 0; }
  .tower-btn { min-height: 48px; }
  #btn-sell  { min-height: 40px; }
  #btn-enhance { min-height: 40px; }
}

/* ── Small portrait: compact header + compact bottom toolbar ── */
@media (orientation: portrait) and (max-width: 600px) {
  #header { padding: 6px 12px; gap: 6px 10px; min-height: unset; }
  .header-spacer { display: none; }
  #header .logo { font-size: 13px; margin-right: 4px; }
  #btn-next-wave { flex: 1; text-align: center; font-size: 12px; padding: 7px 10px; }
  #btn-speed { font-size: 11px; padding: 6px 10px; }
  .stat-block { padding: 3px 7px; font-size: 11px; }

  /* Compact bottom toolbar */
  #sidebar { padding: 5px 6px 8px; gap: 6px; }
  .panel { padding: 6px 8px; min-width: 160px; }
  .panel-title { font-size: 9px; margin-bottom: 4px; }
  .tower-btn { padding: 5px 8px; min-height: 36px; margin-bottom: 3px; }
  .tower-btn .t-desc { display: none; }
  .tower-btn .t-icon { width: 22px; height: 22px; font-size: 12px; }
  .tower-btn .t-name { font-size: 12px; }
  .tower-btn .t-cost { font-size: 11px; padding: 1px 5px; }
  .combo-row { padding: 3px 0; font-size: 11px; }
  #btn-sell { min-height: 32px; padding: 5px; font-size: 12px; }
  #btn-enhance { min-height: 32px; padding: 5px; font-size: 12px; }
}

/* ── Landscape phones/tablets: sidebar on right, narrower ── */
@media (orientation: landscape) and (max-width: 1099px) {
  #header { padding: 3px 8px; min-height: 32px; gap: 4px 6px; }
  .header-spacer { display: none; }
  #header .logo { font-size: 12px; margin-right: 2px; }
  #header img { height: 24px !important; width: 24px !important; }
  .stat-block { padding: 2px 5px; font-size: 10px; gap: 4px; }
  .stat-block .icon { font-size: 12px; }
  #btn-next-wave { width: 100px; font-size: 10px; padding: 4px 0; }
  #btn-speed { font-size: 10px; padding: 3px 8px; }
  #btn-menu { font-size: 10px; padding: 3px 8px; }

  #sidebar { width: 190px; padding: 6px; gap: 6px; }
  .panel { padding: 8px 10px; }
  .panel-title { margin-bottom: 5px; font-size: 9px; }
  .tower-btn { padding: 5px 7px; min-height: 36px; margin-bottom: 3px; }
  .tower-btn .t-desc { display: none; }
  .tower-btn .t-icon { width: 22px; height: 22px; font-size: 12px; }
  .combo-row { padding: 3px 0; }
  #btn-sell { min-height: 32px; padding: 5px; }
  #btn-enhance { min-height: 32px; padding: 5px; }
}
