:root {
  --bg-dark: #0b0f17;
  --bg-arena: #111726;
  --bg-panel: rgba(17, 24, 39, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-gold: #f59e0b;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#app-container {
  width: 100%;
  max-width: 500px;
  height: 100vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

/* Base Scene Management */
.scene {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.scene.hidden {
  display: none !important;
}

/* ==========================================================================
   1. LOBBY & MAIN HUB SCENE (OUT-OF-BATTLE)
   ========================================================================== */

.lobby-scene {
  background: radial-gradient(circle at 50% 20%, #172033 0%, #0b0f17 80%);
}

.lobby-header {
  height: 60px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
  flex-shrink: 0;
}

.lobby-profile-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.lobby-profile-chip:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
}

.lobby-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.lobby-user-details {
  display: flex;
  flex-direction: column;
}

.lobby-username {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-acc-tag {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 600;
}

.lobby-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lobby-main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.lobby-title-banner {
  text-align: center;
  padding: 0.4rem 0 0.2rem 0;
}

.lobby-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 2px 10px rgba(59, 130, 246, 0.5);
}

.lobby-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.15rem;
  letter-spacing: 0.5px;
}

/* Lobby Cards */
.lobby-card {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

/* Campaign Hero Card */
.campaign-hero-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.15);
}

.campaign-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.campaign-stage-pill {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.campaign-threat-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f87171;
}

.campaign-stage-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0.1rem 0;
}

.campaign-realm-name {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

.campaign-reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.9rem;
}

.reward-gold {
  color: #fbbf24;
  font-size: 0.85rem;
}

.campaign-action-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.start-battle-btn {
  font-size: 1rem;
  padding: 0.8rem;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
  border: none;
  font-weight: 900;
}

.start-battle-btn:hover {
  background: linear-gradient(135deg, #fbbf24, #b45309);
  transform: translateY(-1px);
}

.lobby-sub-btn {
  padding: 0.55rem;
  text-align: center;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
}

/* Squad Roster Grid */
.lobby-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.lobby-hero-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.5rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.15s ease;
}

.lobby-hero-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
}

.lobby-hero-img-box {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #0f172a;
  border: 1.5px solid var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.lobby-hero-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}

.lobby-hero-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.1rem;
}

.lobby-hero-tier {
  font-size: 0.62rem;
  font-weight: 700;
  color: #fbbf24;
}

/* PvP Arena Card */
.pvp-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.live-pulse-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}

.pvp-action-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pvp-start-btn {
  flex: 1.2;
  margin: 0;
  background: #d97706;
}

.pvp-start-btn:hover {
  background: #b45309;
}

.pvp-room-box {
  flex: 1;
  display: flex;
  gap: 0.25rem;
}

.pvp-room-box input {
  width: 60px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

/* Quick Navigation Grid */
.lobby-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
}

.lobby-nav-btn {
  padding: 0.7rem 0.5rem;
  text-align: center;
  font-size: 0.78rem;
  background: rgba(30, 41, 59, 0.6);
}

/* ==========================================================================
   2. ISOLATED BATTLE SCENE (BATTLE-ONLY UI)
   ========================================================================== */

.battle-scene {
  background: var(--bg-arena);
}

.battle-top-hud {
  height: 52px;
  padding: 0 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 15, 23, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
  flex-shrink: 0;
}

.battle-hud-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.exit-battle-btn {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-weight: 700;
}

.exit-battle-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: var(--accent-red);
  color: #fff;
}

/* Timeline & Arena Canvas */
.timeline-strip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
}

.timeline-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e293b;
  border: 1.5px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pill-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
}

.timeline-pill.active {
  transform: scale(1.15);
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.2);
}

.stage-banner-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stage-title-hud {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.stage-skulls-hud {
  font-size: 0.65rem;
  font-weight: 700;
  color: #f87171;
}


.hud-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.hud-btn.primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.hud-btn.highlight {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: #fbbf24;
  font-weight: 700;
}

.hud-btn.highlight:hover {
  background: rgba(245, 158, 11, 0.35);
}

/* Velocity Picker */
.velocity-buttons {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.vel-btn {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.35rem 0.2rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.vel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.vel-btn.active {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

/* User Profile Badge */
.user-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
  cursor: pointer;
}

.user-badge.hidden {
  display: none;
}

.user-badge:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
}

/* Auth Modal */
.auth-card {
  max-width: 380px;
}

.auth-tabs {
  display: flex;
  background: #0f172a;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn.active {
  background: #1e293b;
  color: #ffffff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form.hidden {
  display: none;
}

.auth-form input {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font-main);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.auth-error {
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid var(--accent-red);
  color: #f87171;
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  text-align: left;
}

.auth-error.hidden {
  display: none;
}

.gsi-render-box {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
}

.google-auth-btn {
  width: 100%;
  margin-top: 0.9rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.google-auth-btn:hover {
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1rem 0 0.8rem 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-divider span {
  padding: 0 0.6rem;
}

/* Google Account Selection Modal */
.google-select-card {
  max-width: 400px;
  background: #0f172a;
  border: 1px solid rgba(66, 133, 244, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(66, 133, 244, 0.2);
  padding: 1.4rem;
}

.google-brand-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.google-header-text {
  display: flex;
  flex-direction: column;
}

.google-brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.google-brand-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0.15rem 0 0 0;
}

.google-section-heading {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
  text-align: left;
}

.google-account-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.google-account-list.hidden {
  display: none;
}

.google-account-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(66, 133, 244, 0.4);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.google-account-item:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
}

.google-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285F4, #34A853);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.google-account-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  text-align: left;
}

.google-acc-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.google-acc-email {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.google-remove-acc-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.google-remove-acc-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.google-custom-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1.2rem;
}

.google-input-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
  text-align: left;
}

.google-custom-input {
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-main);
}

