/* ==========================================================================
   TIME DETECTIVE: HISTORICAL METHOD QUEST - MAIN DESIGN SYSTEM
   Theme: Deep Navy Blue & Soft Blossom Pink (น้ำเงินเข้ม - ชมพูอ่อน)
   กลุ่มสาระการเรียนรู้สังคมศึกษา ศาสนา และวัฒนธรรม (วิชาประวัติศาสตร์ ม.2)
   ========================================================================== */

:root {
  /* Deep Navy & Soft Blossom Pink Palette */
  --bg-primary: #060b19;            /* Deep Midnight Navy */
  --bg-secondary: #0b142d;          /* Deep Royal Navy */
  --bg-card: rgba(13, 23, 50, 0.82); /* Glassy Navy Card */
  --bg-card-hover: rgba(22, 38, 80, 0.92);
  --bg-glass: rgba(11, 20, 44, 0.78);
  
  --accent-cyan: #60a5fa;           /* Vibrant Ice/Sky Blue */
  --accent-primary: #2563eb;        /* Royal Navy Blue */
  --accent-blue: #1d4ed8;           /* Deep Blue */
  --accent-teal: #38bdf8;           /* Sky Blue Glow */
  --accent-gold: #f472b6;           /* Soft Blossom Pink (Primary Accent) */
  --accent-gold-light: #fbcfe8;     /* Pastel Baby Pink */
  --accent-purple: #c084fc;         /* Lavender Blend */
  --accent-pink: #f472b6;           /* Soft Rose Pink */
  --accent-emerald: #38bdf8;        /* Sky Blue Success */
  --accent-rose: #fb7185;           /* Soft Coral Rose */

  /* Gradients */
  --grad-cyan-blue: linear-gradient(135deg, #60a5fa 0%, #2563eb 50%, #1e3a8a 100%);
  --grad-primary: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-gold: linear-gradient(135deg, #fbcfe8 0%, #f472b6 50%, #db2777 100%); /* Soft Pink Gradient */
  --grad-purple: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  --grad-cyber: linear-gradient(135deg, #60a5fa 0%, #3b82f6 40%, #f472b6 100%); /* Navy to Pink */
  --grad-dark: linear-gradient(180deg, rgba(6,11,25,0.9) 0%, rgba(11,20,45,0.96) 100%);

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-glow: #e0e7ff;

  /* Borders & Shadows */
  --border-glass: 1px solid rgba(96, 165, 250, 0.2);
  --border-cyan: 1px solid rgba(96, 165, 250, 0.45);
  --border-gold: 1px solid rgba(244, 114, 182, 0.45); /* Soft Pink Border */
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(37, 99, 235, 0.18);
  --shadow-neon-cyan: 0 0 22px rgba(96, 165, 250, 0.45);
  --shadow-neon-gold: 0 0 22px rgba(244, 114, 182, 0.5); /* Soft Pink Glow */
  --shadow-neon-purple: 0 0 22px rgba(192, 132, 252, 0.4);

  /* Dimensions & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-main: 'Prompt', 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Background Atmosphere */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(244, 114, 182, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(29, 78, 216, 0.12) 0%, transparent 50%),
    linear-gradient(to bottom, #050a17, #0b142d 60%, #050a17);
  z-index: -2;
  pointer-events: none;
}

#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
}

/* App Wrapper */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

/* Top Navigation Bar */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-neon-cyan);
  overflow: hidden;
  padding: 4px;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(96, 165, 250, 0.5));
}

.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--grad-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

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

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: var(--border-glass);
  color: var(--text-main);
  font-size: 1.1rem;
}

.btn-icon-only:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-primary {
  background: var(--grad-primary);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(37, 99, 235, 0.65);
  transform: translateY(-2px);
}

.btn-gold {
  background: var(--grad-gold);
  color: #4a0429;
  box-shadow: 0 4px 15px rgba(244, 114, 182, 0.35);
}

.btn-gold:hover {
  box-shadow: 0 6px 25px rgba(244, 114, 182, 0.6);
  transform: translateY(-2px);
}

