/* ==========================================================================
   KENKEN PORTAL - DESIGN SYSTEM OFFICIEL & ARCHITECTURE BI-THÈME UNIFIÉE
   Cycle 3 (CM1 - CM2) | Keken.fr • Kenken.site
   Architecture éprouvée : Jetons Sémantiques Universels & Parité Stricte
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@500;700;800&family=Lexend:wght@400;500;600;700&display=swap');

/* ==========================================================================
   1. JETONS SÉMANTIQUES (DESIGN TOKENS)
   ========================================================================== */

/* --------------------------------------------------------------------------
   A. MODE CLAIR (PAR DÉFAUT ABSOLU) — Lumineux, Didactique, Contrasté & Éducatif
   -------------------------------------------------------------------------- */
:root,
html[data-theme="light"],
body.theme-light {
  /* Surfaces & Toiles */
  --bg-canvas: #f8fafc;
  --bg-canvas-gradient: 
    radial-gradient(circle at 12% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 88% 22%, rgba(14, 165, 233, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 88%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
    #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.92);
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-subtle-hover: #e2e8f0;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-dropdown: #ffffff;
  --bg-backdrop: rgba(15, 23, 42, 0.52);

  /* Typographie & Couleurs de Texte (WCAG AAA) */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', var(--font-main);
  --font-readable: 'Lexend', sans-serif;

  --text-primary: #0f172a;       /* Ardoise sombre profonde (contraste > 16:1) */
  --text-secondary: #334155;     /* Ardoise soutenue (contraste > 8:1) */
  --text-muted: #64748b;         /* Ardoise douce (contraste > 4.5:1) */
  --text-inverse: #ffffff;       /* Blanc pour boutons et badges colorés pleins */

  /* Dégradés graphiques adaptés au Mode Clair */
  --logo-title-gradient: linear-gradient(125deg, #0f172a 20%, #4338ca 100%);
  --hero-title-highlight: linear-gradient(135deg, #0284c7 0%, #4f46e5 50%, #7c3aed 100%);

  /* Disciplines Fondamentales du Cycle 3 */
  --color-francais: #4f46e5;
  --color-francais-glow: rgba(79, 70, 229, 0.2);
  --color-francais-light: rgba(79, 70, 229, 0.08);

  --color-maths: #0284c7;
  --color-maths-glow: rgba(2, 132, 199, 0.2);
  --color-maths-light: rgba(2, 132, 199, 0.08);

  --color-sciences: #059669;
  --color-sciences-glow: rgba(5, 150, 105, 0.2);
  --color-sciences-light: rgba(5, 150, 105, 0.08);

  --color-histoire: #d97706;
  --color-histoire-glow: rgba(217, 119, 6, 0.2);
  --color-histoire-light: rgba(217, 119, 6, 0.08);

  --color-emc: #e11d48;
  --color-emc-glow: rgba(225, 29, 72, 0.2);
  --color-emc-light: rgba(225, 29, 72, 0.08);

  /* Accents & États */
  --accent-cyan: #0284c7;
  --accent-purple: #7c3aed;
  --accent-gold: #d97706;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  /* Bordures fines et précises */
  --border-subtle: #cbd5e1;
  --border-card: #e2e8f0;
  --border-glow: rgba(99, 102, 241, 0.3);
  --border-focus: #0284c7;

  /* Ombres et Lueurs douces (Soft Ambient Shadows) */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 4px 18px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 16px 36px rgba(15, 23, 42, 0.12), 0 0 22px rgba(99, 102, 241, 0.12);
  --shadow-dropdown: 0 16px 40px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 25px 60px rgba(15, 23, 42, 0.22), 0 0 35px rgba(99, 102, 241, 0.12);
  --shadow-glow: 0 6px 25px rgba(99, 102, 241, 0.14);

  /* Particules d'arrière-plan */
  --stars-opacity: 0.12;
  --stars-filter: invert(0.85);

  /* Aliasing de compatibilité descendante */
  --bg-space: var(--bg-canvas);
  --bg-space-gradient: var(--bg-canvas-gradient);
  --bg-elevated: var(--bg-surface-elevated);
  --bg-subtle-box: var(--bg-surface-subtle);
  --card-glow-ambient: rgba(99, 102, 241, 0.12);
}

/* --------------------------------------------------------------------------
   B. MODE SOMBRE — Espace Profond, Cyber-Académie, Concentration Nocturne
   -------------------------------------------------------------------------- */
html[data-theme="dark"],
body.theme-dark {
  /* Surfaces & Toiles */
  --bg-canvas: #070a13;
  --bg-canvas-gradient: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.16) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(14, 165, 233, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.09) 0%, transparent 50%),
    #070a13;
  --bg-header: rgba(7, 10, 19, 0.88);
  --bg-card: rgba(18, 26, 47, 0.78);
  --bg-card-hover: rgba(26, 37, 66, 0.92);
  --bg-surface-elevated: #151d33;
  --bg-surface-subtle: rgba(255, 255, 255, 0.05);
  --bg-surface-subtle-hover: rgba(255, 255, 255, 0.1);
  --bg-input: rgba(18, 26, 47, 0.85);
  --bg-input-focus: rgba(26, 37, 66, 0.95);
  --bg-dropdown: rgba(15, 23, 42, 0.98);
  --bg-backdrop: rgba(4, 7, 15, 0.85);

  /* Typographie & Couleurs de Texte */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --logo-title-gradient: linear-gradient(120deg, #ffffff 30%, #38bdf8 100%);
  --hero-title-highlight: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);

  /* Disciplines Fondamentales (Couleurs vibrantes néon) */
  --color-francais: #6366f1;
  --color-francais-glow: rgba(99, 102, 241, 0.4);
  --color-francais-light: rgba(99, 102, 241, 0.15);

  --color-maths: #0ea5e9;
  --color-maths-glow: rgba(14, 165, 233, 0.4);
  --color-maths-light: rgba(14, 165, 233, 0.15);

  --color-sciences: #10b981;
  --color-sciences-glow: rgba(16, 185, 129, 0.4);
  --color-sciences-light: rgba(16, 185, 129, 0.15);

  --color-histoire: #f59e0b;
  --color-histoire-glow: rgba(245, 158, 11, 0.4);
  --color-histoire-light: rgba(245, 158, 11, 0.15);

  --color-emc: #f43f5e;
  --color-emc-glow: rgba(244, 63, 94, 0.4);
  --color-emc-light: rgba(244, 63, 94, 0.15);

  --accent-cyan: #38bdf8;
  --accent-purple: #8b5cf6;
  --accent-gold: #fbbf24;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  --border-focus: #38bdf8;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 25px rgba(99, 102, 241, 0.25);
  --shadow-dropdown: 0 16px 45px rgba(0, 0, 0, 0.65);
  --shadow-modal: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 50px rgba(99, 102, 241, 0.3);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

  --stars-opacity: 0.5;
  --stars-filter: none;

  --bg-space: var(--bg-canvas);
  --bg-space-gradient: var(--bg-canvas-gradient);
  --bg-elevated: var(--bg-surface-elevated);
  --bg-subtle-box: var(--bg-surface-subtle);
  --card-glow-ambient: rgba(99, 102, 241, 0.25);
}

/* --------------------------------------------------------------------------
   C. ACCESSIBILITÉ : MODE DYSLEXIE & POLICE ADAPTÉE
   -------------------------------------------------------------------------- */
body.dyslexic {
  --font-main: 'Lexend', 'Comic Sans MS', sans-serif !important;
  --font-display: 'Lexend', 'Comic Sans MS', sans-serif !important;
  letter-spacing: 0.06em !important;
  word-spacing: 0.15em !important;
  line-height: 1.8 !important;
}

/* Rayons & Transitions Globales */
:root {
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   2. RESET & BASE NATURELLE
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: var(--bg-canvas-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Étoiles d'ambiance */
.stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--stars-opacity);
  filter: var(--stars-filter);
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 140px, #38bdf8, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 200px 90px, #818cf8, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 320px 240px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 450px 120px, #34d399, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 580px 290px, #fbbf24, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 600px 600px;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

/* ==========================================================================
   3. PORTE D'ACCÈS SÉCURISÉE (AUTH GATE SCREEN)
   ========================================================================== */
.auth-gate-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-canvas-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: background 0.25s ease;
}

.auth-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: center;
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.auth-gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #0ea5e9, #10b981, #f59e0b);
}

.gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-francais-light);
  border: 1px solid var(--border-glow);
  color: var(--color-francais);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xl);
  margin-bottom: 1.2rem;
}

