:root {
  --ink: #fff9df;
  --space: #11143f;
  --violet: #44216f;
  --blue: #1b67b5;
  --mint: #6df7ce;
  --sun: #ffd65c;
  --gold: #ffc43d;
  --coral: #ff746f;
  --pink: #ff85cb;
  --line: rgba(255, 255, 255, 0.24);
  --shadow: 0 22px 60px rgba(3, 7, 28, 0.42);
}

* {
  box-sizing: border-box;
  caret-color: transparent;
}

html,
body,
.app {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Comic Sans MS", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--space);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
label,
input,
.choice-grid span {
  -webkit-tap-highlight-color: transparent;
}

button:focus,
button:focus-visible,
a:focus,
a:focus-visible,
input:focus,
input:focus-visible,
.choice-grid input:focus + span,
.choice-grid input:focus-visible + span {
  outline: 0;
  box-shadow: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 13, 45, 0.56), rgba(8, 13, 45, 0.12) 50%, rgba(8, 13, 45, 0.56)),
    url("assets/regne-raketten-space-bg.png") center / cover no-repeat;
}

.screen.active {
  display: block;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.94) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, 0.56) 0 1px, transparent 2px);
  background-position: 0 0, 40px 54px;
  background-size: 94px 94px, 138px 138px;
  opacity: 0.78;
  animation: starDrift 18s linear infinite;
  pointer-events: none;
}

.cosmos,
.start-layout,
.hud,
.problem-panel,
.message,
.help-panel,
.pause-panel,
.end-card,
.landing-scene {
  position: relative;
  z-index: 1;
}

.start-layout {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(260px, 0.8fr) minmax(300px, 0.9fr);
  align-items: center;
  gap: clamp(16px, 3vw, 38px);
  padding: clamp(18px, 4vw, 54px);
}

