/* ============================================================
   Lissajous Lab — Feuille de styles
   Simulateur d'oscilloscope vintage (1957)
   Courbes de Lissajous paramétriques en temps réel

   Organisation :
     1. RESET & BASE         — Styles globaux
     2. HEADER               — Titre et sous-titre
     3. MAIN LAYOUT          — Oscilloscope + Contrôles côte à côte
     4. OSCILLOSCOPE         — Écran rond + cadre vintage
     5. CONTROLS             — Panneau de réglages
     6. SLIDERS              — Contrôles fréquence/phase/amplitude
     7. WHEEL                — Bouton Spin Wheel (🎰)
     8. SCORE & HINTS        — Affichage du score et indices
     9. DEMO BUTTON          — Bouton mode démo
    10. LIBRARY              — Bibliothèque de formes
    11. RESPONSIVE           — Adaptation mobile
   ============================================================ */

/* ──────────────────────────────────────────────
   1. RESET & BASE
   ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

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

body {
  background: #0a0a0f;
  color: #c8d6e5;
  font-family: 'Share Tech Mono', monospace;  /* Police rétro-tech */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  user-select: none;                            /* Pas de sélection texte */
}

/* ──────────────────────────────────────────────
   2. HEADER
   ────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 2.2rem;
  letter-spacing: 4px;
  /* Dégradé vert → cyan, style oscilloscope */
  background: linear-gradient(135deg, #39ff14, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(57, 255, 20, 0.3);
  margin-bottom: 4px;
}

.header .subtitle {
  font-size: 0.8rem;
  color: #555;
  letter-spacing: 6px;
}

/* ──────────────────────────────────────────────
   3. MAIN LAYOUT
   ────────────────────────────────────────────── */
.main {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;                /* Passe en colonne sur petit écran */
  justify-content: center;
  max-width: 1000px;
  width: 100%;
}

/* ──────────────────────────────────────────────
   4. OSCILLOSCOPE — Écran rond vintage
   ────────────────────────────────────────────── */
.scope-wrapper {
  background: #1a1a2e;
  border-radius: 24px;
  border: 3px solid #333;
  padding: 24px;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.5),    /* Ombre interne */
    0 0 30px rgba(57, 255, 20, 0.1),       /* Lueur verte externe */
    0 8px 32px rgba(0, 0, 0, 0.6);         /* Ombre portée */
  flex-shrink: 0;
}

/* Cadre rond de l'écran (cercle) */
.scope-frame {
  background: radial-gradient(circle, #0a1a0a 0%, #061006 100%);
  border-radius: 50%;                        /* Forme circulaire */
  border: 6px solid #444;
  box-shadow:
    inset 0 0 80px rgba(57, 255, 20, 0.08),
    0 0 20px rgba(57, 255, 20, 0.05);
  overflow: hidden;
  position: relative;
  width: 400px;
  height: 400px;
}

.scope-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: blur(0.5px);                       /* Effet phosphore CRT */
}

/* Labels sous l'écran */
.scope-bottom {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.scope-label {
  font-size: 0.7rem;
  color: #666;
  letter-spacing: 2px;
}

/* LED verte clignotante (power indicator) */
.power-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #39ff14;
  box-shadow: 0 0 8px #39ff14, 0 0 16px #39ff14;
  animation: led-pulse 2s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

/* ──────────────────────────────────────────────
   5. CONTROLS — Panneau de réglages
   ────────────────────────────────────────────── */
.controls {
  background: #1a1a2e;
  border-radius: 16px;
  border: 2px solid #333;
  padding: 20px;
  min-width: 300px;
  max-width: 360px;
  flex: 1;
}

.controls h2 {
  font-size: 1rem;
  letter-spacing: 3px;
  color: #666;
  margin-bottom: 16px;
  text-align: center;
}

/* ──────────────────────────────────────────────
   6. SLIDERS — Contrôles fréquence/phase/amplitude
   ────────────────────────────────────────────── */
.slider-group {
  margin-bottom: 14px;
}

.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #888;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

/* Valeur affichée à droite du label */
.slider-group label span {
  color: #39ff14;
  font-weight: bold;
}

/* Piste du slider */
.slider-group input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: #222;
  border-radius: 3px;
  outline: none;
  transition: background 0.2s;
}

