/* ==========================================
   PHARMA-LIFE : Feuille de style
   Jeu de révision ludique pour étudiants en pharmacie
   ========================================== */

/* Polices */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Fredoka:wght@500;600;700&display=swap');

/* Tokens de design */
:root {
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  /* Couleurs */
  --pharma-green: #2E7D32;
  --pharma-green-light: #43A047;
  --pharma-green-dark: #1B5E20;
  --pharma-green-pale: #E8F5E9;
  --medical-white: #FAFCFB;
  --warm-cream: #FFF8E7;
  --accent-orange: #FF7043;
  --accent-blue: #1565C0;
  --accent-purple: #7B1FA2;
  --accent-brown: #5D4037;
  --accent-teal: #00838F;

  --text-dark: #1A1A2E;
  --text-body: #2D2D3F;
  --text-muted: #6B6B7E;
  --text-light: #FFFFFF;

  --bg-gradient: linear-gradient(135deg, #E8F5E9 0%, #FFF8E7 50%, #E3F2FD 100%);
  --bg-primary: #F1F8E9;
  --bg-secondary: #F5F5F5;
  --surface: #FFFFFF;
  --border: #E0E0E0;
  --border-light: #F0F0F0;
  --shadow-small: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-large: 0 16px 48px rgba(0,0,0,0.12);
  --text-faint: #9E9E9E;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-soft: 0 4px 16px rgba(46, 125, 50, 0.12);
  --shadow-medium: 0 8px 32px rgba(46, 125, 50, 0.16);
  --shadow-strong: 0 12px 48px rgba(46, 125, 50, 0.24);

  --transition: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-body);
  background: var(--bg-gradient);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font-family: var(--font-body);
}

/* Conteneur de jeu */
#game-container {
  width: 100vw;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Surcouche UI */
.ui-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.ui-overlay > * {
  pointer-events: auto;
}

/* === ÉCRAN TITRE === */
.screen-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 40%, #B3E5FC 100%);
  z-index: 20;
}

.title-logo {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  color: white;
  text-align: center;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
}

.title-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: white;
  text-align: center;
  max-width: 480px;
  line-height: 1.5;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.25);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(4px);
}

.title-canvas-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
  min-height: 48px;
}

.btn-primary {
  background: var(--pharma-green);
  color: white;
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
  background: var(--pharma-green-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--pharma-green-dark);
  border: 2px solid var(--pharma-green-pale);
  box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
  border-color: var(--pharma-green);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-large {
  padding: 18px 48px;
  font-size: 1.1rem;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === CRÉATION D'AVATAR === */
.screen-avatar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: linear-gradient(135deg, #E8F5E9 0%, #FFF8E7 100%);
  z-index: 20;
  padding: 24px;
  overflow-y: auto;
}

.avatar-section-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--pharma-green-dark);
  font-family: var(--font-display);
}

.avatar-canvas-wrapper {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}

.avatar-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#avatar-canvas {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-xl);
  background: white;
  box-shadow: var(--shadow-medium);
}

.avatar-name-input {
  padding: 12px 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--pharma-green-pale);
  font-size: 1rem;
  text-align: center;
  width: 240px;
  background: white;
  color: #1A1A2E !important;
}

.avatar-name-input:focus {
  outline: none;
  border-color: var(--pharma-green);
}

.avatar-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 360px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.option-choices {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-soft);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: var(--pharma-green-dark);
  transform: scale(1.1);
}

/* === HUD === */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  pointer-events: none;
  z-index: 15;
}

.hud-left {
  display: flex;
  gap: 12px;
  align-items: center;
  pointer-events: auto;
}

.hud-right {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-avatar-mini {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--pharma-green-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--pharma-green);
  overflow: hidden;
}

.hud-player-info {
  display: flex;
  flex-direction: column;
}

.hud-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1A1A2E;
  line-height: 1.2;
}

.hud-role {
  font-size: 0.75rem;
  color: #2D2D3F;
}

.hud-stats {
  display: flex;
  gap: 12px;
}

.stat-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 400ms ease;
}

.stat-fill.xp { background: linear-gradient(90deg, #66BB6A, #43A047); }
.stat-fill.energy { background: linear-gradient(90deg, #FFB74D, #FF7043); }
.stat-fill.knowledge { background: linear-gradient(90deg, #64B5F6, #1565C0); }

.stat-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
}

.hud-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  color: var(--pharma-green-dark);
}

.hud-icon-btn:hover {
  background: white;
  transform: translateY(-2px);
}

/* === PANNEAU DE ZONE === */
.zone-panel {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  pointer-events: none;
  background: white;
  border-radius: var(--radius-xl);
  padding: 24px 32px;
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 360px;
  max-width: 480px;
  z-index: 18;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1), opacity 300ms ease;
}

.zone-panel.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.zone-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zone-panel-icon {
  font-size: 2rem;
  line-height: 1;
}

.zone-panel-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-dark);
}

.zone-panel-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.zone-panel-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* === QUIZ === */
.quiz-container {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}

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

.quiz-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--pharma-green-dark);
}

