:root {
  color-scheme: dark;
  --ink: #101942;
  --ink-deep: #090f2c;
  --cream: #fff0cf;
  --coral: #ff6b4a;
  --orange: #ff9a5a;
  --cyan: #8fe7ee;
  --violet: #7d5ac7;
  --line: rgba(255, 240, 207, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink-deep);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 15% 10%, rgba(125, 90, 199, 0.25), transparent 30rem),
    linear-gradient(145deg, #101942 0%, #090f2c 68%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.site-header,
.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  min-height: 48px;
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.brand-mark {
  width: 17px;
  height: 17px;
  border: 4px solid var(--coral);
  border-radius: 50% 50% 50% 8%;
  transform: rotate(-25deg);
}

.project-tag,
.tech-list {
  color: rgba(255, 240, 207, 0.58);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.game-shell {
  position: relative;
}

.game-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 240, 207, 0.16);
  border-radius: 26px;
  background: #f88a62;
  box-shadow:
    0 30px 80px rgba(2, 5, 22, 0.52),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  isolation: isolate;
}

.game-frame::after {
  position: absolute;
  inset: 0;
  z-index: 6;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: inherit;
  box-shadow: inset 0 -70px 110px rgba(7, 13, 42, 0.14);
  content: "";
  pointer-events: none;
}

