:root {
  --bg-1: #0a0f19;
  --bg-2: #111a2a;
  --bg-3: #18263c;
  --bg-4: #223152;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.18);
  --accent: #2ff0c5;
  --accent-2: #f4a261;
  --accent-3: #78a9ff;
  --text: #f4f7ff;
  --muted: rgba(244, 247, 255, 0.68);
  --shadow: 0 24px 60px rgba(5, 10, 20, 0.55);
  --shadow-soft: 0 10px 30px rgba(5, 10, 20, 0.35);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, rgba(120, 169, 255, 0.25), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(47, 240, 197, 0.2), transparent 45%),
    linear-gradient(180deg, var(--bg-4) 0%, var(--bg-2) 45%, var(--bg-1) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.4;
}

.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.background::after {
  content: "";
  position: absolute;
  inset: -30%;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 55%),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 8px);
  opacity: 0.25;
  mix-blend-mode: screen;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.7;
  mix-blend-mode: screen;
  animation: float 10s ease-in-out infinite;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(52, 245, 197, 0.55), transparent 60%);
  top: -120px;
  left: -80px;
}

.orb-2 {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(247, 178, 103, 0.5), transparent 65%);
  bottom: -140px;
  right: -60px;
  animation-delay: -3s;
}

.orb-3 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(118, 168, 255, 0.45), transparent 65%);
  top: 25%;
  right: 10%;
  animation-delay: -6s;
}

.grid-glow {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(transparent 95%, rgba(255, 255, 255, 0.04) 95%),
    linear-gradient(90deg, transparent 95%, rgba(255, 255, 255, 0.04) 95%);
  background-size: 40px 40px;
  opacity: 0.15;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 32px) 44px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(47, 240, 197, 0.8), rgba(120, 169, 255, 0.8));
  box-shadow: 0 12px 30px rgba(47, 240, 197, 0.3);
}

.eyebrow {
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 4px;
}

h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: 0.01em;
}

h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0 0 8px;
}

.subline {
  margin: 4px 0 0;
  color: var(--muted);
}

.status {
  display: flex;
  gap: 12px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  gap: 20px;
}

.panel {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  animation: rise 0.8s ease both;
}

.panel:nth-child(1) {
  animation-delay: 0.1s;
}

.panel:nth-child(2) {
  animation-delay: 0.2s;
}

.panel:nth-child(3) {
  animation-delay: 0.3s;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tag {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.value {
  font-size: 20px;
  font-weight: 600;
}

.panel-block {
  margin-top: 18px;
}

.small {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.arena {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: clamp(12px, 2vw, 18px);
}

.arena-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px;
  border-radius: 18px;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.arena-stage {
  position: relative;
  width: 100%;
  min-height: 100%;
}

#game {
  width: 100%;
  height: clamp(380px, 68vh, 640px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(6, 10, 20, 0.75), rgba(6, 10, 20, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 30px rgba(47, 240, 197, 0.12);
}

.arena-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.arena-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.run-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.run-stats-title {
    font-size: 14px;
    letter-spacing: 0.24em;
    color: var(--muted);
    margin: 0 8px 0 0;

}

.run-stat {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.run-stat-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 5px 2px 5px;
}

.run-stat-value {
  display: inline-flex;
  align-items: center;
  font-size: clamp(10px, 2vw, 10px);
  font-weight: 600;
}

.lives-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.icon-heart {
  width: 16px;
  height: 16px;
  fill: var(--accent-2);
}

.life-heart svg {
  width: 16px;
  height: 16px;
  fill: var(--accent-2);
  filter: drop-shadow(0 2px 6px rgba(247, 178, 103, 0.35));
}

.life-heart {
  display: inline-flex;
}

.scoreboard {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scoreboard li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(9, 12, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  box-shadow: var(--shadow-soft);
}

.scoreboard span {
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(47, 240, 197, 0.2);
  border: 1px solid rgba(47, 240, 197, 0.38);
  font-size: 12px;
}

.controls {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.controls span {
  font-weight: 600;
  color: var(--accent);
  margin-right: 8px;
}

.footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding: 0 8px;
  gap: 8px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.65);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.4s ease;
}

.overlay.hidden {
  display: none;
}

.modal {
  width: min(420px, 90vw);
  padding: 28px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal h2 {
  margin-top: 8px;
}

.modal input {
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(12, 15, 29, 0.75);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.modal input + input {
  margin-top: 12px;
}

.modal button {
  margin-top: 16px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, rgba(47, 240, 197, 0.9), rgba(120, 169, 255, 0.9));
  color: #0b0f1a;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.modal button:hover {
  transform: translateY(-1px);
}

.final-score {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 700;
  margin: 12px 0;
}

.hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.form-error {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--accent-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-16px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
  }

  #game {
    height: clamp(340px, 62vh, 520px);
  }

  .footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 900px) {
  .arena {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .top {
    flex-direction: column;
    align-items: flex-start;
  }

  .status {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .arena-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .run-stats {
    width: 100%;
    justify-content: flex-start;
  }

  #game {
    height: clamp(280px, 50vh, 360px);
  }
}

@media (max-width: 520px) {
  .panel {
    padding: 16px;
  }

  .arena-chip {
    font-size: 10px;
  }

  .run-stats-title,
  .run-stat-label {
    letter-spacing: 0.12em;
  }

  .modal {
    padding: 22px;
  }
}