.quiz-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}

.quiz-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.quiz-dot.done { background: var(--pharma-green); }
.quiz-dot.current { background: var(--pharma-green); transform: scale(1.3); }
.quiz-dot.wrong { background: var(--accent-orange); }

.quiz-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.quiz-question {
  background: white;
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-medium);
  width: 100%;
  text-align: center;
}

.quiz-question-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.5;
}

.quiz-module-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  margin-bottom: 16px;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.quiz-choice {
  padding: 18px 24px;
  border-radius: var(--radius-md);
  background: white;
  border: 2px solid #E0E0E0;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-soft);
}

.quiz-choice:hover {
  border-color: var(--pharma-green);
  transform: translateY(-2px);
}

.quiz-choice-letter {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--pharma-green-pale);
  color: var(--pharma-green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.quiz-choice.correct {
  background: #E8F5E9;
  border-color: var(--pharma-green);
}

.quiz-choice.correct .quiz-choice-letter {
  background: var(--pharma-green);
  color: white;
}

.quiz-choice.wrong {
  background: #FFEBEE;
  border-color: var(--accent-orange);
}

.quiz-choice.wrong .quiz-choice-letter {
  background: var(--accent-orange);
  color: white;
}

.quiz-choice.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.quiz-feedback {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-soft);
  border-left: 4px solid var(--pharma-green);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-body);
  width: 100%;
  display: none;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.wrong { border-left-color: var(--accent-orange); }

/* === RÉSULTATS QUIZ === */
.quiz-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.results-score {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--pharma-green);
  font-weight: 700;
}

.results-message {
  font-size: 1.1rem;
  color: var(--text-body);
}

.results-xp {
  background: var(--pharma-green-pale);
  border-radius: var(--radius-full);
  padding: 10px 24px;
  font-weight: 600;
  color: var(--pharma-green-dark);
}

/* === CARRIÈRE / ENTRETIEN === */
.career-container {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 50%, #E8F5E9 100%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}

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

.career-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-dark);
}

.career-path {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.career-stage {
  display: flex;
  gap: 16px;
  align-items: center;
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
}

.career-stage.locked {
  opacity: 0.5;
}

.career-stage.current {
  border: 2px solid var(--pharma-green);
  box-shadow: var(--shadow-medium);
}

.career-stage-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.career-stage-info {
  flex: 1;
}

.career-stage-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-dark);
}

.career-stage-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.career-stage-req {
  font-size: 0.8rem;
  color: var(--accent-orange);
  margin-top: 4px;
}

/* Dialogue d'entretien */
.interview-dialog {
  background: white;
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-strong);
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.interview-npc {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.interview-npc-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--pharma-green-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.interview-npc-name {
  font-weight: 700;
  color: var(--text-dark);
}

.interview-npc-role {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.interview-question {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.5;
  margin-bottom: 20px;
}

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

/* === NOTIFICATIONS / TOASTS === */
.toast-container {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(46, 125, 50, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-medium);
  animation: toastIn 300ms ease, toastOut 300ms ease 2.7s forwards;
  white-space: nowrap;
}

.toast.warning {
  background: rgba(255, 112, 67, 0.95);
}

.toast.info {
  background: rgba(21, 101, 192, 0.95);
}

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

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-20px); }
}

/* === BULLE DE DIALOGUE === */
.dialogue-bubble {
  position: absolute;
  background: white;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dark);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
  pointer-events: none;
  z-index: 12;
  animation: bubbleIn 200ms ease;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === ÉCRAN DE CHARGEMENT === */
.loading-screen {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 40;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(46, 125, 50, 0.2);
  border-top-color: var(--pharma-green);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === ANIMATIONS DE NIVEAU === */
.level-up-banner {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: linear-gradient(135deg, #43A047, #2E7D32);
  color: white;
  padding: 24px 48px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-strong);
  text-align: center;
  z-index: 35;
  pointer-events: none;
}

.level-up-banner.show {
  animation: levelUp 2s ease forwards;
}

.level-up-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  overflow: visible;
  white-space: nowrap;
}

.level-up-subtitle {
  font-size: 1.1rem;
  margin-top: 4px;
}

@keyframes levelUp {
  0% { transform: translateX(-50%) scale(0); opacity: 0; }
  15% { transform: translateX(-50%) scale(1.1); opacity: 1; }
  20% { transform: translateX(-50%) scale(1); }
  80% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 0; }
}

