/* Phalanx Gate — 16-Bit Sunlit Bronze-Age Mediterranean Styling */
:root {
  --bg-deep: #0e1c2b;
  --bg-panel: #14273a;
  --bg-card: #193047;
  --marble: #f8f1df;
  --marble-dim: #d8ccb4;
  --bronze: #c27c36;
  --bronze-bright: #e5a552;
  --gold: #facc15;
  --gold-deep: #ca8a04;
  --crimson: #dc2626;
  --crimson-dark: #991b1b;
  --aegean: #0ea5e9;
  --aegean-bright: #38bdf8;
  --emerald: #10b981;
  --border-bronze: rgba(229, 165, 82, 0.38);
  --shadow-deep: 0 14px 36px rgba(4, 12, 22, 0.65);
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, #1c3a56 0%, #0e1c2b 62%, #08111c 100%);
  color: var(--marble);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

#app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Top HUD Bar */
.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  background: linear-gradient(180deg, #1b344d 0%, #112336 100%);
  border: 1.5px solid var(--border-bronze);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 236, 179, 0.14);
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.brand-pill {
  padding: 5px 10px;
  border-radius: 7px;
  background: linear-gradient(180deg, #7f1d1d 0%, #5c1313 100%);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fef3c7;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(8, 17, 28, 0.68);
  border: 1px solid rgba(229, 165, 82, 0.25);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat-gold { color: #fde047; border-color: rgba(250, 204, 21, 0.38); }
.stat-lives { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }
.stat-wave { color: #bae6fd; border-color: rgba(56, 189, 248, 0.35); }
.stat-score { color: #fef08a; border-color: rgba(234, 179, 8, 0.3); }

.hud-btn {
  appearance: none;
  border: 1px solid rgba(229, 165, 82, 0.42);
  background: linear-gradient(180deg, #21405e 0%, #152b42 100%);
  color: var(--marble);
  font-weight: 800;
  font-size: 12.5px;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}

.hud-btn:hover {
  filter: brightness(1.15);
  border-color: var(--gold);
}

.hud-btn:active {
  transform: translateY(1px);
}

.hud-btn.active {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  border-color: var(--gold);
  color: #fef9c3;
}

.hud-btn-call {
  background: linear-gradient(180deg, #b91c1c 0%, #7f1d1d 100%);
  border-color: #facc15;
  color: #fef9c3;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.35);
}

.hud-btn-call.pulse {
  animation: callPulse 1.3s ease-in-out infinite;
}

@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(250, 204, 21, 0.35); }
  50% { box-shadow: 0 0 18px rgba(250, 204, 21, 0.78); }
}

.hud-btn-star {
  background: linear-gradient(180deg, #854d0e 0%, #583106 100%);
  border-color: rgba(250, 204, 21, 0.65);
  color: #fef08a;
}

/* Challenge Banner */
.challenge-banner {
  padding: 7px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.35), rgba(14, 165, 233, 0.28));
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fef3c7;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* Stage & Canvas */
.stage-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.canvas-shell {
  position: relative;
  width: 100%;
  max-width: 1020px;
  aspect-ratio: 16 / 9;
  background: #0d2a3d;
  border: 2px solid var(--bronze-bright);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  touch-action: manipulation;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
}

#game-canvas.targeting-bolt {
  cursor: crosshair;
}

#game-canvas.targeting-rally {
  cursor: cell;
}

/* Boss Alert Banner */
.boss-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.94), rgba(180, 83, 9, 0.94), rgba(127, 29, 29, 0.94));
  border: 2px solid #facc15;
  color: #fef9c3;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Ares Frenzy Active Indicator */
.frenzy-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 16;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(153, 27, 27, 0.92);
  border: 1.5px solid #fde047;
  color: #fef08a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.65);
  pointer-events: none;
}

/* Stage Toast */
.stage-toast {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(12, 24, 38, 0.92);
  border: 1px solid var(--gold);
  color: #fef3c7;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* Contextual Build / Upgrade Popover */
.plot-popover {
  position: absolute;
  z-index: 25;
  width: min(312px, calc(100% - 14px));
  background: linear-gradient(180deg, rgba(20, 39, 58, 0.97) 0%, rgba(12, 24, 38, 0.98) 100%);
  border: 1.5px solid var(--bronze-bright);
  border-radius: 11px;
  padding: 9px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.72);
  color: var(--marble);
}

.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(229, 165, 82, 0.25);
}

