/**
 * 元素物語 (Element Saga) — 雙主題 Token 架構與 WCAG 視覺樣式庫
 */

/* =========================================================
   1. CSS Custom Properties (Design Tokens)
   ========================================================= */

:root,
:root[data-theme='dark'] {
  --color-scheme: dark;

  /* Layout & Surfaces */
  --color-bg-page: #020617;
  --color-bg-app: #0f172a;
  --color-bg-panel: #1e293b;
  --color-bg-card: #1e293b;
  --color-bg-card-hover: #334155;
  --color-bg-empty-cell: #0f172a;

  /* Borders & Dividers */
  --color-border-main: #334155;
  --color-border-subtle: #475569;
  --color-border-cell: rgba(255, 255, 255, 0.1);
  --color-border-empty-cell: #334155;

  /* Typography */
  --color-text-main: #f8fafc;
  --color-text-sub: #cbd5e1;
  --color-text-muted: #94a3b8;
  --color-text-dim: #64748b;
  --color-text-title: #38bdf8;
  --color-text-accent: #fbbf24;
  --color-text-success: #4ade80;
  --color-text-warning: #fbbf24;
  --color-text-danger: #ef4444;

  /* Shadows */
  --shadow-app: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-cell: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-hud: 0 2px 6px rgba(0, 0, 0, 0.25);

  /* Operation Modes */
  --color-mode-connect-active-bg: #0284c7;
  --color-mode-connect-active-border: #38bdf8;
  --color-mode-connect-text: #ffffff;

  --color-mode-swap-active-bg: #b45309;
  --color-mode-swap-active-border: #fbbf24;
  --color-mode-swap-text: #ffffff;

  --color-mode-trash-active-bg: #dc2626;
  --color-mode-trash-active-border: #ef4444;
  --color-mode-trash-text: #ffffff;

  /* Interaction Feedback */
  --color-selection-border: #fbbf24;
  --color-selection-glow: rgba(251, 191, 36, 0.8);
  --color-path-border: #38bdf8;
  --color-path-glow: rgba(56, 189, 248, 0.9);
  --color-path-badge-bg: #38bdf8;
  --color-path-badge-text: #0f172a;

  /* Element Cards - Dark Solid Glow Theme */
  --cell-H-bg: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --cell-H-text: #ffffff;
  --cell-H-subtext: #bae6fd;

  --cell-O-bg: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  --cell-O-text: #ffffff;
  --cell-O-subtext: #fecaca;

  --cell-N-bg: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  --cell-N-text: #ffffff;
  --cell-N-subtext: #ddd6fe;

  --cell-Cl-bg: linear-gradient(135deg, #059669 0%, #047857 100%);
  --cell-Cl-text: #ffffff;
  --cell-Cl-subtext: #a7f3d0;

  --cell-C-bg: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  --cell-C-text: #f3f4f6;
  --cell-C-subtext: #9ca3af;

  --cell-complex-bg: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --cell-complex-text: #ffffff;
  --cell-complex-subtext: #c7d2fe;

  /* Podium Medals & Pedestals */
  --podium-gold: #f59e0b;
  --podium-gold-bg: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  --podium-silver: #94a3b8;
  --podium-silver-bg: linear-gradient(180deg, #cbd5e1 0%, #64748b 100%);
  --podium-bronze: #b45309;
  --podium-bronze-bg: linear-gradient(180deg, #d97706 0%, #78350f 100%);

  /* Theme Toggle Button */
  --color-theme-toggle-bg: #1e293b;
  --color-theme-toggle-border: #475569;
  --color-theme-toggle-text: #f8fafc;
}

:root[data-theme='light'] {
  --color-scheme: light;

  /* Layout & Surfaces */
  --color-bg-page: #f1f5f9;
  --color-bg-app: #ffffff;
  --color-bg-panel: #f8fafc;
  --color-bg-card: #f8fafc;
  --color-bg-card-hover: #e2e8f0;
  --color-bg-empty-cell: #f1f5f9;

  /* Borders & Dividers */
  --color-border-main: #e2e8f0;
  --color-border-subtle: #cbd5e1;
  --color-border-cell: rgba(15, 23, 42, 0.12);
  --color-border-empty-cell: #cbd5e1;

  /* Typography */
  --color-text-main: #0f172a;
  --color-text-sub: #334155;
  --color-text-muted: #475569;
  --color-text-dim: #64748b;
  --color-text-title: #0284c7;
  --color-text-accent: #d97706;
  --color-text-success: #16a34a;
  --color-text-warning: #d97706;
  --color-text-danger: #dc2626;

  /* Shadows */
  --shadow-app: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
  --shadow-cell: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-hud: 0 1px 3px rgba(0, 0, 0, 0.08);

  /* Operation Modes */
  --color-mode-connect-active-bg: #0284c7;
  --color-mode-connect-active-border: #0369a1;
  --color-mode-connect-text: #ffffff;

  --color-mode-swap-active-bg: #d97706;
  --color-mode-swap-active-border: #b45309;
  --color-mode-swap-text: #ffffff;

  --color-mode-trash-active-bg: #dc2626;
  --color-mode-trash-active-border: #b91c1c;
  --color-mode-trash-text: #ffffff;

  /* Interaction Feedback (WCAG AA+ High Contrast) */
  --color-selection-border: #d97706;
  --color-selection-glow: rgba(217, 119, 6, 0.4);
  --color-path-border: #0284c7;
  --color-path-glow: rgba(2, 132, 199, 0.4);
  --color-path-badge-bg: #0284c7;
  --color-path-badge-text: #ffffff;

  /* Element Cards - Light Pastel High-Contrast Theme */
  --cell-H-bg: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  --cell-H-text: #0369a1;
  --cell-H-subtext: #0284c7;

  --cell-O-bg: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  --cell-O-text: #b91c1c;
  --cell-O-subtext: #991b1b;

  --cell-N-bg: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  --cell-N-text: #6d28d9;
  --cell-N-subtext: #581c87;

  --cell-Cl-bg: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  --cell-Cl-text: #047857;
  --cell-Cl-subtext: #065f46;

  --cell-C-bg: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --cell-C-text: #1e293b;
  --cell-C-subtext: #334155;

  --cell-complex-bg: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  --cell-complex-text: #4338ca;
  --cell-complex-subtext: #3730a3;

  /* Podium Medals & Pedestals */
  --podium-gold: #d97706;
  --podium-gold-bg: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  --podium-silver: #64748b;
  --podium-silver-bg: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  --podium-bronze: #92400e;
  --podium-bronze-bg: linear-gradient(180deg, #ffedd5 0%, #fed7aa 100%);

  /* Theme Toggle Button */
  --color-theme-toggle-bg: #f8fafc;
  --color-theme-toggle-border: #cbd5e1;
  --color-theme-toggle-text: #0f172a;
}

/* =========================================================
   2. Component CSS Classes
   ========================================================= */

.element-saga-app {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  background: var(--color-bg-app);
  color: var(--color-text-main);
  border-radius: 16px;
  box-shadow: var(--shadow-app);
  border: 1px solid var(--color-border-main);
  user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Header & HUD */
.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-main);
}

.hud-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-title);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: normal;
}

.hud-solutions-count {
  font-size: 12px;
  color: var(--color-text-dim);
  margin-top: 2px;
}

.hud-solutions-highlight {
  color: var(--color-text-success);
  font-weight: bold;
}

.hud-stats-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hud-card {
  background: var(--color-bg-card);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  text-align: center;
  box-shadow: var(--shadow-hud);
  min-width: 68px;
}

.hud-card-label {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.hud-card-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.hud-card-value.moves-normal {
  color: var(--color-text-title);
}

.hud-card-value.moves-warning {
  color: var(--color-text-danger);
}

.hud-card-value.score {
  color: var(--color-text-accent);
}

.hud-card-max {
  font-size: 12px;
  color: var(--color-text-dim);
  font-weight: normal;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--color-theme-toggle-bg);
  border: 1px solid var(--color-theme-toggle-border);
  color: var(--color-theme-toggle-text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.theme-toggle-btn:hover {
  background: var(--color-bg-card-hover);
}

/* Mode Selector Toolbar */
.mode-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: space-between;
  align-items: center;
}

.mode-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid var(--color-border-subtle);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--color-bg-card);
  color: var(--color-text-main);
  transition: all 0.15s ease;
}

