/* ═══════════════════════════════════════════════════
   Mission IBP 360 — Immersive Dark Forest Theme
   ═══════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════
   CSS Variables — Design Tokens (inlined for perf)
   OPT: Eliminates render-blocking @import chain
   ═══════════════════════════════════════════════════ */
:root {
  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Colors — Background */
  --bg: #0c1410;
  --bg-glass: rgba(14, 24, 18, 0.78);
  --bg-glass-strong: rgba(12, 20, 16, 0.92);
  --panel: rgba(18, 32, 24, 0.88);
  --panel-border: rgba(100, 180, 120, 0.12);

  /* Colors — Text */
  --text: #e8efe6;
  --text-muted: rgba(200, 220, 210, 0.6);

  /* Colors — Accent / Status */
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.15);
  --accent-glow: rgba(74, 222, 128, 0.25);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 200ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ─── Custom Scrollbars ─── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg, #060e0a);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  border: 2px solid var(--bg, #060e0a);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent, #4ade80);
}
/* OPT: scoped to html instead of * to avoid non-composite animation warnings */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* ─── Utilities ─── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─── Accessibility (E3) ─── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.2);
}
.sidebar-tab:focus-visible, .hud-icon-btn:focus-visible, .primary-button:focus-visible, .ghost-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ═══════════════════════════════
   MISSION BRIEFING OVERLAY
   ═══════════════════════════════ */
.brief-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(16, 40, 24, 0.95), transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(10, 28, 18, 0.9), transparent 50%),
    linear-gradient(180deg, #080e0a 0%, #0a1a10 40%, #0c1a12 100%);
  animation: briefFadeIn .6s ease-out;
}

@keyframes briefFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.brief-overlay.hidden {
  display: none;
}

.brief-card {
  max-width: 560px; width: calc(100% - 40px);
  padding: 48px 40px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow), 0 0 120px rgba(74, 222, 128, 0.06);
  backdrop-filter: blur(24px);
  text-align: center;
  animation: briefCardIn .7s ease-out .15s both;
}

@keyframes briefCardIn {
  from { opacity: 0; transform: translateY(30px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brief-badge {
  display: inline-block;
  padding: 6px 16px; border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .72rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: 20px;
}

.brief-logo {
  max-width: 140px;
  height: auto;
  margin: 0 auto 24px;
  display: block;
}

.brief-title {
  font-size: 2.4rem; font-weight: 900;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--accent) 0%, #86efac 50%, var(--amber) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.brief-subtitle {
  color: var(--text-muted); font-size: .95rem; line-height: 1.5;
  margin-bottom: 28px;
}

.brief-body { text-align: left; }

.brief-section { margin-bottom: 18px; }
.brief-section-label {
  display: block; font-size: .7rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.brief-section p { color: var(--text-muted); font-size: .88rem; line-height: 1.55; }

.brief-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin: 24px 0 28px;
}

.brief-stat {
  padding: 16px 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  text-align: center;
}
.brief-stat-value {
  display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent);
}
.brief-stat-label {
  display: block; font-size: .72rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
  margin-top: 4px;
}

.brief-start-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 36px;
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.3);
}
.brief-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(34, 197, 94, 0.45);
}
.brief-start-btn.hidden { display: none; }

.brief-card > .brief-slide {
  display: none;
  animation: briefSlideIn .4s ease-out;
}
.brief-card > .brief-slide.active { display: block; }

@keyframes briefSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.brief-nav {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  margin-top: 20px;
}

.brief-steps {
  display: flex; gap: 8px;
}
.brief-step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  transition: all .3s ease;
  cursor: pointer;
}
.brief-step-dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(74, 222, 128, .4);
}
.brief-step-dot.visited {
  background: rgba(74, 222, 128, .4);
}

/* ─── Accessibility RGAA link on briefing ─── */
.brief-accessibility-link {
  position: absolute;
  bottom: 20px; right: 20px;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 1001;
}
.brief-accessibility-link:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.2);
}
.brief-accessibility-link svg {
  opacity: .7;
  transition: opacity var(--transition);
}
.brief-accessibility-link:hover svg {
  opacity: 1;
}

/* ═══════════════════════════════
   GAME SHELL
   ═══════════════════════════════ */
.game-shell {
  position: relative; width: 100vw; height: 100vh;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: 1fr;
  overflow: hidden;
}

/* ─── HUD Top Bar ─── */
.hud-top {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 20px;
  background: var(--bg-glass-strong);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
}

.hud-left, .hud-right { display: flex; align-items: center; gap: 12px; }

.hud-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 700; color: var(--text);
}
.hud-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.hud-pills { display: flex; gap: 6px; }

.level-pill {
  padding: 6px 14px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: .78rem; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.level-pill:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.level-pill.active {
  background: var(--accent); color: #052e16;
  box-shadow: 0 4px 16px rgba(74, 222, 128, 0.3);
}
.level-pill.locked { opacity: .35; cursor: not-allowed; }

.hud-center { display: flex; align-items: center; }
.hud-info-group {
  display: flex; align-items: center; gap: 0;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.hud-info-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 2px 14px; gap: 1px;
}
.hud-info-label { font-size: .6rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.hud-info-value { font-size: .82rem; font-weight: 700; color: var(--text); }
.hud-timer {
  font-family: 'Courier New', 'Consolas', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}
.hud-divider { width: 1px; height: 24px; background: rgba(255,255,255,0.08); }

.hud-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .72rem; font-weight: 700;
  white-space: nowrap;
}
.hud-badge--sync { display: none !important; }
.hud-badge--sync.ok { background: rgba(74,222,128,0.12); color: #4ade80; }
.hud-badge--sync.warn { background: var(--amber-dim); color: var(--amber); }
.hud-badge--sync.bad, .hud-badge--sync.error { background: var(--danger-dim); color: var(--danger); }
.hud-badge--sync.offline { background: var(--danger-dim); color: var(--danger); animation: sync-pulse 2s ease-in-out infinite; }
@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.hud-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
}
.hud-icon-btn:hover { background: rgba(255,255,255,0.12); color: var(--accent); }

/* ─── Fullscreen toggle ─── */
#toggle-fullscreen.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
#toggle-fullscreen .hidden { display: none; }

/* ─── Viewer Container ─── */
.viewer-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.panorama-viewer {
  width: 100%; height: 100%;
  min-height: 200px;
}

/* ─── Scene Transition (Cinematic Blur + Zoom) ─── */
.scene-transition {
  position: absolute; inset: 0; z-index: 20;
  background: radial-gradient(
    ellipse at center,
    rgba(10, 26, 16, 0.15) 0%,
    rgba(10, 26, 16, 0.45) 100%
  );
  -webkit-backdrop-filter: blur(0px) saturate(1);
  backdrop-filter: blur(0px) saturate(1);
  opacity: 0;
  pointer-events: none;
  transform: scale(1);
  transition:
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    backdrop-filter 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    -webkit-backdrop-filter 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.scene-transition.active {
  opacity: 1;
  -webkit-backdrop-filter: blur(28px) saturate(0.7);
  backdrop-filter: blur(28px) saturate(0.7);
  transform: scale(1.03);
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .scene-transition {
    transition: opacity 0.2s ease;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    transform: none !important;
  }
  .scene-transition.active {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none;
  }
}


/* Panorama error fallback */
.panorama-error-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--text-muted);
  font-size: .9rem; font-weight: 500;
  text-align: center;
  padding: 24px;
  z-index: 2;
}

