@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #000000;
  --space: #020205;
  --panel: rgba(0, 0, 0, 0.6);
  --panel-border: rgba(34, 211, 238, 0.2);
  --cyan: #22d3ee;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: #ffffff;
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  touch-action: none;
  user-select: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--space);
}

.hud {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hud__label {
  margin-bottom: 0.25rem;
  color: rgba(34, 211, 238, 0.9);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

.hud__value {
  color: #ffffff;
  font-size: clamp(3rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.hud__unit {
  margin-left: 0.25rem;
  font-size: 0.45em;
  color: rgba(207, 250, 254, 0.8);
}

.settings-panel {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 1.25rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-slot {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #22d3ee;
}

.icon-slot.is-muted {
  color: rgba(107, 114, 128, 1);
}

.icon-svg {
  width: 20px;
  height: 20px;
}

.volume-slider {
  width: 6rem;
  accent-color: #22d3ee;
  cursor: pointer;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.8);
  pointer-events: none;
  text-align: center;
}

.title {
  margin: 0 0 1rem;
  color: #ffffff;
  font-size: clamp(3rem, 9vw, 5.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}

.record-card {
  position: relative;
  margin-bottom: 2.5rem;
}

.record-card__glow {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.2);
  filter: blur(24px);
}

.record-card__content {
  position: relative;
}

.record-card__label {
  margin-bottom: 0.25rem;
  color: rgba(165, 243, 252, 0.95);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.record-card__value {
  font-size: clamp(2.75rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(90deg, #c084fc, #22d3ee, #4ade80);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.instructions {
  max-width: 32rem;
  margin: 0 0 3rem;
  padding: 0 1rem;
  color: rgba(207, 250, 254, 0.8);
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.65;
}

.instructions__purple {
  color: rgba(216, 180, 254, 0.95);
}

.instructions__green {
  color: rgba(187, 247, 208, 0.95);
}

.instructions__red {
  color: rgba(252, 165, 165, 0.95);
}

.action-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(18rem, 85vw);
  padding: 1rem 2.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-size: clamp(1.25rem, 2.8vw, 1.75rem);
  font-weight: 700;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 120ms ease;
}

.action-button::before,
.action-button::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.action-button::before {
  opacity: 0.82;
  transition: opacity 160ms ease;
}

.action-button::after {
  border: 2px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.22);
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.action-button--launch::before {
  background: linear-gradient(90deg, #0891b2, #7c3aed, #2563eb);
}

.action-button--launch::after {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.action-button--relaunch::before {
  background: linear-gradient(90deg, #dc2626, #7c3aed, #ea580c);
}

.action-button--relaunch::after {
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.action-button:hover::before {
  opacity: 1;
}

.action-button--launch:hover::after {
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
}

.action-button--relaunch:hover::after {
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
}

.action-button:active {
  transform: scale(0.95);
}

.action-button__label {
  position: relative;
  z-index: 1;
  letter-spacing: 0.18em;
}

.gameover-title {
  margin: 0 0 1rem;
  color: var(--red);
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 700;
  text-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
}

.final-score-line {
  margin: 0 0 1rem;
  color: rgba(226, 232, 240, 0.85);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 500;
}

.final-score-line__value {
  color: #22d3ee;
  font-weight: 700;
}

.new-record-line {
  margin-bottom: 3rem;
  font-size: clamp(1.25rem, 2.8vw, 1.6rem);
  font-weight: 700;
  background: linear-gradient(90deg, #fde047, #fb923c, #ef4444);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 10px rgba(255, 200, 0, 0.5);
  animation: pulse-glow 1.3s ease-in-out infinite;
}

.existing-record-line {
  margin-bottom: 3rem;
  color: rgba(165, 243, 252, 0.72);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.existing-record-line__value {
  font-weight: 700;
  background: linear-gradient(90deg, #c084fc, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.is-hidden {
  display: none !important;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.92; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

@media (max-width: 640px) {
  .hud { top: 1.4rem; }
  .hud__label { font-size: 0.72rem; }
  .settings-panel { top: 1rem; right: 1rem; padding: 0.85rem; gap: 0.85rem; }
  .volume-slider { width: 5.2rem; }
  .overlay { padding: 1.5rem 1.25rem 2rem; }
  .record-card { margin-bottom: 2rem; }
  .instructions { margin-bottom: 2.5rem; }
}