.btn-purple {
  background: var(--grad-purple);
  color: #fff;
  box-shadow: 0 4px 15px rgba(129, 140, 248, 0.35);
}

.btn-purple:hover {
  box-shadow: 0 6px 25px rgba(129, 140, 248, 0.6);
  transform: translateY(-2px);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border: var(--border-glass);
  color: var(--text-main);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(96, 165, 250, 0.5);
  color: #fff;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.3);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

/* Screen System (SPA Router) */
.screen {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
  width: 100%;
  flex: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Glass Panels & Cards */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.glass-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--grad-cyber);
}

/* Hero Section (Welcome) */
.hero-wrapper {
  text-align: center;
  padding: 30px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  border: var(--border-cyan);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, #ffffff 0%, #60a5fa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(96, 165, 250, 0.35);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 650px;
}

.story-box {
  background: rgba(11, 20, 44, 0.88);
  border: 1px dashed rgba(96, 165, 250, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 700px;
  text-align: left;
  position: relative;
}

.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--accent-cyan);
  font-size: 0.9rem;
  font-weight: 600;
}

.story-body {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.7;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 800px;
  margin: 10px 0;
}

.feature-card {
  background: rgba(255, 255, 255, 0.03);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.05);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.feature-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Form Controls (Registration) */
.form-container {
  max-width: 550px;
  margin: 0 auto;
  width: 100%;
}

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

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-label span.req {
  color: var(--accent-rose);
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(10, 14, 23, 0.8);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

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

.form-select option {
  background-color: #0f172a;
  color: #fff;
  padding: 8px;
}

/* Difficulty Selection Cards */
.diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.diff-card {
  background: var(--bg-glass);
  border: var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.diff-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  transition: width 0.3s;
}

.diff-card.easy::before { background: var(--accent-cyan); }
.diff-card.normal::before { background: var(--accent-gold); }
.diff-card.hard::before { background: var(--accent-rose); }

.diff-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card);
}

.diff-card.easy:hover { border-color: var(--accent-cyan); box-shadow: 0 10px 30px rgba(96, 165, 250, 0.25); }
.diff-card.normal:hover { border-color: var(--accent-gold); box-shadow: 0 10px 30px rgba(244, 114, 182, 0.25); }
.diff-card.hard:hover { border-color: var(--accent-rose); box-shadow: 0 10px 30px rgba(251, 113, 133, 0.25); }

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

.diff-icon {
  font-size: 2.2rem;
}

.diff-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.diff-card.easy .diff-badge { background: rgba(96, 165, 250, 0.2); color: var(--accent-cyan); }
.diff-card.normal .diff-badge { background: rgba(244, 114, 182, 0.2); color: var(--accent-gold); }
.diff-card.hard .diff-badge { background: rgba(251, 113, 133, 0.2); color: var(--accent-rose); }

.diff-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.diff-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.diff-meta {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.diff-meta span b {
  color: var(--text-main);
}

/* Mission Hub / Timeline Map */
.mission-map {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding: 20px 10px;
  margin-bottom: 24px;
}

.mission-map::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 30px;
  right: 30px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%);
  z-index: 1;
}

.stage-node {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.node-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0b142d;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-dim);
  transition: all 0.3s;
}

.stage-node.completed .node-circle {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #060b19;
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.6);
}

.stage-node.current .node-circle {
  background: var(--grad-gold);
  border-color: #fff;
  color: #4a0429;
  box-shadow: var(--shadow-neon-gold);
  transform: scale(1.15);
}

.node-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-align: center;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-node.current .node-label {
  color: var(--accent-gold);
}

/* In-Game HUD Header */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(11, 20, 44, 0.9);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.hud-stat-val {
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 1.1rem;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.1);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-weight: 700;
  font-family: monospace;
  font-size: 1.1rem;
}

.timer-box.warning {
  animation: pulseRed 0.8s infinite alternate;
}