.gate-title {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: var(--logo-title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gate-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 2rem;
}

.btn-google-login {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #cbd5e1;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.95rem 1.8rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.btn-google-login:hover {
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.gate-waiting-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
}

.gate-theme-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 10000;
  box-shadow: var(--shadow-md);
}

.gate-theme-btn:hover {
  transform: scale(1.08);
  border-color: var(--color-francais);
  box-shadow: 0 0 16px var(--color-francais-glow);
}

/* ==========================================================================
   4. STRUCTURE PRINCIPALE DU PORTAIL & EN-TÊTE
   ========================================================================== */
.main-app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  position: relative;
  box-sizing: border-box;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

body.has-admin-toolbar .site-header {
  top: 52px;
}

.header-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.4);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: #ffffff;
  letter-spacing: -0.05em;
}

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

.logo-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  background: var(--logo-title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.cycle-filter-pills {
  display: flex;
  background: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pill-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-subtle-hover);
}

.pill-btn.active {
  background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
}

.header-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.header-btn:hover {
  border-color: var(--border-glow);
  background: var(--bg-surface-subtle-hover);
  transform: translateY(-1px);
}

.header-btn.primary {
  background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.header-btn.primary:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.header-btn.danger-btn {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.header-btn.danger-btn:hover {
  background: #dc2626;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.auth-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xl);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.auth-chip:hover {
  border-color: var(--border-glow);
  background: var(--bg-surface-subtle-hover);
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #ffffff;
}

.auth-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-verified {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-admin {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* ==========================================================================
   5. MENU DÉROULANT DU PROFIL & HUB UNIFIÉ
   ========================================================================== */
.user-menu-wrapper {
  position: relative;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 310px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow-dropdown);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-primary);
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.user-menu-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.35);
  flex-shrink: 0;
}

.user-menu-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.menu-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-email {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.2rem 0;
}

.menu-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.user-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.row-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.row-icon {
  font-size: 1rem;
}

/* Pills Thème Segmented */
.theme-segmented-pills {
  display: flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2px;
}

.theme-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.35rem 0.7rem;
  border-radius: 16px;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.theme-pill-btn:hover {
  color: var(--text-primary);
}

.theme-pill-btn.active {
  background: var(--color-francais);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--color-francais-glow);
}

