/* ==========================================================================
   RUNE REALM TD – DARK FANTASY STYLING
   ========================================================================== */

:root {
  --font-display: 'Cinzel', serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  --bg-dark: #090b10;
  --bg-card: rgba(18, 22, 32, 0.75);
  --bg-card-hover: rgba(26, 32, 48, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(245, 158, 11, 0.3);

  /* Element / Order Colors */
  --frost-cyan: #38bdf8;
  --frost-glow: rgba(56, 189, 248, 0.35);
  --shadow-crimson: #f43f5e;
  --shadow-glow: rgba(244, 63, 94, 0.35);
  --storm-purple: #c084fc;
  --storm-glow: rgba(192, 132, 252, 0.35);
  --fire-orange: #fb923c;
  --fire-glow: rgba(251, 146, 60, 0.35);
  --nature-green: #4ade80;
  --nature-glow: rgba(74, 222, 128, 0.35);

  --mana-gold: #f59e0b;
  --mana-glow: rgba(245, 158, 11, 0.4);
  --danger-red: #ef4444;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: relative;
}

/* Ambient Background Glow */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}
.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--frost-cyan), transparent);
  top: -150px;
  left: -150px;
}
.bg-glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--fire-orange), transparent);
  bottom: -200px;
  right: -200px;
}

/* Screens Management */
.screen {
  display: none;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* ==========================================================================
   LOBBY SCREEN
   ========================================================================== */
#lobby-screen {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.lobby-container {
  max-width: 860px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  animation: fadeIn 0.4s ease-out;
  margin: auto;
}

.lobby-header {
  text-align: center;
}
.header-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--mana-gold);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}
.game-title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
}
.title-highlight {
  color: var(--mana-gold);
  text-shadow: 0 0 30px var(--mana-glow);
}
.game-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 0.4rem;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  padding: 1.6rem;
}

.setup-card {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.order-selection-group label,
.player-name-group label,
.mode-selection-preview label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ORDER SELECTOR GRID
   minmax(0, 1fr) keeps all columns equally wide; plain 1fr lets a long name like "Sturmbeschwörer" widen its column */
.order-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
}
@media (max-width: 760px) {
  .order-selector-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.order-card {
  background: rgba(14, 18, 28, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.9rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-muted);
}
.order-card:hover {
  background: rgba(22, 28, 44, 0.8);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}
.order-card.active {
  background: rgba(20, 26, 40, 0.95);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.order-card[data-order-id="frost"].active {
  border-color: var(--frost-cyan);
  box-shadow: 0 0 18px var(--frost-glow);
}
.order-card[data-order-id="shadow"].active {
  border-color: var(--shadow-crimson);
  box-shadow: 0 0 18px var(--shadow-glow);
}
.order-card[data-order-id="storm"].active {
  border-color: var(--storm-purple);
  box-shadow: 0 0 18px var(--storm-glow);
}
.order-card[data-order-id="fire"].active {
  border-color: var(--fire-orange);
  box-shadow: 0 0 18px var(--fire-glow);
}
.order-card[data-order-id="nature"].active {
  border-color: var(--nature-green);
  box-shadow: 0 0 18px var(--nature-glow);
}

.order-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.order-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}
.order-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}
.order-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.2;
  margin-top: 0.2rem;
}

