:root {
  color-scheme: dark;
  --ink: #f9f4e8;
  --muted: rgba(249, 244, 232, 0.63);
  --acid: #d9ff43;
  --pink: #ff4fc8;
  --violet: #7847ff;
  --panel: rgba(14, 7, 27, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #10071f;
  font-family: "Space Mono", monospace;
  color: var(--ink);
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  isolation: isolate;
  background: #10071f;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.finale-active .hud {
  animation: finale-hud-tremor 110ms linear infinite;
}

.brand-block {
  position: absolute;
  top: 28px;
  left: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--acid);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.2em;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.78;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  text-shadow: 0 5px 22px rgba(0, 0, 0, 0.28);
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: var(--panel);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.stats-panel {
  position: absolute;
  top: 28px;
  right: 32px;
  width: min(285px, calc(100vw - 64px));
  padding: 17px 19px 18px;
}

.stat-row,
.evolution-copy {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}

.stat-row + .stat-row {
  margin-top: 7px;
}

.stat-row span,
.evolution-copy {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.stat-row strong {
  color: var(--ink);
  font-size: 15px;
}

.evolution-copy {
  margin-top: 16px;
  letter-spacing: 0;
}

.progress-track {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.13);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--acid));
  box-shadow: 0 0 15px var(--pink);
  transition: width 240ms ease;
}

.controls-panel {
  position: absolute;
  right: 32px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 12px;
  pointer-events: auto;
}

.controls-panel p {
  margin: 0 10px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.controls-panel p strong {
  color: var(--ink);
}

.key-cluster {
  display: grid;
  grid-template-columns: repeat(3, 20px);
  gap: 2px;
}

kbd {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  font: 700 8px "Space Mono", monospace;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--acid);
  border-color: var(--acid);
}

.icon-button--muted {
  color: rgba(249, 244, 232, 0.38);
  border-color: rgba(255, 255, 255, 0.09);
}

.corner-accent {
  position: absolute;
  z-index: 2;
  left: 32px;
  width: 42px;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.corner-accent::before {
  content: "";
  position: absolute;
  width: 1px;
  height: 42px;
  background: inherit;
}

.corner-accent--top {
  top: 18px;
}

.corner-accent--top::before {
  top: 0;
  left: 0;
}

.corner-accent--bottom {
  bottom: 18px;
}

.corner-accent--bottom::before {
  bottom: 0;
  left: 0;
}

.overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease, visibility 400ms;
}

.overlay--visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

#start-screen {
  place-items: end center;
  padding: 0 0 clamp(20px, 4vh, 42px);
  background:
    linear-gradient(0deg, rgba(4, 10, 13, 0.45), rgba(4, 10, 13, 0.12)),
    url("Assets/Optimized/Start Screen.webp") center / cover no-repeat;
}

.start-card {
  width: min(620px, calc(100% - 48px));
  padding: 44px;
  border-left: 2px solid var(--pink);
  background: rgba(12, 5, 24, 0.7);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.38);
  opacity: 0.8;
}

.start-card h2 {
  max-width: 520px;
  font-size: clamp(64px, 10vw, 116px);
}

.intro-copy {
  max-width: 520px;
  margin: 28px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.objective-strip {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
  font-size: 10px;
  font-weight: 700;
}

.pill-icon {
  position: relative;
  display: inline-block;
  width: 23px;
  height: 11px;
  border-radius: 999px;
  transform: rotate(-30deg);
  background: linear-gradient(90deg, var(--acid) 50%, var(--pink) 50%);
}

.pill-icon i {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(20, 8, 35, 0.35);
}

.objective-arrow {
  color: var(--pink);
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding: 17px 20px;
  border: 0;
  background: var(--acid);
  color: #15091f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  background: #edff91;
}

.primary-button b {
  font-size: 18px;
}

.keyboard-hint {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9px;
  text-align: center;
}

#pause-screen {
  background: rgba(7, 3, 14, 0.68);
  backdrop-filter: blur(8px);
}