.mode-btn:hover {
  background: var(--color-bg-card-hover);
}

.mode-btn.active-connect {
  border-color: var(--color-mode-connect-active-border);
  background: var(--color-mode-connect-active-bg);
  color: var(--color-mode-connect-text);
}

.mode-btn.active-swap {
  border-color: var(--color-mode-swap-active-border);
  background: var(--color-mode-swap-active-bg);
  color: var(--color-mode-swap-text);
}

.mode-btn.active-trash {
  border-color: var(--color-mode-trash-active-border);
  background: var(--color-mode-trash-active-bg);
  color: var(--color-mode-trash-text);
}

.btn-shuffle {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-card);
  color: var(--color-text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-shuffle:hover {
  background: var(--color-bg-card-hover);
}

/* Mode Instruction Banner */
.mode-instruction-banner {
  background: var(--color-bg-panel);
  border-left: 4px solid var(--color-border-subtle);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border-main);
  border-right: 1px solid var(--color-border-main);
  border-bottom: 1px solid var(--color-border-main);
}

.mode-instruction-banner.mode-connect {
  border-left-color: var(--color-path-border);
}

.mode-instruction-banner.mode-swap {
  border-left-color: var(--color-selection-border);
}

.mode-instruction-banner.mode-trash {
  border-left-color: var(--color-text-danger);
}

