* {
  box-sizing: border-box;
}

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f7f8fb;
  background: #080b13;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top, rgba(61, 110, 255, 0.18), transparent 38%),
    linear-gradient(180deg, #0b1020 0%, #070a11 100%);
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.game-card {
  width: min(960px, 100%);
  background: rgba(13, 18, 31, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 30px 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #8ca8ff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.subtitle {
  margin-bottom: 0;
  color: #b8c0d6;
  max-width: 560px;
}

.stats {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.stat {
  min-width: 92px;
  padding: 12px 14px;
  text-align: center;
  border-radius: 14px;
  background: #11182a;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  display: block;
  color: #8790a7;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.5rem;
}

.instructions {
  margin: 0 30px 20px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.instructions p {
  margin-bottom: 0;
  color: #c6cddd;
  line-height: 1.55;
}

.arena-wrap {
  padding: 0 30px;
}

.arena {
  position: relative;
  width: 100%;
  height: clamp(340px, 52vh, 520px);
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(124, 157, 255, 0.35);
  background:
    linear-gradient(rgba(121, 155, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 155, 255, 0.045) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(42, 69, 140, 0.34), rgba(7, 11, 22, 0.92));
  background-size: 28px 28px, 28px 28px, auto;
  touch-action: manipulation;
}

.ready-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  background: rgba(8, 12, 22, 0.68);
  backdrop-filter: blur(4px);
}


/* Ensure the HTML hidden attribute actually hides the start/end overlay.
   This is necessary because .ready-panel otherwise declares display: grid. */
.ready-panel[hidden] {
  display: none !important;
}

.ready-panel p {
  margin: 0;
  color: #d6dced;
  font-size: 1.05rem;
}

.primary-button {
  min-width: 160px;
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  cursor: pointer;
  color: #06101b;
  background: #9fffc3;
  font-weight: 850;
  box-shadow: 0 10px 28px rgba(60, 255, 148, 0.18);
  transition: transform 120ms ease, filter 120ms ease;
}

.primary-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:focus-visible,
.target:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 4px;
}

.target {
  position: absolute;
  z-index: 1;
  width: clamp(64px, 10vw, 86px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(88, 137, 255, 0.2);
  box-shadow:
    0 0 0 10px rgba(88, 137, 255, 0.08),
    0 0 38px rgba(88, 137, 255, 0.65);
  transform: translate(0, 0);
  transition: box-shadow 100ms ease, transform 70ms ease;
  touch-action: manipulation;
}

.target:hover {
  box-shadow:
    0 0 0 12px rgba(88, 137, 255, 0.10),
    0 0 44px rgba(88, 137, 255, 0.82);
}

.target:active {
  transform: scale(0.94);
}

.target-core {
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  background: #a8f8ff;
  box-shadow:
    0 0 0 8px rgba(168, 248, 255, 0.12),
    0 0 24px rgba(168, 248, 255, 0.86);
}

/* Target color progression by score */
.target-blue {
  background: rgba(88, 137, 255, 0.2);
  box-shadow:
    0 0 0 10px rgba(88, 137, 255, 0.08),
    0 0 38px rgba(88, 137, 255, 0.65);
}

.target-blue .target-core {
  background: #a8f8ff;
  box-shadow:
    0 0 0 8px rgba(168, 248, 255, 0.12),
    0 0 24px rgba(168, 248, 255, 0.86);
}

.target-green {
  background: rgba(71, 220, 145, 0.22);
  box-shadow:
    0 0 0 10px rgba(71, 220, 145, 0.09),
    0 0 38px rgba(71, 220, 145, 0.68);
}

.target-green .target-core {
  background: #b7ffd0;
  box-shadow:
    0 0 0 8px rgba(183, 255, 208, 0.12),
    0 0 24px rgba(183, 255, 208, 0.86);
}

.target-yellow {
  background: rgba(255, 214, 74, 0.24);
  box-shadow:
    0 0 0 10px rgba(255, 214, 74, 0.10),
    0 0 38px rgba(255, 214, 74, 0.72);
}

.target-yellow .target-core {
  background: #fff3a6;
  box-shadow:
    0 0 0 8px rgba(255, 243, 166, 0.14),
    0 0 24px rgba(255, 243, 166, 0.9);
}

.target-orange {
  background: rgba(255, 142, 61, 0.24);
  box-shadow:
    0 0 0 10px rgba(255, 142, 61, 0.10),
    0 0 38px rgba(255, 142, 61, 0.72);
}

.target-orange .target-core {
  background: #ffd0a8;
  box-shadow:
    0 0 0 8px rgba(255, 208, 168, 0.14),
    0 0 24px rgba(255, 208, 168, 0.9);
}

.target-magenta {
  background: rgba(225, 91, 255, 0.24);
  box-shadow:
    0 0 0 10px rgba(225, 91, 255, 0.10),
    0 0 42px rgba(225, 91, 255, 0.76);
}

.target-magenta .target-core {
  background: #ffc2ff;
  box-shadow:
    0 0 0 8px rgba(255, 194, 255, 0.14),
    0 0 26px rgba(255, 194, 255, 0.92);
}

.result-panel,
.leaderboard-section {
  margin: 20px 30px 0;
}

.result-panel {
  min-height: 28px;
  color: #d9dfef;
  text-align: center;
  font-weight: 700;
}

.result-panel p {
  margin-bottom: 0;
}

.leaderboard-section {
  margin-bottom: 30px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-section h2 {
  color: #dce2f0;
}

.leaderboard-fallback {
  margin: 0;
  color: #8993aa;
  font-size: 0.9rem;
}

@media (max-width: 680px) {
  .page-shell {
    padding: 12px;
  }

  .game-card {
    border-radius: 18px;
  }

  .game-header {
    flex-direction: column;
    padding: 22px 18px 16px;
  }

  .stats {
    width: 100%;
  }

  .stat {
    flex: 1;
  }

  .instructions,
  .result-panel,
  .leaderboard-section {
    margin-left: 18px;
    margin-right: 18px;
  }

  .arena-wrap {
    padding: 0 18px;
  }

  .arena {
    height: min(52vh, 430px);
    min-height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}




.high-score-banner {
  padding: 10px 18px;
  border: 1px solid rgba(98, 245, 154, 0.55);
  border-radius: 999px;
  color: #62f59a;
  background: rgba(98, 245, 154, 0.10);
  font-size: clamp(1.15rem, 4vw, 1.6rem);
  font-weight: 950;
  letter-spacing: 0.06em;
  text-shadow: 0 0 18px rgba(98, 245, 154, 0.38);
  box-shadow: 0 0 26px rgba(98, 245, 154, 0.12);
}

.high-score-banner[hidden] {
  display: none !important;
}
