/* ==========================================================================
   QuizPulse — Dynamic Quiz Score Arena
   Clean, Modern, High-Contrast Design System (Light & Dark Mode)
   ========================================================================== */

:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Default Dark Mode Tokens */
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-card: #131b2e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.16);

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

  --dot-color: rgba(255, 255, 255, 0.04);
  --brand-accent-color: #818cf8;

  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --accent-rose: #f43f5e;
  --accent-rose-dark: #e11d48;
  --accent-amber: #f59e0b;
  --accent-indigo: #6366f1;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-elevation: 0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 0 1px 1px rgba(255, 255, 255, 0.06);
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);

  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Light Mode Theme
   Crisp, Architectural, High-Contrast Masterclass
   ========================================================================== */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-active: #cbd5e1;

  --text-main: #0f172a;       /* Deep charcoal slate: 14:1 contrast ratio */
  --text-muted: #334155;      /* Crisp slate secondary: 8:1 contrast ratio */
  --text-dim: #64748b;        /* Subtle meta text: 4.8:1 contrast ratio */

  --dot-color: rgba(15, 23, 42, 0.045);
  --brand-accent-color: #4f46e5;

  --shadow-elevation: 0 4px 14px -2px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.05), 0 0 1px rgba(15, 23, 42, 0.1);
}

/* Base & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow-x: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Clean, subtle architectural dot matrix (replaces tacky AI blur blobs) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: radial-gradient(var(--dot-color) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Main Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 640px;
  position: relative;
}

/* ==========================================================================
   Header & Controls
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
}

[data-theme="light"] .app-header {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-main);
}

.brand-accent {
  color: var(--brand-accent-color);
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Apple/Linear Style Segmented Controls */
.mode-selector-pill,
.point-step-pill {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.pill-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 0 0.5rem 0 0.45rem;
}

.step-btn,
.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.step-btn:hover,
.mode-btn:hover {
  color: var(--text-main);
}

/* Active Segmented State */
.step-btn.active,
.mode-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .step-btn.active {
  color: #0f172a;
}

[data-theme="light"] .mode-btn[data-mode="survival"].active {
  color: #be123c;
  font-weight: 800;
}

[data-theme="light"] .mode-btn[data-mode="classic"].active {
  color: #4338ca;
  font-weight: 800;
}

[data-theme="dark"] .mode-btn[data-mode="survival"].active {
  color: #f43f5e;
}

[data-theme="dark"] .mode-btn[data-mode="classic"].active {
  color: #818cf8;
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}

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

.btn-primary {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-active);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--text-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

/* ==========================================================================
   Survival Status Bar (Last Man Standing)
   ========================================================================== */
.survival-status-bar {
  padding: 0.55rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 15;
  transition: all 0.25s ease;
  background: rgba(225, 29, 72, 0.1);
  border-bottom: 1px solid rgba(244, 63, 94, 0.25);
}

[data-theme="light"] .survival-status-bar {
  background: #fff1f2;
  border-bottom: 1px solid #fecdd3;
}

.survival-status-bar.hidden {
  display: none;
}

.survival-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.survival-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #e11d48;
  animation: pulseIndicator 1.5s infinite;
}

.survival-badge {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  color: #f43f5e;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

[data-theme="light"] .survival-badge {
  color: #9f1239;
}

.standing-count-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-surface);
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .standing-count-label {
  color: #881337;
  border-color: #fecdd3;
  background: #ffffff;
}

.survival-hint-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

[data-theme="light"] .survival-hint-text {
  color: #be123c;
}

/* ==========================================================================
   Arena Podium: The Rising Columns Stage
   ========================================================================== */
.arena-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem 2rem 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg-primary);
}

.arena-background-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 1.75rem;
  pointer-events: none;
  z-index: 1;
}

