/* 
  Baby Name Arena - Custom CSS Styling
  Theme: Dreamy Gender-Neutral Dark Mode
  Aesthetic: Modern Glassmorphism & Viewport-Locked (No-Scroll Mobile App Experience)
*/

:root {
  --bg-dark: #0b081c;
  --bg-dark-end: #150f33;
  
  /* Primary & Accent Colors */
  --primary: #a78bfa;         /* Glowing Lavender */
  --primary-rgb: 167, 139, 250;
  --accent: #fda4af;          /* Soft Peach/Rose */
  --accent-rgb: 253, 164, 175;
  --accent-blue: #38bdf8;        /* Soft Sky Blue */
  
  /* Neutral Colors */
  --text-primary: #f3f4f6;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  /* Glassmorphism Variables */
  --glass-bg: rgba(30, 24, 62, 0.45);
  --glass-border: rgba(167, 139, 250, 0.15);
  --glass-border-hover: rgba(167, 139, 250, 0.35);
  --glass-glow: rgba(167, 139, 250, 0.1);
  --glass-shadow: rgba(0, 0, 0, 0.4);
  
  /* Layout Dimensions Optimized for Viewport Lock */
  --header-height: 60px;
  --nav-height: 64px;
  --border-radius-lg: 20px;
  --border-radius-md: 14px;
  --border-radius-sm: 10px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font-family);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Prevent any page-level scrolling */
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 50% 0%, var(--bg-dark-end) 0%, var(--bg-dark) 100%);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Background Decorative Glowing Blobs */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.2;
  mix-blend-mode: screen;
  animation: float-blobs 16s infinite alternate ease-in-out;
}

.blob-1 {
  top: -10%;
  left: 15%;
  width: 300px;
  height: 300px;
  background: var(--primary);
}

.blob-2 {
  bottom: 20%;
  right: -10%;
  width: 350px;
  height: 350px;
  background: var(--accent);
  animation-delay: -4s;
}

.blob-3 {
  top: 40%;
  left: -10%;
  width: 250px;
  height: 250px;
  background: var(--accent-blue);
  animation-delay: -8s;
}

@keyframes float-blobs {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 20px) scale(1.1); }
}

/* Base App Layout - Viewport Locked */
.app-container {
  width: 100%;
  max-width: 480px; /* Standard compact mobile width */
  height: 100%; /* Matches exactly the locked body height */
  display: flex;
  flex-direction: column;
  background: rgba(11, 8, 28, 0.3);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Header - Compact */
.app-header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(11, 8, 28, 0.8);
  backdrop-filter: blur(20px);
  z-index: 100;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-emoji {
  font-size: 1.3rem;
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.accent-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Header Button & Chip Styles - More Compact */
.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-btn .material-icons-round {
  font-size: 1.15rem;
}

.profile-chip {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.12) 0%, rgba(253, 164, 175, 0.12) 100%);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 16px;
  font-weight: 600;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
  max-width: 130px;
}

.profile-chip span:not(.material-icons-round) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-chip .material-icons-round {
  font-size: 1rem;
  color: var(--primary);
}

/* Main Content Area - Locked Height */
.app-main {
  flex: 1;
  padding: 14px;
  overflow: hidden; /* Prevent main scroll */
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  height: 100%;
  flex-direction: column;
  overflow: hidden; /* Locked by default */
  animation: fadeIn 0.3s ease-out forwards;
}

.tab-content.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.section-header {
  margin-bottom: 12px;
  flex-shrink: 0;
}

.section-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 3px;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.3;
}

/* 🗳️ VOTING ARENA - SIDE-BY-SIDE NO-SCROLL LAYOUT */
.voter-indicator-bar {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.voter-indicator-bar strong {
  color: var(--primary);
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.78rem;
}

.voting-arena {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Critical for inner flex sizing */
}

/* Side-by-side cards on mobile for no-scroll viewport fit! */
.matchup-container {
  display: flex;
  flex-direction: row; /* Split screen side-by-side */
  gap: 10px;
  flex: 1;
  min-height: 0;
  position: relative;
  align-items: stretch;
}

/* Split-screen Name Cards */
.name-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 16px 10px;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition-smooth);
  box-shadow: 0 6px 20px var(--glass-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  text-align: center;
}

.name-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.12);
}

.name-card:active {
  transform: scale(0.97);
}

.card-bg-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.06) 0%, rgba(253, 164, 175, 0) 60%);
  pointer-events: none;
}

.card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  justify-content: space-between; /* Spans top, middle, and button */
  padding: 6px 0;
}

.card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.15) 0%, rgba(253, 164, 175, 0.15) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  flex-shrink: 0;
}

/* Responsive font scaling for names, preventing viewport overflows! */
.name-display {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 5.5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 10px 0;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1; /* Centering vertically */
}