/* === PARTICULES === */
.particle {
  position: absolute;
  pointer-events: none;
  z-index: 14;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .hud {
    padding: 8px;
  }

  .hud-card {
    padding: 8px 12px;
  }

  .hud-stats {
    gap: 8px;
  }

  .stat-bar {
    min-width: 60px;
  }

  .quiz-content {
    gap: 16px;
  }

  .quiz-question {
    padding: 20px;
  }

  .quiz-question-text {
    font-size: 1rem;
  }

  .quiz-choice {
    padding: 14px 16px;
    font-size: 0.9rem;
  }

  .avatar-canvas-wrapper {
    gap: 16px;
  }

  #avatar-canvas {
    width: 160px;
    height: 160px;
  }

  .zone-panel {
    min-width: 280px;
    padding: 16px 20px;
    bottom: 16px;
  }
}

/* === INDICATION DE DÉPLACEMENT === */
.move-hint {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-soft);
  z-index: 12;
}

.move-hint kbd {
  display: inline-block;
  padding: 2px 8px;
  background: var(--pharma-green-pale);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--pharma-green-dark);
}

/* === MINI-CARTE === */
.minimap {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 160px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 2px solid white;
  z-index: 12;
  pointer-events: none;
}

#minimap-canvas {
  width: 100%;
  height: 100%;
}

/* Fade transition entre écrans */
.fade-transition {
  position: absolute;
  inset: 0;
  background: var(--bg-gradient);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms ease;
}

.fade-transition.active {
  opacity: 1;
  pointer-events: auto;
}

/* === TABLEAU DE BORD === */
.dash-module-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.dash-module-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.dash-module-info {
  flex: 1;
}

.dash-module-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.dash-module-bar {
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.dash-module-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 400ms ease;
}

.dash-module-score {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

/* Flashcard card flip animation */
#flashcard-front, #flashcard-back {
  transition: opacity 200ms ease;
}

/* Responsive: cacher le bouton dashboard sur très petit écran */
@media (max-width: 480px) {
  .hud-right {
    flex-direction: column;
    gap: 4px;
  }
  .hud-icon-btn {
    width: 36px;
    height: 36px;
  }
}

/* ==========================================
   STYLES COMMERCIAUX — Landing, Auth, Légal
   ========================================== */

.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #F1F8E9;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 0;
}

#auth-screen, #legal-screen, #account-screen {
  z-index: 2100;
}

/* --- LANDING PAGE --- */
.commercial-landing {
  width: 100%;
  max-width: 1200px;
  padding: 40px 24px;
}

.commercial-hero {
  text-align: center;
  padding: 60px 20px 48px;
  background: linear-gradient(135deg, var(--pharma-green) 0%, #1B5E20 100%);
  border-radius: var(--radius-xl);
  color: white;
  margin-bottom: 48px;
}

.commercial-logo {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.commercial-tagline {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
}

.commercial-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 32px;
}

.commercial-cta-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.commercial-cta-group .btn-ghost {
  color: white;
  border-color: rgba(255,255,255,0.4);
}

/* --- FEATURES --- */
.commercial-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 56px;
}

.commercial-feature {
  text-align: center;
  padding: 32px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.commercial-feature-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.commercial-feature h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.commercial-feature p {
  font-size: 0.9rem;
  color: var(--text-body);
  line-height: 1.5;
}

/* --- PRICING --- */
.commercial-pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 56px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  position: relative;
}

.pricing-featured {
  border-color: var(--pharma-green);
  transform: scale(1.02);
  box-shadow: var(--shadow-medium);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pharma-green);
  color: white;
  padding: 4px 16px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pricing-card h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--pharma-green-dark);
  margin-bottom: 20px;
}

.pricing-price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-card ul {
  list-style: none;
  padding: 0;
  margin-bottom: 24px;
  text-align: left;
}

.pricing-card li {
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-body);
  border-bottom: 1px solid var(--border-light);
}

.pricing-card li::before {
  content: "✓ ";
  color: var(--pharma-green);
  font-weight: 700;
}

.pricing-card .btn {
  width: 100%;
}

/* --- FOOTER --- */
.commercial-footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.commercial-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  margin: 0 12px;
  padding: 4px;
  text-decoration: underline;
}

.commercial-link:hover {
  color: var(--pharma-green-dark);
}

.commercial-copyright {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* --- AUTH --- */
.auth-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-large);
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  margin: 40px auto;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.auth-close:hover {
  background: var(--bg-secondary);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--pharma-green-dark);
  box-shadow: var(--shadow-small);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 12px;
}

.auth-label:first-child {
  margin-top: 0;
}

.auth-input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--surface);
  width: 100%;
}

.auth-input:focus {
  outline: none;
  border-color: var(--pharma-green);
}