.grid-line {
  position: absolute;
  left: 2rem;
  right: 2rem;
  border-bottom: 1px dashed var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.grid-line span {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  transform: translateY(-50%);
  background: var(--bg-primary);
  padding: 0 0.5rem;
  border-radius: var(--radius-full);
}

/* Columns Track Stage */
.columns-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.25rem;
  height: calc(100% - 2.5rem);
  min-height: 380px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Individual Column Unit */
.column-unit {
  flex: 1;
  max-width: 180px;
  min-width: 125px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.tower-bar-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

/* Floating Head & High Contrast Score Pill */
.column-floating-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 4;
}

.rank-crown {
  font-size: 1.35rem;
  margin-bottom: -0.25rem;
  animation: floatBounce 2.5s ease-in-out infinite alternate;
}

@keyframes floatBounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

/* The High Contrast Score Badge — 100% Legible from 25 feet away! */
.score-bubble {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  padding: 0.2rem 0.85rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  transition: transform 0.2s ease;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 2.5px solid var(--player-color, #4f46e5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .score-bubble {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--player-color, #4f46e5);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .score-bubble {
  background: #0f172a;
  color: #ffffff;
  border-color: var(--player-color, #818cf8);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.score-bubble.score-bump {
  animation: scorePunch 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scorePunch {
  0% { transform: scale(1); }
  40% { transform: scale(1.3) rotate(-3deg); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.score-unit-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* The Physical Rising Pillar */
.pillar-bar {
  width: 100%;
  min-height: 24px;
  border-radius: var(--radius-md) var(--radius-md) 4px 4px;
  background: linear-gradient(180deg, var(--player-color) 0%, var(--player-color-dark) 100%);
  border: 1px solid var(--player-color);
  border-bottom: none;
  position: relative;
  transition: height 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.pillar-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.pillar-bar:hover {
  filter: brightness(1.08);
}

/* Floating Click Indicator */
.pop-score-indicator {
  position: absolute;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 10;
  animation: floatAndFade 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] .pop-score-indicator {
  color: #0f172a;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.95), 0 2px 5px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .pop-score-indicator {
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

@keyframes floatAndFade {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  25% { opacity: 1; transform: translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-75px) scale(0.9); }
}

/* ==========================================================================
   Consolidated Participant Control Card (Clean & Unified)
   ========================================================================== */
.participant-base-control {
  width: 100%;
  margin-top: 0.65rem;
  z-index: 5;
}

.participant-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: 3.5px solid var(--player-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.participant-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevation);
}

/* Card Header: Hotkey, Name, and Mini Tools */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.btn-hotkey-badge {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

[data-theme="light"] .btn-hotkey-badge {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.hotkey-spacer {
  width: 16px;
}

.player-display-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  cursor: pointer;
}

.player-display-name:hover {
  color: var(--player-color);
}

.column-sub-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.sub-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.35rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-smooth);
  line-height: 1;
}

.sub-btn:hover {
  color: var(--text-main);
  border-color: var(--border-active);
}

.sub-btn.minus-btn:hover {
  color: #f43f5e;
  border-color: #f43f5e;
}

/* Card Action Area */
.card-action-row {
  width: 100%;
}

.win-fail-control-group {
  display: flex;
  gap: 0.35rem;
  width: 100%;
}

/* Crisp, Solid High-Contrast Action Buttons */
.btn-win {
  flex: 1.25;
  background: #059669;
  color: #ffffff;
  border: 1px solid #047857;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.35rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.25);
  transition: var(--transition-smooth);
}

.btn-win:hover {
  background: #047857;
  transform: translateY(-1px);
}

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

.btn-win-classic {
  flex: 1;
  background: #2563eb;
  border-color: #1d4ed8;
}

.btn-win-classic:hover {
  background: #1d4ed8;
}

.btn-fail {
  flex: 1;
  background: #e11d48;
  color: #ffffff;
  border: 1px solid #be123c;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.35rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  box-shadow: 0 1px 3px rgba(225, 29, 72, 0.25);
  transition: var(--transition-smooth);
}

.btn-fail:hover {
  background: #be123c;
  transform: translateY(-1px);
}

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

/* Exited / Stepped Down State */
.column-unit.is-eliminated {
  opacity: 0.65;
  transition: var(--transition-bounce);
}

.column-unit.is-eliminated:hover {
  opacity: 0.92;
}

.column-unit.is-eliminated .pillar-bar {
  background: #475569 !important;
  border-color: #64748b !important;
}

.eliminated-overlay-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #0f172a;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 8;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .eliminated-overlay-badge {
  background: #ffffff;
  color: #e11d48;
  border: 1px solid #fecdd3;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.12);
}

.btn-revive {
  width: 100%;
  background: #d97706;
  color: #ffffff;
  border: 1px solid #b45309;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-revive:hover {
  background: #b45309;
  transform: translateY(-1px);
}

/* Hotkey Banner */
.hotkey-banner {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 0.45rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hint-tag {
  color: var(--accent-amber);
  font-weight: 800;
}

kbd {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.74rem;
  font-family: inherit;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] kbd {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* ==========================================================================
   Summary Footer Bar — Exact match for User Specification:
   "at the bottom, they can also see total scores for example: John- 5, Andrew 7, Amy - 10"
   ========================================================================== */
.summary-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 0.85rem 1.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 20;
}

[data-theme="light"] .summary-footer {
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.03);
}

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

.summary-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.summary-indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #10b981;
  animation: pulseIndicator 2s infinite;
}

@keyframes pulseIndicator {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.summary-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.summary-subtitle {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Horizontal Score Pills Ribbon */
.summary-scores-tape {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.2rem 0.2rem 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-active) transparent;
}

/* High Contrast Summary Chip (e.g. John - 5) */
.summary-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem 0.35rem 0.45rem;
  transition: var(--transition-bounce);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .summary-chip {
  background: #ffffff;
  border-color: #e2e8f0;
}

.summary-chip:hover {
  border-color: var(--chip-color, #4f46e5);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevation);
}

.chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--chip-color, #4f46e5);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
}

.chip-divider {
  color: var(--text-dim);
  font-weight: 600;
}

/* Pill badge around score guaranteeing 100% readability */
.chip-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-surface-elevated);
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .chip-score {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

/* Leader chip styling */
.summary-chip.leader {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

[data-theme="light"] .summary-chip.leader {
  background: #fffbeb;
  border-color: #f59e0b;
}

[data-theme="light"] .summary-chip.leader .chip-score {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.summary-chip.is-chip-eliminated {
  opacity: 0.6;
  filter: grayscale(0.7);
}

.summary-chip.is-chip-eliminated .chip-score {
  text-decoration: line-through;
  color: #e11d48;
}

.chip-out-tag {
  font-size: 0.65rem;
  font-weight: 800;
  color: #e11d48;
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.25);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: auto;
  padding: 3rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-lg);
  max-width: 460px;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */
.roster-modal {
  margin: auto;
  border: none;
  background: transparent;
  padding: 1rem;
  max-width: 580px;
  width: 92%;
  z-index: 100;
}

.roster-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

[data-theme="light"] .modal-card {
  background: #ffffff;
  border-color: #cbd5e1;
}

.modal-card-sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.modal-close {
  background: var(--bg-surface-elevated);
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

.count-generator-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.divider-text {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.85rem 0 0.65rem;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.divider-text span {
  padding: 0 0.75rem;
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button input,
.edit-name-form input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.95rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-with-button input:focus,
.edit-name-form input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.quick-templates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.quick-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  width: 100%;
}

.btn-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-chip:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.btn-chip-danger {
  color: #e11d48;
  border-color: rgba(225, 29, 72, 0.3);
}

.btn-chip-danger:hover {
  background: rgba(225, 29, 72, 0.1);
}

.roster-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.roster-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.roster-hint {
  font-size: 0.72rem;
  color: var(--brand-accent-color);
  text-transform: none;
  font-weight: 600;
}

.roster-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.35rem;
}

.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
}

.roster-player-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.color-orb-picker {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 2px solid #ffffff;
  background: var(--item-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.roster-name-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  outline: none;
  width: 150px;
  max-width: 100%;
}

.roster-score-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-surface);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.roster-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

/* Toast notification */
.toast-notice {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-active);
  box-shadow: var(--shadow-elevation);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Champion Modal */
.champion-modal {
  max-width: 480px;
}

.champion-card {
  text-align: center;
  background: var(--bg-surface);
  border: 2px solid #f59e0b;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.25);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: var(--radius-lg);
}

.champion-trophy-glow {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.champion-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 900;
  color: #d97706;
}

.champion-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.champion-profile {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin: 1.25rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.champion-avatar {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--champ-color, #4f46e5);
}

.champion-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
}

.champion-stat-badge {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.25);
  padding: 0.3rem 1rem;
  border-radius: var(--radius-full);
}

.champion-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .app-header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .brand-title {
    font-size: 1.2rem;
  }

  .arena-container {
    padding: 1rem 1rem 1.25rem;
  }

  .columns-stage {
    gap: 0.85rem;
  }

  .column-unit {
    min-width: 110px;
  }

  .score-bubble {
    font-size: 1.2rem;
    padding: 0.15rem 0.65rem;
  }

  .summary-footer {
    padding: 0.75rem 1rem 0.85rem;
  }
}
