/* ============================================================
   style.css — Rubik's Cube Tutoriel
   Design sombre moderne · Glassmorphism · Micro-animations
   Responsive : mobile, tablette, desktop
   ============================================================ */

/* ─── Imports ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── Design Tokens (CSS Custom Properties) ─────────────────────── */
:root {
  /* Couleurs de base */
  --bg:          #0a0a0f;
  --bg-2:        #111118;
  --bg-3:        #18181f;
  --surface:     rgba(255,255,255,0.05);
  --surface-2:   rgba(255,255,255,0.08);
  --border:      rgba(255,255,255,0.10);
  --border-2:    rgba(255,255,255,0.18);

  /* Texte */
  --text:        #f0f0f8;
  --text-dim:    rgba(240,240,248,0.60);
  --text-muted:  rgba(240,240,248,0.38);

  /* Accent (overridable via JS) */
  --accent:      #7c3aed;
  --accent-dim:  #7c3aedaa;
  --accent-glow: #7c3aed44;

  /* Autocollants Rubik's Cube */
  --sticker-white:  #f8f8f8;
  --sticker-yellow: #fde047;
  --sticker-red:    #ef4444;
  --sticker-orange: #f97316;
  --sticker-blue:   #3b82f6;
  --sticker-green:  #22c55e;

  /* Typographie */
  --font:       'Inter', system-ui, sans-serif;
  --font-head:  'Space Grotesk', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Mono', monospace;

  /* Rayons */
  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 9999px;

  /* Ombres */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 24px var(--accent-glow);

  /* Transitions */
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --transition-fast: 0.12s ease;
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);

  /* Mise en page */
  --nav-h: 64px;
  --sidebar-w: 320px;
  --max-w: 1200px;
}

/* ─── Mode dyslexie ─────────────────────────────────────────────── */
.dyslexia {
  --font: 'Arial', 'Helvetica', sans-serif;
  letter-spacing: 0.05em;
  word-spacing:   0.15em;
  line-height:    1.9;
}

/* ─── Mode contraste élevé ──────────────────────────────────────── */
.high-contrast {
  --border:   rgba(255,255,255,0.4);
  --border-2: rgba(255,255,255,0.7);
  --text-dim: rgba(240,240,248,0.9);
  --surface:  rgba(255,255,255,0.12);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Liens ─────────────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}
a:hover { opacity: 0.8; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ─── Focus visible (mode clavier uniquement) ───────────────────── */
.keyboard-nav *:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
*:focus:not(:focus-visible) { outline: none; }

/* ─── Skip Link ─────────────────────────────────────────────────── */
#skip-to-main {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--r-sm);
  z-index: 9999;
  font-weight: 600;
  transition: top var(--transition-fast);
}
#skip-to-main:focus { top: 1rem; }

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ─── Typographie ───────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p { color: var(--text-dim); max-width: 65ch; }

/* ─── Navigation ────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  gap: 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.navbar-logo {
  height: 36px;
  width: auto;
}

.navbar-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  list-style: none;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface-2);
}

.nav-link.active {
  color: var(--accent);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Burger mobile */
.nav-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text);
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: var(--r-full);
  transition: transform var(--transition), opacity var(--transition);
}

/* ─── Boutons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.3rem;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--border-2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-2); }

.btn-success {
  background: #16a34a;
  color: #fff;
}
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
  line-height: 1;
}
.btn-icon:hover { color: var(--text); border-color: var(--accent-dim); }

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--r-md);
}

/* ─── Cards / Surfaces ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-glass {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--r-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ─── Layout général ────────────────────────────────────────────── */
.page-wrapper {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

main { flex: 1; }

/* ─── Footer ────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent); }

/* ─── Hero (Accueil) ────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 50%, var(--accent-glow), transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(59,130,246,0.08), transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
  padding: 5rem 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.hero-text { max-width: 540px; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 0.3rem 0.9rem;
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero h1 {
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Cube 3D container dans le hero */
.hero-cube {
  display: flex;
  justify-content: center;
  align-items: center;
}

#hero-cube-container {
  width: min(420px, 90vw);
  height: min(420px, 90vw);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(124,58,237,0.12) 0%, transparent 70%);
  border: 1px solid var(--border);
}

/* ─── Bloc sauvegarde ────────────────────────────────────────────── */
.save-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 0.9rem 1.2rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* ─── Étapes (Accueil) ───────────────────────────────────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.step-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.step-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.step-card:hover::before { opacity: 1; }

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.step-card h3 { margin-bottom: 0.4rem; font-size: 1rem; }
.step-card p  { font-size: 0.9rem; margin: 0; }

/* ─── Page Résoudre ──────────────────────────────────────────────── */
.solve-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 0;
  min-height: calc(100vh - var(--nav-h));
}

/* Panneau gauche : configurateur + guide */
.solve-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-2);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Zone principale : cube 3D */
.solve-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  overflow-y: auto;
}

/* ─── Barre de progression ───────────────────────────────────────── */
.progress-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-bar-track {
  height: 6px;
  background: var(--bg-3);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  border-radius: var(--r-full);
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  min-width: 0;
}

.progress-steps {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.progress-step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
  font-family: var(--font-head);
}

.progress-step.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.progress-step.completed {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Configurateur 2D ───────────────────────────────────────────── */
.configurator-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.config-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Palette de couleurs */
.palette {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.palette-color {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  padding: 0;
}

.palette-color:hover { transform: scale(1.15); }
.palette-color.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: scale(1.1);
}

/* Grille des faces */
.faces-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.face-wrapper h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.face-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 80px;
}