.hero-copy {
  align-self: start;
  padding-top: clamp(8px, 3vh, 34px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: 18px;
  padding: 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  background: rgba(12, 16, 51, 0.5);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 9ch;
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(3.9rem, 8.2vw, 8.7rem);
  line-height: 0.85;
  letter-spacing: 0;
  text-shadow: 6px 6px 0 #07102f, 0 0 34px rgba(255, 214, 92, 0.66);
}

.hero-copy p {
  max-width: 27rem;
  margin-top: 18px;
  color: #fff9df;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 900;
  line-height: 1.2;
}

.setup-panel {
  display: grid;
  gap: 24px;
  width: min(100%, 560px);
  padding: clamp(26px, 3vw, 36px);
  border: 3px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(10, 18, 58, 0.74);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 14px;
  color: var(--mint);
  font-size: 1.45rem;
  font-weight: 950;
}

.choice-grid {
  display: grid;
  gap: 14px;
}

.choice-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid label {
  display: block;
}

.choice-grid input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.choice-grid span {
  display: grid;
  place-items: center;
  min-height: 68px;
  padding: 12px 16px;
  border: 3px solid #07102f;
  border-radius: 8px;
  background: #fff9df;
  color: #17214d;
  font-size: 1.16rem;
  font-weight: 950;
  text-align: center;
  box-shadow: none;
}

.choice-grid input:checked + span {
  background: var(--sun);
  color: #211506;
  transform: none;
  box-shadow: none;
  outline: 0;
}

.start-actions,
.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
.round-button,
.icon-button {
  min-height: 64px;
  border: 3px solid #07102f;
  border-radius: 8px;
  font-weight: 950;
  box-shadow: none;
}

.primary-button {
  flex: 1 1 190px;
  padding: 0 22px;
  background: linear-gradient(135deg, var(--gold), #fff7a8);
  color: #1d1604;
  font-size: 1.35rem;
}

.secondary-button,
.round-button,
.icon-button {
  padding: 0 14px;
  background: #f3fbff;
  color: #132056;
}

.primary-button:active,
.secondary-button:active,
.round-button:active,
.icon-button:active {
  transform: none;
  box-shadow: none;
}

.launch-art {
  min-height: 520px;
  display: grid;
  place-items: center;
}

.rocket-asset {
  position: absolute;
  display: block;
  width: min(32vw, 310px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(12px 18px 24px rgba(4, 8, 28, 0.44));
}

.rocket-large {
  transform: rotate(10deg) translateY(-18px);
  animation: floatRocket 3s ease-in-out infinite;
}

.comet,
.moon {
  position: absolute;
  border-radius: 50%;
  z-index: 0;
}

.comet {
  width: 12px;
  height: 12px;
  background: #fff;
  box-shadow: -30px 12px 0 -3px rgba(255, 255, 255, 0.48), -58px 23px 0 -5px rgba(255, 214, 92, 0.6);
}

.comet-a {
  top: 12%;
  left: 58%;
}

.comet-b {
  right: 8%;
  bottom: 28%;
  transform: rotate(24deg);
}

.moon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #fff8b8, #ffb86c);
  box-shadow: inset -12px -10px 0 rgba(178, 91, 81, 0.2);
}

.moon-a {
  top: 10%;
  right: 18%;
}

.moon-b {
  width: 34px;
  height: 34px;
  left: 16%;
  bottom: 16%;
  background: linear-gradient(135deg, #b6fff1, #73baff);
}

#space-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 16px 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(7, 16, 47, 0.72);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.hud span {
  font-size: 1.38rem;
  font-weight: 900;
}

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

.top-left {
  top: 18px;
  left: 18px;
}

.top-center {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.top-right {
  top: 18px;
  right: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.energy {
  width: 230px;
  height: 34px;
  overflow: hidden;
  border: 3px solid #07102f;
  border-radius: 999px;
  background: #301943;
}

.energy span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #50f08f, #fff06a);
  transition: width 220ms ease;
}

.problem-panel {
  position: absolute;
  top: 108px;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 22px 12px;
  border: 3px solid #07102f;
  border-radius: 8px;
  background: rgba(255, 249, 223, 0.96);
  color: #121a48;
  box-shadow: none;
  transform: translateX(-50%);
}

.problem-panel strong {
  font-size: clamp(2rem, 5.4vw, 4.7rem);
  line-height: 1;
}

.problem-panel span {
  color: #3e4775;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  font-weight: 900;
}

.round-button {
  min-height: 58px;
  padding: 0 24px;
  font-size: 1.22rem;
}

.message {
  position: absolute;
  left: 50%;
  bottom: 22px;
  min-width: min(520px, calc(100% - 28px));
  padding: 12px 18px;
  border: 3px solid #07102f;
  border-radius: 8px;
  background: rgba(255, 249, 223, 0.94);
  color: #17214d;
  font-size: clamp(1.1rem, 2.3vw, 1.45rem);
  font-weight: 950;
  text-align: center;
  box-shadow: none;
  transform: translateX(-50%);
}

.message.good {
  background: #c8ffd9;
}

.message.try {
  background: #ffe0cf;
}

.help-panel {
  position: absolute;
  left: 28px;
  bottom: 96px;
  display: none;
  width: min(780px, calc(100% - 56px));
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 28px;
  border: 3px solid #07102f;
  border-radius: 8px;
  background: rgba(255, 249, 223, 0.96);
  color: #17214d;
  box-shadow: none;
}

.help-panel.show {
  display: block;
}

.close-help {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid #07102f;
  border-radius: 8px;
  background: #fff;
  color: #17214d;
  font-size: 2rem;
  font-weight: 950;
}

.dot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-right: 58px;
  font-size: 1.7rem;
  font-weight: 950;
}

.dot {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #07102f;
  border-radius: 50%;
  background: var(--gold);
}

.dot.crossed {
  position: relative;
  background: #d9e0f1;
}

.dot.crossed::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #ff554f;
  transform: rotate(-28deg);
}

.number-line {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  margin-top: 28px;
  padding-top: 34px;
  overflow-x: auto;
}

.tick {
  position: relative;
  display: grid;
  place-items: end center;
  min-width: 34px;
  height: 50px;
  color: #17214d;
  font-size: 1rem;
  font-weight: 900;
}

.tick::before {
  content: "";
  position: absolute;
  top: 0;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: #17214d;
}

.tick.mark {
  color: #d64053;
}

.tick.mark::after {
  content: "★";
  position: absolute;
  top: -22px;
  color: #d64053;
  font-size: 1.1rem;
}

.pause-panel {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(4, 8, 28, 0.62);
}

.pause-panel.show {
  display: grid;
}

.pause-panel > div,
.end-card {
  width: min(480px, calc(100% - 32px));
  padding: 26px;
  border: 3px solid #07102f;
  border-radius: 8px;
  background: rgba(255, 249, 223, 0.96);
  color: #17214d;
  text-align: center;
  box-shadow: none;
}

.pause-panel h2,
.end-card h2 {
  margin-bottom: 16px;
  color: #17214d;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0;
}

.pause-panel button {
  width: 100%;
  margin-top: 12px;
}

.end-screen {
  display: none;
  place-items: center;
}

.end-screen.active {
  display: grid;
}

.landing-scene {
  position: absolute;
  inset: 0;
}

.small-planet {
  position: absolute;
  left: 50%;
  bottom: -70px;
  width: min(640px, 86vw);
  height: 190px;
  border: 4px solid #07102f;
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.56), transparent 9%),
    linear-gradient(135deg, #7cf3d8, #5085df 58%, #584cc6);
  transform: translateX(-50%);
}