.pop-title {
  font-size: 13px;
  font-weight: 900;
  color: #fef08a;
  letter-spacing: 0.02em;
}

.pop-close {
  background: transparent;
  border: 1px solid rgba(229, 165, 82, 0.35);
  color: var(--marble-dim);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-weight: 800;
}

.pop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.pop-build-btn {
  appearance: none;
  text-align: left;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(15, 31, 47, 0.92);
  border: 1px solid rgba(229, 165, 82, 0.35);
  color: var(--marble);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.pop-build-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(31, 61, 89, 0.95);
  transform: translateY(-1px);
}

.pop-build-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.pop-b-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 900;
  font-size: 12px;
}

.pop-b-cost {
  color: #fde047;
  font-size: 11.5px;
}

.pop-b-desc {
  font-size: 10.5px;
  color: var(--marble-dim);
  line-height: 1.25;
}

.pop-stats {
  font-size: 11.5px;
  color: #cbd5e1;
  margin-bottom: 8px;
  line-height: 1.4;
}

.pop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pop-act-btn {
  flex: 1 1 auto;
  min-width: 82px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid rgba(250, 204, 21, 0.5);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  color: #fef9c3;
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
}

.pop-act-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pop-act-btn.rally {
  background: linear-gradient(180deg, #0369a1 0%, #0c4a6e 100%);
  border-color: #38bdf8;
}

.pop-act-btn.sell {
  background: linear-gradient(180deg, #7f1d1d 0%, #450a0a 100%);
  border-color: #f87171;
  color: #fee2e2;
}

/* Primary Overlay (Title / Campaign / Victory / Defeat) */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: radial-gradient(circle at 50% 35%, rgba(16, 36, 56, 0.78), rgba(7, 16, 26, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}

.overlay-card {
  width: min(650px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, #1b3650 0%, #102336 100%);
  border: 2px solid var(--bronze-bright);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 240, 200, 0.18);
}

.ov-crest {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 2px;
}

.ov-title {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fef08a;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.ov-subtitle {
  margin: 3px 0 10px;
  font-size: 12.5px;
  color: var(--marble-dim);
  font-weight: 600;
}

/* Daily Strip */
.daily-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(234, 179, 8, 0.18));
  border: 1px solid rgba(56, 189, 248, 0.5);
  text-align: left;
}

.daily-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.daily-badge {
  font-size: 11.5px;
  font-weight: 900;
  color: #7dd3fc;
  letter-spacing: 0.05em;
}

.daily-mod {
  font-size: 11.5px;
  color: var(--marble);
  font-weight: 600;
}

.daily-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.68);
  border: 1px solid rgba(251, 146, 60, 0.6);
  color: #fed7aa;
  font-size: 11.5px;
  font-weight: 800;
}

/* 6-Map Campaign Grid */
.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 11px;
}

.map-card {
  appearance: none;
  text-align: left;
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(11, 25, 39, 0.85);
  border: 1.5px solid rgba(229, 165, 82, 0.28);
  color: var(--marble);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.map-card:hover:not(.locked) {
  border-color: var(--gold);
  background: rgba(25, 51, 77, 0.94);
  transform: translateY(-1px);
}

.map-card.selected {
  border-color: #facc15;
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.34), rgba(16, 36, 56, 0.96));
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.25);
}