/* Explains the mastery of the selected order before the player commits to it */
.order-mastery-info {
  margin-top: 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.06);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.order-mastery-title {
  font-weight: 700;
  color: var(--mana-gold);
  margin-bottom: 0.15rem;
}
.order-mastery-tower {
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 0.3rem;
}
.leaderboard-box {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  background: rgba(14, 18, 28, 0.5);
}
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.leaderboard-header label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}
.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.leaderboard-tab-divider {
  width: 1px;
  margin: 0 0.2rem;
  background: rgba(255, 255, 255, 0.15);
}
.room-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0.25rem 0 0.75rem;
}
.room-option-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.room-option-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.25rem;
}
.leaderboard-tab,
.room-option-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}
.leaderboard-tab.active,
.room-option-btn.active {
  border-color: var(--mana-gold);
  color: #fff;
  background: rgba(245, 158, 11, 0.15);
}
.room-option-btn:disabled {
  cursor: default;
}
.leaderboard-list {
  margin: 0.5rem 0 0;
  padding-left: 1.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.leaderboard-list .leaderboard-wave {
  color: var(--mana-gold);
  font-weight: 700;
}
.leaderboard-empty {
  list-style: none;
  margin-left: -1.3rem;
  color: var(--text-dim);
}
.modal-leaderboard-rank {
  font-weight: 700;
  color: var(--mana-gold);
}
.order-spell-title {
  margin-top: 0.5rem;
}
.order-mastery-note {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Offered after a reload instead of jumping straight back into the running game */
.resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--mana-gold);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 18px var(--mana-glow);
}
.resume-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.resume-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
}
.resume-card-details {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.resume-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Name Input with Dice */
.btn-dice {
  padding: 0 1.1rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 0.9rem;
  font-size: 1.25rem;
  pointer-events: none;
  z-index: 2;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-with-button input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(10, 14, 22, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
}
.input-with-icon input,
.input-with-button .input-with-icon input {
  padding-left: 3rem !important;
}
.input-with-icon input:focus,
.input-with-button input:focus {
  border-color: var(--mana-gold);
  box-shadow: 0 0 15px var(--mana-glow);
}

/* Mode Switcher */
.mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.mode-btn {
  background: rgba(12, 16, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-muted);
}
.mode-btn:hover {
  background: rgba(20, 26, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.18);
}
.mode-btn.active {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--mana-gold);
  color: #fff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.18);
}
.mode-btn .mode-icon {
  font-size: 1.4rem;
}
.mode-btn .mode-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}
.mode-btn .mode-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Actions Split */
.actions-split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.action-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.action-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}
.action-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.action-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
}
.input-with-button {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
}
.btn-large {
  padding: 0.85rem 1.6rem;
  font-size: 1rem;
}
.btn-primary {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.35);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}
.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(45, 60, 85, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.btn-glow {
  animation: glowPulse 2s infinite ease-in-out;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Room Panel */
.room-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.room-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.8rem;
}
.room-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.room-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
}
.room-code-badge {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.8rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  color: var(--mana-gold);
}
.btn-tiny {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}
.room-mode-tag {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--frost-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.room-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
}

/* 4-Player Slots Grid */
.player-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.player-slot-card {
  background: rgba(12, 16, 26, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.1rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  position: relative;
  transition: all 0.25s ease;
}
/* Team mode: a colored top edge groups the two pairs */
.player-slot-card[data-team="0"] {
  border-top-color: #38bdf8;
}
.player-slot-card[data-team="1"] {
  border-top-color: #f43f5e;
}
.player-slot-card.occupied {
  border-color: var(--slot-color, rgba(255, 255, 255, 0.2));
  box-shadow: 0 4px 20px var(--slot-glow, transparent);
}
.player-slot-card.my-slot {
  box-shadow: 0 0 25px var(--slot-glow, transparent);
  border-width: 2.5px;
}
.player-slot-card.empty {
  opacity: 0.65;
  border-style: dashed;
  cursor: pointer;
}
.player-slot-card.empty:hover {
  opacity: 1;
  background: rgba(20, 28, 44, 0.8);
  border-color: var(--slot-color, rgba(255, 255, 255, 0.3));
  transform: translateY(-2px);
}
.slot-order-badge {
  font-size: 2rem;
}
.slot-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.slot-order-title {
  font-size: 0.72rem;
  color: var(--slot-color, var(--text-dim));
  font-weight: 600;
}
.slot-status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.slot-status-pill.ready {
  background: rgba(74, 222, 128, 0.2);
  color: var(--nature-green);
  border: 1px solid rgba(74, 222, 128, 0.4);
}
.slot-status-pill.not-ready {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-red);
}
.slot-switch-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--mana-gold);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.slot-switch-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  transform: scale(1.05);
}

.room-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.host-actions {
  display: flex;
  gap: 0.8rem;
}

/* ==========================================================================
   GAME SCREEN & HUD
   ========================================================================== */
#game-screen {
  flex-direction: column;
  background: #080a0e;
}

.game-hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding: 0 1.5rem;
  background: rgba(12, 16, 24, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 10;
}
.hud-left, .hud-right, .hud-center {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.hud-stat-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(20, 26, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
}
.next-wave-creeps {
  display: flex;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.pill-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}
.pill-value {
  font-weight: 800;
  font-size: 0.95rem;
}
.highlight-cyan { color: var(--frost-cyan); }
.highlight-amber { color: var(--mana-gold); }
.highlight-gold { color: #fde047; }
.highlight-green { color: var(--nature-green); }

.btn-early-wave {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  border: 1px solid var(--border-gold);
  color: var(--mana-gold);
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: glowPulse 2s infinite ease-in-out;
  pointer-events: auto;
  user-select: none;
  position: relative;
  z-index: 25;
}
.btn-early-wave:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.5));
  transform: translateY(-1px);
}
.btn-early-wave * {
  pointer-events: none;
}

