:root {
  --noir: #434241;
  --creme: #f3e9d2;
  --bleu: #6677d7;
  --rouge: #e63946;
  --blanc: #f8f9fa;
  --bordeaux: #9c2b3c;
  --sarcelle: #2f6f6a;
  --creme-dim: #e4d6b0;
  --noir-2: #241c17;

  /* Couleurs éclaircies pour le texte sur fond sombre */
  --bleu-text: #a3b2ee;
  --rouge-text: #ef5b68;
}


/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* =========================================================
   BASE
   ========================================================= */

html,
body {
  min-height: 100%;
  background: var(--noir);
  color: var(--creme);
  font-family: 'Space Grotesk', sans-serif;
}

body {
  background:
    radial-gradient(
      circle at 15% 10%,
      rgba(74, 111, 165, 0.08),
      transparent 80%
    ),
    radial-gradient(
      circle at 85% 90%,
      rgba(230, 57, 70, 0.10),
      transparent 55%
    ),
    var(--noir);

  overflow-x: hidden;
}


/* =========================================================
   CONTENEUR PRINCIPAL
   ========================================================= */

.app {
  width: 100%;
  max-width: 960px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 20px 80px;
  position: relative;
}


/* =========================================================
   TYPOGRAPHIE
   ========================================================= */

h1,
h2,
h3,
.display {
  font-family: 'Helvetica', Arial, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}


/* =========================================================
   HEADER
   ========================================================= */

header {
  display: flex;
  align-items: center;
  gap: 24px;

  /*
   * Hauteur réservée correspondant au disque vinyle.
   * Évite un déplacement du contenu lors du rendu.
   */
  min-height: 96px;

  margin-bottom: 36px;
  flex-wrap: wrap;
}


/* =========================================================
   DISQUE VINYLE
   ========================================================= */

.vinyl-wrap {
  width: 96px;
  height: 96px;

  min-width: 96px;
  min-height: 96px;

  flex: none;
  position: relative;
}

.vinyl {
  width: 96px;
  height: 96px;

  border-radius: 50%;

  background:
    repeating-radial-gradient(
      circle at center,
      #0c0a09 0px,
      #0c0a09 2px,
      #221a15 3px,
      #221a15 4px
    );

  box-shadow:
    0 0 0 2px rgba(74, 111, 165, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.5);

  position: relative;

  animation: spin 6s linear infinite;
  animation-play-state: paused;
}

.vinyl.playing {
  animation-play-state: running;
}

.vinyl::after {
  content: '';

  position: absolute;
  top: 50%;
  left: 50%;

  width: 28px;
  height: 28px;

  background: var(--bleu);
  border-radius: 50%;

  transform: translate(-50%, -50%);

  box-shadow:
    inset 0 0 0 4px var(--noir);
}

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


/* =========================================================
   TITRE ET SOUS-TITRE
   ========================================================= */

header .titles {
  flex: 1;
  min-width: 200px;
}

header .eyebrow {
  min-height: 21px;

  font-family: 'Space Mono', monospace;

  color: var(--bleu-text);

  font-size: 1.05rem;
  line-height: 1.3;

  letter-spacing: 0.25em;
  text-transform: uppercase;
}

header h1 {
  min-height: 42px;

  font-size: 2.6rem;
  line-height: 1;

  color: var(--creme);

  margin-top: 6px;
}

header h1 span {
  color: var(--rouge-text);
}

header p.sub {
  min-height: 48px;

  font-family: 'Space Grotesk', sans-serif;

  color: var(--creme-dim);

  margin-top: 8px;

  font-size: 0.95rem;
  line-height: 1.5;

  max-width: 46ch;
}


/* =========================================================
   ÉCRANS
   ========================================================= */

.screen {
  display: none;
}

.screen.active {
  display: block;

  animation:
    fadeUp 0.45s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================================================
   ÉCRAN D'ACCUEIL
   ========================================================= */

/*
 * La grille des thèmes est remplie dynamiquement
 * par JavaScript.
 *
 * On réserve suffisamment d'espace pour éviter
 * que le footer soit repoussé lorsque les cartes
 * apparaissent.
 */

#screen-home {
  min-height: 620px;
}


/* =========================================================
   GRILLE DES THÈMES
   ========================================================= */

.grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fit, minmax(240px, 1fr));

  gap: 18px;

  /*
   * Réservation de l'espace nécessaire aux cartes.
   * Valeur volontairement supérieure à l'ancienne
   * réservation de 300px afin d'éviter le déplacement
   * du footer.
   */
  min-height: 620px;
}


/* =========================================================
   CARTES DES THÈMES
   ========================================================= */