.map-card.locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.map-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 11px;
  color: #93c5fd;
  font-weight: 800;
}

.map-card-name {
  font-size: 12.5px;
  font-weight: 900;
  color: #fef3c7;
  line-height: 1.15;
}

.map-card-sub {
  font-size: 10.5px;
  color: var(--marble-dim);
}

.map-stars {
  color: #facc15;
  letter-spacing: 1px;
}

/* Post-run stats */
.ov-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.ov-stat-box {
  background: rgba(9, 20, 32, 0.78);
  border: 1px solid rgba(229, 165, 82, 0.28);
  border-radius: 8px;
  padding: 7px 6px;
}

.ov-stat-val {
  font-size: 16px;
  font-weight: 900;
  color: #fef08a;
}

.ov-stat-lbl {
  font-size: 10.5px;
  color: var(--marble-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cliffhanger {
  padding: 7px 10px;
  margin-bottom: 9px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #d1fae5;
  font-size: 12px;
  font-weight: 700;
}

/* Leaderboard Submit & Share */
.lb-submit-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.lb-submit-row input {
  background: rgba(8, 17, 28, 0.85);
  border: 1px solid rgba(229, 165, 82, 0.5);
  border-radius: 7px;
  color: var(--marble);
  padding: 7px 10px;
  font-size: 12.5px;
  width: 170px;
}

.lb-submit-msg {
  font-size: 11.5px;
  color: #86efac;
  font-weight: 700;
}

.share-preview {
  padding: 7px 10px;
  margin-bottom: 9px;
  border-radius: 8px;
  background: rgba(8, 17, 28, 0.8);
  border: 1px dashed rgba(250, 204, 21, 0.45);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #fde68a;
  word-break: break-word;
}

/* Buttons */
.ov-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.btn {
  appearance: none;
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  border-color: #facc15;
  color: #fef9c3;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
}

.btn-daily {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border-color: #7dd3fc;
  color: #f0f9ff;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-gold {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  border-color: #facc15;
  color: #fef08a;
}

.btn-secondary {
  background: linear-gradient(180deg, #244361 0%, #172e45 100%);
  border-color: rgba(229, 165, 82, 0.45);
  color: var(--marble);
}

.btn-share {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  border-color: #6ee7b7;
  color: #ecfdf5;
}

.btn-small {
  padding: 5px 10px;
  font-size: 11.5px;
}

.ov-hint {
  font-size: 11.5px;
  color: #cbd5e1;
}

/* Modals (Pantheon Star Tree + Leaderboard) */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(6, 14, 24, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 94%;
  overflow-y: auto;
  background: linear-gradient(180deg, #1a344e 0%, #0f2032 100%);
  border: 2px solid var(--bronze-bright);
  border-radius: 13px;
  padding: 14px 16px;
  box-shadow: var(--shadow-deep);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  color: #fef08a;
}

.modal-sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--marble-dim);
}

.modal-close {
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid rgba(229, 165, 82, 0.45);
  background: rgba(9, 20, 32, 0.8);
  color: var(--marble);
  font-weight: 900;
  cursor: pointer;
}

.stars-bank-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(8, 17, 28, 0.72);
  border: 1px solid rgba(250, 204, 21, 0.35);
  margin-bottom: 10px;
  font-size: 12.5px;
}

.stars-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.perk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(11, 24, 38, 0.85);
  border: 1px solid rgba(229, 165, 82, 0.28);
}

.perk-info {
  text-align: left;
}

.perk-name {
  font-weight: 900;
  font-size: 13px;
  color: #fef3c7;
}

.perk-desc {
  font-size: 11.5px;
  color: var(--marble-dim);
}

.perk-pips {
  margin-top: 3px;
  font-size: 11px;
  color: #facc15;
  font-weight: 800;
}