.selected-indicator {
  color: var(--color-text-accent);
  font-weight: bold;
}

/* Grid Board */
.grid-board-container {
  background: var(--color-bg-panel);
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--color-border-main);
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.grid-board {
  display: grid;
  gap: 8px;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Grid Cell Styles */
.grid-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid var(--color-border-cell);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--shadow-cell);
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: none !important;
}

.grid-cell-empty {
  aspect-ratio: 1;
  background: var(--color-bg-empty-cell);
  border-radius: 8px;
  border: 1px dashed var(--color-border-empty-cell);
}

/* Element Specific Variants */
.grid-cell-H {
  background: var(--cell-H-bg);
}
.grid-cell-H .cell-symbol {
  color: var(--cell-H-text);
}
.grid-cell-H .cell-label {
  color: var(--cell-H-subtext);
}

.grid-cell-O {
  background: var(--cell-O-bg);
}
.grid-cell-O .cell-symbol {
  color: var(--cell-O-text);
}
.grid-cell-O .cell-label {
  color: var(--cell-O-subtext);
}

.grid-cell-N {
  background: var(--cell-N-bg);
}
.grid-cell-N .cell-symbol {
  color: var(--cell-N-text);
}
.grid-cell-N .cell-label {
  color: var(--cell-N-subtext);
}

.grid-cell-Cl {
  background: var(--cell-Cl-bg);
}
.grid-cell-Cl .cell-symbol {
  color: var(--cell-Cl-text);
}
.grid-cell-Cl .cell-label {
  color: var(--cell-Cl-subtext);
}

.grid-cell-C {
  background: var(--cell-C-bg);
}
.grid-cell-C .cell-symbol {
  color: var(--cell-C-text);
}
.grid-cell-C .cell-label {
  color: var(--cell-C-subtext);
}

.grid-cell-complex {
  background: var(--cell-complex-bg);
}
.grid-cell-complex .cell-symbol {
  color: var(--cell-complex-text);
}
.grid-cell-complex .cell-label {
  color: var(--cell-complex-subtext);
}

/* Cell State Highlighting */
.grid-cell.selected {
  border: 3px solid var(--color-selection-border) !important;
  transform: scale(1.06);
  box-shadow: 0 0 16px var(--color-selection-glow) !important;
  z-index: 2;
}

.grid-cell.in-path {
  border: 3px solid var(--color-path-border) !important;
  transform: scale(1.06);
  box-shadow: 0 0 16px var(--color-path-glow) !important;
  z-index: 2;
}

/* Path Badge */
.path-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-path-badge-bg);
  color: var(--color-path-badge-text);
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.cell-symbol {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.cell-symbol.is-complex {
  font-size: 14px;
}

.cell-label {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
  pointer-events: none;
}

/* Recipe Reference Footer */
.recipe-reference-footer {
  margin-top: 16px;
  background: var(--color-bg-panel);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border-main);
  font-size: 12px;
  color: var(--color-text-muted);
}

.recipe-title {
  font-weight: 700;
  color: var(--color-text-sub);
  margin-bottom: 4px;
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

/* Action Log Feed */
.action-log-feed {
  margin-top: 12px;
  font-size: 11px;
  color: var(--color-text-dim);
  max-height: 80px;
  overflow-y: auto;
}

.action-log-title {
  font-weight: 600;
  color: var(--color-text-muted);
}

/* =========================================================
   3. Ticket 05: Timer, STRT Valve, Quiz Drawer & Lock Overlay
   ========================================================= */

/* Timer HUD Card & Progress Bar */
.hud-timer-card {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.hud-timer-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-border-main);
}

.hud-timer-progress-bar {
  height: 100%;
  background: var(--color-text-title);
  transition: width 0.1s linear, background-color 0.2s ease;
}

.hud-timer-progress-bar.alert {
  background: var(--color-text-danger);
}

.timer-text-alert {
  color: var(--color-text-danger) !important;
  font-weight: 900;
}

@keyframes timerAlertPulseAnim {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    border-color: var(--color-text-danger);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.8);
    border-color: #f87171;
  }
}

.timer-alert-pulse {
  animation: timerAlertPulseAnim 1s infinite ease-in-out;
  border-color: var(--color-text-danger) !important;
}

/* Secondary Task: Laboratory Pressure Valve Widget */
.valve-widget {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-hud);
}

.valve-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.valve-text-group {
  display: flex;
  flex-direction: column;
}

.valve-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-main);
}

.valve-status-text {
  font-size: 11px;
  color: var(--color-text-muted);
}

.valve-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-border-subtle);
  border: 2px solid var(--color-border-main);
  transition: all 0.2s ease;
}