/* ─── Panorama Skeleton Loader ─── */
.panorama-skeleton {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(45, 48, 52, 0.65);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.panorama-skeleton.active {
  opacity: 1;
  pointer-events: auto;
  transition: none; /* Instant show */
}
.skeleton-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: skeletonSpin 1s linear infinite;
}
@keyframes skeletonSpin {
  to { transform: rotate(360deg); }
}
.skeleton-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: skeletonPulse 1.5s ease-in-out infinite alternate;
}
@keyframes skeletonPulse {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

/* #4: Pannellum & hotspot overrides moved to pannellum-overrides.css */

/* Scene overlay */
.scene-overlay {
  position: absolute; bottom: 44px; left: 160px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px;
  animation: slideUp .4s ease-out;
  max-width: 300px;
}

.scene-overlay-inner { display: flex; gap: 6px; }

.scene-chip {
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg-glass);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: .72rem; font-weight: 600;
  backdrop-filter: blur(12px);
}

.scene-overlay-desc {
  max-width: 380px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: .8rem; line-height: 1.45;
  backdrop-filter: blur(12px);
}

/* Hint overlay */
.hint-overlay {
  position: absolute; bottom: 44px; right: 20px; z-index: 5;
}

.hint-card {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass-strong);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  max-width: 280px;
}
.hint-label {
  display: block; font-size: .65rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 6px;
}
.hint-card p { color: var(--text-muted); font-size: .82rem; line-height: 1.45; }

.hint-budget {
  display: flex; gap: 6px; margin-top: 10px;
}
.hint-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all var(--transition);
}
.hint-dot.available {
  background: var(--accent);
  border-color: rgba(74, 222, 128, 0.4);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.3);
}

.hint-btn {
  margin-top: 10px; padding: 8px 14px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text); font-size: .78rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.hint-btn:hover { background: rgba(255,255,255,0.14); }
.hint-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Compass */
/* ─── Gyroscope / Orientation Indicator ─── */
.gyroscope {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(0,0,0,0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 8px 6px;
  border: 1px solid rgba(255,255,255,0.1);
}
.gyro-ring {
  width: 56px; height: 56px;
  transition: transform 0.12s ease-out;
}
.gyro-svg { display: block; }
.gyro-angle {
  font-size: 0.6rem; font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.03em;
  padding: 2px 0;
  min-width: 32px; text-align: center;
}
.gyro-toggle {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s;
}
.gyro-toggle:hover { background: rgba(255,255,255,0.15); color: #fff; }
.gyro-toggle.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ─── Custom Zoom Control ─── */
.zoom-control {
  position: absolute; top: 124px; left: 20px; z-index: 5;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}
.zoom-btn {
  width: 32px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.zoom-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.zoom-btn:active {
  transform: scale(0.9);
  background: rgba(255,255,255,0.25);
}
.zoom-level {
  font-size: 0.6rem; font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
  padding: 2px 0;
  min-width: 28px; text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes skillsRadarIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── Bottom Bar ─── */
.bottom-bar {
  position: relative; z-index: 10;
  padding: 8px 20px;
  background: var(--bg-glass-strong);
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
}

.bottom-bar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}

.gps-compact { display: flex; align-items: center; gap: 10px; }
.gps-track-compact { display: flex; align-items: center; gap: 0; }
.gps-progress-compact {
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap;
}

/* GPS nodes (reused class names) */
.gps-track { display: flex; align-items: center; gap: 0; }
.gps-track-grid { display: block; position: relative; }

.gps-node {
  width: 26px; height: 26px;
  border: 2px solid transparent; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: .7rem; font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  z-index: 1;
}
.gps-node:hover { transform: scale(1.15); filter: brightness(1.2); }

/* Status Colors (Green/Orange/Grey) */
.gps-node.status-unvisited {
  border-color: rgba(255,255,255,0.2);
  color: var(--text-muted);
}
.gps-node.status-partial {
  border-color: var(--amber); 
  color: var(--amber);
  background: rgba(245, 158, 11, 0.4);
}
.gps-node.status-completed {
  border-color: var(--accent); 
  color: var(--accent);
  background: rgba(74, 222, 128, 0.35);
}

.gps-node.active {
  transform: scale(1.15);
}
.gps-node.status-unvisited.active {
  border-color: #fff; color: #fff; background: rgba(255,255,255,0.15); box-shadow: 0 0 12px rgba(255,255,255,0.2);
}
.gps-node.status-partial.active {
  border-color: var(--amber); background: var(--amber); color: #000; box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}
.gps-node.status-completed.active {
  border-color: var(--accent); background: var(--accent); color: #000; box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
}

.gps-link {
  width: 24px; height: 2px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.gps-link.visited { background: rgba(74, 222, 128, 0.2); }

.gps-labels { display: none; }

.scene-nav-bar {
  display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-start; flex: 1;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 4px 0;
  margin: -4px 0;
}
.scene-nav-bar::-webkit-scrollbar { display: none; }

.scene-button {
  padding: 7px 16px;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: .78rem; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.scene-button:hover { background: rgba(255,255,255,0.1); color: var(--text); transform: translateY(-1px); }

/* Scene button Status Colors */
.scene-button.status-unvisited {
  border-color: rgba(255,255,255,0.2); color: var(--text-muted);
}
.scene-button.status-partial {
  border-color: var(--amber); color: var(--amber); background: rgba(245, 158, 11, 0.25);
}
.scene-button.status-completed {
  border-color: var(--accent); color: var(--accent); background: rgba(74, 222, 128, 0.25);
}

.scene-button.active {
  font-weight: 800; transform: scale(1.05);
}
.scene-button.status-unvisited.active {
  background: rgba(255,255,255,0.15); color: #fff; border-color: #fff; box-shadow: 0 0 16px rgba(255,255,255,0.1);
}
.scene-button.status-partial.active {
  background: var(--amber); color: #000; border-color: var(--amber); box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}
.scene-button.status-completed.active {
  background: var(--accent); color: #000; border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow);
}

.session-controls { display: flex; gap: 4px; }

.ctrl-btn {
  width: 32px; height: 32px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: .7rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.ctrl-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.ctrl-btn--danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ─── Sidebar ─── */
.sidebar {
  position: fixed; top: 0; right: -420px;
  width: 400px; max-width: 90vw;
  height: 100vh; z-index: 50;
  background: var(--bg-glass-strong);
  border-left: 1px solid var(--panel-border);
  backdrop-filter: blur(24px);
  display: flex; flex-direction: column;
  transition: right .35s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,.3);
}
.sidebar.open { right: 0; }

.sidebar-close {
  position: absolute; top: 12px; left: 12px;
  width: 32px; height: 32px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: 1rem; cursor: pointer;
  transition: all var(--transition);
}
.sidebar-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.sidebar-tabs {
  display: flex; gap: 0;
  padding: 12px 16px 0 52px;
  border-bottom: 1px solid var(--panel-border);
}

.sidebar-tab {
  padding: 10px 14px;
  border: none; background: none;
  color: var(--text-muted);
  font-size: .78rem; font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.sidebar-tab:hover { color: var(--text); }
.sidebar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sidebar-panel {
  display: none; flex: 1;
  overflow-y: auto; padding: 16px;
}
.sidebar-panel.active { display: block; }

.sidebar-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px;
}
.sidebar-panel-header.compact { margin-bottom: 8px; }
.sidebar-panel-header h2 { font-size: 1.05rem; font-weight: 700; }
.sidebar-panel-header h3 { font-size: .9rem; font-weight: 700; }

.sidebar-badge {
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .7rem; font-weight: 700;
  white-space: nowrap;
}

.sidebar-objectives {
  padding: 12px 16px;
  border-top: 1px solid var(--panel-border);
  background: rgba(0,0,0,.15);
}

/* ─── Evidence & Factor cards ─── */
.evidence-list, .factor-list, .debrief-output, .history-list { display: grid; gap: 10px; }

/* ─── Badges ─── */
.badges-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  padding-bottom: 20px;
}
.badge-card {
  padding: 16px 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px;
  transition: all var(--transition);
}
.badge-card.locked {
  opacity: 0.4;
  filter: grayscale(100%);
}
/* unlocked styles are now under .badge-card.unlocked below */
.badge-icon {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}
.badge-label {
  font-size: .8rem; font-weight: 700; color: var(--text);
}
.badge-card.locked .badge-label { color: var(--text-muted); }
.badge-desc {
  font-size: .7rem; color: var(--text-muted); line-height: 1.35;
}

/* Badge progress bar */
.badges-progress {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.badges-progress-bar {
  flex: 1; height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden;
}
.badges-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 3px;
  transition: width .6s cubic-bezier(0.16, 1, 0.3, 1);
}
.badges-progress-text {
  font-size: .75rem; color: var(--text-muted); white-space: nowrap;
}

/* Badge unlock glow */
.badge-card.unlocked {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.08), rgba(22, 163, 74, 0.02));
  border-color: rgba(74, 222, 128, 0.2);
  box-shadow: inset 0 0 20px rgba(74, 222, 128, 0.05);
}
.badge-card.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.15), inset 0 0 20px rgba(74, 222, 128, 0.08);
}
.badge-card.unlocked .badge-icon {
  animation: badge-bounce .5s ease-out;
}
@keyframes badge-bounce {
  0%   { transform: scale(0.6); opacity: 0.5; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1);   opacity: 1; }
}

/* ─── History cards ─── */
.history-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  transition: background var(--transition);
  display: grid; gap: 10px;
}
.history-card:hover { background: rgba(255,255,255,0.05); }