.btn-repair {
  margin-left: 0.6rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #bbf7d0;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-repair.is-cooling {
  opacity: 0.5;
  cursor: default;
}
.incoming-warning {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  justify-content: center;
  pointer-events: none;
  max-width: 90vw;
}
.incoming-warning-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid #ef4444;
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
  font-size: 0.85rem;
  font-weight: 600;
  animation: slideUp 0.25s ease-out, pulseRed 2s infinite ease-in-out;
}
.incoming-timer {
  color: #f87171;
  font-weight: 700;
  white-space: nowrap;
}
.incoming-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.incoming-badge {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fee2e2;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
}
.incoming-from {
  color: #94a3b8;
  font-size: 0.75rem;
  white-space: nowrap;
}
@keyframes pulseRed {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
  }
  50% {
    box-shadow: 0 4px 25px rgba(239, 68, 68, 0.6);
    border-color: #fca5a5;
  }
}
.sanctum-hp-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 250px;
}
.sanctum-icon {
  font-size: 1.4rem;
}
.sanctum-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sanctum-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
}
.sanctum-title { color: var(--frost-cyan); font-family: var(--font-display); }
.sanctum-values { color: #fff; }
.sanctum-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.sanctum-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--frost-cyan), #06b6d4);
  border-radius: 999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--frost-glow);
}

.btn-icon {
  background: rgba(20, 26, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s;
}
.btn-icon:hover {
  background: rgba(30, 40, 60, 0.9);
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.players-sidebar {
  position: absolute;
  top: 66px;
  right: 15px;
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 10;
}
.sidebar-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}
.player-hud-card {
  pointer-events: auto;
  background: rgba(14, 18, 28, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--p-color, var(--text-dim));
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}
.player-hud-card.eliminated {
  opacity: 0.4;
  filter: grayscale(1);
}
.p-hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.p-hud-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-hud-hp {
  font-size: 0.75rem;
  color: var(--mana-gold);
  font-weight: 700;
}
.p-hud-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.btn-send-mana {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--mana-gold);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s;
}
.btn-send-mana:hover {
  background: rgba(245, 158, 11, 0.3);
}

.tower-inspector {
  position: absolute;
  bottom: 110px;
  left: 20px;
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 1.25rem;
  z-index: 20;
  animation: slideUp 0.2s ease-out;
  border-radius: 14px;
}
/* Tower info has more text than the inspector, so it scrolls instead of leaving the screen on small windows */
#tower-info {
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100% - 130px);
  overflow-y: auto;
}
.tower-info-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0 0 0.7rem;
}
.tower-info-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.tower-info-tracks {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
}
.tower-info-track {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.tower-info-track span:last-child {
  color: #fff;
  font-weight: 600;
  text-align: right;
}
.tower-info-mastery {
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.06);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tower-info-mastery .tower-info-section-title {
  color: var(--mana-gold);
}
.tower-info-mastery.is-mine {
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}
.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.7rem;
}
.inspector-title-wrap {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.inspector-icon {
  font-size: 1.7rem;
}
.inspector-title-wrap h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}
.inspector-level {
  font-size: 0.72rem;
  color: var(--mana-gold);
  font-weight: 600;
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
}
.inspector-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}
.inspector-stats .stat-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.72rem;
  text-align: center;
}
.inspector-stats .stat-pill strong {
  color: #fff;
  font-size: 0.82rem;
}
.target-mode-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}
.btn-target-mode {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.3rem 0.1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.btn-target-mode:hover {
  background: rgba(255, 255, 255, 0.12);
}
.btn-target-mode.active {
  border-color: var(--mana-gold);
  color: #fff;
  background: rgba(245, 158, 11, 0.15);
}
.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.btn-sell {
  color: var(--danger-red);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-sell:hover {
  background: rgba(239, 68, 68, 0.15);
}

.game-hud-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 1.5rem;
  background: rgba(10, 14, 22, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-glass);
  gap: 1.5rem;
  z-index: 10;
}
.spell-card {
  border-color: rgba(245, 158, 11, 0.45);
}
.spell-card.is-cooling {
  opacity: 0.5;
  filter: grayscale(0.7);
}
.spell-card.is-aiming {
  border-color: var(--mana-gold);
  box-shadow: 0 0 15px var(--mana-glow);
}
.deck-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  text-align: center;
}
.deck-cards {
  display: flex;
  gap: 0.7rem;
}
.summon-deck .deck-cards {
  gap: 0.45rem;
}
.tower-card, .summon-card {
  background: rgba(18, 24, 36, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  min-width: 85px;
}
.summon-card {
  min-width: 76px;
  padding: 0.4rem 0.55rem;
}
.tower-card:hover, .summon-card:hover {
  background: rgba(26, 36, 54, 0.9);
  border-color: var(--mana-gold);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(245, 158, 11, 0.2);
}
.tower-card.selected {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--mana-gold);
  box-shadow: 0 0 15px var(--mana-glow);
}
.card-hotkey {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.card-icon {
  font-size: 1.3rem;
}
.card-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}
.card-cost {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--mana-gold);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease-out;
  overflow-y: auto;
  padding: 1rem;
}
.modal-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.modal-card {
  max-width: 480px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: auto;
}
.modal-icon {
  font-size: 3.5rem;
}
.modal-card h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: #fff;
}
.modal-stats {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  font-size: 0.85rem;
}