.mobile-jump-button {
  display: none;
  width: 100%;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  padding: 12px 22px;
  border: 1px solid rgba(143, 231, 238, 0.5);
  border-radius: 18px;
  color: var(--ink-deep);
  background: linear-gradient(135deg, var(--cyan), #d4fbff);
  box-shadow:
    0 12px 28px rgba(2, 5, 22, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform 100ms ease, opacity 160ms ease, filter 160ms ease;
}

.mobile-jump-button:active:not(:disabled) {
  transform: translateY(2px) scale(0.985);
  filter: brightness(1.08);
}

.mobile-jump-button:disabled {
  cursor: default;
  opacity: 0.38;
  filter: saturate(0.45);
}

.jump-button-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  color: var(--cream);
  background: var(--coral);
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
}

.jump-button-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.jump-button-label strong {
  font-size: 1.15rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.jump-button-label small {
  margin-top: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0.68;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

.hud {
  position: absolute;
  top: clamp(16px, 3vw, 34px);
  right: clamp(66px, 8vw, 94px);
  left: clamp(18px, 3.6vw, 42px);
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.hud.is-hidden,
.screen.is-hidden,
.new-best.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.score-block,
.speed-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--cream);
  text-shadow: 0 2px 12px rgba(16, 25, 66, 0.5);
}

.score-block strong {
  font-size: clamp(1.1rem, 2.7vw, 2.1rem);
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.score-block small {
  margin-left: 4px;
  font-size: 0.65em;
  font-weight: 900;
}

.hud-label {
  font-size: clamp(0.48rem, 1vw, 0.66rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  opacity: 0.72;
}

.stage-chip {
  position: absolute;
  top: 2px;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  color: var(--cream);
  text-align: center;
  text-shadow: 0 2px 12px rgba(16, 25, 66, 0.55);
  transform: translateX(-50%);
}

.stage-chip span {
  color: var(--cyan);
  font-size: clamp(0.46rem, 0.85vw, 0.6rem);
  font-weight: 950;
  letter-spacing: 0.18em;
}

.stage-chip strong {
  font-size: clamp(0.52rem, 1vw, 0.72rem);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.speed-meter {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 20px;
}

.speed-meter i {
  display: block;
  width: clamp(4px, 0.65vw, 7px);
  height: 8px;
  border-radius: 2px;
  background: rgba(255, 240, 207, 0.25);
  transform: skewX(-12deg);
  transition: height 180ms ease, background 180ms ease;
}

.speed-meter i:nth-child(2) { height: 10px; }
.speed-meter i:nth-child(3) { height: 12px; }
.speed-meter i:nth-child(4) { height: 14px; }
.speed-meter i:nth-child(5) { height: 16px; }
.speed-meter i:nth-child(6) { height: 18px; }
.speed-meter i:nth-child(7) { height: 20px; }
.speed-meter i.is-active { background: var(--cyan); }

.icon-button {
  position: absolute;
  top: clamp(14px, 2.6vw, 30px);
  right: clamp(14px, 2.6vw, 30px);
  z-index: 8;
  display: grid;
  width: clamp(38px, 4.5vw, 50px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 240, 207, 0.28);
  border-radius: 50%;
  color: var(--cream);
  background: rgba(16, 25, 66, 0.22);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:hover {
  background: rgba(16, 25, 66, 0.42);
  transform: scale(1.05);
}

.icon-button:focus-visible,
.primary-button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.sound-waves,
.sound-waves::before,
.sound-waves::after {
  display: block;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 50% 50% 0;
  content: "";
}

.sound-waves {
  position: relative;
  width: 12px;
  height: 18px;
}

.sound-waves::before {
  position: absolute;
  top: 3px;
  left: -7px;
  width: 8px;
  height: 8px;
  background: currentColor;
  clip-path: polygon(0 35%, 45% 35%, 100% 0, 100% 100%, 45% 65%, 0 65%);
}

.sound-waves::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 4px;
  height: 8px;
}

.icon-button.is-muted .sound-waves::after {
  position: absolute;
  top: 7px;
  left: -4px;
  width: 19px;
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: var(--coral);
  transform: rotate(-45deg);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  padding: clamp(28px, 6vw, 74px);
  background: linear-gradient(90deg, rgba(8, 14, 45, 0.82) 0%, rgba(8, 14, 45, 0.5) 44%, transparent 74%);
  transition: visibility 220ms ease, opacity 220ms ease;
}

.screen-content {
  position: relative;
  z-index: 2;
}

.start-content {
  width: min(480px, 56%);
}

.eyebrow {
  margin: 0 0 clamp(7px, 1.2vw, 14px);
  color: var(--cyan);
  font-size: clamp(0.52rem, 1vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0.2em;
}

h1,
h2 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(2.5rem, 7.8vw, 6.2rem);
  font-weight: 950;
  line-height: 0.78;
  letter-spacing: -0.075em;
  text-shadow: 0 8px 30px rgba(8, 14, 45, 0.3);
}

h1 em {
  color: var(--coral);
  font-style: normal;
}

.lead {
  margin: clamp(13px, 2.3vw, 24px) 0;
  color: rgba(255, 240, 207, 0.82);
  font-size: clamp(0.68rem, 1.35vw, 0.98rem);
  font-weight: 650;
  line-height: 1.7;
}

.primary-button {
  display: inline-flex;
  min-width: clamp(184px, 23vw, 260px);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(11px, 1.7vw, 17px) clamp(15px, 2.2vw, 24px);
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 10px 26px rgba(8, 14, 45, 0.24);
  cursor: pointer;
  font-size: clamp(0.67rem, 1.1vw, 0.86rem);
  font-weight: 950;
  letter-spacing: 0.08em;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary-button:hover:not(:disabled) {
  background: white;
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button-arrow {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--cream);
  background: var(--coral);
  font-size: 1rem;
}

.control-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: clamp(12px, 2vw, 22px);
  color: rgba(255, 240, 207, 0.68);
  font-size: clamp(0.53rem, 0.9vw, 0.7rem);
  font-weight: 800;
}

kbd,
.tap-icon {
  display: inline-grid;
  min-height: 22px;
  margin-right: 4px;
  padding: 0 8px;
  place-items: center;
  border: 1px solid rgba(255, 240, 207, 0.32);
  border-radius: 6px;
  color: var(--cream);
  background: rgba(16, 25, 66, 0.3);
  font: inherit;
}

.tap-icon {
  min-width: 22px;
  padding: 0;
  color: var(--coral);
  font-size: 0.45rem;
}

.best-line {
  margin: clamp(10px, 1.8vw, 18px) 0 0;
  color: rgba(255, 240, 207, 0.54);
  font-size: clamp(0.56rem, 0.9vw, 0.7rem);
  font-weight: 900;
  letter-spacing: 0.16em;
}

.best-line strong {
  margin-left: 5px;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

.game-over-screen {
  justify-content: center;
  background: rgba(8, 14, 45, 0.54);
  backdrop-filter: blur(6px);
}

.result-card {
  width: min(470px, 90%);
  padding: clamp(20px, 4vw, 42px);
  border: 1px solid rgba(255, 240, 207, 0.2);
  border-radius: 24px;
  text-align: center;
  background: rgba(10, 17, 52, 0.85);
  box-shadow: 0 26px 70px rgba(3, 6, 24, 0.38);
}

.result-card h2 {
  font-size: clamp(2.1rem, 6vw, 4.8rem);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: clamp(16px, 3vw, 28px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: clamp(12px, 2.5vw, 20px);
}

.result-grid > div + div {
  border-left: 1px solid var(--line);
}

.result-grid span {
  color: rgba(255, 240, 207, 0.56);
  font-size: clamp(0.56rem, 1vw, 0.7rem);
  font-weight: 800;
}

.result-grid strong {
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-variant-numeric: tabular-nums;
}

.result-grid small {
  margin-left: 3px;
  font-size: 0.48em;
}

.result-card .primary-button {
  width: min(260px, 100%);
}

.new-best {
  margin: -14px 0 18px;
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.completion-screen {
  z-index: 10;
  justify-content: center;
  overflow: hidden;
  padding: clamp(12px, 2.5vw, 28px);
  background:
    radial-gradient(circle at 50% 42%, rgba(50, 226, 231, 0.2), transparent 32%),
    radial-gradient(circle at 50% 55%, rgba(255, 107, 74, 0.2), transparent 52%),
    rgba(5, 10, 35, 0.8);
  backdrop-filter: blur(5px);
}

.completion-card {
  width: min(560px, 94%);
  padding: clamp(14px, 2.8vw, 30px);
  border: 1px solid rgba(143, 231, 238, 0.42);
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(145deg, rgba(17, 27, 74, 0.94), rgba(7, 13, 44, 0.9));
  box-shadow:
    0 0 0 6px rgba(143, 231, 238, 0.05),
    0 28px 80px rgba(3, 6, 24, 0.5);
}

.completion-screen.is-active .completion-card {
  animation: completion-pop 720ms cubic-bezier(0.2, 0.9, 0.24, 1.18) both;
}

.completion-badge {
  display: grid;
  width: clamp(42px, 6vw, 62px);
  aspect-ratio: 1;
  margin: 0 auto clamp(9px, 1.4vw, 14px);
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--cyan);
  box-shadow: 0 0 32px rgba(143, 231, 238, 0.42);
  font-size: clamp(1.1rem, 2.4vw, 1.8rem);
}

.completion-heading {
  margin: 0 0 clamp(8px, 1.3vw, 14px);
  color: var(--coral);
  font-size: clamp(1.15rem, 3.3vw, 2.35rem);
  font-weight: 950;
  letter-spacing: 0.04em;
}

.completion-card h2 {
  font-size: clamp(2.1rem, 6.5vw, 5rem);
  line-height: 0.92;
}

.completion-card h2 span,
.completion-card h2 em {
  display: block;
}

.completion-card h2 span {
  font-size: 0.58em;
  letter-spacing: -0.025em;
}

.completion-card h2 em {
  color: var(--cyan);
  font-style: normal;
}

.completion-message {
  margin: clamp(12px, 2vw, 20px) 0 0;
  color: rgba(255, 240, 207, 0.82);
  font-size: clamp(0.65rem, 1.2vw, 0.88rem);
  font-weight: 750;
}

.completion-results {
  margin: clamp(12px, 2.2vw, 22px) 0;
}

.completion-card .primary-button {
  width: min(280px, 100%);
}

.completion-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.completion-confetti i {
  position: absolute;
  top: -12%;
  left: 10%;
  width: 8px;
  height: 20px;
  border-radius: 2px;
  background: var(--cyan);
  animation: confetti-fall 2.8s linear infinite paused;
}

.completion-screen.is-active .completion-confetti i {
  animation-play-state: running;
}

.completion-confetti i:nth-child(2) { left: 18%; animation-delay: -1.8s; background: var(--coral); }
.completion-confetti i:nth-child(3) { left: 26%; animation-delay: -0.7s; background: var(--cream); }
.completion-confetti i:nth-child(4) { left: 34%; animation-delay: -2.3s; background: #a991ff; }
.completion-confetti i:nth-child(5) { left: 42%; animation-delay: -1.1s; background: var(--coral); }
.completion-confetti i:nth-child(6) { left: 49%; animation-delay: -2.6s; background: var(--cyan); }
.completion-confetti i:nth-child(7) { left: 56%; animation-delay: -0.4s; background: var(--cream); }
.completion-confetti i:nth-child(8) { left: 63%; animation-delay: -1.5s; background: #a991ff; }
.completion-confetti i:nth-child(9) { left: 70%; animation-delay: -2.1s; background: var(--cyan); }
.completion-confetti i:nth-child(10) { left: 76%; animation-delay: -0.9s; background: var(--coral); }
.completion-confetti i:nth-child(11) { left: 82%; animation-delay: -2.5s; background: var(--cream); }
.completion-confetti i:nth-child(12) { left: 88%; animation-delay: -1.3s; background: #a991ff; }
.completion-confetti i:nth-child(13) { left: 93%; animation-delay: -0.2s; background: var(--cyan); }
.completion-confetti i:nth-child(14) { left: 6%; animation-delay: -2s; background: var(--coral); }

@keyframes completion-pop {
  from { opacity: 0; transform: translateY(22px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes confetti-fall {
  from { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  to { transform: translate3d(34px, 120vh, 0) rotate(540deg); }
}

.stage-transition {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  visibility: visible;
  flex-direction: column;
  gap: clamp(6px, 1.2vw, 12px);
  align-items: center;
  justify-content: center;
  color: var(--cream);
  text-align: center;
  background: radial-gradient(circle at 50% 50%, rgba(7, 13, 44, 0.2), transparent 42%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.stage-transition.is-active {
  opacity: 1;
  transition: opacity 280ms ease;
}

.stage-transition.is-hidden {
  visibility: hidden;
}

.stage-transition p,
.stage-transition span {
  margin: 0;
  color: var(--cyan);
  font-size: clamp(0.56rem, 1.1vw, 0.76rem);
  font-weight: 950;
  letter-spacing: 0.24em;
}

.stage-transition strong {
  font-size: clamp(2rem, 6.5vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-shadow: 0 4px 22px rgba(3, 8, 36, 0.72);
}

.stage-transition span {
  color: var(--coral);
  font-size: clamp(0.5rem, 0.9vw, 0.65rem);
}

.corner-label {
  position: absolute;
  right: clamp(16px, 2.4vw, 28px);
  bottom: clamp(13px, 2vw, 22px);
  z-index: 7;
  color: rgba(255, 240, 207, 0.52);
  font-size: clamp(0.5rem, 0.9vw, 0.65rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.project-footer {
  gap: 20px;
  padding: 17px 4px 0;
  color: rgba(255, 240, 207, 0.54);
}

.project-footer p {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.studio-credit {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 240, 207, 0.7);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-decoration: none;
  transition: color 180ms ease, opacity 180ms ease;
}

.studio-credit img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  opacity: 0.88;
}

.studio-credit:hover,
.studio-credit:focus-visible {
  color: var(--cream);
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.tech-list span {
  padding: 6px 9px;
  border: 1px solid rgba(255, 240, 207, 0.12);
  border-radius: 999px;
}

@media (hover: none) and (pointer: coarse) {
  .mobile-jump-button {
    display: flex;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .site-header {
    min-height: 38px;
    margin-bottom: 8px;
  }

  .project-tag {
    display: none;
  }

  .brand {
    font-size: 0.65rem;
  }

  .game-frame {
    border-radius: 17px;
  }

  .mobile-jump-button {
    display: flex;
  }

  .screen {
    padding: 24px;
  }

  .start-content {
    width: 66%;
  }

  .lead br {
    display: none;
  }

  .control-hints span:first-child {
    display: none;
  }

  .stage-chip strong {
    display: none;
  }

  .project-footer p {
    display: none;
  }

  .project-footer {
    flex-direction: column;
    justify-content: center;
    gap: 10px;
  }

  .tech-list {
    justify-content: center;
  }
}

@media (max-width: 450px) {
  .screen {
    padding: 18px;
  }

  .start-content {
    width: 73%;
  }

  .lead {
    line-height: 1.45;
  }

  .primary-button {
    min-width: 164px;
    padding-block: 9px;
  }

  .button-arrow {
    width: 22px;
    height: 22px;
  }

  .control-hints,
  .best-line {
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