.history-card-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}
.history-date {
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
}
.history-level-chip {
  padding: 3px 10px; border-radius: 999px;
  font-size: .68rem; font-weight: 700;
  background: var(--accent-dim); color: var(--accent);
}
.history-level-chip.mastery { background: var(--amber-dim); color: var(--amber); }
.history-level-chip.expertise { background: rgba(192, 132, 252, 0.12); color: #c084fc; }

.history-score-row {
  display: flex; align-items: center; gap: 10px;
}
.history-score-bar {
  flex: 1; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.history-score-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, #4ade80);
  transition: width .4s ease;
}
.history-score-fill.warn { background: linear-gradient(90deg, #b45309, #fbbf24); }
.history-score-fill.bad { background: linear-gradient(90deg, #991b1b, #ef4444); }
.history-score-value {
  font-size: .85rem; font-weight: 800; color: var(--accent);
  min-width: 36px; text-align: right;
}
.history-score-value.warn { color: var(--amber); }
.history-score-value.bad { color: var(--danger); }

.history-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.history-stat {
  font-size: .72rem; color: var(--text-muted);
}
.history-stat strong {
  font-weight: 700; color: var(--text);
}

.empty-state {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: .85rem; line-height: 1.5;
}

.evidence-card, .factor-card, .result-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  transition: background var(--transition);
  word-wrap: break-word; /* Prevent long words from causing horizontal scroll */
}
.evidence-card:hover, .factor-card:hover { background: rgba(255,255,255,0.05); }

/* ─── Distractor evidence card ─── */
.evidence-card.evidence-distractor {
  border-color: rgba(251, 191, 36, 0.3);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.04), rgba(251, 191, 36, 0.01));
}
.evidence-card.evidence-distractor:hover {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.03));
}

.distractor-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: var(--amber);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  border: 1px solid rgba(251, 191, 36, 0.25);
  margin-bottom: 6px;
}

/* ─── Debrief distractor feedback card ─── */
.distractor-feedback-card {
  border-color: rgba(251, 191, 36, 0.25);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.05), rgba(251, 191, 36, 0.01));
}
.distractor-feedback-item {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.distractor-feedback-item:first-of-type {
  margin-top: 8px;
}
.distractor-feedback-item strong {
  font-size: .85rem;
  color: var(--amber);
}

.evidence-card h3, .factor-card h3, .result-card h3 {
  font-size: .88rem; font-weight: 600; margin-bottom: 4px;
}
.meta {
  color: var(--text-muted); font-size: .78rem; line-height: 1.4;
}

.factor-card { display: grid; gap: 8px; }
.factor-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }

.factor-select {
  min-width: 72px; padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.05);
  color: var(--text); font-family: var(--font);
}
.factor-select option { background: #1a2e20; color: var(--text); }

.factor-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-chip {
  padding: 4px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: .68rem; font-weight: 600;
}

/* ── Factor card header with info button ── */
.factor-card-header {
  display: flex; align-items: center; gap: 8px;
}
.factor-card-header h3 { flex: 1; }

.factor-info-btn {
  width: 26px; height: 26px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: .78rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.factor-info-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(74, 222, 128, 0.3);
  transform: scale(1.12);
}

/* ═══════════ FACTOR INFO MODAL ═══════════ */
.factor-info-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.factor-info-overlay.open {
  opacity: 1; pointer-events: auto;
}

.factor-info-card {
  position: relative;
  width: 100%; max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px 24px 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(20,40,28,.97), rgba(12,24,16,.98));
  border: 1px solid rgba(74, 222, 128, 0.15);
  box-shadow: 0 24px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.03) inset;
  animation: factorModalIn .35s ease-out;
}

@keyframes factorModalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.factor-info-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: .9rem; cursor: pointer;
  transition: all var(--transition);
}
.factor-info-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.factor-info-badge {
  display: inline-block;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .65rem; font-weight: 700;
  letter-spacing: .1em;
  margin-bottom: 10px;
}

.factor-info-title {
  font-size: 1.15rem; font-weight: 700; margin: 0 0 8px;
}

.factor-info-desc {
  color: var(--text-muted); font-size: .88rem; line-height: 1.55;
  margin: 0 0 18px;
}

.factor-info-section {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 14px;
}

.factor-info-section-label {
  display: block;
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); margin-bottom: 10px;
}

.factor-info-grid {
  display: grid; gap: 6px;
}

.factor-info-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
}

.factor-info-score {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .78rem; font-weight: 700;
}

.factor-info-feedback {
  color: var(--text-muted);
  font-size: .82rem; line-height: 1.45;
  flex: 1;
}

.factor-info-empty {
  color: var(--text-muted);
  font-size: .82rem;
  font-style: italic;
  padding: 8px 0;
}

/* Debrief */
.debrief-actions { margin-bottom: 12px; }
.primary-button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff; font-size: .85rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25);
  transition: all var(--transition);
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(34, 197, 94, 0.35); }

.score-line {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: .85rem; margin-top: 6px;
}
.score-line strong.good { color: var(--accent); }
.score-line strong.warn { color: var(--amber); }
.score-line strong.bad { color: var(--danger); }

/* Ensure the radar chart does not overflow the sidebar */
#debrief-radar-chart,
#debrief-skills-radar {
  max-width: 100%;
  height: auto;
}

/* Skills radar card premium styling */
.skills-radar-card {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.04), rgba(22, 163, 74, 0.01)) !important;
  border-color: rgba(74, 222, 128, 0.15) !important;
  position: relative;
  overflow: hidden;
  animation: skillsRadarIn .6s ease-out;
}
.skills-radar-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 40px rgba(74, 222, 128, 0.04);
  pointer-events: none;
}