/* Switch Dyslexie */
.menu-toggle-switch {
  width: 44px;
  height: 24px;
  border-radius: 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
  outline: none;
}

.menu-toggle-switch .switch-handle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-toggle-switch.active {
  background: #10b981;
  border-color: #059669;
}

.menu-toggle-switch.active .switch-handle {
  transform: translateX(20px);
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Bouton Action Menu (Admin) */
.menu-action-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  transition: var(--transition-fast);
}

.menu-action-btn:hover {
  background: var(--color-francais);
  color: #ffffff;
  border-color: var(--color-francais);
  box-shadow: 0 4px 15px var(--color-francais-glow);
  transform: translateY(-1px);
}

.user-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.menu-logout-btn {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.menu-logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

/* ==========================================================================
   6. TOASTS & NOTIFICATIONS
   ========================================================================== */
.app-toast-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.app-toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-dropdown);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast.toast-success {
  border-color: rgba(34, 197, 94, 0.45);
}

.app-toast.toast-error {
  border-color: rgba(239, 68, 68, 0.45);
}

.app-toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.45);
}

.app-toast.toast-info {
  border-color: var(--border-glow);
}

/* ==========================================================================
   7. HERO BANNER & COCKPIT ÉLÈVE
   ========================================================================== */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  position: relative;
  z-index: 1;
}