.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 25px rgba(245, 158, 11, 0.5); }
}


/* GAME NOTIFICATIONS / TOASTS OVERLAY */
.game-notifications {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 100;
  pointer-events: none;
  max-width: 500px;
  width: 90%;
}

/* IN-GAME HELPER BANNER */
.build-guide-banner {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  padding: 0.5rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mana-gold);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7);
  z-index: 25;
  animation: glowPulse 3s infinite ease-in-out;
  pointer-events: auto;
}
.build-guide-banner strong {
  color: #fff;
}
.btn-dismiss-guide {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: 0.4rem;
}
.btn-dismiss-guide:hover {
  color: #fff;
}

.card-size-badge {
  font-size: 0.60rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.card-size-badge.size-1x1 {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.card-size-badge.size-2x2 {
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.4);
}

/* =====================================================================
   MAP SIZE SELECTOR & CAMERA CONTROLS
   ===================================================================== */

.map-size-selection-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.map-size-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-size-badge-hint {
  font-size: 0.72rem;
  color: var(--mana-gold);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-weight: 500;
}

.map-size-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}

@media (max-width: 900px) {
  .map-size-selector-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.map-size-btn {
  background: rgba(12, 16, 26, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-muted);
}

.map-size-btn:hover {
  background: rgba(20, 28, 45, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.map-size-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.08));
  border-color: var(--mana-gold);
  color: #fff;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.22);
  transform: translateY(-2px);
}

.map-size-btn .size-icon {
  font-size: 1.3rem;
}

.map-size-btn .size-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
}

.map-size-btn .size-res {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cyan-frost);
}

.map-size-btn .size-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.15;
  margin-top: 2px;
}

/* Room panel header tags wrap */
.room-tags-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.room-size-tag {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--cyan-frost);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Floating Camera Controls Dock: bottom right, because the player sidebar owns the top right corner */
.camera-controls-dock {
  position: absolute;
  bottom: 18px;
  right: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(10, 14, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.4rem 0.6rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
  user-select: none;
}

.btn-cam {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-cam:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

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

.cam-zoom-label {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan-frost);
  min-width: 44px;
  text-align: center;
}

.cam-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 0.15rem;
}

.btn-cam-focus {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--mana-gold);
}

.btn-cam-focus:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--mana-gold);
}

.btn-cam-fit {
  background: rgba(147, 51, 234, 0.12);
  border-color: rgba(147, 51, 234, 0.3);
  color: #c084fc;
}

.btn-cam-fit:hover {
  background: rgba(147, 51, 234, 0.22);
  border-color: #c084fc;
}

.bot-add-row {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.bot-add-btn,
.bot-remove-btn {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.bot-add-btn:hover {
  background: rgba(148, 163, 184, 0.28);
  transform: scale(1.05);
}
.bot-remove-btn {
  margin-top: 0.4rem;
}
.bot-remove-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Own slot only: switch the order without leaving the room */
.order-switch-row {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.4rem;
  justify-content: center;
}
.order-switch-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  padding: 0.15rem 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}
.order-switch-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}
.order-switch-btn.active {
  opacity: 1;
  border-color: var(--slot-color);
  box-shadow: 0 0 8px var(--slot-glow);
}

.inspector-upgrades {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.7rem 0;
}
.upgrade-track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  transition: all 0.15s ease;
}
.upgrade-track-row:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}
/* Order mastery: only the builder's order has this track, so it stands out in gold */
.upgrade-track-row.mastery {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.18);
}
.upgrade-track-row.mastery .upgrade-track-title {
  color: var(--mana-gold);
}