.pause-card {
  width: min(400px, calc(100% - 40px));
  padding: 36px;
  text-align: center;
}

.pause-card h2 {
  font-size: clamp(52px, 8vw, 84px);
}

.text-button {
  margin-top: 17px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
  cursor: pointer;
}

.victory-screen {
  overflow: hidden;
  place-items: end start;
  background: #09020d;
}

.victory-screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: victory-drift 14s ease-in-out infinite alternate;
}

.victory-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 2, 12, 0.84) 0%, rgba(8, 2, 12, 0.35) 30%, transparent 62%),
    linear-gradient(0deg, rgba(8, 2, 12, 0.7), transparent 38%);
}

.victory-card {
  position: relative;
  width: min(355px, calc(100% - 48px));
  margin: 0 0 3.5vh 3.5vw;
  padding-left: 16px;
  border-left: 2px solid var(--acid);
}

.victory-card h2 {
  font-size: clamp(54px, 7vw, 92px);
  text-shadow: 0 10px 50px rgba(0, 0, 0, 0.55);
}

.victory-card p:not(.eyebrow) {
  max-width: 300px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 10px;
}

.victory-card .primary-button {
  max-width: 220px;
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 9px;
}

.evolution-banner {
  position: absolute;
  z-index: 8;
  top: var(--banner-y, 50%);
  left: var(--banner-x, 50%);
  display: grid;
  min-width: 330px;
  max-width: calc(100vw - 28px);
  padding: 17px 28px;
  border-top: 1px solid var(--acid);
  border-bottom: 1px solid var(--acid);
  background: rgba(10, 4, 19, 0.87);
  box-shadow: 0 0 70px rgba(217, 255, 67, 0.16);
  text-align: center;
  transform: translate(-50%, calc(-50% + var(--banner-enter-y, 16px))) scale(0.94);
  opacity: 0;
  pointer-events: none;
}

.evolution-banner span {
  color: var(--acid);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.evolution-banner strong {
  margin-top: 4px;
  font-family: "Archivo Black", sans-serif;
  font-size: 29px;
}

.evolution-banner--visible {
  animation: evolution-pop 1.65s ease both;
}

@keyframes evolution-pop {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + var(--banner-enter-y, 16px))) scale(0.94); }
  18%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% + var(--banner-exit-y, 25px))) scale(1.02); }
}

@keyframes victory-drift {
  from { transform: scale(1.03); }
  to { transform: scale(1.1) translate(-1%, -1%); }
}

@keyframes finale-hud-tremor {
  0% { transform: translate(-2px, 1px); }
  25% { transform: translate(2px, -2px); }
  50% { transform: translate(-1px, -1px); }
  75% { transform: translate(2px, 2px); }
  100% { transform: translate(-2px, 1px); }
}

@media (max-width: 680px) {
  .brand-block {
    top: 23px;
    left: 20px;
  }

  .stats-panel {
    top: 20px;
    right: 18px;
    width: 205px;
    padding: 13px;
  }

  .stats-panel .stat-row span {
    display: none;
  }

  .evolution-copy {
    margin-top: 10px;
    font-size: 8px;
  }

  .controls-panel {
    right: 18px;
    bottom: 18px;
  }

  .controls-panel p,
  .key-cluster {
    display: none;
  }

  .corner-accent {
    display: none;
  }

  .start-card {
    padding: 30px 24px;
  }

  #start-screen {
    padding-bottom: 18px;
  }

  .objective-strip {
    flex-wrap: wrap;
  }

  .victory-card {
    width: min(300px, calc(100% - 36px));
    margin: 0 18px 3vh;
  }

  .victory-card h2 {
    font-size: clamp(48px, 16vw, 68px);
  }

  .evolution-banner {
    min-width: min(330px, calc(100vw - 28px));
    padding: 14px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