.hero-section {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 3.5rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-francais-light);
  border: 1px solid var(--border-glow);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-xl);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-francais);
  margin-bottom: 1.2rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.2rem;
  color: var(--text-primary);
}

.hero-title .highlight {
  background: var(--hero-title-highlight);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 1.8rem;
  max-width: 620px;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.feature-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface-subtle);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.feature-tag svg {
  color: var(--accent-cyan);
}

.hero-cockpit {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.hero-cockpit::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #0ea5e9, #10b981, #f59e0b);
}

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

.cockpit-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.cockpit-badge {
  background: var(--color-maths-light);
  color: var(--color-maths);
  border: 1px solid var(--border-glow);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

.cockpit-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.stat-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: var(--transition-fast);
}

.stat-box:hover {
  background: var(--bg-surface-subtle-hover);
  border-color: var(--border-glow);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-val.gradient {
  background: var(--hero-title-highlight);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.session-indicator {
  background: var(--color-francais-light);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.session-info strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.session-info span {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.session-time-pill {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-francais);
  background: var(--bg-surface-elevated);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   8. RECHERCHE & FILTRES RAPIDES
   ========================================================================== */
.filter-bar-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 300px;
  max-width: 520px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.1rem 0.85rem 3rem;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.search-input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.discipline-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.discipline-tab-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.discipline-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-subtle-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.discipline-tab-btn.active {
  color: #ffffff;
  border-color: transparent;
}

.discipline-tab-btn[data-disc="all"].active { background: linear-gradient(135deg, #4f46e5, #0284c7); }
.discipline-tab-btn[data-disc="francais"].active { background: var(--color-francais); box-shadow: 0 4px 15px var(--color-francais-glow); }
.discipline-tab-btn[data-disc="mathematiques"].active { background: var(--color-maths); box-shadow: 0 4px 15px var(--color-maths-glow); }
.discipline-tab-btn[data-disc="sciences"].active { background: var(--color-sciences); box-shadow: 0 4px 15px var(--color-sciences-glow); }
.discipline-tab-btn[data-disc="histoire-geo"].active { background: var(--color-histoire); box-shadow: 0 4px 15px var(--color-histoire-glow); }
.discipline-tab-btn[data-disc="emc"].active { background: var(--color-emc); box-shadow: 0 4px 15px var(--color-emc-glow); }

/* ==========================================================================
   9. GRILLE DES DISCIPLINES DU CYCLE 3
   ========================================================================== */
.section-heading-group {
  margin-bottom: 2rem;
}

.section-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 0.35rem;
}

.section-main-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.disciplines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.8rem;
  margin-bottom: 4rem;
}

.discipline-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.discipline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, #6366f1);
  opacity: 0.85;
  transition: var(--transition-fast);
}

.discipline-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  border-color: var(--card-accent, var(--border-glow));
  box-shadow: var(--shadow-card-hover);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.card-icon-bubble {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--card-accent, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 6px 18px var(--card-glow, rgba(99, 102, 241, 0.3));
  font-size: 1.4rem;
}

.card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.card-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.4rem;
  flex: 1;
}

.competencies-preview-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.6rem;
  background: var(--bg-surface-subtle);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.comp-preview-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.comp-preview-item::before {
  content: '▸';
  color: var(--card-accent, #38bdf8);
  font-weight: bold;
}

.card-bottom-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: var(--color-maths-light);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glow);
}

.card-cta-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.discipline-card:hover .card-cta-btn {
  color: var(--accent-cyan);
  transform: translateX(4px);
}

/* ==========================================================================
   10. OUTILS MÉTHODOLOGIQUES & ASSISTANCE À L'ÉLÈVE
   ========================================================================== */
.tools-section {
  margin-bottom: 4rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}

.tool-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: var(--transition-fast);
}

