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

:root {
  --stage-black: #0b0d16;
  --stage-black-2: #121120;
  --brass: #d9a94f;
  --brass-soft: rgba(217, 169, 79, 0.4);
  --brass-dim: rgba(217, 169, 79, 0.14);
  --parchment: #f3ede0;
  --mist: #8b91b0;
  --alarm: #c1473f;
  --font-display: "Fraunces", serif;
  --font-body: "Public Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

body {
  font-family: var(--font-body);
  background: var(--stage-black);
  color: var(--parchment);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
}

/* Halo de scène en haut de la page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(217, 169, 79, 0.16), transparent 60%),
    linear-gradient(180deg, var(--stage-black-2) 0%, var(--stage-black) 55%);
  z-index: -2;
}

/* Portée musicale animée en fond, très discrète */
.staff-lines {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 78px,
    rgba(217, 169, 79, 0.06) 79px,
    rgba(217, 169, 79, 0.06) 80px
  );
  background-size: 100% 400px;
  animation: driftStaff 40s linear infinite;
}

@keyframes driftStaff {
  from { background-position: 0 0; }
  to { background-position: 0 400px; }
}

@media (prefers-reduced-motion: reduce) {
  .staff-lines { animation: none; }
}

.stage {
  padding: 24px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.program-card {
  max-width: 420px;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--brass-dim);
  border-radius: 18px;
  padding: 40px 32px;
  text-align: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--brass);
  margin-bottom: 18px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--parchment);
}

h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--brass);
}

.subtitle {
  color: var(--mist);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 32px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 8px var(--brass);
}

/* --- Jeu --- */

.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.game-frame {
  position: relative;
  width: 100%;
  max-width: 280px;
}

#game-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 320 / 480;
  border-radius: 14px;
  border: 1px solid var(--brass-dim);
  touch-action: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(11, 13, 22, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.game-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--parchment);
}

.overlay-text {
  font-size: 0.82rem;
  color: var(--mist);
  line-height: 1.4;
}

.overlay-btn {
  margin-top: 6px;
  background: var(--brass-dim);
  border: 1px solid var(--brass-soft);
  color: var(--brass);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.overlay-btn:hover {
  background: var(--brass-soft);
}

.overlay-btn:active {
  transform: scale(0.97);
}

.overlay-btn:focus-visible,
#game-canvas:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.game-hud {
  display: flex;
  gap: 20px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brass);
}

.hud-value small {
  font-size: 0.6rem;
  color: var(--mist);
  font-weight: 500;
}

@media (max-width: 400px) {
  .program-card { padding: 32px 20px; }
}


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.music-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 13, 22, 0.75);
  border: 1px solid var(--brass-dim);
  color: var(--brass);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.music-toggle:hover {
  background: rgba(217, 169, 79, 0.12);
  border-color: var(--brass-soft);
}

.music-toggle:active {
  transform: scale(0.96);
}

@media (max-width: 480px) {
  .music-toggle {
    top: 12px;
    right: 12px;
    padding: 7px 12px;
    font-size: 0.72rem;
  }
}