/* ═══════════ SPLIT-SCREEN DEBRIEF COMPARISON ═══════════ */
.splitscreen-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6, 16, 10, 0.97);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity .4s cubic-bezier(.4,0,.2,1);
}
.splitscreen-overlay.open {
  opacity: 1; pointer-events: auto;
}

.splitscreen-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.3);
  gap: 16px;
  flex-shrink: 0;
}

.splitscreen-title {
  display: flex; align-items: center; gap: 12px;
}
.splitscreen-title h2 {
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin: 0;
}

.splitscreen-badge {
  padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05));
  color: var(--amber);
  font-size: .6rem; font-weight: 800;
  letter-spacing: .12em;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.splitscreen-scene-nav {
  display: flex; gap: 6px; align-items: center;
}
.splitscreen-scene-pill {
  padding: 6px 14px; border: none; border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: .75rem; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.splitscreen-scene-pill:hover {
  background: rgba(255,255,255,0.1); color: var(--text);
}
.splitscreen-scene-pill.active {
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.splitscreen-close {
  width: 36px; height: 36px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: 1rem; cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.splitscreen-close:hover {
  background: rgba(239, 68, 68, 0.15); color: var(--danger);
}

.splitscreen-body {
  display: flex; flex: 1;
  overflow: hidden;
  position: relative;
}

.splitscreen-pane {
  flex: 1; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  min-width: 0;
}

.splitscreen-pane-label {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: .82rem; font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  animation: splitLabelIn .5s ease-out .3s both;
}
@keyframes splitLabelIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.splitscreen-pane-label.player-label {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--accent);
}
.splitscreen-pane-label.expert-label {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--amber);
}
.splitscreen-pane-icon {
  font-size: 1.1rem; line-height: 1;
}

.splitscreen-viewer {
  flex: 1;
  position: relative;
  background: rgba(0,0,0,0.4);
}

.splitscreen-divider {
  width: 3px; flex-shrink: 0;
  background: linear-gradient(180deg,
    rgba(74, 222, 128, 0.0) 0%,
    rgba(74, 222, 128, 0.4) 20%,
    rgba(251, 191, 36, 0.4) 80%,
    rgba(251, 191, 36, 0.0) 100%
  );
  position: relative;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.1), 0 0 20px rgba(251, 191, 36, 0.1);
}
.splitscreen-divider::after {
  content: "⟷";
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  background: rgba(20, 40, 28, 0.95);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: .7rem;
  z-index: 5;
}

.splitscreen-legend {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 16px;
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: .75rem; color: var(--text-muted);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.splitscreen-legend-item {
  display: flex; align-items: center; gap: 6px;
}
.splitscreen-legend-dot {
  width: 8px; height: 8px; border-radius: 999px;
  flex-shrink: 0;
}
.splitscreen-legend-dot.found { background: var(--accent); }
.splitscreen-legend-dot.missed { background: var(--danger); }
.splitscreen-legend-dot.distractor { background: var(--amber); }

.splitscreen-legend-count {
  font-weight: 700; color: var(--text);
}

/* Split-screen hotspot diff markers */
.split-hotspot-found .custom-hotspot-label {
  background: rgba(74, 222, 128, 0.2) !important;
  border-color: rgba(74, 222, 128, 0.5) !important;
  color: var(--accent) !important;
}
.split-hotspot-missed {
  animation: splitMissedPulse 2s ease-in-out infinite !important;
}
.split-hotspot-missed .custom-hotspot-label {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: var(--danger) !important;
}
@keyframes splitMissedPulse {
  0%, 100% { opacity: .7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}
.split-hotspot-distractor .custom-hotspot-label {
  background: rgba(251, 191, 36, 0.2) !important;
  border-color: rgba(251, 191, 36, 0.5) !important;
  color: var(--amber) !important;
}

/* Split-screen button in debrief output */
.splitscreen-btn {
  width: 100%; justify-content: center;
  margin-top: 12px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(74, 222, 128, 0.15));
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--amber);
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.1);
}
.splitscreen-btn:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(74, 222, 128, 0.25));
  box-shadow: 0 8px 30px rgba(251, 191, 36, 0.2);
  transform: translateY(-1px);
}

/* Responsive: stack vertically on small screens */
@media (max-width: 768px) {
  .splitscreen-body { flex-direction: column; }
  .splitscreen-divider {
    width: 100%; height: 3px;
    background: linear-gradient(90deg,
      rgba(74, 222, 128, 0.0) 0%,
      rgba(74, 222, 128, 0.4) 20%,
      rgba(251, 191, 36, 0.4) 80%,
      rgba(251, 191, 36, 0.0) 100%
    );
  }
  .splitscreen-divider::after { display: none; }
  .splitscreen-header { flex-wrap: wrap; }
  .splitscreen-title h2 { font-size: .88rem; }
}

/* Objectives */
.objective-list { display: grid; gap: 6px; }
.objective-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  color: var(--text-muted);
  font-size: .78rem;
}
.objective-item.done { background: var(--accent-dim); color: var(--accent); }
.objective-item.done::before { content: "✓ "; font-weight: 700; }
.objective-item.todo::before { content: "○ "; font-weight: 700; color: var(--text-muted); }

/* Analytics */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.analytics-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-border);
}
.analytics-label {
  display: block; font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 3px;
}
.analytics-value { font-size: .88rem; font-weight: 700; color: var(--accent); }

/* ─── Street View Navigation Arrows ─── */
.nav-arrow-hotspot {
  background: none !important;
  border: none !important;
  cursor: pointer !important;
}
.nav-arrow-hotspot .pnlm-tooltip { display: none !important; }

.nav-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  transition: transform .25s ease, filter .25s ease;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.8));
}
.nav-arrow:hover {
  transform: scale(1.25) translateY(-4px);
  filter: drop-shadow(0 4px 16px rgba(74, 222, 128, .8));
}

.nav-arrow-icon {
  animation: arrowBreathe 2.5s ease-in-out infinite;
}
.nav-arrow:hover .nav-arrow-icon {
  animation: none;
}
.nav-arrow-icon path {
  transition: fill .2s ease;
}
.nav-arrow:hover .nav-arrow-icon path {
  fill: var(--accent);
}

.nav-arrow-label {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--font);
  font-size: .7rem; font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}
.nav-arrow:hover .nav-arrow-label {
  opacity: 1;
  transform: translateY(0);
}

@keyframes arrowBreathe {
  0%, 100% { opacity: .95; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

/* (scene-transition defined above — single source of truth) */


/* ─── Feedback toast ─── */
.feedback-toast {
  position: absolute; bottom: 140px; left: 50%; z-index: 15;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass-strong);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: .88rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  max-width: 500px; text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.feedback-toast.visible {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ─── Status badge ─── */
.status-badge { display: none; }

/* ═══════════ ADMIN PAGE COMPAT ═══════════ */
/* Keep admin styles working */
.admin-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-layout { display: grid; gap: 20px; }

.editor-grid {
  display: grid; gap: 20px;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
}

.stack-column { display: grid; gap: 14px; }

.editor-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 20px;
}

.panel-heading {
  display: flex; justify-content: space-between;
  gap: 16px; align-items: flex-start; margin-bottom: 16px;
}
.panel-heading.compact { margin-bottom: 10px; }
.panel-heading h2 { font-size: 1.15rem; }

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--amber); font-size: 0.72rem; font-weight: 700;
}
h1 { font-size: clamp(2rem, 3vw, 3rem); line-height: 1; margin: 0; }
h2, h3, p { margin: 0; }
.subtitle { max-width: 760px; margin-top: 12px; color: var(--text-muted); font-size: 1rem; line-height: 1.5; }