.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.tool-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-maths-light);
  border: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 1.3rem;
  flex-shrink: 0;
}

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

.tool-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.tool-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   11. SYSTÈME DE MODAUX UNIVERSELS & ACCORDÉONS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-backdrop);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.25s ease;
  padding: 2.2rem;
  position: relative;
  color: var(--text-primary);
}

.modal-backdrop.open .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--bg-surface-subtle-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.modal-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: var(--color-maths-light);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.9rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.modal-summary {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.8rem;
}

.modal-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.modal-domains-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.8rem;
}

.modal-domain-item {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.domain-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.domain-item-skills {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.domain-item-skills li {
  font-size: 0.84rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.domain-item-skills li::before {
  content: '✓';
  color: var(--success);
  font-weight: bold;
}

.pedagogy-alert-box {
  background: var(--color-francais-light);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-bottom: 1.6rem;
}

.pedagogy-alert-box h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-francais);
  margin-bottom: 0.4rem;
}

.pedagogy-alert-box p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   12. CONSOLE D'ADMINISTRATION
   ========================================================================== */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.admin-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  color: var(--text-primary);
}

.admin-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.admin-input-group {
  margin-bottom: 0.8rem;
}

.admin-input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.admin-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.admin-input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.whitelist-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
  font-size: 0.8rem;
}

.whitelist-table th, .whitelist-table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.whitelist-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.whitelist-del-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.85rem;
}

/* ==========================================================================
   13. SMART TV MODE (10-FOOT UI & FOCUS CALIBRÉ TCL 960x507)
   ========================================================================== */
body.tv-mode {
  font-size: 18px;
  --radius-xl: 28px;
  --radius-md: 16px;
  padding-bottom: 70px !important;
}

body.tv-mode .site-header {
  padding: 0.8rem 1.8rem;
}

body.tv-mode .main-content {
  padding: 1.5rem 1.8rem 5rem;
  max-width: 1400px;
}

body.tv-mode .hero-section {
  padding: 2rem 1.8rem;
  gap: 1.5rem;
}

body.tv-mode .hero-title {
  font-size: 2.3rem;
  line-height: 1.15;
}

body.tv-mode .hero-cockpit {
  padding: 1.4rem;
}

body.tv-mode .disciplines-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
}

body.tv-mode .discipline-card {
  padding: 1.4rem;
}

/* Raccourci numérique TV sur chaque carte discipline */
.tv-shortcut-badge {
  display: none;
}

body.tv-mode .tv-shortcut-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-cyan);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  box-shadow: 0 0 10px var(--color-maths-glow);
  letter-spacing: 0.5px;
}

/* Focus spatial D-pad haute visibilité (10-Foot standard) */
[data-navigable]:focus,
[data-navigable].tv-focused {
  outline: none !important;
  box-shadow: 0 0 0 4px var(--accent-cyan), 0 0 35px var(--color-maths-glow) !important;
  transform: scale(1.035) !important;
  z-index: 50;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Barre HUD d'actions télécommande Smart TV (Bas d'écran) */
.tv-hud-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 2px solid var(--accent-cyan);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 9999;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tv-hud-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  white-space: nowrap;
}

.tv-hud-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tv-hud-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--accent-cyan);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 800;
}