.google-custom-input:focus {
  outline: none;
  border-color: #4285F4;
}

.google-actions-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* Arena Canvas */
.arena-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-arena);
  overflow: hidden;
}

#arena-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: none;
  cursor: crosshair;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.mode-option-card {
  background: #1f2937;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-option-card:hover {
  border-color: var(--accent-blue);
  background: #283548;
}

.mode-option-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.mode-option-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Stage Banner in HUD */
.stage-banner-hud {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.55rem;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 170px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stage-title-hud {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-skulls-hud {
  font-size: 0.7rem;
}

/* Gold Badge in HUD */
.gold-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  padding: 0.25rem 0.5rem;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 800;
}

/* Stage Select Modal (10 Stages) */
.stage-select-card {
  max-width: 480px;
  padding: 1.25rem;
}

.campaign-stages-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.2rem;
  margin-bottom: 0.8rem;
}

.stage-card {
  background: #1e293b;
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stage-card:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  background: #273549;
}

.stage-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.stage-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.stage-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stage-num-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.stage-skulls {
  font-size: 0.65rem;
  letter-spacing: -1px;
}

.stage-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-card-realm {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.stage-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
}

.stage-bounty {
  color: #fbbf24;
}

.stage-clear-badge {
  color: #10b981;
  font-weight: 700;
}

/* Extra row in mode modal */
.mode-extra-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  background: #0f172a;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.velocity-compact {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vel-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pvp-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-subtle);
}

/* Squad Upgrades Modal */
.squad-modal-card {
  max-width: 460px;
  padding: 1.25rem;
}

.upgrade-gold-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.upgrade-gold-banner .gold-amount {
  color: #fbbf24;
  font-size: 1rem;
}

.heroes-upgrade-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 380px;
  overflow-y: auto;
}

.hero-upgrade-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #1e293b;
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.hero-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #0f172a;
  border: 2px solid var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.hero-avatar-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
}

.hero-upgrade-info {
  flex: 1;
}

.hero-upgrade-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-upgrade-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
}

.hero-upgrade-tier {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.hero-stats-preview {
  display: flex;
  gap: 0.6rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.btn-upgrade-hero {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-upgrade-hero:hover:not(:disabled) {
  background: #059669;
  transform: scale(1.03);
}

.btn-upgrade-hero:disabled {
  background: #475569;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Result Modal Upgrades */
.result-card {
  max-width: 360px;
}

.result-stars {
  font-size: 1.6rem;
  letter-spacing: 4px;
  margin-bottom: 0.4rem;
}

.result-stats-box {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0.8rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.highlight-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 0.95rem;
  padding: 0.75rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.highlight-btn:hover {
  background: linear-gradient(135deg, #fbbf24, #b45309);
}

.result-secondary-btns {
  display: flex;
  gap: 0.5rem;
}

.btn-primary {
  width: 100%;
  padding: 0.65rem;
  background: var(--accent-blue);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary:hover {
  background: #2563eb;
}

.pvp-room-input {
  display: flex;
  gap: 0.4rem;
}

.pvp-room-input input {
  flex: 1;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
}

/* Leaderboard */
.leaderboard-container {
  max-height: 240px;
  overflow-y: auto;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.75rem;
}

.leaderboard-table th {
  background: #1e293b;
  color: var(--text-muted);
  padding: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.leaderboard-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Account HUD & Profile Modal */
.account-hud-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-weight: 700;
}

.account-hud-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #fff;
}

.hud-avatar-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-transform: uppercase;
}

.account-modal-card {
  max-width: 440px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.account-header-profile {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

.account-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  text-transform: uppercase;
}

.account-header-info {
  flex: 1;
  min-width: 0;
}

.account-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.account-title-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-type-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid #3b82f6;
  color: #60a5fa;
  font-weight: 700;
  text-transform: uppercase;
}

.account-email-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.account-sub-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.account-uid-tag {
  font-size: 0.65rem;
  color: #64748b;
  font-family: monospace;
}

.account-sync-tag {
  font-size: 0.65rem;
  color: #10b981;
  font-weight: 600;
}

.account-nav-tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  margin-bottom: 0.8rem;
}

.acc-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.2rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.acc-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.acc-tab-btn.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.acc-pane.hidden {
  display: none;
}

.acc-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.acc-stat-box {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.acc-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.acc-stat-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.acc-progression-card {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
}

.acc-prog-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-main);
}

.acc-prog-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin: 0.4rem 0;
  overflow: hidden;
}

.acc-prog-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.acc-input-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  text-align: left;
}

.acc-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.acc-action-btn {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.acc-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.acc-action-btn.primary-action {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #93c5fd;
}

.acc-action-btn.primary-action:hover {
  background: rgba(59, 130, 246, 0.35);
  color: #fff;
}

.acc-action-btn.warning-action {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}

.acc-action-btn.warning-action:hover {
  background: rgba(245, 158, 11, 0.3);
}

.acc-action-btn.danger-action {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

.acc-action-btn.danger-action:hover {
  background: rgba(239, 68, 68, 0.3);
}

.acc-alert {
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  margin-bottom: 0.6rem;
  text-align: center;
  font-weight: 600;
}

.acc-alert.success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #6ee7b7;
}

.acc-alert.error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.acc-notice-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 0.6rem;
  font-size: 0.75rem;
  color: #fcd34d;
  line-height: 1.4;
  margin-bottom: 0.6rem;
}