.ghost-button, .ghost-link {
  padding: 8px 14px; border: none; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted); font-size: .82rem; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: all var(--transition);
}
.ghost-button:hover, .ghost-link:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.status-inline {
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent);
  font-size: .78rem; font-weight: 700;
}
.status-inline.warn { background: var(--amber-dim); color: var(--amber); }
.status-inline.bad { background: var(--danger-dim); color: var(--danger); }

.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sync-state {
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent);
  font-size: .78rem; font-weight: 700;
}
.sync-state.warn { background: var(--amber-dim); color: var(--amber); }
.sync-state.bad { background: var(--danger-dim); color: var(--danger); }

.scene-list, .factor-list-admin { display: grid; gap: 8px; }
.list-item-admin,
.scene-item,
.factor-item-admin {
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-md);
  padding: 10px 12px; text-align: left;
  cursor: pointer; color: var(--text);
}
.list-item-admin.active,
.scene-item.active,
.factor-item-admin.active {
  border-color: rgba(74, 222, 128, 0.3);
  background: var(--accent-dim); font-weight: 700;
}

.form-row { display: grid; gap: 6px; }
.form-row label {
  font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.text-input, .text-area, .select-input, .number-input {
  width: 100%;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 8px 12px; color: var(--text);
  font-family: var(--font);
}
.select-input option, .text-input option { background: #1a2e20; color: var(--text); }
.text-area { min-height: 90px; resize: vertical; }

/* ─── Scale Overlay ─── */
.scale-overlay {
  position: absolute; top: 86px; right: 20px; z-index: 5;
  padding: 10px 14px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  min-width: 52px;
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: auto;
}
.scale-overlay.hidden { display: none; }

.scale-header {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin-bottom: 8px;
}
.scale-title {
  font-size: .55rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); opacity: .8;
}
.scale-distance {
  font-size: .65rem; font-weight: 600;
  color: var(--text-muted);
}

.scale-bar {
  position: relative;
  width: 4px; margin: 0 auto;
  background: linear-gradient(180deg, var(--accent) 0%, rgba(74, 222, 128, .3) 100%);
  border-radius: 2px;
  min-height: 40px;
}

.scale-tick {
  position: absolute; left: -8px; right: -8px;
  height: 0;
  border-top: 1.5px solid var(--accent);
}
.scale-tick.minor {
  left: -4px; right: -4px;
  border-top-color: rgba(74, 222, 128, .4);
  border-top-width: 1px;
}
.scale-tick-label {
  position: absolute; left: 16px; top: -6px;
  font-size: .6rem; font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.scale-tick:first-child .scale-tick-label,
.scale-tick:last-child .scale-tick-label {
  color: var(--accent);
}

.hud-icon-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════
   TOUCH & MOBILE SUPPORT
   ═══════════════════════════════════════════════════ */

/* ─── Touch fundamentals ─── */
@media (pointer: coarse) {
  /* Ensure Pannellum container accepts touch gestures */
  .panorama-viewer, .pnlm-container, .pnlm-render-container {
    touch-action: none;
  }

  /* Minimum 44×44 hit targets for all interactive elements (WCAG 2.5.5) */
  .hud-icon-btn {
    width: 44px; height: 44px;
    font-size: .82rem;
  }
  .ctrl-btn {
    width: 44px; height: 44px;
    font-size: .8rem;
  }
  .gps-node {
    width: 44px; height: 44px;
    font-size: .78rem;
  }
  .level-pill {
    min-height: 44px;
    padding: 10px 16px;
    font-size: .82rem;
  }
  .sidebar-tab {
    min-height: 44px;
    padding: 12px 16px;
  }
  .sidebar-close {
    width: 44px; height: 44px;
  }
  .scene-button {
    min-height: 44px;
    padding: 10px 18px;
  }
  .hint-btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  .primary-button {
    min-height: 48px;
    padding: 12px 24px;
  }
  .factor-select {
    min-height: 44px;
    padding: 8px 10px;
    font-size: .85rem;
  }
  .factor-info-btn {
    width: 36px; height: 36px;
  }
  .factor-info-close {
    width: 40px; height: 40px;
  }
  .brief-start-btn {
    min-height: 52px;
    padding: 14px 32px;
  }
  .brief-step-dot {
    width: 16px; height: 16px;
  }
  .coachmark-close {
    width: 44px; height: 44px;
  }
  .coachmark-btn {
    min-height: 44px;
    padding: 10px 18px;
  }
  .gdpr-btn {
    min-height: 44px;
    padding: 12px 20px;
  }

  /* Enlarge hotspots for fat-finger tapping */
  .custom-hotspot {
    width: 38px; height: 38px;
  }
  .custom-hotspot.expertise.revealed {
    width: 38px; height: 38px;
  }
  .custom-hotspot-label {
    font-size: .78rem;
    padding: 5px 12px;
    opacity: 1;
  }

  /* Show labels by default on touch (no hover) */
  .nav-arrow-label {
    opacity: .85;
    transform: translateY(0);
  }

  /* Disable hover-only effects on touch */
  /* Fast-click (remove 300ms tap delay) on interactive elements */
  button, a, input, select, .custom-hotspot, .gps-node, .level-pill, .scene-item, .factor-item-admin {
    touch-action: manipulation;
  }
}

/* ─── Tablet (≤ 1024px) ─── */
@media (max-width: 1024px) {
  .hud-top { padding: 8px 14px; gap: 10px; }
  .hud-center { display: flex; }
  .sidebar { width: 360px; }
  .scene-overlay { max-width: 300px; }
  .hint-overlay .hint-card { max-width: 240px; }

  .editor-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Mobile (≤ 768px) ─── */
@media (max-width: 768px) {
  /* Full-width sidebar */
  .sidebar {
    width: 100%; max-width: 100vw;
    right: -100%;
  }
  .sidebar.open { right: 0; }

  /* Compact HUD & Prevent Overflow */
  .game-shell { min-width: 0; }
  .hud-top { padding: 6px 8px; gap: 8px; flex-wrap: wrap; justify-content: center; min-width: 0; }
  .hud-left { flex-wrap: wrap; justify-content: center; }
  .hud-right { flex-wrap: wrap; justify-content: center; }
  .hud-pills { flex-wrap: wrap; justify-content: center; }
  .hud-center { display: flex; width: 100%; order: 3; justify-content: center; }
  .hud-info-group { width: 100%; justify-content: center; flex-wrap: wrap; column-gap: 8px; row-gap: 4px; padding: 6px; }
  .hud-info-item { padding: 2px 4px; }
  .hud-info-label { font-size: .55rem; letter-spacing: 0; }
  
  /* Cacher les diviseurs verticaux pour permettre le wrap */
  .hud-divider { display: none; }
  
  /* Masquer Scène et Niveau (labels) sur mobile, car c'est évident */
  .hud-info-item:nth-child(1) .hud-info-label,
  .hud-info-item:nth-child(3) .hud-info-label {
    display: none;
  }
  
  .hud-info-value { font-size: .75rem; }
  
  .hud-logo .hud-logo-text { display: none; }
  .hud-badge { font-size: .65rem; padding: 4px 8px; }
  .hud-badge--sync { font-size: .62rem; }

  /* Stack level pills */
  .hud-pills { gap: 4px; }
  .level-pill { padding: 8px 12px; font-size: .72rem; }

  /* Overlays repositioned */
  .scene-overlay { bottom: 65px; left: 8px; right: 8px; max-width: 100%; }
  .scene-overlay-desc { max-width: 100%; font-size: .75rem; }
  .scene-chip { font-size: .65rem; padding: 4px 8px; }
  
  .hint-overlay { bottom: 120px; right: 8px; left: 8px; }
  .hint-card { padding: 10px 14px; max-width: 100%; }
  
  .compass { top: 75px; left: 8px; width: 44px; height: 44px; }
  .scale-overlay { top: 120px; right: 8px; }
  .gyroscope { top: 75px; right: 8px; transform: scale(0.85); transform-origin: top right; }
  .zoom-control { right: 8px; bottom: 140px; transform: scale(0.85); transform-origin: bottom right; }

  /* Bottom bar: stack layout */
  .bottom-bar { padding: 6px 10px; }
  .bottom-bar-inner {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
  .gps-compact { order: 2; }
  .scene-nav-bar {
    order: 1; width: 100%;
    justify-content: center;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .scene-nav-bar::-webkit-scrollbar { display: none; }
  .session-controls { order: 3; }

  /* Scene buttons horizontal scroll */
  .scene-button {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: .72rem;
    white-space: nowrap;
  }

  /* Sidebar panels */
  .sidebar-tabs { padding: 10px 12px 0 48px; }
  .sidebar-panel { padding: 12px; }
  .sidebar-panel-header h2 { font-size: .95rem; }

  /* Briefing modal */
  .brief-card { padding: 32px 24px; }
  .brief-title { font-size: 1.8rem; }
  .brief-subtitle { font-size: .85rem; }
  .brief-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .brief-stat-value { font-size: 1.4rem; }
  .brief-stat-label { font-size: .65rem; }

  /* Factor info modal */
  .factor-info-card { padding: 20px 16px 16px; max-height: 85vh; }
  .factor-info-title { font-size: 1rem; }

  /* Feedback toast */
  .feedback-toast { bottom: 100px; font-size: .8rem; padding: 10px 18px; }

  /* Navigation arrows */
  .nav-arrow-icon { width: 48px !important; height: 48px !important; }
}

/* ─── Small phones (≤ 480px) ─── */
@media (max-width: 480px) {
  .hud-top { padding: 5px 8px; }
  .hud-pills { flex-wrap: wrap; }
  .level-pill { padding: 6px 10px; font-size: .68rem; min-height: 44px; min-width: 44px; }

  .sidebar-tabs { gap: 0; }
  .sidebar-tab { padding: 10px 10px; font-size: .72rem; min-height: 44px; }

  .brief-card { padding: 16px 12px; max-height: 90vh; overflow-y: auto; }
  .brief-title { font-size: 1.4rem; }
  .brief-grid { gap: 6px; grid-template-columns: 1fr; }
  .brief-stat { padding: 12px 8px; display: flex; align-items: center; justify-content: space-between; }
  .brief-stat-value { font-size: 1.2rem; }

  .scene-overlay-desc { max-width: 100%; }
  .hint-card { max-width: 100%; }

  .factor-info-card { max-width: 100%; max-height: 85vh; overflow-y: auto; }
}

/* ─── Landscape mode on mobile ─── */
@media (max-height: 500px) and (orientation: landscape) {
  .hud-top { padding: 4px 12px; }
  .hud-logo .hud-logo-text { display: none; }
  .bottom-bar { padding: 4px 10px; }
  .scene-overlay { bottom: 50px; }
  .hint-overlay { bottom: 50px; }
  .brief-card { padding: 20px 24px; max-height: 95vh; overflow-y: auto; }
  .brief-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .brief-title { font-size: 1.4rem; }

  /* Full height for panorama in landscape */
  .game-shell { grid-template-rows: auto 1fr auto; }
  .viewer-container { min-height: 0; }
}

/* ─── iOS safe area insets ─── */
@supports (padding: env(safe-area-inset-top)) {
  .hud-top {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .bottom-bar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .sidebar {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ═══════════ D1 · RESUME SESSION DIALOG ═══════════ */
.resume-dialog-overlay {
  position: fixed; inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .3s ease;
}
.resume-dialog-overlay.hidden {
  opacity: 0; pointer-events: none;
}
.resume-dialog-card {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(74, 222, 128, 0.1) inset;
  text-align: center;
  animation: resume-dialog-enter .35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes resume-dialog-enter {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.resume-dialog-icon {
  margin-bottom: 16px;
  color: var(--accent);
}
.resume-dialog-title {
  font-size: 1.15rem; font-weight: 700;
  color: var(--text); margin: 0 0 8px;
}
.resume-dialog-info {
  font-size: .85rem; color: var(--text-muted);
  line-height: 1.5; margin: 0 0 24px;
}
.resume-dialog-actions {
  display: flex; gap: 12px; justify-content: center;
}
.resume-dialog-btn {
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 8px;
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: none;
}
.resume-dialog-btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.resume-dialog-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.resume-dialog-btn--primary {
  background: var(--accent);
  color: var(--bg);
}
.resume-dialog-btn--primary:hover {
  background: #5df094;
}

@media (max-width: 600px) {
  .resume-dialog-card { padding: 24px 20px; }
  .resume-dialog-actions { flex-direction: column; gap: 8px; }
  .resume-dialog-btn { width: 100%; }
}

/* ═══════════ RESET PROGRESSION DIALOG ═══════════ */
.reset-dialog-overlay {
  position: fixed;
  bottom: 80px; /* Position above bottom bar */
  right: 20px;
  z-index: 9500;
  display: flex;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(0);
}
.reset-dialog-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}
.reset-dialog-card {
  background: var(--bg-surface);
  border: 1px solid var(--danger-dim);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  max-width: 360px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(248, 113, 113, 0.2) inset;
  background: linear-gradient(145deg, rgba(20, 24, 20, 0.98), rgba(12, 16, 12, 0.98));
}
.reset-dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.reset-dialog-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--danger);
  margin: 0;
}
.reset-dialog-header svg {
  color: var(--danger);
}
.reset-dialog-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-block: 0 20px;
}
.reset-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.primary-button.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
}
.primary-button.danger:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
}

@media (max-width: 600px) {
  .reset-dialog-overlay {
    bottom: 50px;
    right: 8px;
    left: 8px;
  }
  .reset-dialog-card {
    max-width: none;
    padding: 20px;
  }
}


/* ═══════════ MISSION SELECTOR DIALOG ═══════════ */
.mission-selector-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(12, 20, 16, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.mission-selector-overlay.hidden {
  opacity: 0; pointer-events: none;
}
.mission-selector-card {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 32px; width: 100%; max-width: 500px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(74, 222, 128, 0.1) inset;
  display: flex; flex-direction: column; gap: 24px;
}
.mission-selector-title {
  color: var(--text); font-size: 1.5rem; font-weight: 800;
  text-align: center; margin: 0;
}
.mission-selector-info {
  color: var(--text-muted); font-size: .95rem; line-height: 1.5;
  text-align: center; margin: 0;
}
.mission-selector-list {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 50vh; overflow-y: auto;
  padding-right: 4px;
}
.mission-variant-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 16px; text-align: left;
  cursor: pointer; transition: all var(--transition);
  display: flex; flex-direction: column; gap: 8px;
}
.mission-variant-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.mission-variant-header {
  display: flex; align-items: center; gap: 8px;
}
.mission-variant-color {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}
.mission-variant-title {
  color: var(--text); font-size: 1.1rem; font-weight: 700; margin: 0;
}
.mission-variant-desc {
  color: var(--text-muted); font-size: .85rem; line-height: 1.4; margin: 0;
}

/* ═══════════ COACHMARKS TUTORIAL ═══════════ */
.coachmarks-overlay {
  position: absolute; inset: 0; z-index: 9000;
  pointer-events: auto;
  transition: opacity .4s ease;
}
.coachmarks-overlay.hidden {
  opacity: 0; pointer-events: none;
}

.coachmark-highlight {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  border: 2px solid var(--accent);
  pointer-events: none;
  transition: all .4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9001;
}

.coachmark-dialog {
  position: absolute;
  z-index: 9002;
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(74, 222, 128, 0.15) inset;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: all .4s cubic-bezier(0.16, 1, 0.3, 1);
  /* Default positioning if no target */
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.coachmark-close {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px;
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; border-radius: 4px;
  transition: color .2s, background .2s;
  display: flex; align-items: center; justify-content: center;
}
.coachmark-close:hover { color: var(--text); background: rgba(255,255,255,0.1); }

.coachmark-step-counter {
  font-size: .65rem; font-weight: 800;
  letter-spacing: .1em; color: var(--accent);
  margin-bottom: 8px;
}

.coachmark-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  margin: 0 0 8px;
}

.coachmark-text {
  font-size: .85rem; color: var(--text-muted); line-height: 1.5;
  margin: 0 0 16px;
}

.coachmark-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

.coachmark-btn {
  padding: 8px 16px; border-radius: 6px; font-weight: 600; font-size: .8rem;
  cursor: pointer; transition: all .2s;
}
.coachmark-btn.coachmark-prev {
  background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid rgba(255,255,255,0.1);
}
.coachmark-btn.coachmark-prev:hover { background: rgba(255,255,255,0.1); }
.coachmark-btn.coachmark-next {
  background: var(--accent); color: var(--bg); border: none;
}
.coachmark-btn.coachmark-next:hover { background: #5df094; }

@media (max-width: 768px) {
  .coachmark-dialog { width: calc(100vw - 40px); left: 20px !important; transform: none !important; }
}

/* ═══════════ GDPR BANNER ═══════════ */
.gdpr-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--panel-border);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  padding: 16px 24px;
  z-index: 10000;
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1), opacity .4s ease;
  transform: translateY(0);
  opacity: 1;
}
.gdpr-banner.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}
.gdpr-content h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 700;
}
.gdpr-content p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.gdpr-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.gdpr-btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.gdpr-btn--deny {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
}
.gdpr-btn--deny:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.gdpr-btn--accept {
  background: var(--accent);
  color: var(--bg);
  border: none;
}
.gdpr-btn--accept:hover {
  background: #5df094;
}

