:root {
  color-scheme: dark;
  --bg: #030303;
  --ink: #f7f7f2;
  --muted: rgba(247, 247, 242, 0.66);
  --faint: rgba(247, 247, 242, 0.13);
  --line: rgba(247, 247, 242, 0.22);
  --accent: #ffffff;
  --accent-strong: #f7f7f2;
  --danger: #ffffff;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body.is-playing {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.15;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 10%, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px);
  background-size: 31px 31px, 47px 47px;
}

.landing {
  min-height: 100svh;
  background: #030303;
  transform-origin: center top;
  transition: opacity 320ms ease, filter 320ms ease, transform 420ms ease;
}

body.is-transitioning .landing,
body.is-playing .landing.is-gone {
  position: fixed;
  inset: 0;
  z-index: 45;
  width: 100%;
}

.landing.is-gone {
  opacity: 0;
  filter: blur(8px);
  transform: translate3d(0, -126vh, 0) scale(0.96);
  pointer-events: none;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 22px clamp(20px, 4vw, 58px);
  color: var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.brand-mark {
  width: 12px;
  height: 34px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.62);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 18px;
  color: rgba(247, 247, 242, 0.64);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.nav-link-button {
  border: 0;
  background: transparent;
  color: rgba(247, 247, 242, 0.8);
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
}

.nav-link-button:hover,
.nav-link-button:focus-visible {
  color: var(--ink);
  outline: 0;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.5);
}

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: 118px clamp(20px, 5vw, 76px) 82px;
}

.hero-media,
.hero-glass {
  position: absolute;
  inset: 0;
}

.hero-media {
  background-image: url("assets/cryo-bank-hero.png");
  background-size: cover;
  background-position: center;
  filter: grayscale(1) contrast(1.12) brightness(0.74);
  transform: scale(1.02);
  animation: heroDrift 18s ease-in-out infinite alternate;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.73) 38%, rgba(0, 0, 0, 0.18) 74%),
    radial-gradient(circle at 72% 43%, rgba(255, 255, 255, 0.18), transparent 25%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.75));
}

.hero-glass {
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 46%, rgba(255, 255, 255, 0.12) 46.2% 46.5%, transparent 46.7%),
    linear-gradient(115deg, transparent 0 56%, rgba(255, 255, 255, 0.2) 56.1% 56.2%, transparent 56.35%);
  opacity: 0.78;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(650px, 100%);
  animation: introRise 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.kicker {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.23em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 10ch;
  margin-bottom: 24px;
  font-size: clamp(4.2rem, 11vw, 10.4rem);
  line-height: 0.82;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 0 52px rgba(255, 255, 255, 0.16);
}

.lead {
  max-width: 520px;
  margin-bottom: 44px;
  color: rgba(247, 247, 242, 0.77);
  font-size: clamp(1rem, 1.6vw, 1.28rem);
  line-height: 1.55;
}

.newsletter-form {
  width: 100%;
  max-width: 580px;
}

.newsletter-form label {
  display: block;
  margin-bottom: 10px;
  color: rgba(247, 247, 242, 0.7);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 72px;
  border: 1px solid rgba(247, 247, 242, 0.34);
  background: rgba(3, 3, 3, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 48px rgba(255, 255, 255, 0.08);
  overflow: visible;
}

.input-wrap::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 360ms ease;
}

.input-wrap:focus-within::before,
.input-wrap.is-opening::before {
  transform: scaleX(1);
}

.input-wrap.is-opening {
  animation: inputRift 520ms cubic-bezier(0.16, 1, 0.22, 1) both;
}

#emailInput {
  width: 100%;
  min-width: 0;
  height: 70px;
  padding: 0 88px 0 22px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(1rem, 3vw, 1.55rem);
  font-weight: 780;
  letter-spacing: 0;
}

#emailInput::placeholder {
  color: rgba(247, 247, 242, 0.28);
}

#charCounter {
  position: absolute;
  right: 18px;
  color: rgba(247, 247, 242, 0.55);
  font-size: 0.72rem;
  font-weight: 800;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
}

#submitButton,
#restartButton,
#submitScoreButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #030303;
  padding: 0 24px;
  font-weight: 860;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