.valve-idle {
  background: #38bdf8;
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.5);
}

@keyframes valveFlashingPulse {
  0%, 100% {
    background-color: #ef4444;
    box-shadow: 0 0 4px 1px rgba(239, 68, 68, 0.6);
    transform: scale(1);
  }
  50% {
    background-color: #dc2626;
    box-shadow: 0 0 16px 4px rgba(239, 68, 68, 0.95);
    transform: scale(1.25);
  }
}

.valve-flashing {
  background: #ef4444;
  border-color: #fee2e2;
  animation: valveFlashingPulse 0.6s infinite ease-in-out;
}

.valve-venting {
  background: #22c55e;
  border-color: #bbf7d0;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
  transform: scale(1.1);
}

.valve-missed {
  background: #f59e0b;
  border-color: #fef3c7;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.valve-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-card);
  color: var(--color-text-dim);
  cursor: not-allowed;
  transition: all 0.15s ease;
}

.valve-btn.btn-vent-urgent {
  background: #ef4444;
  color: #ffffff;
  border-color: #f87171;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
  animation: valveFlashingPulse 0.6s infinite ease-in-out;
}

.valve-btn.btn-vent-urgent:hover {
  background: #dc2626;
}

/* In-Game Quiz Drawer */
.quiz-drawer-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: auto;
}

.quiz-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.25s ease-out;
}

.quiz-drawer-card {
  position: relative;
  width: 100%;
  max-width: 600px;
  background: var(--color-bg-panel);
  border: 2px solid var(--color-text-accent);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 16px 20px 24px 20px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.quiz-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.quiz-badge {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text-accent);
  background: rgba(251, 191, 36, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-text-accent);
}

.quiz-timer-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-title);
}

.quiz-timer-track {
  width: 100%;
  height: 6px;
  background: var(--color-border-main);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.quiz-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 0.1s linear, background-color 0.2s ease;
}

.quiz-timer-bar.urgent {
  background: var(--color-text-danger);
}

.quiz-question-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 14px;
  line-height: 1.4;
}

.quiz-options-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.quiz-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-main);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-option-btn:hover:not(:disabled) {
  background: var(--color-bg-card-hover);
  border-color: var(--color-text-title);
  transform: translateY(-1px);
}

.quiz-option-btn .option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--color-bg-panel);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-title);
  flex-shrink: 0;
}

.quiz-option-btn.correct {
  background: #15803d !important;
  border-color: #4ade80 !important;
  color: #ffffff !important;
}

.quiz-option-btn.wrong {
  background: #b91c1c !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
}

.quiz-feedback {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 8px;
  animation: fadeIn 0.2s ease-out;
}

.feedback-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: var(--color-text-success);
}

.feedback-error,
.feedback-timeout {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: var(--color-text-danger);
}

.feedback-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.feedback-desc {
  font-size: 11px;
  opacity: 0.9;
}

/* Board Locked Overlay */
.grid-board-container {
  position: relative;
}

.board-locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  animation: fadeIn 0.3s ease-out;
}

:root[data-theme='light'] .board-locked-overlay {
  background: rgba(241, 245, 249, 0.9);
}

.locked-card {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border-subtle);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: center;
  max-width: 320px;
  box-shadow: var(--shadow-app);
}

.locked-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.locked-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text-danger);
  margin-bottom: 6px;
}

.locked-score-row {
  font-size: 14px;
  color: var(--color-text-main);
  margin-bottom: 8px;
}

.locked-score-value {
  color: var(--color-text-accent);
  font-size: 20px;
  font-weight: 800;
}

.locked-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.locked-restart-btn {
  background: var(--color-mode-connect-active-bg);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.locked-restart-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* =========================================================
   4. Ticket 06: Micro-Assessment, Delta-Score Badge & Session Summary
   ========================================================= */

/* Micro-Assessment Overlay & Card */
.assessment-card-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

:root[data-theme='light'] .assessment-card-overlay {
  background: rgba(241, 245, 249, 0.88);
}

.assessment-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--color-bg-app);
  border: 2px solid var(--color-text-title);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.assessment-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-title);
  background: rgba(56, 189, 248, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-text-title);
}

.assessment-tag {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.assessment-prompt {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text-main);
  margin: 0 0 10px 0;
}

.assessment-question-content {
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-sub);
  margin-bottom: 18px;
  padding: 12px;
  background: var(--color-bg-panel);
  border-radius: 8px;
  border-left: 4px solid var(--color-text-title);
}

.assessment-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.assessment-option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border-subtle);
  color: var(--color-text-main);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.assessment-option-item:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-text-title);
  transform: translateX(2px);
}

.assessment-option-item.selected {
  background: rgba(56, 189, 248, 0.18) !important;
  border-color: var(--color-text-title) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

:root[data-theme='light'] .assessment-option-item.selected {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}

.option-index-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text-title);
  flex-shrink: 0;
}