.combo-badge {
  background: var(--grad-gold);
  color: #4a0429;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Game Stage Content Container */
.stage-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.case-brief {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(244, 114, 182, 0.12) 100%);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.case-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.case-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.case-desc {
  font-size: 0.95rem;
  color: #cbd5e1;
}

/* Stage 1: Topic Selection Options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.option-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.option-btn:hover {
  background: rgba(96, 165, 250, 0.12);
  border-color: var(--accent-cyan);
  transform: translateX(4px);
}

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.option-btn.selected {
  background: rgba(96, 165, 250, 0.18);
  border-color: var(--accent-cyan);
}

.option-btn.correct {
  background: rgba(37, 99, 235, 0.3) !important;
  border-color: var(--accent-cyan) !important;
  color: #bfdbfe;
}

.option-btn.wrong {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: var(--accent-rose) !important;
  color: #fecdd3;
}

/* Stage 2: Drag & Drop / Radar Sifting */
.radar-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

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

.drop-zone {
  min-height: 220px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: rgba(11, 20, 44, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.25s;
}

.drop-zone.zone-primary {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.06);
}

.drop-zone.zone-secondary {
  border-color: rgba(244, 114, 182, 0.45);
  background: rgba(244, 114, 182, 0.06);
}

.drop-zone.drag-over {
  background: rgba(96, 165, 250, 0.18);
  border-color: var(--accent-cyan);
  transform: scale(1.02);
}

.zone-header {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.zone-primary .zone-header { color: var(--accent-cyan); }
.zone-secondary .zone-header { color: var(--accent-gold); }

.evidence-deck {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-lg);
  border: var(--border-glass);
  min-height: 100px;
}

.evidence-card {
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  cursor: grab;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s;
}

.evidence-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.25);
}

.evidence-card:active {
  cursor: grabbing;
}

.evidence-card.matched {
  cursor: default;
  opacity: 0.85;
}

/* Quick Action Tap for Mobile */
.tap-sorter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.tap-evidence-display {
  background: var(--bg-card-hover);
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-neon-cyan);
}

.tap-evidence-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.tap-evidence-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tap-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 500px;
}

/* Stage 3: Cyber Forensic Scanner */
.forensic-scanner {
  background: rgba(11, 20, 44, 0.92);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-gold), transparent);
  box-shadow: 0 0 15px var(--accent-cyan);
}

.forensic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

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

.forensic-box {
  background: rgba(255, 255, 255, 0.03);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
}

.forensic-box-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Results / Victory Screen */
.result-card {
  text-align: center;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.result-badge-anim {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--grad-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  box-shadow: var(--shadow-neon-gold);
}

.result-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--grad-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin: 10px 0;
}

.score-stat-card {
  background: rgba(15, 23, 42, 0.8);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.score-stat-card .val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.score-stat-card .lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}

/* Leaderboard Page */
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tr:hover td {
  background: rgba(0, 242, 254, 0.05);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
}

.rank-1 { background: #fbbf24; color: #78350f; }
.rank-2 { background: #94a3b8; color: #1e293b; }
.rank-3 { background: #d97706; color: #fff; }

/* Admin Dashboard */
.admin-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

@media (max-width: 860px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-tab-btn {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-glass);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-tab-btn:hover, .admin-tab-btn.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: var(--border-glass);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  position: relative;
}

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

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

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

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
  border: var(--border-glass);
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.toast.success { border-color: var(--accent-emerald); color: #a7f3d0; }
.toast.error { border-color: var(--accent-rose); color: #fecdd3; }
.toast.info { border-color: var(--accent-cyan); color: #bae6fd; }

/* Responsive adjustments */
@media (max-width: 640px) {
  .app-container { padding: 10px; }
  .top-nav { padding: 10px 14px; margin-bottom: 12px; }
  .brand-text h1 { font-size: 0.95rem; }
  .glass-panel { padding: 18px 14px; border-radius: var(--radius-lg); }
  .mission-map { padding: 10px 0; }
  .node-circle { width: 36px; height: 36px; font-size: 0.85rem; }
  .node-label { font-size: 0.65rem; }
  .form-row { grid-template-columns: 1fr; }
}