@media (max-width: 768px) {
  .gdpr-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 20px;
  }
  .gdpr-actions {
    justify-content: flex-end;
  }
}

/* ═══════════════════════════════════════════════════
   D2 · TABLET BREAKPOINT (≤ 1024px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* ─── HUD Top Bar ─── */
  .hud-top { padding: 8px 12px; gap: 8px; }
  .hud-left, .hud-right { gap: 6px; }
  .hud-center { display: flex; }

  .hud-logo { font-size: .75rem; gap: 6px; }

  .level-pill {
    padding: 8px 14px;
    min-height: 44px; min-width: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
  }

  .hud-badge { font-size: .65rem; padding: 4px 8px; }

  .hud-icon-btn {
    width: 44px; height: 44px;
  }

  /* ─── Pannellum Controls ─── */
  .pnlm-controls .pnlm-zoom-in,
  .pnlm-controls .pnlm-zoom-out {
    width: 48px !important; height: 48px !important;
  }

  /* ─── Custom Hotspots ─── */
  .custom-hotspot {
    width: 40px; height: 40px;
  }
  .custom-hotspot.expertise {
    width: 22px; height: 22px;
  }
  .custom-hotspot.expertise.revealed {
    width: 40px; height: 40px;
  }
  .custom-hotspot::after {
    inset: -8px;
  }

  /* ─── Nav Arrows ─── */
  .nav-arrow-icon svg { width: 48px; height: 48px; }
  .nav-arrow-label { font-size: .75rem; padding: 5px 12px; opacity: 1; transform: translateY(0); }

  /* ─── Scene Overlay ─── */
  .scene-overlay { 
    bottom: 65px; 
    left: 16px; 
    right: auto; /* Stop l'étirement forcé */
    width: auto;
    max-width: 440px; 
  }
  .scene-overlay-desc { font-size: .8rem; max-width: 100%; }

  /* ─── Hint Overlay ─── */
  .hint-overlay { 
    bottom: 130px; 
    right: 16px; 
    left: auto;
    width: 280px; /* Force une largeur stricte pour éviter l'overflow du texte */
    max-width: calc(100vw - 32px);
  }
  .hint-card { 
    width: 100%; 
    max-width: 100%; 
    padding: 12px 14px; 
    box-sizing: border-box; /* Assure que le padding ne fait pas déborder */
  }

  /* ─── Compass ─── */
  .compass { width: 44px; height: 44px; top: 110px; left: 8px; }

  /* ─── Bottom Bar ─── */
  .bottom-bar { padding: 6px 12px; }
  .bottom-bar-inner { gap: 10px; }

  .scene-button {
    padding: 8px 14px;
    min-height: 44px;
    font-size: .75rem;
  }

  .gps-node {
    width: 36px; height: 36px;
    min-width: 44px; min-height: 44px;
    font-size: .75rem;
  }

  .ctrl-btn {
    width: 44px; height: 44px;
    font-size: .75rem;
  }

  /* ─── Sidebar ─── */
  .sidebar {
    width: 100vw; max-width: 100vw;
    right: -100%;
  }

  .sidebar-close {
    width: 44px; height: 44px;
    font-size: 1.2rem;
  }

  .sidebar-tabs { padding: 12px 12px 0 52px; }
  .sidebar-tab {
    padding: 12px 14px;
    min-height: 44px;
    font-size: .82rem;
  }

  .sidebar-panel { padding: 12px; }

  /* ─── Factor Cards ─── */
  .factor-info-btn {
    width: 44px; height: 44px;
    font-size: .88rem;
  }

  .factor-select {
    min-height: 44px;
    padding: 10px 12px;
    font-size: .85rem;
  }

  /* ─── Buttons ─── */
  .primary-button {
    min-height: 44px;
    padding: 12px 20px;
  }
  .ghost-button, .ghost-link {
    min-height: 44px;
    padding: 10px 16px;
  }
  .gdpr-btn {
    min-height: 44px;
    padding: 12px 20px;
  }

  /* ─── Feedback Toast ─── */
  .feedback-toast {
    bottom: 100px;
    max-width: calc(100vw - 40px);
    font-size: .82rem;
    padding: 10px 18px;
  }

  /* ─── Briefing ─── */
  .brief-card { max-width: calc(100vw - 32px); }

  /* ─── Factor Info Modal ─── */
  .factor-info-card { max-width: calc(100vw - 32px); }
  .factor-info-close { width: 44px; height: 44px; }

  /* ─── Coachmark ─── */
  .coachmark-btn { min-height: 44px; padding: 10px 18px; }

  /* ─── Admin (not critical but safe) ─── */
  .editor-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   D2 · PHONE BREAKPOINT (≤ 600px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* ─── Analytics Grid ─── */
  .analytics-grid { grid-template-columns: 1fr; }

  /* ─── Badges Grid ─── */
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
}