.assessment-option-item.selected .option-index-badge {
  background: var(--color-text-title);
  color: #ffffff;
}

.option-text {
  flex-grow: 1;
}

.assessment-action-bar {
  display: flex;
  justify-content: flex-end;
}

.assessment-submit-btn {
  background: var(--color-mode-connect-active-bg);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.assessment-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.assessment-submit-btn:not(:disabled):hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* 3-2-1 Opening Countdown Overlay */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(5px);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease-out;
}

.countdown-number {
  font-size: 80px;
  font-weight: 900;
  color: var(--color-text-accent);
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
  animation: countdownZoom 1s infinite ease-out;
}

.countdown-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-main);
  margin-top: 10px;
}

@keyframes countdownZoom {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

/* Growth Badge (ΔScore) */
.delta-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  margin-top: 12px;
}

.delta-score-badge.badge-positive {
  background: rgba(34, 197, 94, 0.18);
  border: 2px solid #22c55e;
  color: var(--color-text-success);
}

.delta-score-badge.badge-neutral {
  background: rgba(56, 189, 248, 0.18);
  border: 2px solid #38bdf8;
  color: var(--color-text-title);
}

.delta-score-badge.badge-negative {
  background: rgba(251, 191, 36, 0.18);
  border: 2px solid #fbbf24;
  color: var(--color-text-warning);
}

/* Session Summary View */
.session-summary-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  animation: fadeIn 0.3s ease-out;
  border-radius: 12px;
}

.session-summary-card {
  width: 100%;
  max-width: 480px;
  background: var(--color-bg-app);
  border: 2px solid var(--color-border-main);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border-main);
  padding-bottom: 12px;
}

.summary-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-emoji {
  font-size: 22px;
}

.summary-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  color: var(--color-text-title);
}

.summary-upload-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.summary-upload-status.synced {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-text-success);
  border: 1px solid #22c55e;
}

.summary-upload-status.uploading {
  background: rgba(56, 189, 248, 0.15);
  color: var(--color-text-title);
  border: 1px solid #38bdf8;
}

.summary-upload-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-text-danger);
  border: 1px solid #ef4444;
}

.summary-hero-score {
  text-align: center;
  background: var(--color-bg-panel);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--color-border-subtle);
}

.hero-score-label {
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.hero-score-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--color-text-accent);
  line-height: 1.2;
}

.summary-growth-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-bg-panel);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--color-border-subtle);
}

.assessment-scores-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.assessment-score-box {
  text-align: center;
  min-width: 90px;
}

.score-box-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.score-box-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text-main);
}

.score-box-val.highlight {
  color: var(--color-text-success);
}

.score-unit {
  font-size: 12px;
  color: var(--color-text-dim);
  font-weight: normal;
}

.score-arrow {
  font-size: 18px;
  color: var(--color-text-dim);
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.summary-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg-card);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
}

.stat-icon {
  font-size: 20px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  color: var(--color-text-muted);
}

.stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-main);
}

.summary-action-bar {
  display: flex;
  justify-content: center;
}

.summary-restart-btn {
  width: 100%;
  background: var(--color-mode-connect-active-bg);
  color: #ffffff;
  border: none;
  padding: 12px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.summary-restart-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* =========================================================
   5. Ticket 07: Teacher Dashboard, Submission Aggregator & Podium Reveal
   ========================================================= */

/* ─── Teacher Dashboard View ─── */
.teacher-dashboard-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  background: var(--color-bg-app);
  color: var(--color-text-main);
  border-radius: 20px;
  box-shadow: var(--shadow-app);
  border: 1px solid var(--color-border-main);
  animation: fadeIn 0.3s ease-out;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-main);
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  font-size: 32px;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  color: var(--color-text-title);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-room-card {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-text-title);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-hud);
}

.room-code-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-title);
  background: rgba(56, 189, 248, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.room-code-display {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--color-text-accent);
  margin-bottom: 12px;
  font-family: monospace;
}

.room-qr-wrapper {
  background: var(--color-bg-card);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 12px;
}

.room-qr-wrapper:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.room-qr-preview svg {
  display: block;
  margin: 0 auto;
}

.room-qr-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.room-join-instruction {
  font-size: 12px;
  color: var(--color-text-dim);
  line-height: 1.4;
}

.dashboard-students-card {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.students-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.students-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
}

.students-count-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-success);
  background: rgba(34, 197, 94, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #22c55e;
}

.students-wall-container {
  flex-grow: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}

.student-avatar-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease-out backwards;
}

.student-avatar-item:hover {
  border-color: var(--color-text-title);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hud);
}

.student-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.student-avatar-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-main);
  max-width: 95px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-avatar-code {
  font-size: 10px;
  color: var(--color-text-dim);
}

.students-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 13px;
}