/* Tower card of the player's own order: shows that this tower can get the mastery */
.tower-card.mastery-tower::after {
  content: '👑';
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 0.8rem;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.8));
}
.upgrade-track-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}
.upgrade-track-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.upgrade-track-title {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.upgrade-track-pips {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.upgrade-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.4);
  padding: 0;
  cursor: default;
  transition: all 0.18s ease-in-out;
}
.upgrade-pip.filled {
  background: var(--mana-gold);
  border-color: #fbbf24;
  box-shadow: 0 0 7px rgba(245, 158, 11, 0.55);
}
.upgrade-pip.next-step {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
  cursor: pointer;
  animation: pulsePip 1.8s infinite ease-in-out;
}
.upgrade-pip.next-step:hover {
  transform: scale(1.35);
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.85);
  border-color: #86efac;
}
.upgrade-pip.future-step {
  border-color: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}
.upgrade-pip.future-step:hover {
  transform: scale(1.2);
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.15);
}
@keyframes pulsePip {
  0%, 100% {
    box-shadow: 0 0 3px rgba(74, 222, 128, 0.3);
    border-color: #4ade80;
  }
  50% {
    box-shadow: 0 0 9px rgba(74, 222, 128, 0.7);
    border-color: #86efac;
  }
}
.upgrade-track-value {
  font-size: 0.73rem;
  color: #94a3b8;
}
.upgrade-next {
  color: #4ade80;
  font-weight: 700;
}
.btn-upgrade-track {
  flex-shrink: 0;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--mana-gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-upgrade-track:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}
.btn-upgrade-track:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Team tag in the in-game player list, colored like the lobby team edges */
.p-hud-team {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0 0.3rem;
  margin-right: 0.3rem;
  border-radius: 4px;
  color: #0b0f17;
  background: #38bdf8;
}
.p-hud-team[data-team="1"] {
  background: #f43f5e;
}

/* ==========================================================================
   MOBILE RESPONSIVE ADJUSTMENTS (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  #lobby-screen {
    padding: 1rem 0.75rem 3rem;
  }
  .lobby-container {
    gap: 0.9rem;
    margin: 0 auto;
  }
  .header-badge {
    font-size: 0.68rem;
    margin-bottom: 0.35rem;
    padding: 0.25rem 0.75rem;
  }
  .game-title {
    font-size: 2.1rem;
  }
  .game-subtitle {
    font-size: 0.85rem;
  }
  .glass-card {
    padding: 1.1rem 0.85rem;
    border-radius: 12px;
  }
  .setup-card {
    gap: 1rem;
  }

  /* In-Game Top & Bottom HUD */
  .game-hud-top {
    height: auto;
    min-height: 46px;
    padding: 0.3rem 0.5rem;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .game-hud-top::-webkit-scrollbar {
    display: none;
  }
  .hud-stat-pill {
    padding: 0.25rem 0.45rem;
    gap: 0.3rem;
  }
  .pill-label {
    font-size: 0.6rem;
  }
  .pill-value {
    font-size: 0.82rem;
  }
  .hud-left, .hud-right, .hud-center {
    gap: 0.3rem;
  }
  .game-hud-bottom {
    padding: 0.35rem 0.5rem;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    max-width: 100vw;
  }
  .game-hud-bottom::-webkit-scrollbar {
    display: none;
  }
  .deck-cards {
    gap: 0.3rem;
  }
  .tower-card, .summon-card {
    min-width: 66px;
    padding: 0.3rem 0.4rem;
  }
  .card-icon {
    font-size: 1.05rem;
  }
  .card-name {
    font-size: 0.62rem;
  }
  .card-cost {
    font-size: 0.62rem;
  }
  .card-size-badge {
    font-size: 0.55rem;
  }

  /* Camera dock */
  .camera-controls-dock {
    bottom: 8px;
    right: 8px;
    padding: 0.25rem 0.4rem;
    gap: 0.25rem;
  }
  .btn-cam {
    padding: 0.25rem 0.45rem;
    font-size: 0.75rem;
  }
  .cam-zoom-label {
    font-size: 0.65rem;
    min-width: 30px;
  }

  /* Compact Threat Warning on Mobile */
  .incoming-warning {
    top: 52px;
  }
  .incoming-warning-pill {
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    gap: 0.35rem;
  }
  .incoming-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.3rem;
  }
  .incoming-from {
    font-size: 0.68rem;
  }
}