.tv-color-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}
.tv-color-dot.red { background: #ef4444; color: #ef4444; }
.tv-color-dot.green { background: #22c55e; color: #22c55e; }
.tv-color-dot.yellow { background: #eab308; color: #eab308; }
.tv-color-dot.blue { background: #3b82f6; color: #3b82f6; }

/* Simulation du cadre TV TCL (Mode Simulateur Admin) */
body.simulating-tv .main-app-container {
  max-width: 960px !important;
  margin: 15px auto 70px auto !important;
  border: 12px solid #0f172a !important;
  border-radius: 18px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7) !important;
  background: var(--bg-canvas) !important;
  overflow: hidden !important;
  position: relative !important;
}

/* ==========================================================================
   TÉLÉCOMMANDE VIRTUELLE TCL RC802V INTERACTIVE (SIMULATEUR TV)
   ========================================================================== */
.virtual-remote-widget {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 0.75rem 0.85rem 0.85rem;
  z-index: 10005;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 20px rgba(14, 165, 233, 0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 180px;
  user-select: none;
  animation: remoteFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes remoteFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.virtual-remote-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.remote-header-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.4px;
}

.remote-power-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  transition: all 0.2s ease;
}

.remote-power-led.active {
  background: #38bdf8;
  box-shadow: 0 0 12px #38bdf8;
  transform: scale(1.3);
}

.remote-header-controls {
  display: flex;
  gap: 0.25rem;
}

.remote-header-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.remote-header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.virtual-remote-screen-badge {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 600;
  padding: 0 0.1rem;
}

.remote-viewport-tag {
  background: rgba(14, 165, 233, 0.18);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
}

/* Corps de la télécommande & Image TCL */
.virtual-remote-body {
  position: relative;
  width: 146px;
  height: 520px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 28px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8), 0 5px 15px rgba(0, 0, 0, 0.5);
  background: #000000;
}

.tcl-remote-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

/* Calque des hotspots interactifs superposés */
.remote-hotspots-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.remote-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  outline: none;
  border-radius: 50%;
  transition: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.remote-hotspot:hover {
  background: rgba(56, 189, 248, 0.28);
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.remote-hotspot:active,
.remote-hotspot.pressed {
  background: rgba(56, 189, 248, 0.7) !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 18px #38bdf8 !important;
  transform: translate(-50%, -50%) scale(0.9) !important;
}

/* Formes spéciales des boutons */
.remote-hotspot.pill {
  border-radius: 12px;
}

.remote-hotspot.pill.red:hover {
  background: rgba(239, 68, 68, 0.45);
  border-color: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}
.remote-hotspot.pill.red:active, .remote-hotspot.pill.red.pressed {
  background: #ef4444 !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 20px #ef4444 !important;
}

.remote-hotspot.pill.green:hover {
  background: rgba(34, 197, 94, 0.45);
  border-color: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}
.remote-hotspot.pill.green:active, .remote-hotspot.pill.green.pressed {
  background: #22c55e !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 20px #22c55e !important;
}

.remote-hotspot.pill.yellow:hover {
  background: rgba(234, 179, 8, 0.45);
  border-color: #eab308;
  box-shadow: 0 0 10px #eab308;
}
.remote-hotspot.pill.yellow:active, .remote-hotspot.pill.yellow.pressed {
  background: #eab308 !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 20px #eab308 !important;
}

.remote-hotspot.pill.blue:hover {
  background: rgba(59, 130, 246, 0.45);
  border-color: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
}
.remote-hotspot.pill.blue:active, .remote-hotspot.pill.blue.pressed {
  background: #3b82f6 !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 20px #3b82f6 !important;
}

.remote-hotspot.power:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.3);
}

.remote-hotspot.ok-center {
  border-radius: 50%;
}

.remote-hotspot.dpad-up,
.remote-hotspot.dpad-down {
  border-radius: 14px;
}

.remote-hotspot.dpad-left,
.remote-hotspot.dpad-right {
  border-radius: 14px;
}

.remote-hotspot.rocker-top {
  border-radius: 12px 12px 4px 4px;
}
.remote-hotspot.rocker-bot {
  border-radius: 4px 4px 12px 12px;
}

/* Pastille de statut au bas de la télécommande */
.remote-status-pill {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.35rem 0.5rem;
  font-size: 0.68rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.remote-status-pill .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
  flex-shrink: 0;
}

/* Badge flottant minimisé pour la télécommande */
.remote-floating-badge {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: #ffffff;
  padding: 0.65rem 1.15rem;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  z-index: 10005;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
  animation: remoteBadgeBounce 0.4s ease-out;
}

.remote-floating-badge:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 15px 35px rgba(2, 132, 199, 0.5);
}