.dashboard-action-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 14px;
  padding: 14px 20px;
}

.dashboard-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.status-indicator-text {
  font-size: 13px;
  color: var(--color-text-sub);
}

.btn-start-game-large {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  font-size: 16px;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-start-game-large:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

/* QR Code 放大投影 Modal */
.dashboard-qr-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.25s ease-out;
}

.qr-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.qr-modal-card {
  position: relative;
  background: #ffffff;
  color: #0f172a;
  padding: 32px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  max-width: 480px;
  width: 90%;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.qr-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
}

.qr-modal-close:hover {
  color: #0f172a;
}

.qr-modal-title {
  margin: 0 0 6px 0;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.qr-modal-code {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #0284c7;
  margin-bottom: 16px;
  font-family: monospace;
}

.qr-modal-svg-box {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.qr-modal-url {
  font-size: 11px;
  color: #64748b;
  word-break: break-all;
}

/* ─── Submission Aggregator View ─── */
.submission-aggregator-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  background: var(--color-bg-app);
  color: var(--color-text-main);
  border-radius: 20px;
  box-shadow: var(--shadow-app);
  border: 1px solid var(--color-border-main);
}

.aggregator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-main);
}

.aggregator-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  color: var(--color-text-title);
}

.aggregator-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.btn-reveal-podium {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
  transition: all 0.2s ease;
}

.btn-reveal-podium:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.6);
}

.aggregator-progress-card {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.progress-status-label {
  color: var(--color-text-main);
}

.progress-percentage-label {
  color: var(--color-text-title);
  font-size: 16px;
  font-weight: 900;
}

.progress-bar-track {
  width: 100%;
  height: 12px;
  background: var(--color-bg-card);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #4ade80 100%);
  border-radius: 6px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.aggregator-cards-section {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 14px;
  padding: 20px;
}

.cards-section-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-sub);
  margin-bottom: 16px;
}

.submitted-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.submitted-student-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.2s ease;
  animation: slideUp 0.3s ease-out backwards;
}

.submitted-student-card:hover {
  border-color: var(--color-text-title);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hud);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-student-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-main);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delta-mini-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
}

.delta-mini-badge.badge-positive {
  background: rgba(34, 197, 94, 0.18);
  color: var(--color-text-success);
  border: 1px solid #22c55e;
}

.delta-mini-badge.badge-neutral {
  background: rgba(56, 189, 248, 0.18);
  color: var(--color-text-title);
  border: 1px solid #38bdf8;
}

.delta-mini-badge.badge-negative {
  background: rgba(251, 191, 36, 0.18);
  color: var(--color-text-warning);
  border: 1px solid #fbbf24;
}

.card-score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.card-score-label {
  font-size: 11px;
  color: var(--color-text-muted);
}

.card-score-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--color-text-accent);
}

.card-test-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--color-text-dim);
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 6px;
}

.stat-divider {
  color: var(--color-border-subtle);
}

.submissions-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--color-text-muted);
}

/* Jackpot Toasts */
.jackpot-toasts-overlay {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.jackpot-toast-item {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-text-accent);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  animation: slideInRight 0.3s ease-out;
  pointer-events: auto;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.jackpot-icon {
  font-size: 24px;
}

.jackpot-text {
  font-size: 13px;
  color: var(--color-text-main);
}

.jackpot-student {
  font-weight: 800;
  color: var(--color-text-title);
}

/* ─── Podium Reveal View ─── */
.podium-reveal-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  background: var(--color-bg-app);
  color: var(--color-text-main);
  border-radius: 20px;
  box-shadow: var(--shadow-app);
  border: 1px solid var(--color-border-main);
  animation: fadeIn 0.4s ease-out;
}

.podium-header {
  text-align: center;
  margin-bottom: 28px;
}

.podium-trophy-icon {
  font-size: 40px;
  margin-bottom: 6px;
}

.podium-main-title {
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 6px 0;
  color: var(--color-text-accent);
}

.podium-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* 3-Tier Podium Stage */
.podium-stage-section {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 16px;
  padding: 30px 20px 20px 20px;
  margin-bottom: 28px;
}

.podium-stage {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  min-height: 280px;
}

.podium-pillar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: podiumRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  position: relative;
}

@keyframes podiumRise {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.crown-icon {
  font-size: 28px;
  margin-bottom: 2px;
  animation: crownFloat 2s ease-in-out infinite alternate;
}

@keyframes crownFloat {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-6px);
  }
}

