:root {
  --bg-deep: #0d1117;
  --bg-panel: #151b24;
  --bg-card: #1c2432;
  --bg-card-hover: #242f41;
  --border: #2c384d;
  --border-bright: #415575;
  --text: #e8eef7;
  --text-muted: #8fa3bf;
  --accent-gold: #f5b942;
  --accent-coffee: #d9822b;
  --accent-cyan: #38bdf8;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-purple: #a78bfa;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 10px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* ==================== TOP HUD ==================== */
#hud-top {
  height: 58px;
  min-height: 58px;
  background: linear-gradient(180deg, #1a2230 0%, #131922 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 6px rgba(245, 185, 66, 0.4));
}
.brand-text h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-gold);
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  min-width: 106px;
}
.stat-icon {
  font-size: 18px;
}
.stat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: var(--text-muted);
}
.stat-val {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stat-budget .stat-val { color: var(--accent-green); }
.stat-sanity .stat-val { color: var(--accent-red); }
.stat-wave .stat-val { color: var(--accent-cyan); }
.stat-sp .stat-val { color: var(--accent-purple); }

.hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-group {
  display: flex;
  gap: 4px;
}

/* ==================== BUTTONS ==================== */
.btn {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.14s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}
.btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #f5b942 0%, #d97706 100%);
  color: #11161f;
  border-color: #fbbf24;
  font-weight: 800;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #fcd34d 0%, #ea580c 100%);
  border-color: #fde68a;
}

.btn-tech {
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  border-color: #8b5cf6;
  color: #f3e8ff;
}
.btn-tech:hover:not(:disabled) {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-color: #a78bfa;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.25);
  border-color: #f87171;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 15px;
}
.btn-icon.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.btn-speed {
  min-width: 44px;
  height: 34px;
  font-variant-numeric: tabular-nums;
}
.btn-lg {
  padding: 12px 26px;
  font-size: 15px;
  border-radius: 10px;
}
.btn-tiny {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-tiny:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent-gold);
  color: #111;
  font-size: 10px;
  font-weight: 900;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(245, 185, 66, 0.8);
  animation: bounceBadge 1.2s infinite;
}
@keyframes bounceBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.pulse-glow {
  animation: pulseGlow 1.8s infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 185, 66, 0.55); }
  50% { box-shadow: 0 0 18px 4px rgba(245, 185, 66, 0.35); }
}

.hidden {
  display: none !important;
}

/* ==================== WORKSPACE ==================== */
#workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

#stage-wrap {
  flex: 1;
  position: relative;
  background: #101620;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#webgl-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
#webgl-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}
#overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
#cam-hint {
  position: absolute;
  bottom: 42px;
  right: 14px;
  background: rgba(13, 18, 28, 0.78);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 10.5px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 8;
}
.badge-3d {
  display: inline-block;
  font-size: 10px;
  background: var(--accent-cyan);
  color: #0b111a;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 3px;
}
.hg-badge {
  font-size: 9.5px;
  font-weight: 800;
  background: rgba(245, 185, 66, 0.22);
  border: 1px solid rgba(245, 185, 66, 0.55);
  color: #fde68a;
  padding: 2px 6px;
  border-radius: 4px;
}

/* FLOATING WAVE BAR */
#wave-bar {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}
.wave-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#wave-bar > * {
  pointer-events: auto;
}
.wave-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(17, 23, 33, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.wave-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--text);
  font-weight: 600;
}
.wave-chip.boss {
  background: rgba(248, 113, 113, 0.22);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

/* ABILITIES BAR */
#abilities-bar {
  position: absolute;
  bottom: 42px;
  left: 14px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.ability-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(17, 24, 36, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-bright);
  border-radius: 9px;
  padding: 6px 11px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.ability-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: rgba(30, 41, 59, 0.96);
  transform: translateY(-2px);
}
.ability-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ab-key {
  font-size: 10px;
  font-weight: 800;
  background: rgba(255,255,255,0.1);
  color: var(--accent-gold);
  padding: 1px 5px;
  border-radius: 4px;
}
.ab-icon { font-size: 16px; }
.ab-name { font-size: 11px; font-weight: 700; }
.ab-cd {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-green);
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ability-btn.on-cd .ab-cd {
  color: var(--text-muted);
}

/* SLACK TICKER */
#slack-ticker {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: rgba(13, 17, 23, 0.92);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 11.5px;
  z-index: 9;
}
.slack-channel {
  color: var(--accent-cyan);
  font-weight: 800;
  font-family: monospace;
  font-size: 11px;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}
#slack-msg {
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#placement-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(245, 185, 66, 0.16);
  border: 1px solid var(--accent-gold);
  color: #fde68a;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  z-index: 12;
  pointer-events: none;
}