.auth-submit {
  margin-top: 20px;
  width: 100%;
}

.auth-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.auth-hint a {
  color: var(--pharma-green-dark);
  text-decoration: underline;
}

.auth-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-body);
  margin-top: 8px;
  cursor: pointer;
  text-align: left;
}

.auth-checkbox-label > span {
  flex: 1;
  line-height: 1.4;
}

.auth-checkbox-label a {
  color: var(--pharma-green-dark);
  text-decoration: underline;
}

.auth-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  text-align: center;
  display: none;
}

.auth-message.auth-error {
  display: block;
  background: #FFEBEE;
  color: #C62828;
}

/* --- LEGAL --- */
.legal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-large);
  padding: 48px 40px;
  width: 100%;
  max-width: 700px;
  margin: 40px auto;
}

.legal-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 24px;
}

.legal-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--pharma-green-dark);
  margin: 24px 0 12px;
}

.legal-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 20px 0 8px;
}

.legal-content p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-body);
  margin-bottom: 12px;
}

.legal-content ul {
  margin: 8px 0 16px 24px;
}

.legal-content li {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-body);
  margin-bottom: 4px;
}

.legal-warning {
  background: #FFF3E0;
  border-left: 4px solid #FF9800;
  padding: 16px;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.legal-warning p {
  color: #E65100;
  font-weight: 600;
}

/* --- USER BAR --- */
#user-bar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border-bottom-left-radius: var(--radius-lg);
  box-shadow: var(--shadow-medium);
}

.user-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
}

.user-bar-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.user-bar-plan {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-free {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.badge-premium {
  background: #FFD700;
  color: #5D4037;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* --- ACCOUNT --- */
.account-section {
  margin: 24px 0;
}

.account-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.95rem;
}

.account-label {
  font-weight: 600;
  color: var(--text-muted);
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .commercial-landing { padding: 20px 12px; }
  .commercial-hero { padding: 40px 16px 32px; }
  .commercial-tagline { font-size: 1.5rem; }
  .commercial-subtitle { font-size: 0.95rem; }
  .commercial-cta-group { flex-direction: column; }
  .commercial-cta-group .btn { width: 100%; }
  .commercial-features { grid-template-columns: 1fr; }
  .commercial-pricing { grid-template-columns: 1fr; }
  .pricing-featured { transform: none; }
  .auth-card { margin: 16px; padding: 32px 20px; }
  .legal-card { margin: 16px; padding: 32px 20px; }
  .user-bar-inner { flex-wrap: wrap; padding: 6px 10px; }
  .user-bar-name { font-size: 0.8rem; }
}

/* --- SCROLLBAR SCENARIO --- */
#scenario-screen .quiz-content,
#flashcard-screen .quiz-content {
  overflow-y: auto;
  padding-bottom: 24px;
}

/* === Conformité légale === */
.legal-todo { color: #b45309; background: #fef3c7; padding: 0 4px; border-radius: 4px; font-weight: 600; }
#consent-screen { z-index: 10000; }
.consent-card { max-width: 480px; }
.consent-price { text-align: center; margin: 0 0 18px; color: var(--color-text-muted, #555); }
.consent-line { align-items: flex-start; margin-bottom: 14px; font-size: 0.9rem; line-height: 1.45; text-align: left; }
.consent-line input { margin-top: 3px; flex-shrink: 0; }
.account-legal { text-align: center; font-size: 0.8rem; margin-top: 16px; }
.account-legal a { color: inherit; opacity: 0.75; }

/* === Formules tarifaires === */
.pricing-desc { font-size: 0.85rem; color: #666; margin: 4px 0 10px; min-height: 2.6em; }
.pricing-soon { opacity: 0.75; border-style: dashed; }
.plan-soon-btn { cursor: default; }
.plan-current { font-size: 0.75rem; color: #2e7d32; font-weight: 600; }
.plan-selector-card { max-width: 560px; }
.plan-option {
  display: block; width: 100%; text-align: left; margin-bottom: 12px;
  padding: 14px 16px; border: 1px solid #d0d5c0; border-radius: 12px;
  background: #fff; cursor: pointer; font: inherit;
}
.plan-option:hover:not([disabled]) { border-color: #2e7d32; background: #f6fbf4; }
.plan-option[disabled] { opacity: 0.6; cursor: default; }
.plan-option-name { display: block; font-weight: 700; }
.plan-option-price { display: inline-block; margin: 4px 0; color: #2e7d32; font-weight: 600; }
.plan-option-desc { display: block; font-size: 0.85rem; color: #555; }
.content-locked { position: relative; opacity: 0.7; }
.lock-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  background: #fff3cd; color: #856404; border-radius: 8px; font-size: 0.75rem; font-weight: 600;
}