.pedestal-student-info {
  text-align: center;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pedestal-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.tier-gold .pedestal-avatar-circle {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  width: 52px;
  height: 52px;
  font-size: 22px;
}

.tier-silver .pedestal-avatar-circle {
  background: linear-gradient(135deg, #cbd5e1 0%, #64748b 100%);
}

.tier-bronze .pedestal-avatar-circle {
  background: linear-gradient(135deg, #d97706 0%, #78350f 100%);
}

.pedestal-student-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: 2px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pedestal-student-score {
  font-size: 18px;
  font-weight: 900;
  color: var(--color-text-accent);
  margin-bottom: 4px;
}

.pedestal-empty-slot {
  text-align: center;
  margin-bottom: 10px;
  color: var(--color-text-dim);
}

.slot-medal {
  font-size: 24px;
}

.slot-label {
  font-size: 12px;
  font-weight: 700;
}

.slot-name {
  font-size: 11px;
}

.podium-block {
  width: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 8px 20px rgba(0, 0, 0, 0.3);
}

.block-gold {
  height: 140px;
  background: var(--podium-gold-bg);
  border: 2px solid #f59e0b;
}

.block-silver {
  height: 100px;
  background: var(--podium-silver-bg);
  border: 2px solid #94a3b8;
}

.block-bronze {
  height: 70px;
  background: var(--podium-bronze-bg);
  border: 2px solid #b45309;
}

.pedestal-rank-num {
  font-size: 36px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Full Rankings Table */
.podium-full-rankings-section {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.rankings-list-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 16px 0;
  color: var(--color-text-title);
}

.rankings-table-container {
  overflow-x: auto;
}

.rankings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rankings-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-border-main);
  color: var(--color-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
}

.rankings-table td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-main);
}

.rank-row.top-rank-row.rank-1 {
  background: rgba(251, 191, 36, 0.08);
}

.rank-row.top-rank-row.rank-2 {
  background: rgba(203, 213, 225, 0.06);
}

.rank-row.top-rank-row.rank-3 {
  background: rgba(217, 119, 6, 0.06);
}

.rank-badge {
  font-weight: 800;
}

.name-cell {
  font-weight: 700;
}

.score-cell {
  font-weight: 900;
  color: var(--color-text-accent);
}

.table-empty-cell {
  text-align: center;
  color: var(--color-text-dim);
  padding: 24px !important;
}

.podium-footer-actions {
  display: flex;
  justify-content: center;
}

.btn-restart-game {
  background: var(--color-mode-connect-active-bg);
  color: #ffffff;
  border: none;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 32px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
}

.btn-restart-game:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ==========================================================================
   Ticket 08: 研究變項控制台視圖 (ExperimentConsoleView)
   ========================================================================== */

.experiment-console-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg-app);
  color: var(--color-text-main);
  padding: 24px;
  box-sizing: border-box;
  font-family: inherit;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-border-main);
  padding-bottom: 16px;
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.console-logo {
  font-size: 36px;
}

.console-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  color: var(--color-text-title);
  letter-spacing: -0.5px;
}

.console-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.console-main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.console-section {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.section-title-group {
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text-title);
  margin: 0 0 4px 0;
}

.section-desc {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Preset Cards Grid */
.preset-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.preset-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border-main);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  outline: none;
}

.preset-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-mode-connect-active-bg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.preset-card.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
}

.preset-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.preset-icon {
  font-size: 28px;
}

.preset-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-amber {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-emerald {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.preset-card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text-title);
  margin-bottom: 2px;
}

.preset-card-subtitle {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-bottom: 8px;
}

.preset-card-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  flex-grow: 1;
}

.preset-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  font-size: 12px;
  color: var(--color-text-main);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preset-card-footer {
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.preset-status-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-accent);
}

.preset-card.active .preset-status-label {
  color: #38bdf8;
}

/* Advanced Section & Form */
.advanced-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.advanced-toggle-btn {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.advanced-params-body {
  margin-top: 20px;
  border-top: 1px solid var(--color-border-main);
  padding-top: 20px;
}

.form-grid-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.form-fieldset {
  border: 1px solid var(--color-border-main);
  border-radius: 12px;
  padding: 16px;
  background: var(--color-bg-card);
}

.fieldset-legend {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-title);
  padding: 0 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dimension-badge {
  font-size: 11px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.form-input,
.form-select {
  background: var(--color-bg-app);
  border: 1px solid var(--color-border-main);
  color: var(--color-text-main);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
  border-color: #38bdf8;
}

.field-hint {
  font-size: 11px;
  color: var(--color-text-dim);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.checkbox-group-horizontal {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.checkbox-label,
.toggle-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Validation Box */
.validation-box-wrapper {
  margin: 4px 0;
}

.validation-box {
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.5;
}

.validation-box-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: var(--color-text-success);
}

.validation-box-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--color-text-danger);
}

.validation-status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.validation-error-list {
  margin: 8px 0 0 0;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.validation-error-item {
  color: var(--color-text-main);
}

.error-field {
  font-weight: 800;
  color: var(--color-text-danger);
}

/* Console Action Card */
.console-action-card {
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border-main);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.action-card-left {
  display: flex;
  align-items: center;
}

.room-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-input-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.room-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-code-input {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--color-bg-app);
  border: 2px solid var(--color-border-main);
  color: var(--color-text-accent);
  border-radius: 8px;
  padding: 8px 14px;
  width: 140px;
  text-align: center;
}

.action-card-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-create-room {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  font-size: 16px;
  font-weight: 900;
  padding: 14px 28px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-create-room:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(2, 132, 199, 0.5);
}

.btn-create-room:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Live Score Stream Ticker */
.live-score-stream-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-warning);
  margin-bottom: 8px;
}