@keyframes remoteBadgeBounce {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   14. BARRE DE SUPERVISION MULTI-ÉCRAN ADMIN (RÉVERSIBLE)
   ========================================================================== */
.admin-preview-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.toolbar-icon {
  font-size: 1.1rem;
}

.toolbar-modes {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-subtle);
}

.mode-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.45rem 1.1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-main);
  white-space: nowrap;
}

.mode-pill:hover {
  color: var(--text-primary);
  background: var(--bg-surface-subtle-hover);
}

.mode-pill.active {
  background: var(--accent-cyan);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 16px var(--color-maths-glow);
}

.toolbar-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  white-space: nowrap;
}

#admin-viewport-label {
  font-weight: 600;
  color: var(--text-secondary);
}

body.has-admin-toolbar {
  padding-top: 52px;
}

/* Simulateur Mobile */
.mobile-restore-banner {
  display: none;
}

body.simulating-mobile {
  padding-top: 60px !important;
  min-height: 100vh !important;
}

body.simulating-mobile .mobile-restore-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  transition: background 0.2s;
  user-select: none;
}

body.simulating-mobile .main-app-container {
  max-width: 420px !important;
  margin: 15px auto 40px auto !important;
  border: 10px solid var(--border-subtle) !important;
  border-radius: 44px !important;
  box-shadow: var(--shadow-modal) !important;
  background: var(--bg-canvas) !important;
  overflow: hidden !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative;
}

body.simulating-mobile .hero-section {
  grid-template-columns: 1fr !important;
  padding: 1.5rem 1rem !important;
}

body.simulating-mobile .hero-title {
  font-size: 1.8rem !important;
}

body.simulating-mobile .disciplines-grid {
  grid-template-columns: 1fr !important;
}

body.simulating-mobile .tools-grid {
  grid-template-columns: 1fr !important;
}

body.simulating-mobile .header-container {
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 1rem !important;
}

body.simulating-mobile .header-actions {
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
}

body.simulating-mobile .filter-bar-section {
  flex-direction: column !important;
}

body.simulating-mobile .search-input-wrapper {
  max-width: 100% !important;
}

/* ==========================================================================
   15. PIED DE PAGE DU PORTAIL
   ========================================================================== */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  padding: 2.5rem 1.5rem;
  margin-top: auto;
  color: var(--text-secondary);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-left strong {
  color: var(--text-primary);
}

.footer-domains {
  display: flex;
  gap: 0.8rem;
  font-size: 0.82rem;
  color: var(--accent-cyan);
}

.footer-domains a {
  color: inherit;
  text-decoration: none;
}

.footer-domains a:hover {
  text-decoration: underline;
}

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

/* ==========================================================================
   17. STUDIO LUDO-ÉDUCATIF & LECTEUR D'APPLICATIONS (APP PLAYER)
   ========================================================================== */
.games-section {
  margin-top: 3.5rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.8rem;
  margin-top: 2rem;
}

.game-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--game-accent, var(--accent-cyan));
  opacity: 0.8;
  transition: height 0.2s ease;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--game-accent, var(--accent-cyan));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 0 25px var(--game-glow, rgba(14, 165, 233, 0.2));
}

.game-card:hover::before {
  height: 6px;
}

.game-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.game-icon-bubble {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.game-card:hover .game-icon-bubble {
  transform: scale(1.1) rotate(4deg);
}

.game-badges-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.game-badge-discipline {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.game-badge-level {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.game-concept-pill {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--game-accent, var(--accent-cyan));
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  letter-spacing: 0.3px;
}

.game-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.game-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.2rem;
  flex-grow: 1;
}

.game-competencies-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.8rem;
}

.game-competencies-list li {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  line-height: 1.4;
}

.comp-check {
  color: var(--success);
  font-weight: 900;
}

.game-card-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
}

.btn-play-game {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--game-accent, var(--accent-cyan));
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-open-game-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all 0.2s ease;
}