#submitButton:hover,
#restartButton:hover,
#submitScoreButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 38px rgba(255, 255, 255, 0.28);
}

.button-arrow {
  width: 28px;
  height: 1px;
  background: currentColor;
  position: relative;
}

.button-arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1px solid currentColor;
  border-top: 1px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 700;
}

.hero-foot {
  position: absolute;
  left: clamp(20px, 5vw, 76px);
  right: clamp(20px, 5vw, 76px);
  bottom: 28px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: rgba(247, 247, 242, 0.48);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.email-drop {
  position: fixed;
  z-index: 60;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow:
    0 0 16px rgba(255, 255, 255, 0.88),
    0 0 48px rgba(255, 255, 255, 0.36);
  transform-origin: 50% 50%;
  pointer-events: none;
}

.game-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 0.08), transparent 25%),
    #000;
}

body.is-transitioning .game-shell {
  animation: voidReveal 820ms cubic-bezier(0.28, 0, 0.08, 1) both;
}

.game-shell::before,
.game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.game-shell::before {
  z-index: 2;
  background:
    radial-gradient(circle at 50% 54%, transparent 0 31%, rgba(0, 0, 0, 0.2) 48%, rgba(0, 0, 0, 0.84) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 14%, transparent 78%, rgba(255, 255, 255, 0.08));
}

.game-shell::after {
  z-index: 5;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.42), transparent 31%),
    rgba(255, 255, 255, 0.12);
  transition: opacity 120ms ease;
}

body.is-hit .game-shell::after {
  opacity: 1;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 7;
  top: 24px;
  left: clamp(16px, 3vw, 36px);
  right: clamp(16px, 3vw, 36px);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
  transition: opacity 180ms ease;
}

body.is-transitioning .hud,
body.is-transitioning .letter-rail {
  opacity: 0;
}

.hud > div {
  min-width: 142px;
}

.hud-label {
  display: block;
  margin-bottom: 4px;
  color: rgba(247, 247, 242, 0.5);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  font-size: clamp(1.05rem, 3vw, 1.9rem);
  font-weight: 900;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.34);
}

.letter-rail {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 24px;
  display: flex;
  justify-content: center;
  max-width: min(92vw, 920px);
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 180ms ease;
}

.letter-rail span {
  display: inline-grid;
  place-items: center;
  width: clamp(12px, 2.7vw, 24px);
  height: clamp(22px, 4.2vw, 34px);
  margin-left: -1px;
  border: 1px solid rgba(247, 247, 242, 0.28);
  color: rgba(247, 247, 242, 0.78);
  background: rgba(0, 0, 0, 0.24);
  font-size: clamp(0.52rem, 1.6vw, 0.82rem);
  font-weight: 840;
  overflow: hidden;
  text-transform: uppercase;
}

.letter-rail span.is-lost {
  color: rgba(255, 255, 255, 0.36);
  border-color: rgba(255, 255, 255, 0.24);
  opacity: 0.28;
  transform: translateY(8px) rotate(8deg);
}

.game-over {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
}

.game-over[hidden] {
  display: none;
}

.game-over > * {
  grid-column: 1;
}

.game-over h2 {
  max-width: 9ch;
  margin: 20px auto 16px;
  font-size: clamp(3.4rem, 10vw, 8rem);
  line-height: 0.84;
  font-weight: 950;
  text-transform: uppercase;
}

.final-score {
  margin-bottom: 26px;
  color: var(--accent);
  font-size: clamp(1.2rem, 4vw, 2.1rem);
  font-weight: 900;
}

.score-form {
  width: min(520px, 100%);
  margin: 0 auto 20px;
}

.score-form label {
  display: block;
  margin-bottom: 10px;
  color: rgba(247, 247, 242, 0.58);
  font-size: 0.7rem;
  font-weight: 840;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.score-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

#playerName {
  min-width: 0;
  height: 48px;
  border: 1px solid rgba(247, 247, 242, 0.38);
  outline: 0;
  background: rgba(0, 0, 0, 0.5);
  color: var(--ink);
  padding: 0 14px;
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#playerName:focus {
  border-color: var(--ink);
  box-shadow: 0 0 32px rgba(255, 255, 255, 0.16);
}