.card {
  position: relative;

  min-height: 185px;

  border-radius: 14px;

  padding: 22px 20px 20px;

  background:
    linear-gradient(
      155deg,
      var(--noir-2),
      #180f0c
    );

  border:
    1px solid rgba(74, 111, 165, 0.18);

  cursor: pointer;

  text-align: left;

  color: var(--creme);

  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;

  overflow: hidden;
}

.card::before {
  content: '';

  position: absolute;
  inset: 0;

  opacity: 0;

  background:
    radial-gradient(
      circle at 85% -10%,
      rgba(74, 111, 165, 0.25),
      transparent 60%
    );

  transition: opacity 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);

  border-color: var(--bleu);

  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.45);
}

.card:hover::before {
  opacity: 1;
}

.card .icon {
  display: block;

  min-height: 38px;

  font-size: 2rem;
  line-height: 1;

  margin-bottom: 10px;
}

.card h3 {
  min-height: 24px;

  font-size: 1.25rem;
  line-height: 1.2;

  color: var(--creme);

  margin-bottom: 6px;
}

.card p {
  min-height: 38px;

  font-size: 0.82rem;

  color: var(--creme-dim);

  font-family: 'Space Mono', monospace;

  line-height: 1.5;
}

.card .tag {
  display: inline-block;

  min-height: 22px;

  margin-top: 12px;

  font-family: 'Space Mono', monospace;

  font-size: 0.68rem;
  line-height: 1.4;

  letter-spacing: 0.1em;

  text-transform: uppercase;

  color: var(--noir);

  background: var(--bleu-text);

  padding: 3px 8px;

  border-radius: 20px;
}


/* =========================================================
   QUIZ — EN-TÊTE
   ========================================================= */

.quiz-top {
  display: flex;

  justify-content: space-between;
  align-items: center;

  min-height: 35px;

  margin-bottom: 18px;

  gap: 16px;

  flex-wrap: wrap;
}

.quiz-theme-label {
  min-height: 22px;

  font-family: 'Space Mono', monospace;

  font-size: 0.95rem;
  line-height: 1.4;

  letter-spacing: 0.15em;

  text-transform: uppercase;

  color: var(--bleu-text);
}

.score-badge {
  min-height: 32px;

  font-family: 'Space Mono', monospace;

  font-size: 0.85rem;
  line-height: 1.4;

  background: var(--noir-2);

  border:
    1px solid rgba(74, 111, 165, 0.25);

  padding: 6px 12px;

  border-radius: 20px;
}


/* =========================================================
   BARRE DE PROGRESSION
   ========================================================= */

.dial {
  position: relative;

  width: 100%;
  height: 10px;

  border-radius: 6px;

  background: var(--noir-2);

  border:
    1px solid rgba(74, 111, 165, 0.2);

  margin-bottom: 28px;

  overflow: hidden;
}

.dial-fill {
  position: absolute;

  top: 0;
  left: 0;
  bottom: 0;

  width: 0%;

  background:
    linear-gradient(
      90deg,
      var(--rouge),
      var(--bleu)
    );

  transition:
    width 0.35s ease;
}


/* =========================================================
   BOÎTE DE QUESTION
   ========================================================= */

.question-box {
  min-height: 130px;

  background: var(--noir-2);

  border:
    1px solid rgba(74, 111, 165, 0.18);

  border-radius: 16px;

  padding: 28px 24px;

  margin-bottom: 22px;
}

.q-count {
  min-height: 18px;

  font-family: 'Space Mono', monospace;

  color: var(--creme-dim);

  font-size: 0.78rem;
  line-height: 1.4;

  margin-bottom: 10px;
}

.q-text {
  min-height: 58px;

  font-size: 1.35rem;
  line-height: 1.35;

  color: var(--creme);

  font-weight: 700;
}


/* =========================================================
   OPTIONS DE RÉPONSE
   ========================================================= */

.options {
  display: grid;

  gap: 12px;

  /*
   * Réserve l'espace nécessaire avant
   * l'injection des réponses par JavaScript.
   */
  min-height: 260px;
}

.opt {
  min-height: 58px;

  text-align: left;

  padding: 16px 18px;

  border-radius: 10px;

  border:
    1px solid rgba(243, 233, 210, 0.18);

  background:
    rgba(243, 233, 210, 0.03);

  color: var(--creme);

  font-family: 'Space Grotesk', sans-serif;

  font-size: 1.3rem;
  line-height: 1.35;

  cursor: pointer;

  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;

  display: flex;

  align-items: center;

  gap: 12px;
}

.opt:hover:not(:disabled) {
  border-color: var(--bleu);

  background:
    rgba(74, 111, 165, 0.08);
}