.elo-display {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.vote-select-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 16px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
  flex-shrink: 0;
}

.name-card:hover .vote-select-btn {
  background: var(--text-primary);
  color: var(--bg-dark);
  border-color: var(--text-primary);
}

/* VS Divider - Overlaid in center */
.vs-divider {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 32px;
  height: 32px;
  background: var(--bg-dark);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--accent);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.25);
  pointer-events: none;
}

/* Heart Pop Animation */
.heart-pop {
  position: absolute;
  pointer-events: none;
  font-size: 2rem;
  animation: pop-n-fade 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  z-index: 100;
}

@keyframes pop-n-fade {
  0% { transform: scale(0.3) translateY(0) rotate(0deg); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: scale(1.1) translateY(-60px) rotate(15deg); opacity: 0; }
}

/* Vote Actions Bar / Undo Button Container */
.vote-actions-bar {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  flex-shrink: 0;
}

.btn-undo {
  gap: 4px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(167, 139, 250, 0.15) !important;
  color: var(--primary) !important;
  transition: var(--transition-smooth);
}

.btn-undo:hover {
  background: rgba(167, 139, 250, 0.06) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.2) !important;
}

/* Leaderboard View Toggle Segment Control */
.leaderboard-toggle-container {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.segment-control {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: 24px;
  width: 100%;
  max-width: 340px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  outline: none;
}

.segment-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.segment-btn:hover:not(.active) {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

/* 📊 LEADERBOARD - VIEWPORT-LOCKED SCROLLING */
.leaderboard-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 6px 24px var(--glass-shadow);
  display: flex;
  flex-direction: column;
  flex: 1; /* Take remaining space */
  min-height: 0; /* Crucial for scrolling */
}

.leaderboard-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.leaderboard-list {
  flex: 1;
  overflow-y: auto; /* Internally scrollable */
  min-height: 0;
  padding-right: 2px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: var(--transition-smooth);
}

.rank-col {
  width: 32px;
  font-weight: 700;
  font-family: var(--font-display);
}

.name-col {
  flex: 1.5;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rating-col {
  flex: 1;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 0.92rem;
}

.stats-col {
  flex: 1.1;
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.suggested-col {
  flex: 1.1;
  text-align: right;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Medals */
.rank-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.rank-1 .rank-badge {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #5b21b6;
}

.rank-2 .rank-badge {
  background: linear-gradient(135deg, #e4e4e7 0%, #a1a1aa 100%);
  color: #1f2937;
}

.rank-3 .rank-badge {
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  color: #fff;
}

.rank-normal {
  color: var(--text-muted);
  padding-left: 4px;
}

/* ➕ ADD NAME FORM - COMPACT */
.form-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  box-shadow: 0 6px 24px var(--glass-shadow);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.88rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

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

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.25);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* SUGGESTION HISTORY ROW - Viewport Lock optimized */
.my-suggestions-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.my-suggestions-container h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.recent-names-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-y: auto; /* scrollable grid */
  flex: 1;
  min-height: 0;
  align-content: flex-start;
}

.name-tag {
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.15);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ⚙️ MANAGEMENT PANEL - SMOOTH SCROLLABLE TABS */
#tab-manage {
  overflow-y: auto; /* Let the admin settings scroll internally */
  padding-right: 2px;
}

.manage-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  box-shadow: 0 6px 24px var(--glass-shadow);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.card-title-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.card-title-bar h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-title-icon {
  color: var(--primary);
  font-size: 1.25rem;
}

.manage-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-bottom: 12px;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}

.manage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
}

.manage-item-title {
  font-weight: 600;
  font-size: 0.88rem;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.manage-item-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #ef4444;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-delete:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.btn-delete .material-icons-round {
  font-size: 0.95rem;
}

.manage-inline-form {
  display: flex;
  gap: 8px;
}

.manage-inline-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
}

.manage-inline-form .btn {
  padding: 10px 16px;
  font-size: 0.85rem;
}

/* Danger Zone */
.card-danger {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.01);
}

.card-danger:hover {
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.08) !important;
}

.text-danger {
  color: #fda4af !important;
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(244, 63, 94, 0.2);
  font-size: 0.85rem;
}

.btn-danger:hover {
  box-shadow: 0 5px 15px rgba(244, 63, 94, 0.35);
}

/* EMPTY STATE COMPACT */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 10px;
  margin: auto;
}

.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 18px;
  max-width: 280px;
}

.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* STICKY BOTTOM NAVIGATION - COMPACT */
.app-nav {
  height: var(--nav-height);
  display: flex;
  background: rgba(15, 11, 38, 0.85);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  flex-shrink: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  gap: 2px;
}

.nav-item .material-icons-round {
  font-size: 1.25rem;
}