#submitScoreButton {
  min-height: 48px;
  border-radius: 0;
  padding-inline: 18px;
}

.score-help,
.score-message,
.leaderboard-status {
  min-height: 18px;
  margin: 9px 0 0;
  color: rgba(247, 247, 242, 0.62);
  font-size: 0.82rem;
  font-weight: 700;
}

.score-message.is-error,
.leaderboard-status.is-error {
  color: rgba(255, 255, 255, 0.98);
}

.compact-leaderboard {
  width: min(520px, 100%);
  margin: 0 auto 18px;
}

.leaderboard-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(18px);
}

.leaderboard-panel[hidden] {
  display: none;
}

.leaderboard-dialog {
  position: relative;
  width: min(620px, 100%);
  max-height: min(760px, 92svh);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(247, 247, 242, 0.28);
  background: rgba(0, 0, 0, 0.82);
  padding: clamp(22px, 4vw, 38px);
  box-shadow: 0 0 80px rgba(255, 255, 255, 0.12);
}

.leaderboard-dialog h2 {
  margin-bottom: 22px;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  line-height: 0.86;
  font-weight: 950;
  text-transform: uppercase;
}

.close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(247, 247, 242, 0.34);
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.leaderboard-rows {
  display: grid;
  gap: 6px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border-bottom: 1px solid rgba(247, 247, 242, 0.14);
  color: rgba(247, 247, 242, 0.82);
  font-size: 0.9rem;
  font-weight: 850;
}

.leaderboard-rank {
  color: rgba(247, 247, 242, 0.45);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
}

.leaderboard-name {
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1em;
}

.leaderboard-score {
  color: var(--ink);
}

.leaderboard-empty {
  color: rgba(247, 247, 242, 0.56);
  font-weight: 700;
}

@keyframes heroDrift {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.07) translate3d(-1.4%, -1%, 0);
  }
}

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

@keyframes inputRift {
  0% {
    transform: translate3d(0, 0, 0);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 48px rgba(255, 255, 255, 0.08);
  }
  45% {
    transform: translate3d(0, -1px, 0);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.18),
      0 0 76px rgba(255, 255, 255, 0.16);
  }
  100% {
    transform: translate3d(0, 0, 0);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 48px rgba(255, 255, 255, 0.08);
  }
}

@keyframes voidReveal {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .site-nav {
    min-height: 66px;
    padding: 18px 18px;
  }

  .nav-status {
    display: flex;
    gap: 0;
  }

  .nav-status span {
    display: none;
  }

  .hero {
    align-items: end;
    padding: 96px 18px 78px;
  }

  .hero-media {
    background-position: 60% center;
  }

  .hero-media::after {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0.72) 28%, rgba(0, 0, 0, 0.94) 88%),
      radial-gradient(circle at 74% 31%, rgba(255, 255, 255, 0.16), transparent 30%);
  }

  h1 {
    max-width: calc(100vw - 36px);
    font-size: clamp(2.45rem, 12vw, 3.8rem);
    overflow-wrap: normal;
  }

  .hero-copy,
  .newsletter-form,
  .input-wrap {
    max-width: calc(100vw - 36px);
  }

  .lead {
    margin-bottom: 32px;
    font-size: 1rem;
  }

  .form-row {
    align-items: stretch;
    flex-direction: column;
  }

  #submitButton,
  #restartButton,
  #submitScoreButton {
    width: 100%;
  }

  .score-input-row {
    grid-template-columns: 1fr;
  }

  .leaderboard-dialog h2 {
    font-size: clamp(2.1rem, 9vw, 3rem);
  }

  .hero-foot {
    display: none;
  }

  .hud {
    top: 16px;
    left: 12px;
    right: 12px;
    gap: 10px;
  }

  .hud > div {
    min-width: auto;
  }

  .hud-label {
    margin-bottom: 2px;
    font-size: 0.52rem;
    letter-spacing: 0.1em;
  }

  .hud strong {
    font-size: 0.92rem;
  }

  .hud > div:last-child {
    text-align: right;
  }

  .letter-rail {
    bottom: 12px;
    max-width: 84vw;
  }

  .letter-rail span {
    width: 7px;
    height: 12px;
    font-size: 0.4rem;
  }
}