.rocket-asset.landed {
  left: 50%;
  bottom: 130px;
  width: min(28vw, 210px);
  transform: translateX(-50%) rotate(-8deg);
}

.end-card {
  position: relative;
  z-index: 2;
  margin-bottom: 80px;
}

.end-card p {
  margin-bottom: 16px;
  color: #39446f;
  font-size: 1.15rem;
  font-weight: 850;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.result-grid span {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 3px solid #07102f;
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.result-grid strong {
  color: #d64053;
  font-size: 2.1rem;
}

.shake {
  animation: shake 260ms linear;
}

.happy-hop {
  animation: happyHop 420ms ease;
}

@keyframes starDrift {
  from {
    background-position: 0 0, 40px 54px;
  }

  to {
    background-position: -94px 94px, -98px 192px;
  }
}

@keyframes floatRocket {
  0%,
  100% {
    transform: rotate(10deg) translateY(-18px);
  }

  50% {
    transform: rotate(7deg) translateY(-42px);
  }
}

@keyframes flamePulse {
  from {
    transform: translateX(-50%) scaleY(0.82);
  }

  to {
    transform: translateX(-50%) scaleY(1.08);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

@keyframes happyHop {
  0%,
  100% {
    transform: translateY(0);
  }

  45% {
    transform: translateY(-18px) rotate(6deg);
  }
}

@media (max-width: 980px) {
  .start-layout {
    grid-template-columns: 1fr 1fr;
    align-content: center;
  }

  .setup-panel {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .launch-art {
    min-height: 380px;
  }

}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .screen {
    min-height: 100svh;
    overflow: auto;
  }

  .start-layout {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .setup-panel {
    justify-self: stretch;
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  h1 {
    max-width: 7.2ch;
    font-size: clamp(3rem, 14vw, 4.6rem);
  }

  .hero-copy {
    padding-top: 0;
  }

  .hero-copy p {
    font-size: 1.1rem;
  }

  .launch-art {
    min-height: 280px;
    order: -1;
  }

  .rocket-large {
    width: min(48vw, 210px);
  }

  .choice-grid.three {
    grid-template-columns: 1fr;
  }

  .play-screen {
    overflow: hidden;
  }

  .top-left {
    top: 8px;
    left: 8px;
  }

  .top-center {
    top: 8px;
    right: 8px;
    left: auto;
    transform: none;
  }

  .top-right {
    top: auto;
    right: 8px;
    bottom: 88px;
    max-width: calc(100% - 16px);
  }

  .energy {
    width: 136px;
  }

  .problem-panel {
    top: 88px;
    width: min(380px, calc(100% - 24px));
  }

  .problem-panel strong {
    font-size: 2.5rem;
  }

  .hud {
    min-height: 54px;
    padding: 10px 12px;
  }

  .hud span {
    font-size: 1rem;
  }

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

  .round-button {
    min-height: 46px;
    padding: 0 14px;
    font-size: 1rem;
  }

  .help-panel {
    left: 12px;
    bottom: 134px;
    width: calc(100% - 24px);
    max-height: 52vh;
    padding: 22px;
  }

  .dot-row {
    gap: 9px;
    font-size: 1.35rem;
  }

  .dot {
    width: 24px;
    height: 24px;
  }
}