/* ═══════════════════════════════════════════════════
   D2 · TOUCH-SPECIFIC — disable hover effects
   ═══════════════════════════════════════════════════ */
@media (hover: none) {
  /* Show hotspot labels always on touch (no hover) */
  .custom-hotspot-label { opacity: 0.85; }

  /* Show nav-arrow labels always on touch */
  .nav-arrow-label { opacity: 1; transform: translateY(0); }

  /* Disable hover transforms on buttons */
  .scene-button:hover { transform: none; }
  .primary-button:hover { transform: none; box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25); }
  .nav-arrow:hover { transform: none; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }
  .custom-hotspot:hover { transform: none; }
  .factor-info-btn:hover { transform: none; }

  /* Prevent sticky hover states on touch */
  .level-pill:hover { background: rgba(255,255,255,0.06); color: var(--text-muted); }
  .level-pill.active:hover { background: var(--accent); color: #052e16; }
  .hud-icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-muted); }
  .scene-button:hover { background: rgba(255,255,255,0.06); color: var(--text-muted); }
  .scene-button.active:hover { background: var(--accent-dim); color: var(--accent); }
  .ctrl-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-muted); }
  .ghost-button:hover, .ghost-link:hover { background: rgba(255,255,255,0.06); color: var(--text-muted); }
  .sidebar-tab:hover { color: var(--text-muted); }
  .sidebar-tab.active:hover { color: var(--accent); }

  /* Larger touch targets for Pannellum controls */
  .pnlm-controls .pnlm-zoom-in,
  .pnlm-controls .pnlm-zoom-out {
    width: 48px !important; height: 48px !important;
  }

  /* Touch-active feedback (added via JS) */
  .touch-active {
    opacity: 0.7;
    transition: opacity 0.1s ease;
  }
}