.nav-item span:not(.material-icons-round) {
  font-size: 0.7rem;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .material-icons-round {
  transform: translateY(-1px);
  color: var(--primary);
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.3);
}

/* MODAL OVERLAYS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 4, 13, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 360px;
  padding: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 16px;
}

.profile-selection-area {
  margin-bottom: 16px;
}

.profile-selection-area label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.profiles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 100px;
  overflow-y: auto;
}

.profile-chip-select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.profile-chip-select:hover {
  background: rgba(167, 139, 250, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.modal-form {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
}

.icon-btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

/* QR Code Screen Specifics */
.qr-code-wrapper {
  background: #fff;
  padding: 10px;
  border-radius: var(--border-radius-md);
  display: inline-block;
  margin: 10px 0;
}

.qr-code-wrapper img {
  display: block;
  width: 140px;
  height: 140px;
}

.connection-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.network-badge {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-blue);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.ip-url-display {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Safari / iPhone Troubleshooting Collapsible */
.safari-warning-box {
  margin-top: 12px;
  background: rgba(253, 164, 175, 0.02);
  border: 1px solid rgba(253, 164, 175, 0.12);
  border-radius: var(--border-radius-sm);
  text-align: left;
  overflow: hidden;
}

.safari-warning-box[open] {
  background: rgba(253, 164, 175, 0.04);
  border-color: rgba(253, 164, 175, 0.2);
}

.safari-warning-box summary {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  outline: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.safari-warning-box summary::-webkit-details-marker {
  display: none;
}

.safari-warning-box summary::after {
  content: '▼';
  font-size: 0.65rem;
  color: var(--text-muted);
}

.safari-warning-box[open] summary::after {
  transform: rotate(180deg);
}

.safari-warning-content {
  padding: 0 12px 12px 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  border-top: 1px solid rgba(253, 164, 175, 0.06);
  padding-top: 8px;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 320px;
}

.toast {
  background: rgba(19, 16, 43, 0.92);
  border: 1px solid var(--glass-border-hover);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

/* Tablet / Desktop scaling support */
@media (min-width: 481px) {
  body {
    padding: 20px 0;
  }
  .app-container {
    min-height: calc(100vh - 40px);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  }
  .app-nav {
    position: absolute;
  }
}

/* 🔒 PRIVATE PASSWORD GATE LOCK SCREEN */
.lock-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 0%, var(--bg-dark-end) 0%, var(--bg-dark) 100%);
  z-index: 9999; /* Ensure it overlays everything, including nav and modals */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.4s ease, visibility 0.4s;
  visibility: visible;
}

.lock-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--border-radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(167, 139, 250, 0.1);
  backdrop-filter: blur(20px);
  animation: lock-entrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes lock-entrance {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.lock-icon {
  font-size: 3.2rem;
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 0 0 15px rgba(253, 164, 175, 0.3);
}

.lock-container h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.lock-container p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 24px;
}

.lock-form input {
  text-align: center;
  letter-spacing: 2px;
  font-size: 1rem;
}

/* Shake Animation for incorrect password */
.shake {
  animation: shake-anim 0.4s ease-in-out;
}

@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Centered, spaced 4-digit PIN Input */
.pin-input {
  text-align: center !important;
  letter-spacing: 8px !important;
  font-size: 1.3rem !important;
  font-weight: 700 !important;
}

/* 📊 ARENA ANALYTICS - SLEEK GLASSMORPHIC DASHBOARD */
.analytics-summary-cards {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.analytics-card-summary {
  flex: 1;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 15px var(--glass-shadow);
  backdrop-filter: blur(10px);
}

.analytics-summary-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-weight: 600;
}

.analytics-summary-value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.analytics-table-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 6px 24px var(--glass-shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* Crucial for internal scrolling */
  backdrop-filter: blur(10px);
}

.analytics-table-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.analytics-voters-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.analytics-voter-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: var(--transition-smooth);
}

.analytics-voter-row:hover {
  background: rgba(255, 255, 255, 0.01);
}

.voter-name-col {
  flex: 1.2;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}

.voter-status-col {
  flex: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.voter-votes-col {
  flex: 0.8;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.voter-remaining-col {
  flex: 0.8;
  text-align: right;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.95rem;
}

/* Glowing Online Indicators */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981, 0 0 16px rgba(16, 185, 129, 0.4);
}

.status-dot.offline {
  background-color: var(--text-muted);
}

.status-text {
  font-weight: 500;
}

.status-text.online {
  color: #34d399;
}

.status-text.offline {
  color: var(--text-secondary);
}

/* Progress Pill Badge on Vote Page */
.progress-pill {
  background: rgba(253, 164, 175, 0.1);
  border: 1px solid rgba(253, 164, 175, 0.2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: var(--transition-smooth);
}

.progress-pill.done {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
}