.opt .letter {
  flex: 0 0 auto;

  font-family: 'Space Mono', monospace;

  color: var(--bleu-text);

  font-weight: 700;
}

.opt.correct {
  border-color: var(--sarcelle);

  background:
    rgba(47, 111, 106, 0.25);
}

.opt.wrong {
  border-color: var(--bordeaux);

  background:
    rgba(156, 43, 60, 0.22);
}

.opt:disabled {
  cursor: default;
  opacity: 0.75;
}


/* =========================================================
   FEEDBACK
   ========================================================= */

.feedback {
  min-height: 35px;

  margin-top: 16px;

  font-family: 'Space Mono', monospace;

  font-size: 1.25rem;
  line-height: 1.4;

  color: var(--creme-dim);

  background: var(--noir-2);
}

.feedback.good {
  color: var(--sarcelle);
}

.feedback.bad {
  color: var(--bordeaux);
}


/* =========================================================
   BOUTONS / ACTIONS
   ========================================================= */

.quiz-actions {
  display: flex;

  justify-content: space-between;
  align-items: center;

  min-height: 48px;

  margin-top: 22px;

  gap: 12px;
}

.btn {
  min-height: 44px;

  font-family: 'Space Mono', monospace;

  text-transform: uppercase;

  letter-spacing: 0.08em;

  font-size: 0.99rem;
  line-height: 1.3;

  border:
    1px solid var(--bleu-text);

  background: transparent;

  color: var(--bleu-text);

  padding: 11px 18px;

  border-radius: 8px;

  cursor: pointer;

  transition:
    background 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.btn:hover {
  background: var(--creme);
  color: var(--noir);
}

.btn.primary {
  background: var(--creme);
  color: var(--noir);
}

.btn.primary:hover {
  background:
    rgba(243, 233, 210, 0.3);

  color: var(--creme);
}

.btn.ghost {
  border-color:
    rgba(243, 233, 210, 0.3);

  background: var(--creme);

  color: var(--noir);
}

.btn.ghost:hover {
  background:
    rgba(243, 233, 210, 0.3);

  color: var(--creme);
}

.btn:disabled {
  opacity: 0.35;

  cursor: not-allowed;

  background: transparent;

  color: var(--creme-dim);
}


/* =========================================================
   RÉSULTATS
   ========================================================= */

.results {
  text-align: center;

  padding: 20px 10px 0;

  min-height: 300px;
}

.results .big-score {
  min-height: 67px;

  font-family: 'Anton', sans-serif;

  font-size: 4.2rem;
  line-height: 1;

  color: var(--bleu-text);

  margin: 14px 0 6px;
}

.results .rating {
  min-height: 22px;

  font-family: 'Space Mono', monospace;

  color: var(--creme-dim);

  font-size: 0.9rem;
  line-height: 1.4;

  margin-bottom: 26px;
}

.results-actions {
  display: flex;

  gap: 12px;

  justify-content: center;

  flex-wrap: wrap;

  margin-top: 10px;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
  /*
   * Hauteur minimale réservée au footer.
   * Évite que sa hauteur change lorsque les
   * polices et le contenu sont finalisés.
   */
  min-height: 70px;

  text-align: center;

  margin-top: 50px;

  font-family: 'Helvetica', Arial, sans-serif;

  font-size: 0.9rem;
  line-height: 1.5;

  color:
    rgba(228, 214, 176, 0.8);

  letter-spacing: 0.1em;
}

footer a {
  display: inline-block;

  color: white;

  text-decoration: none;
}


/* =========================================================
   FOCUS CLAVIER / NAVIGATION
   ========================================================= */

a:focus-visible,
button:focus-visible,
.card:focus-visible,
.opt:focus-visible,
[tabindex]:focus-visible {
  outline:
    3px solid var(--bleu-text);

  outline-offset: 3px;

  border-radius: 6px;
}


/* =========================================================
   RÉDUCTION DES ANIMATIONS
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  .vinyl {
    animation: none;
  }

  .screen.active {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 560px) {

  .app {
    padding:
      24px 15px 60px;
  }

  header {
    gap: 18px;
  }

  header h1 {
    font-size: 2rem;
  }

  header p.sub {
    min-height: 72px;
  }

  /*
   * Sur mobile les cartes sont empilées.
   * On réserve donc davantage de hauteur.
   */
  #screen-home,
  .grid {
    min-height: 1250px;
  }

  .q-text {
    font-size: 1.1rem;
  }

  .opt {
    font-size: 1.05rem;

    padding:
      14px 15px;
  }

  .results .big-score {
    font-size: 3.2rem;
  }

  .quiz-actions {
    align-items: stretch;

    flex-direction: column;
  }

  .quiz-actions .btn {
    width: 100%;
  }
}