/* ═══════════ PRINT STYLES (PDF EXPORT) ═══════════ */
@media print {
  /* Hide everything by default */
  body * {
    visibility: hidden;
  }
  
  /* Show only the debrief output and its children */
  #tab-debrief, #tab-debrief *, .debrief-output, .debrief-output * {
    visibility: visible;
  }
  
  /* Reset background and colors for print */
  body {
    background: white !important;
    color: black !important;
  }
  
  /* Adjust layout so debrief takes full page */
  #tab-debrief {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    background: none;
    max-height: none;
    overflow: visible;
  }
  
  /* Hide non-printable elements within debrief */
  .debrief-actions, #run-debrief, #export-debrief, .sidebar-panel-header {
    display: none !important;
  }

  /* Style cards for print */
  .result-card {
    background: white !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    margin-bottom: 20px;
    page-break-inside: avoid;
    color: black !important;
  }

  .result-card *, .result-card h3, .result-card h4, .result-card .hud-info-label {
    color: black !important;
  }
  
  .result-card .score-bar > div {
    /* To print background colors correctly, browsers need specific settings, 
       but we can use borders or shadows as a fallback */
    box-shadow: inset 0 0 0 1000px #333 !important; 
  }

  /* Specific color overrides for print */
  .text-danger { color: #d32f2f !important; }
  .text-amber { color: #f57c00 !important; }
  .text-success { color: #388e3c !important; }

  /* Ensure chart prints well if possible */
  #debrief-radar-chart {
    max-width: 500px;
    margin: 0 auto;
    display: block;
  }
}

/* ═══════════ KEYBOARD SHORTCUTS OVERLAY ═══════════ */
.keyboard-shortcuts-overlay {
  position: fixed; inset: 0;
  z-index: 9600;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .3s ease;
}
.keyboard-shortcuts-overlay.hidden {
  opacity: 0; pointer-events: none;
}
.keyboard-shortcuts-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(74, 222, 128, 0.1) inset;
  animation: kbd-dialog-enter .3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
@keyframes kbd-dialog-enter {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.keyboard-shortcuts-dialog h2 {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text); margin: 0 0 18px;
}
.keyboard-shortcuts-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none; background: rgba(255,255,255,0.06);
  color: var(--text-muted); cursor: pointer;
  border-radius: 6px; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.keyboard-shortcuts-close:hover {
  background: rgba(255,255,255,0.12); color: var(--text);
}

.shortcuts-table {
  width: 100%; border-collapse: collapse;
}
.shortcuts-table tr { border-bottom: 1px solid rgba(255,255,255,0.06); }
.shortcuts-table tr:last-child { border-bottom: none; }
.shortcuts-table td {
  padding: 10px 6px;
  font-size: .85rem;
  color: var(--text-muted);
  vertical-align: middle;
}
.shortcuts-table td:first-child {
  width: 100px; white-space: nowrap;
  text-align: center;
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-family: 'Inter', monospace;
  font-size: .75rem; font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  line-height: 1.4;
  min-width: 24px; text-align: center;
}

/* Factor card keyboard focus highlight */
.factor-card.keyboard-focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
}

@media (max-width: 600px) {
  .keyboard-shortcuts-dialog { padding: 20px 16px 16px; }
  .shortcuts-table td { padding: 8px 4px; font-size: .8rem; }
}

/* ═══════════════════════════════════════════════════
   E4 · ACCESSIBILITY: REDUCED MOTION
   ═══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════
   ULTIMATE MOBILE OVERRIDES (≤ 768px)
   Placé à la fin pour garantir la priorité absolue
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ========================================================
     PURIFICATION DE L'INTERFACE (Maximum de visibilité 3D)
     ======================================================== */

  /* 1. Masquer les éléments non-essentiels qui bloquent la vue */
  .hud-pills,             /* Sélecteur de niveau (prend trop de place) */
  .hint-overlay,          /* Bulle AIDE TERRAIN (masque la scène) */
  .zoom-control,          /* Contrôles +/-, on utilise le pinch-to-zoom natif */
  .hud-logo .hud-logo-text,         /* Texte du logo "Mission IBP 360" */
  .hud-info-label,        /* Textes "Preuves", "Temps", "Facteurs" */
  #current-scene-name,    /* Nom de la scène longue */
  #current-level-name {   /* Nom du niveau (Déjà clair par d'autres moyens) */
    display: none !important;
  }

  /* Cacher les séparateurs associés aux éléments supprimés, on garde juste 3 infos avec gap */
  .hud-info-group .hud-divider {
    display: none !important;
  }

  /* 2. Rendre la barre de statistiques ultra-compacte */
  .hud-top { 
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    padding: 4px 8px !important;
  }
  .hud-center {
    width: 100% !important;
    order: 3 !important;
    margin-top: 4px !important;
    padding: 4px 8px !important;
    justify-content: center !important;
    background: rgba(8, 14, 10, 0.7) !important;
    border-radius: 8px !important;
  }
  .hud-info-group {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px 16px !important; /* Petit espacement compact */
  }
  .hud-info-value {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
  }
  .hud-right .hud-icon-btn {
    width: 38px !important;
    height: 38px !important;
  }

  /* 3. Réduire drastiquement la place des widgets (et masquer la minicarte) */
  .minimap-overlay, #minimap-overlay {
    display: none !important;
  }
  .gyroscope {
    transform: scale(0.7) !important;
    top: 55px !important;
    left: auto !important;   /* CRITIQUE : empêcher l'étirement dû au left hérité */
    right: 8px !important;   /* Déplacer proprement à droite */
    width: auto !important;
    min-width: 44px !important;
  }

  /* 4. Compacter la bannière de description de scène (en bas) */
  .scene-overlay {
    bottom: 50px !important;
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    width: calc(100% - 16px) !important;
    margin: 0 8px !important;
    line-height: 1.2 !important;
  }
  .scene-overlay .nav-arrow-overlay {
    margin-bottom: 2px !important;
    font-size: 1.2rem !important;
  }

  /* ========================================================
     SÉCURITÉ CONTRE LE DÉBORDEMENT DE GRILLE
     ======================================================== */
  html, body, .app-container {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .game-shell, .viewer-container, .hud-top, .bottom-bar, .bottom-bar-inner {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Le carnet doit couvrir 100% strict */
  .sidebar {
    position: fixed !important;
    max-width: 100vw !important;
    width: 100% !important;
    z-index: 1000 !important;
  }
}