/* ==================== SIDEBAR ==================== */
#sidebar {
  width: 310px;
  min-width: 310px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
  gap: 12px;
}

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px;
}
.sidebar-section.compact {
  padding: 9px 11px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.section-header h2 {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.hint-tag {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* TOWER SHOP GRID */
.tower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tower-card {
  background: #141a24;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.14s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.tower-card:hover:not(.unaffordable) {
  border-color: var(--accent-gold);
  background: #1c2636;
  transform: translateY(-1px);
}
.tower-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.14);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}
.tower-card.unaffordable {
  opacity: 0.5;
}
.tc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tc-icon {
  font-size: 20px;
}
.tc-cost {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-green);
}
.tower-card.unaffordable .tc-cost {
  color: var(--accent-red);
}
.tc-name {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.tc-role {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.25;
}
.tc-key {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  opacity: 0.7;
}

/* SYNERGIES */
.synergy-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: #cbd5e1;
}
.syn-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(245, 185, 66, 0.14);
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
}
.syn-tag.gold { color: #fde68a; background: rgba(245, 185, 66, 0.22); }
.syn-tag.cyan { color: #67e8f9; background: rgba(56, 189, 248, 0.18); }
.syn-tag.blue { color: #93c5fd; background: rgba(59, 130, 246, 0.22); }
.syn-tag.red { color: #fca5a5; background: rgba(248, 113, 113, 0.2); }

/* INSPECTOR */
#panel-inspector {
  border-color: var(--accent-cyan);
  background: linear-gradient(180deg, #1b2638 0%, #151c28 100%);
}
.insp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.tier-badge {
  font-size: 10px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-cyan);
  padding: 2px 7px;
  border-radius: 4px;
}
.kills-badge {
  font-size: 10.5px;
  color: var(--text-muted);
}
.insp-quote {
  font-size: 11px;
  font-style: italic;
  color: #cbd5e1;
  margin-bottom: 8px;
}
.insp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 9px;
}
.insp-stat {
  background: rgba(0,0,0,0.25);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 10.5px;
  display: flex;
  justify-content: space-between;
}
.insp-stat span:first-child { color: var(--text-muted); }
.insp-stat span:last-child { font-weight: 700; color: var(--text); }

.insp-target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.target-pills {
  display: flex;
  gap: 3px;
}
.target-pills button {
  background: #101620;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
}
.target-pills button.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #0b111a;
}

.insp-upgrades {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}
.upg-btn {
  width: 100%;
  text-align: left;
  background: #121822;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.14s ease;
}
.upg-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: #1b2535;
}
.upg-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.upg-btn.spec {
  border-color: var(--accent-purple);
  background: rgba(109, 40, 217, 0.14);
}
.upg-btn.spec:hover:not(:disabled) {
  border-color: #c4b5fd;
  background: rgba(109, 40, 217, 0.25);
}
.upg-head {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 11.5px;
  margin-bottom: 2px;
}
.upg-cost { color: var(--accent-green); }
.upg-btn:disabled .upg-cost { color: var(--accent-red); }
.upg-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.3;
}
.max-badge {
  text-align: center;
  padding: 8px;
  background: rgba(245, 185, 66, 0.12);
  border: 1px dashed rgba(245, 185, 66, 0.45);
  border-radius: 8px;
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 11px;
}

.insp-actions {
  display: flex;
}
.insp-actions .btn {
  width: 100%;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 15, 0.78);
  backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 26px;
}

.modal-start-card {
  width: 860px;
  max-width: 100%;
}
.modal-hero {
  text-align: center;
  margin-bottom: 18px;
}
.hero-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-gold);
  background: rgba(245, 185, 66, 0.14);
  border: 1px solid rgba(245, 185, 66, 0.35);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.modal-hero h1 {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #fde68a 0%, #f59e0b 60%, #fb923c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.hero-tagline {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
}
.hero-tagline b { color: var(--text); }

.start-section {
  margin-bottom: 16px;
}
.start-section h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.map-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 9px;
}
.map-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.map-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
}
.map-card.active {
  border-color: var(--accent-gold);
  background: rgba(245, 185, 66, 0.1);
}
.map-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.map-card h4 {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}
.map-diff {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: var(--accent-cyan);
}
.map-card p {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.diff-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.diff-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s ease;
}
.diff-btn strong { font-size: 13px; }
.diff-btn span { font-size: 11px; color: var(--text-muted); }
.diff-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

/* TECH TREE MODAL */
.modal-tech-card {
  width: 1120px;
  max-width: 100%;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent-purple);
}
.modal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.tech-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sp-pill {
  background: rgba(167, 139, 250, 0.16);
  border: 1px solid var(--accent-purple);
  color: #e9d5ff;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
}

