* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 15%, rgba(107, 70, 193, 0.28), transparent 40%),
    radial-gradient(circle at 82% 5%, rgba(56, 118, 255, 0.22), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(255, 93, 115, 0.14), transparent 55%),
    radial-gradient(circle at 50% 0%, #1c2333, #0a0d16);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8ecf7;
  padding: 8px;
}

.game-wrap {
  position: relative;
  width: 100%;
  /* Tient aussi dans la hauteur de la fenêtre (ex. iframe) : canevas 800×680 + ~104px d'interface. */
  max-width: min(832px, calc((100vh - 104px) * 800 / 680 + 32px));
  padding: 16px;
  background: #10141f;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.combo {
  color: #ffd75d;
  font-weight: 700;
}

.mute-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  color: inherit;
}

.mute-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.gauge-track {
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 10px;
}

.gauge-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4fd8ff, #7ee787);
  border-radius: 6px;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  background: #05070d;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px #2a3350;
}

.overlay {
  position: absolute;
  inset: 16px 16px auto 16px;
  top: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(5, 7, 13, 0.88);
  border-radius: 8px;
  text-align: center;
  padding: 24px;
}

.overlay[hidden] {
  display: none;
}

.overlay h1 {
  margin: 0;
  font-size: 32px;
}

.overlay p {
  margin: 0;
  max-width: 420px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: #2a3350 transparent;
  color: #a7b0c8;
  line-height: 1.5;
}

.overlay button {
  padding: 10px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: #4f7cff;
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.overlay button:hover {
  background: #6a91ff;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  body {
    padding: 0;
  }

  .game-wrap {
    max-width: calc((100vh - 64px) * 800 / 680 + 16px);
    padding: 8px;
    border-radius: 0;
  }

  .hud {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .gauge-track {
    margin-bottom: 6px;
  }

  .overlay {
    inset: 8px;
    padding: 12px;
    gap: 10px;
  }

  .overlay h1 {
    font-size: 24px;
  }

  .overlay p {
    font-size: 12px;
    line-height: 1.4;
  }
}
