:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #05070a;
  color: #f7fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 58, 128, 0.2), transparent 24rem),
    radial-gradient(circle at 78% 42%, rgba(26, 188, 156, 0.16), transparent 30rem),
    radial-gradient(circle at 55% 78%, rgba(249, 255, 75, 0.13), transparent 22rem),
    #05070a;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  pointer-events: none;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 7, 10, 0.24), rgba(5, 7, 10, 0.5));
  opacity: 0;
  transition: opacity 180ms ease;
}

.screen--menu::before,
.screen--levels::before,
.screen--pause::before,
.screen--result::before {
  opacity: 1;
}

.panel {
  width: min(100%, 820px);
  position: relative;
  pointer-events: auto;
}

.panel--hero {
  display: grid;
  justify-items: start;
  gap: 22px;
}

.volume-control,
.toggle-control {
  width: min(100%, 360px);
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(247, 251, 255, 0.14);
}

.volume-control span {
  display: flex;
  justify-content: space-between;
  color: rgba(247, 251, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.volume-control input {
  width: 100%;
  accent-color: #f9ff4b;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(247, 251, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toggle-control input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: #7cf7d4;
}

.eyebrow {
  margin: 0;
  color: #7cf7d4;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 0.92;
  letter-spacing: 0;
}

h1 {
  max-width: 8ch;
  font-size: clamp(4rem, 14vw, 9rem);
  text-shadow: 0 0 42px rgba(124, 247, 212, 0.18);
}

h2 {
  font-size: clamp(2.4rem, 7vw, 4.8rem);
}

.primary-button,
.ghost-button {
  min-width: 10rem;
  min-height: 3.35rem;
  padding: 0 1.4rem;
  border-radius: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.primary-button {
  background: #f9ff4b;
  color: #071015;
  box-shadow: 0 0 32px rgba(249, 255, 75, 0.25);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 42px rgba(249, 255, 75, 0.34);
}

.ghost-button,
.icon-button {
  background: rgba(247, 251, 255, 0.1);
  color: #f7fbff;
  box-shadow: inset 0 0 0 1px rgba(247, 251, 255, 0.18);
}

.ghost-button:hover,
.icon-button:hover {
  background: rgba(247, 251, 255, 0.16);
}

.icon-button {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 8px;
  font-size: 2.3rem;
  line-height: 1;
}

.panel--levels {
  display: grid;
  gap: 18px;
}

.level-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.mode-row {
  display: flex;
  gap: 10px;
  width: min(100%, 440px);
}

.mode-button {
  flex: 1;
  min-height: 2.8rem;
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.08);
  color: rgba(247, 251, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(247, 251, 255, 0.15);
  font-weight: 900;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.mode-button.is-active {
  background: #7cf7d4;
  color: #071015;
  box-shadow: 0 0 32px rgba(124, 247, 212, 0.28);
}

.level-carousel {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) 3.2rem;
  align-items: center;
  gap: 14px;
}

.carousel-arrow {
  width: 3.2rem;
  height: min(34vh, 220px);
  min-height: 8rem;
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.1);
  box-shadow:
    inset 0 0 0 1px rgba(247, 251, 255, 0.15),
    0 0 34px rgba(124, 247, 212, 0.12);
  color: #f7fbff;
  font-size: 2rem;
  font-weight: 900;
}

.carousel-arrow:hover {
  background: rgba(249, 255, 75, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(249, 255, 75, 0.45),
    0 0 44px rgba(249, 255, 75, 0.2);
}

.level-grid {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 12px 2px 20px;
}

.level-grid::-webkit-scrollbar {
  display: none;
}

.level-card {
  flex: 0 0 min(76vw, 420px);
  min-height: min(34vh, 220px);
  display: grid;
  align-content: space-between;
  gap: 16px;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 28%, transparent), transparent 58%),
    rgba(8, 14, 20, 0.74);
  box-shadow:
    inset 0 0 0 1px rgba(247, 251, 255, 0.14),
    0 0 34px color-mix(in srgb, var(--accent) 16%, transparent),
    0 22px 62px rgba(0, 0, 0, 0.28);
  scroll-snap-align: center;
  text-align: left;
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-2px);
  background: rgba(12, 22, 30, 0.82);
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 24px 70px rgba(0, 0, 0, 0.32),
    0 0 38px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: 0;
}

.level-card strong {
  display: block;
  font-size: clamp(1.8rem, 6vw, 3.8rem);
  line-height: 0.92;
  color: #f7fbff;
  text-shadow: 0 0 28px var(--accent);
}

.level-card span {
  color: rgba(247, 251, 255, 0.72);
  font-size: 0.92rem;
  line-height: 1.35;
}

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

.level-meta i {
  min-width: 4.7rem;
  padding: 0.38rem 0.48rem;
  border-radius: 999px;
  background: rgba(247, 251, 255, 0.1);
  color: #f7fbff;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel--pause {
  width: min(100%, 460px);
  display: grid;
  gap: 22px;
  padding: 28px;
  border-radius: 8px;
  background: rgba(8, 14, 20, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(247, 251, 255, 0.13),
    0 32px 90px rgba(0, 0, 0, 0.4);
}

.pause-actions,
.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.result-stats span {
  flex: 1 1 9rem;
  padding: 12px;
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.08);
  color: rgba(247, 251, 255, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 800;
}

.result-stats b {
  display: block;
  color: #f7fbff;
  font-size: 1.65rem;
  letter-spacing: 0;
}

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hud > div {
  min-width: 7rem;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.42);
  box-shadow: inset 0 0 0 1px rgba(247, 251, 255, 0.1);
  backdrop-filter: blur(10px);
}

.hud-label {
  display: block;
  color: rgba(247, 251, 255, 0.62);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  font-size: clamp(1.05rem, 2.8vw, 1.55rem);
}

.health-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  background: rgba(247, 251, 255, 0.16);
  pointer-events: none;
}

.health-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: #f7fbff;
  box-shadow: 0 0 24px rgba(247, 251, 255, 0.8);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 120ms ease;
}

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .level-grid {
    padding-inline: 0;
  }

  .level-carousel {
    grid-template-columns: 2.7rem minmax(0, 1fr) 2.7rem;
    gap: 8px;
  }

  .carousel-arrow {
    width: 2.7rem;
  }

  .hud {
    align-items: start;
  }

  .hud > div {
    min-width: 0;
    flex: 1;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