.btn-open-game-ext:hover {
  background: var(--bg-surface-subtle-hover);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

/* Modal App Player Plein Écran */
.app-player-modal {
  padding: 1rem;
  z-index: 10002;
}

.app-player-container {
  width: 100%;
  max-width: 1360px;
  height: 94vh;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-glow);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-player-header {
  height: 60px;
  padding: 0 1.4rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.app-player-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-player-back-btn:hover {
  background: var(--accent-cyan);
  color: #ffffff;
}

.app-player-title-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.app-player-icon {
  font-size: 1.8rem;
}

.app-player-titles {
  display: flex;
  flex-direction: column;
}

.app-player-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.app-player-discipline {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 700;
}

.app-player-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-player-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.app-player-action-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.app-player-x {
  position: static;
  width: 36px;
  height: 36px;
}

.app-player-frame-wrapper {
  flex: 1;
  width: 100%;
  position: relative;
  background: #000000;
}

.app-player-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #ffffff;
}

body.app-player-active {
  overflow: hidden !important;
}

body.tv-mode .games-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

body.tv-mode .game-card {
  padding: 1.4rem;
}

/* ==========================================================================
   18. RESPONSIVE DESIGN (TABLETTES & SMARTPHONES)
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .disciplines-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .hero-title {
    font-size: 2.4rem;
  }
  .disciplines-grid {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions {
    justify-content: space-between;
  }
  .filter-bar-section {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrapper {
    max-width: 100%;
  }
}

/* ==========================================================================
   16. SECTION APPLICATIONS LUDO-ÉDUCATIVES & JEUX INTERACTIFS (CYCLE 3)
   ========================================================================== */
.games-section {
  margin-top: 3.5rem;
  margin-bottom: 3.5rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.8rem;
  margin-top: 1.6rem;
}

.game-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  cursor: pointer;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--game-accent, var(--color-maths));
  transition: height 0.2s ease;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--game-accent, var(--color-maths));
  box-shadow: 0 16px 36px var(--game-glow, rgba(0, 0, 0, 0.25));
}

.game-card:hover::before {
  height: 6px;
}

.game-card:focus-visible {
  outline: 3px solid var(--game-accent, var(--color-maths));
  outline-offset: 4px;
  transform: translateY(-6px);
}

.game-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.game-icon-bubble {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.game-badges-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.game-badge-discipline {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-surface-subtle);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.game-badge-level {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.game-concept-pill {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--game-accent, var(--color-maths));
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
}

.game-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.game-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.game-competencies-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.8rem;
}

.game-competencies-list li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  line-height: 1.35;
}

.comp-check {
  color: var(--success);
  font-weight: bold;
  font-size: 0.85rem;
}

.game-card-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: auto;
}

.btn-play-game {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--game-accent, var(--color-maths));
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.btn-play-game:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.btn-open-game-ext {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-open-game-ext:hover {
  background: var(--bg-surface-hover);
  border-color: var(--game-accent, var(--color-maths));
  color: var(--game-accent, var(--color-maths));
}

/* ==========================================================================
   17. MODAL APP PLAYER (STUDIO PLEIN ÉCRAN KENKEN)
   ========================================================================== */
.app-player-modal {
  padding: 0;
  z-index: 10000;
}

.app-player-container {
  width: 96vw;
  height: 94vh;
  max-width: 1440px;
  background: var(--bg-base);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  animation: appPlayerIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes appPlayerIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.app-player-header {
  height: 64px;
  padding: 0 1.4rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.app-player-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-player-back-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.app-player-title-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  overflow: hidden;
}

.app-player-icon {
  font-size: 1.8rem;
}

.app-player-titles {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-player-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.app-player-discipline {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

.app-player-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.app-player-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.app-player-action-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.app-player-x {
  position: static;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-player-x:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

.app-player-frame-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  background: #ffffff;
}

.app-player-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Optimisation Smart TV */
body.tv-mode .game-card {
  border-width: 2px;
}

body.tv-mode .game-card:focus-visible,
body.tv-mode .game-card.tv-focused {
  outline: 4px solid #38bdf8 !important;
  outline-offset: 4px;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.6) !important;
  transform: scale(1.03);
}

body.tv-mode .app-player-container {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
}