.stream-ticker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  animation: pulseDot 1.5s infinite;
}

/* =========================================================
   6. Ticket 09: AppNavigator, Floating DevToolbox & Telemetry Inspector
   ========================================================= */

/* App Navigator Root & Container */
.app-navigator-root {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-view-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Top Navigation Bar */
.app-nav-bar {
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-main);
  border-radius: 12px;
  padding: 8px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-hud);
  flex-wrap: wrap;
  gap: 10px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand-logo {
  font-size: 20px;
}

.nav-brand-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text-title);
  letter-spacing: 0.5px;
}

.nav-tabs-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-card);
  color: var(--color-text-sub);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-tab-btn:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-text-main);
  border-color: var(--color-text-title);
}

.nav-tab-btn.active {
  background: var(--color-mode-connect-active-bg);
  border-color: var(--color-mode-connect-active-border);
  color: var(--color-mode-connect-text);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

/* Floating Dev Toolbox */
.floating-dev-toolbox {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.floating-dev-toolbox-btn {
  background: #1e293b;
  border: 2px solid #38bdf8;
  color: #38bdf8;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 10px rgba(56, 189, 248, 0.4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-dev-toolbox-btn:hover {
  transform: scale(1.08);
  background: #0f172a;
  border-color: #7dd3fc;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
}

.floating-dev-toolbox-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #ffffff;
}

.dev-toolbox-btn-text {
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  margin-top: 1px;
}

.floating-dev-toolbox-panel {
  position: absolute;
  bottom: 58px;
  right: 0;
  width: 250px;
  background: var(--color-bg-panel);
  border: 2px solid var(--color-border-main);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  flex-direction: column;
  gap: 8px;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme='light'] .floating-dev-toolbox-panel {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.dev-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border-main);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.dev-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text-title);
}

.dev-panel-close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.dev-panel-close-btn:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-text-main);
}

.dev-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  color: var(--color-text-main);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.dev-action-btn:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-text-title);
  transform: translateX(2px);
}

.dev-btn-icon {
  font-size: 14px;
}

.dev-btn-label {
  flex-grow: 1;
}

/* Telemetry Inspector Modal */
.telemetry-inspector-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.telemetry-inspector-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.telemetry-inspector-card {
  position: relative;
  width: 100%;
  max-width: 860px;
  max-height: 80vh;
  background: var(--color-bg-app);
  border: 2px solid var(--color-border-main);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  z-index: 10001;
  overflow: hidden;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-bg-panel);
  border-bottom: 1px solid var(--color-border-main);
  flex-wrap: wrap;
  gap: 10px;
}

.inspector-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inspector-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text-title);
}

.inspector-count-badge {
  font-size: 12px;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--color-text-title);
  color: var(--color-text-title);
  padding: 2px 8px;
  border-radius: 12px;
}

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

.inspector-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: 6px;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.inspector-btn:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-text-title);
}

.inspector-btn-danger {
  color: var(--color-text-danger);
  border-color: var(--color-text-danger);
}

.inspector-btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.inspector-close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.inspector-close-btn:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-text-main);
}

.inspector-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.inspector-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.inspector-table-wrapper {
  overflow-x: auto;
}

.inspector-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.inspector-table th {
  background: var(--color-bg-panel);
  color: var(--color-text-muted);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--color-border-main);
  font-weight: 700;
}

.inspector-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-main);
  vertical-align: top;
}

.inspector-table tr:hover td {
  background: var(--color-bg-card-hover);
}

.cell-idx {
  font-weight: 700;
  color: var(--color-text-dim);
}

.cell-ts, .cell-perf {
  font-family: monospace;
  font-size: 11px;
  color: var(--color-text-sub);
}

.cell-payload {
  max-width: 320px;
  word-break: break-all;
}

.cell-payload code {
  font-family: monospace;
  font-size: 11px;
  background: var(--color-bg-panel);
  padding: 2px 4px;
  border-radius: 4px;
}

.kind-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.kind-game_start, .kind-first_touch {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.kind-swap, .kind-trash_discard {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.kind-compound_clear, .kind-strt_click {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.kind-strt_appear, .kind-quiz_appear {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.kind-invalid_click, .kind-strt_miss, .kind-time_up {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.kind-quiz_answer {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
}