.tech-branches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.tech-branch {
  background: #121721;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.branch-title {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tech-node {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: left;
  color: var(--text);
  position: relative;
}
.tech-node:hover:not(:disabled) {
  border-color: var(--accent-purple);
  background: var(--bg-card-hover);
}
.tech-node.unlocked {
  border-color: var(--accent-green);
  background: rgba(52, 211, 153, 0.12);
  cursor: default;
}
.tech-node.locked-req {
  opacity: 0.45;
  cursor: not-allowed;
}
.tn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 3px;
}
.tn-cost {
  font-size: 11px;
  color: var(--accent-purple);
  font-weight: 800;
}
.tech-node.unlocked .tn-cost {
  color: var(--accent-green);
}
.tn-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* END MODAL */
.modal-end-card {
  width: 480px;
  max-width: 100%;
  text-align: center;
}
.end-icon {
  font-size: 54px;
  margin-bottom: 6px;
}
#end-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-gold);
  margin-bottom: 6px;
}
#end-desc {
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.45;
}
.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.end-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.end-stat div:first-child {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.end-stat div:last-child {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

@media (max-width: 980px) {
  #sidebar { width: 260px; min-width: 260px; }
  .map-cards, .diff-cards, .tech-branches { grid-template-columns: 1fr; }
}

.stat-score .stat-val { color: #fde047; }

/* SPRINT MODIFIER OFFERS */
.offer-row {
  display: flex;
  gap: 8px;
}
.offer-card {
  width: 230px;
  text-align: left;
  background: rgba(17, 23, 33, 0.92);
  backdrop-filter: blur(6px);
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.14s ease;
}
.offer-card:hover { border-color: var(--border-bright); }
.offer-card.safe.chosen { border-color: var(--accent-green); background: rgba(16, 185, 129, 0.16); }
.offer-card.risky.chosen { border-color: var(--accent-red); background: rgba(239, 68, 68, 0.16); }
.offer-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
}
.offer-kind { font-size: 9px; letter-spacing: 0.5px; color: var(--text-muted); white-space: nowrap; }
.offer-card.risky .offer-kind { color: #fca5a5; }
.offer-card.safe .offer-kind { color: #a7f3d0; }
.offer-desc { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.wave-chip.streak { background: rgba(251, 146, 60, 0.22); color: #fed7aa; }
.wave-chip.daily { background: rgba(167, 139, 250, 0.22); color: #e9d5ff; }

.ability-btn.aiming {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.55);
}
.ability-btn.aiming .ab-cd { color: #fecaca; }

/* WALL CARD */
.tower-card.wall-card { grid-column: span 2; }

/* RANK BAR */
.rank-row { margin: 6px 0 8px; }
.rank-head {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  color: #fde68a;
  margin-bottom: 3px;
}
.rank-head span:last-child { color: var(--text-muted); font-weight: 600; }
.rank-bar { height: 5px; background: #0f172a; border-radius: 3px; overflow: hidden; }
.rank-fill { height: 100%; width: 0; background: linear-gradient(90deg, #f59e0b, #fde047); transition: width 0.2s ease; }

/* COMBOS */
.combo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
  color: #cbd5e1;
  line-height: 1.3;
}
.combo-list li.unknown { color: var(--text-muted); opacity: 0.7; }
.combo-name {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  color: #f0abfc;
  background: rgba(232, 121, 249, 0.16);
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
}
.combo-list li.unknown .combo-name { color: var(--text-muted); background: rgba(255,255,255,0.06); }

/* START MODAL EXTRAS */
.resume-wrap, .daily-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.resume-wrap { border-color: var(--accent-green); }
.daily-card { border-color: var(--accent-purple); }
.resume-wrap > div, .daily-card > div { display: flex; flex-direction: column; gap: 3px; }
.resume-wrap span, .daily-card span { font-size: 11.5px; color: var(--text-muted); }
.daily-card strong span { color: var(--text); font-size: inherit; }
.map-record { margin-top: 7px; font-size: 10.5px; font-weight: 700; color: #fde68a; }

/* PERK DRAFT */
.modal-draft-card { width: 720px; max-width: 100%; text-align: center; }
.modal-draft-card h2 { font-size: 20px; font-weight: 900; color: var(--accent-gold); }
.draft-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.draft-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.draft-card:hover { border-color: var(--accent-gold); transform: translateY(-3px); background: var(--bg-card-hover); }
.draft-icon { font-size: 34px; margin-bottom: 6px; }
.draft-name { font-size: 14px; font-weight: 800; margin-bottom: 5px; }
.draft-owned { font-size: 10px; color: var(--accent-green); }
.draft-desc { font-size: 12px; color: var(--text-muted); line-height: 1.35; }

/* END RECORD */
.end-record {
  font-weight: 800;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.end-record.new { color: #fde047; }
.end-stats { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 1250px) {
  .brand-sub { display: none; }
  .stat-pill { padding-left: 8px; padding-right: 8px; min-width: 92px; }
}

/* Enemy inspector */
.enemy-hp-fill { background: linear-gradient(90deg, #ef4444, #f87171); }
.enemy-shield-fill { background: linear-gradient(90deg, #0ea5e9, #67e8f9); }
.enemy-list {
  margin: 8px 0 6px;
  padding-left: 16px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #cbd5e1;
}
.enemy-status { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.enemy-none { font-size: 11px; color: #64748b; }