.perk-btn {
  padding: 7px 11px;
  border-radius: 7px;
  border: 1px solid #facc15;
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  color: #fef9c3;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.perk-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}

.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr 70px 84px;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(8, 17, 28, 0.72);
  border: 1px solid rgba(229, 165, 82, 0.22);
}

.lb-rank { font-weight: 900; color: #facc15; }
.lb-name { font-weight: 800; color: var(--marble); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wave { color: #7dd3fc; font-weight: 700; text-align: right; }
.lb-score { color: #fde047; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }

/* Bottom Command Deck */
.command-deck {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #172e45 0%, #0f2032 100%);
  border: 1.5px solid var(--border-bronze);
  border-radius: 10px;
}

.spell-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spell-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1.5px solid #38bdf8;
  background: linear-gradient(180deg, #0c4a6e 0%, #082f49 100%);
  color: #f0f9ff;
  cursor: pointer;
  min-height: 40px;
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.spell-btn-ares {
  border-color: #f97316;
  background: linear-gradient(180deg, #991b1b 0%, #631010 100%);
  color: #fef3c7;
}

.spell-btn.armed {
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.85);
  border-color: #facc15;
  transform: translateY(-1px);
}

.spell-btn.cooling {
  opacity: 0.58;
  filter: saturate(0.4);
}

.spell-key {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
}

.spell-icon { font-size: 18px; line-height: 1; }
.spell-info { display: flex; flex-direction: column; text-align: left; }
.spell-name { font-size: 12px; font-weight: 900; line-height: 1.1; }
.spell-cd { font-size: 10.5px; color: #fde047; font-weight: 800; }

.wave-intel {
  flex: 1 1 220px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(8, 17, 28, 0.65);
  border: 1px solid rgba(229, 165, 82, 0.25);
  font-size: 12px;
  color: var(--marble);
}

.intel-label {
  font-weight: 900;
  color: #facc15;
  margin-right: 4px;
}

.deck-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.leg-chip {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(9, 20, 32, 0.72);
  border: 1px solid rgba(229, 165, 82, 0.22);
  font-size: 11px;
  font-weight: 700;
  color: var(--marble-dim);
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(11, 23, 36, 0.75);
  border: 1px solid rgba(229, 165, 82, 0.2);
  font-size: 11.5px;
  color: var(--marble-dim);
}

/* Mobile Responsive (0px horizontal overflow at 390x844) */
@media (max-width: 720px) {
  #app {
    padding: 6px 6px 10px;
    gap: 6px;
  }

  .hud-bar {
    padding: 6px 7px;
    gap: 5px;
  }

  .brand-pill {
    font-size: 11.5px;
    padding: 4px 7px;
  }

  .stat-pill {
    font-size: 11.5px;
    padding: 3px 6px;
  }

  .hud-btn {
    font-size: 11.5px;
    padding: 4px 7px;
    min-height: 29px;
  }

  .canvas-shell {
    border-radius: 8px;
  }

  .overlay,
  .modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    padding: 10px;
    align-items: center;
  }

  .overlay-card,
  .modal-card {
    padding: 12px 12px;
    border-radius: 12px;
    max-height: 94dvh;
  }

  .plot-popover {
    position: fixed;
    left: 50% !important;
    top: auto !important;
    bottom: 10px;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 14px));
    z-index: 55;
  }

  .ov-crest { font-size: 20px; }
  .ov-subtitle { margin: 2px 0 6px; font-size: 11px; }

  .map-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    margin-bottom: 8px;
  }

  .map-card {
    padding: 6px 7px;
  }

  .map-card-name { font-size: 11.5px; }
  .map-card-sub { font-size: 9.5px; }

  .ov-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .daily-strip {
    padding: 6px 8px;
    margin-bottom: 7px;
  }

  .deck-legend {
    display: none;
  }

  .spell-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .spell-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 6px 8px;
  }

  .spell-name { font-size: 11px; }
  .wave-intel { font-size: 11px; }
  .btn { padding: 7px 11px; font-size: 12px; }
}