.sticker {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.sticker:hover:not(.center) { transform: scale(1.12); z-index: 1; }
.sticker.center { cursor: default; opacity: 0.9; }

/* Erreur de configuration */
.config-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  border-radius: var(--r-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* Boutons de configuration */
.config-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* ─── Cube 3D container ───────────────────────────────────────────── */
.cube-container-wrapper {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(124,58,237,0.1), transparent 70%);
  border: 1px solid var(--border);
  flex: 1;
  min-height: 360px;
}

#cube-container {
  width: 100%;
  height: 100%;
  min-height: 360px;
}

/* Label de la face mise en évidence */
.cube-face-indicator {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-full);
  padding: 0.3rem 1rem;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Contrôles de lecture ───────────────────────────────────────── */
.playback-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.playback-controls .speed-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.speed-group input[type=range] {
  width: 80px;
  accent-color: var(--accent);
}

/* ─── Guide pédagogique ─────────────────────────────────────────── */
.guide-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.guide-header {
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.guide-header h2 {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.orientation-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.guide-body { padding: 1.5rem; }

.guide-description {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

/* Onglets de cas */
.case-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.case-tab {
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
}

.case-tab.active, .case-tab:hover {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* Situation du cas */
.case-situation {
  background: var(--bg-3);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-style: italic;
}

/* Algorithme */
.algo-section h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

#algorithm-display {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 40px;
  margin-bottom: 1rem;
}

.move-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: all var(--transition-fast);
  min-width: 48px;
}

.move-badge.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.move-notation {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.move-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 72px;
  line-height: 1.3;
}

.algo-placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.88rem;
  align-self: center;
}

/* Notes pédagogiques */
.guide-notes {
  background: rgba(250,204,21,0.07);
  border: 1px solid rgba(250,204,21,0.2);
  border-radius: var(--r-sm);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

.guide-notes::before {
  content: '💡 ';
}

/* Boutons guide */
.guide-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ─── Face 2D miniature ─────────────────────────────────────────── */
.face-2d-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.face-2d-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

#face-2d-display { }

.face-2d-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 72px;
}

.face-2d-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.2);
}

.face-2d-cell.center {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3) inset;
}

/* ─── Panneaux latéraux (Accessibilité, Paramètres) ─────────────── */
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  animation: fadeIn 0.22s ease;
}

.panel-overlay[hidden] { display: none; }

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

.panel-drawer {
  width: min(380px, 95vw);
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.28s cubic-bezier(0.4,0,0.2,1);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 { font-size: 1.1rem; }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Ligne de paramètre */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.setting-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.setting-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

/* Range slider */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--bg-3);
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Color picker */
input[type=color] {
  -webkit-appearance: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  background: none;
  padding: 0;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border-radius: var(--r-sm); border: 2px solid var(--border); }

/* ─── Page Chronomètre ───────────────────────────────────────────── */
.timer-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h));
  text-align: center;
  padding: 3rem 1.5rem;
}

.timer-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.05); opacity: 0.8; }
}

.timer-badge {
  display: inline-block;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 0.3rem 1rem;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

/* ─── Pages simples (FAQ, Contact, etc.) ────────────────────────── */
.simple-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.simple-page h1 { margin-bottom: 1rem; }
.simple-page > p { margin-bottom: 2.5rem; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 1px; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.1rem 1.25rem;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.faq-question:hover { background: var(--surface-2); }
.faq-question::after { content: '+'; font-size: 1.25rem; color: var(--accent); flex-shrink: 0; }
.faq-item[open] .faq-question::after { content: '−'; }

.faq-answer {
  padding: 0 1.25rem 1.1rem;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.75;
}

/* Formulaire contact */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

input[type=text], input[type=email], textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.7rem 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
}

input[type=text]:focus, input[type=email]:focus, textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

textarea { min-height: 140px; }

/* ─── Badges de navigation d'étapes ─────────────────────────────── */
.step-nav {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .solve-layout {
    grid-template-columns: 1fr;
  }
  .solve-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  .navbar-nav { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 0.75rem; }
  .navbar-nav.open { display: flex; }
  .nav-burger { display: flex; }

  .hero-content {
    grid-template-columns: 1fr;
    padding: 2.5rem 1rem;
    gap: 2rem;
    text-align: center;
  }
  .hero-text { max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-cube { order: -1; }

  #hero-cube-container {
    width: min(280px, 85vw);
    height: min(280px, 85vw);
  }

  .steps-grid { grid-template-columns: 1fr; }

  .faces-grid { grid-template-columns: repeat(3, 1fr); }

  .solve-sidebar { padding: 1rem; }
  .solve-main    { padding: 1rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .section    { padding: 2.5rem 0; }

  #hero-cube-container {
    width: min(240px, 80vw);
    height: min(240px, 80vw);
  }

  .playback-controls { gap: 0.3rem; }
  .playback-controls .speed-group { margin-left: 0; }
}

/* ─── Animations générales ───────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.5s cubic-bezier(0.4,0,0.2,1) both;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }

/* ─── Utilitaires ────────────────────────────────────────────────── */
.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;
}

.text-accent  { color: var(--accent); }
.text-dim     { color: var(--text-dim); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.font-mono    { font-family: var(--font-mono); }
.hidden       { display: none !important; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-sm       { gap: 0.5rem; }
.gap-md       { gap: 1rem; }
.mt-sm        { margin-top: 0.5rem; }
.mt-md        { margin-top: 1rem; }
.mt-lg        { margin-top: 2rem; }
