* { box-sizing: border-box; }

html {
  min-width: 280px;
  background: var(--background);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.page {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(24px, 5vw, 48px);
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 13px;
  font-family: var(--display);
  font-size: 29px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.logo {
  position: relative;
  display: inline-block;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 4px solid white;
  border-radius: 11px;
  background: var(--orange);
  box-shadow: 0 5px 0 var(--dark-green);
  transform: rotate(-8deg);
}

.logo::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 10px;
  height: 4px;
  border-radius: 2px;
  background: white;
}

main {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 42px 0 36px;
}

.welcome {
  width: min(100%, 760px);
  text-align: center;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.5rem, 7.3vw, 5.25rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.headline-first { display: block; }

.headline-second {
  display: block;
  margin-top: 10px;
}

.highlight {
  display: inline-block;
  padding: 0 0.14em 0.06em;
  border-radius: 0.15em;
  background: var(--outline);
  color: var(--orange);
  box-shadow: 0 5px 0 var(--dark-orange);
  transform: rotate(-3deg);
}

.subline {
  max-width: 43ch;
  margin: 27px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.3vw, 1.2rem);
  line-height: 1.65;
  text-wrap: pretty;
}

.playground {
  display: block;
  width: min(100%, 330px);
  height: auto;
  margin: 24px auto 8px;
  overflow: visible;
}

.avatar {
  animation: bounce 3s ease-in-out infinite;
}

.wave {
  transform-box: view-box;
  transform-origin: 204px 100px;
  animation: wave 3s ease-in-out infinite;
}

.building {
  width: min(100%, 324px);
  margin: 0 auto;
}

.building p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.progress {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  padding: 9px;
  border: 3px solid var(--outline);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 5px 0 var(--dark-green);
}

.progress span {
  height: 24px;
  border: 2px solid var(--dark-green);
  border-radius: 5px;
  background: var(--slot);
  animation: build 6s step-end infinite;
  animation-delay: calc(var(--i) * 0.3s);
}

.progress span:nth-child(-n+4) { background: var(--green); }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

footer p { margin: 0; }

.motion-toggle {
  min-height: 44px;
  padding: 8px 13px;
  border: 2px solid var(--muted);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  touch-action: manipulation;
}

.motion-toggle:hover { border-color: var(--ink); }

.motion-toggle:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.motion-toggle:active { transform: translateY(2px); }

[hidden] { display: none !important; }

.cubes {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.cube {
  position: absolute;
  width: var(--size, 52px);
  aspect-ratio: 1;
  border: 3px solid var(--outline);
  border-radius: 22%;
  background: var(--color, var(--green));
  box-shadow: 0 7px 0 var(--shadow, var(--dark-green));
  animation: float var(--duration, 8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  transform: rotate(var(--tilt, -12deg));
}

.cube::before {
  content: "";
  position: absolute;
  top: 15%;
  left: 15%;
  width: 28%;
  height: 9%;
  border-radius: 3px;
  background: var(--background);
}

.cube:nth-child(1) { left: 9%; top: 24%; --size: 62px; --delay: -2s; }
.cube:nth-child(2) {
  right: 10%; top: 17%; --size: 48px;
  --color: var(--orange); --shadow: var(--dark-orange);
  --tilt: 14deg; --delay: -4s; --duration: 10s;
}
.cube:nth-child(3) {
  left: 17%; bottom: 21%; --size: 35px;
  --color: var(--dark-green); --tilt: 9deg;
  --delay: -5s; --duration: 9s;
}
.cube:nth-child(4) {
  right: 12%; bottom: 24%; --size: 66px;
  --color: var(--orange); --shadow: var(--dark-orange);
  --tilt: -16deg; --delay: -1s; --duration: 11s;
}
.cube:nth-child(5) {
  right: 27%; top: 8%; --size: 24px;
  --color: var(--dark-green); --tilt: 16deg; --delay: -3s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--tilt, -12deg)); }
  50% { transform: translateY(-16px) rotate(calc(var(--tilt, -12deg) + 12deg)); }
}

@keyframes bounce {
  0%, 35%, 65%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes wave {
  0%, 15%, 65%, 100% { transform: rotate(0deg); }
  25%, 45% { transform: rotate(-16deg); }
  35%, 55% { transform: rotate(10deg); }
}

@keyframes build {
  0%, 8% { background: var(--slot); }
  9%, 80% { background: var(--green); }
  81%, 100% { background: var(--slot); }
}

html[data-motion="paused"] *,
html[data-motion="paused"] *::before,
html[data-motion="paused"] *::after {
  animation-play-state: paused !important;
}

@media (min-width: 1400px) {
  .page { padding-inline: max(48px, calc((100vw - 1300px) / 2)); }
}

@media (max-width: 700px) {
  .cube:nth-child(1) { left: -23px; top: 23%; --size: 44px; }
  .cube:nth-child(2) { right: -15px; top: 13%; --size: 36px; }
  .cube:nth-child(3) { display: none; }
  .cube:nth-child(4) { right: -23px; bottom: 25%; --size: 43px; }
  .cube:nth-child(5) { display: none; }
}

@media (max-width: 380px) {
  .page { padding-inline: 20px; }
  main { padding-top: 36px; }
  .brand { font-size: 26px; }
  .playground { width: 270px; max-width: 100%; }
  .progress { gap: 4px; }
  footer { justify-content: center; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #122012;
    --panel: #1b2d1a;
    --ink: #eef6e6;
    --muted: #b4c6a7;
    --green: #46c467;
    --orange: #ff9a3c;
    --slot: #30452a;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .motion-toggle { display: none !important; }
}

@media (forced-colors: active) {
  .highlight { border: 2px solid CanvasText; }
  .progress span:nth-child(-n+4) { background: Highlight; }
  .motion-toggle:focus-visible { outline-color: Highlight; }
}