.slider-group input[type="range"]:hover {
  background: #333;
}

/* Curseur (thumb) du slider — style néon vert */
.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #39ff14;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.5);
  cursor: pointer;
  border: 2px solid #111;
}

/* ──────────────────────────────────────────────
   7. WHEEL — Bouton Spin Wheel (🎰)
   ────────────────────────────────────────────── */
.wheel-section {
  text-align: center;
  margin: 20px 0 12px;
}

.btn-wheel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #2a2a3e, #1a1a2e);
  color: #c8d6e5;
  border: 2px solid #555;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.btn-wheel:hover {
  border-color: #39ff14;
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.2), 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.btn-wheel:active {
  transform: scale(0.96);            /* Effet d'enfoncement */
}

.btn-wheel .icon {
  font-size: 1.4rem;
}

/* ──────────────────────────────────────────────
   8. SCORE & HINTS
   ────────────────────────────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 10px 14px;
  background: #111;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

.score {
  font-size: 2rem;
  font-weight: bold;
  color: #39ff14;
  text-shadow: 0 0 20px rgba(57, 255, 20, 0.5);
}

.hint {
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 1px;
  transition: color 0.3s;
}

/* Animation quand le score est parfait (≥85%) */
.hint.match {
  color: #39ff14;
  animation: hint-glow 0.5s ease-in-out;
}

@keyframes hint-glow {
  0%, 100% { text-shadow: 0 0 8px rgba(57, 255, 20, 0.5); }
  50%      { text-shadow: 0 0 20px rgba(57, 255, 20, 0.9); }
}

/* ──────────────────────────────────────────────
   9. DEMO BUTTON
   ────────────────────────────────────────────── */
.btn-demo {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 2px;
  background: transparent;
  color: #39ff14;
  border: 1px solid rgba(57, 255, 20, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-demo:hover {
  background: rgba(57, 255, 20, 0.05);
  border-color: rgba(57, 255, 20, 0.6);
}

/* ──────────────────────────────────────────────
   10. LIBRARY — Bibliothèque de formes
   ────────────────────────────────────────────── */
.library-section {
  max-width: 1000px;
  width: 100%;
  margin-top: 24px;
  background: #1a1a2e;
  border-radius: 16px;
  border: 2px solid #333;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.library-section h2 {
  font-size: 0.9rem;
  letter-spacing: 3px;
  color: #666;
  margin-bottom: 16px;
  text-align: center;
}

/* Grille responsive des cartes de forme */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  justify-items: center;
}

/* Une carte = une forme de la bibliothèque */
.shape-card {
  background: #111;
  border: 2px solid #2a2a2a;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
  width: 100%;
  max-width: 200px;
}

.shape-card:hover {
  border-color: #39ff14;
  box-shadow: 0 0 18px rgba(57, 255, 20, 0.15);
  transform: translateY(-2px);
  background: #1a1a28;
}

/* Carte sélectionnée (cible active) */
.shape-card.selected {
  border-color: #39ff14;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
  background: #1a2a1a;
}

.shape-card.selected .shape-name {
  color: #39ff14;
}

.shape-card canvas {
  display: block;
  margin: 0 auto 8px;
  border-radius: 4px;
  background: #060e06;
}

.shape-name {
  font-size: 0.7rem;
  color: #888;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.shape-ratio {
  font-size: 0.6rem;
  color: #555;
  letter-spacing: 1px;
}

/* Tag d'indice (💡) sous la carte */
.shape-hint-tag {
  display: inline-block;
  font-size: 0.55rem;
  color: #39ff14;
  background: rgba(57, 255, 20, 0.08);
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* ──────────────────────────────────────────────
   11. RESPONSIVE — Adaptation mobile (< 700px)
   ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .scope-frame {
    width: 300px;
    height: 300px;
  }

  .controls {
    max-width: 100%;
  }

  .main {
    flex-direction: column;
    align-items: center;
  }

  .library-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
