:root {
  --bg: #f7f4ee;
  --ink: #241f1a;
  --muted: #5c534c;
  --line: #f0e4c4;
  --yellow: #f0c400;
  --card: #fffdf8;
  --font: "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(ellipse 56% 38% at 50% 0%, rgba(240, 196, 0, 0.42), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
}

html.locked {
  touch-action: none;
  overscroll-behavior: none;
  scrollbar-width: none;
}

html.locked::-webkit-scrollbar { display: none; }

html.locked body { user-select: none; }

html.locked.hands-on,
html.locked.hands-on * { cursor: none !important; }

html.in-room .status { display: none; }

body {
  position: relative;
  min-height: 100%;
}

main, footer { position: relative; z-index: 1; }

img { max-width: 100%; }

button, a { font: inherit; color: inherit; }

a { text-decoration-thickness: 1px; text-underline-offset: 3px; }

.hero {
  position: relative;
  max-width: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 24px 28px;
  overflow: hidden;
  text-align: center;
}

.hero > * { position: relative; z-index: 1; }

.hero > .hero-bubbles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bubble {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.bubble.yellow { background: rgba(240, 196, 0, 0.78); }
.bubble.purple { background: rgba(190, 156, 255, 0.76); }
.bubble.soft { background: rgba(206, 176, 255, 0.48); }

.hero-bubbles .bubble:nth-child(1) { width: 340px; height: 340px; left: -90px; top: 4%; }
.hero-bubbles .bubble:nth-child(2) { width: 280px; height: 280px; right: -70px; top: 2%; }
.hero-bubbles .bubble:nth-child(3) { width: 220px; height: 220px; left: -40px; top: 38%; }
.hero-bubbles .bubble:nth-child(4) { width: 260px; height: 260px; right: -30px; top: 34%; }
.hero-bubbles .bubble:nth-child(5) { width: 200px; height: 200px; left: 8%; bottom: -40px; }
.hero-bubbles .bubble:nth-child(6) { width: 300px; height: 300px; right: 6%; bottom: -80px; }
.hero-bubbles .bubble:nth-child(7) { width: 460px; height: 460px; left: 50%; top: 22%; transform: translate(-50%, -20%); }
.hero-bubbles .bubble:nth-child(8) { width: 150px; height: 150px; left: 62%; top: 8%; }
.hero-bubbles .bubble:nth-child(9) { width: 130px; height: 130px; left: 22%; top: 62%; }
.hero-bubbles .bubble:nth-child(10) { width: 170px; height: 170px; left: 38%; bottom: 6%; }
.hero-bubbles .bubble:nth-child(11) { width: 110px; height: 110px; right: 22%; top: 58%; }

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

.site-bubbles .bubble:nth-child(1) { width: 260px; height: 260px; left: -110px; top: 112vh; }
.site-bubbles .bubble:nth-child(2) { width: 200px; height: 200px; right: -70px; top: 124vh; }
.site-bubbles .bubble:nth-child(3) { width: 140px; height: 140px; left: 72%; top: 148vh; }
.site-bubbles .bubble:nth-child(4) { width: 300px; height: 300px; left: -130px; top: 168vh; }
.site-bubbles .bubble:nth-child(5) { width: 180px; height: 180px; right: -40px; top: 196vh; }
.site-bubbles .bubble:nth-child(6) { width: 120px; height: 120px; left: 8%; top: 214vh; }
.site-bubbles .bubble:nth-child(7) { width: 240px; height: 240px; right: -90px; top: 236vh; }
.site-bubbles .bubble:nth-child(8) { width: 160px; height: 160px; left: -50px; top: 258vh; }
.site-bubbles .bubble:nth-child(9) { width: 220px; height: 220px; right: 4%; top: 286vh; }
.site-bubbles .bubble:nth-child(10) { width: 280px; height: 280px; left: -120px; top: 312vh; }
.site-bubbles .bubble:nth-child(11) { width: 150px; height: 150px; right: -30px; top: 340vh; }
.site-bubbles .bubble:nth-child(12) { width: 190px; height: 190px; left: 64%; top: 368vh; }

.bubble.ring {
  background: transparent;
  box-shadow: inset 0 0 0 12px rgba(240, 196, 0, 0.9);
}

.bubble.ring.purple { box-shadow: inset 0 0 0 12px rgba(190, 156, 255, 0.95); }

.hero-copy {
  width: min(640px, 100%);
  padding: 18px 22px 16px;
  background: rgba(255, 253, 248, 0.92);
  border-radius: 36px;
  box-shadow: 0 12px 0 rgba(240, 196, 0, 0.72);
}

.logo-slot {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  container-type: size;
}

.hero > :not(.logo-slot) { flex-shrink: 0; }

.logo {
  width: auto;
  height: auto;
  max-width: min(86vw, 640px, 100cqw);
  max-height: 100cqh;
  display: block;
  object-fit: contain;
}

#hands-btn {
  min-width: 210px;
  min-height: 56px;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 800;
}

.lede {
  margin: 0;
  color: var(--ink);
  max-width: 14em;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.sub, .boot-note {
  margin: 14px 0 0;
  max-width: 36em;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.boot-note:empty { display: none; }

.cue {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-copy .kicker { margin-bottom: 6px; }

.hero-copy .lede,
.hero-copy .sub,
.hero-copy .cue {
  margin-left: auto;
  margin-right: auto;
}

.hero-copy .lede { margin-top: 0; }

.hero-copy .hero-actions { margin-top: 16px; }

.hero-copy .cue { margin-bottom: 0; }

.hero-actions, .play-actions, .try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 18px;
  margin-top: 26px;
}

.primary, .ghost, .fab, .mode-btn {
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  border: 0;
  font-weight: 800;
}

.primary {
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 10px 0 #e0b000, 0 16px 28px rgba(224, 176, 0, 0.28);
}

.primary:hover { background: #ffd21a; }
.primary:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }

.ghost, .mode-btn {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 0 #efe4d2;
}

.ghost:hover, .mode-btn:hover { background: #fffaf0; }

.quiet {
  color: var(--muted);
  font-size: 15px;
}

.primary:focus-visible,
.ghost:focus-visible,
.fab:focus-visible,
.mode-btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.hand-hot {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.fab {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 25;
  background: #fff;
  box-shadow: 0 10px 24px rgba(50, 40, 10, 0.1);
}

.fab[hidden],
#hands-btn[hidden],
#blocks-reset[hidden],
#assemble-btn[hidden],
#model-picker[hidden] { display: none; }

section {
  position: relative;
  isolation: isolate;
  width: min(820px, calc(100% - 36px));
  margin: 0 auto 72px;
  padding: 34px 32px 30px;
  scroll-margin-top: 28px;
  background: var(--card);
  border-radius: 36px;
  box-shadow: 0 12px 0 #f0c400;
}

section::before,
section::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.hero::before,
.hero::after { content: none; }

#product { margin-top: 48px; box-shadow: 0 12px 0 #f0c400; }
#product::before { width: 150px; height: 150px; right: -12px; top: -36px; background: #f0c400; }
#product::after { width: 96px; height: 96px; left: 28px; bottom: -28px; background: #c9b0ff; }

#gestures { box-shadow: 0 12px 0 #c9b0ff; }
#gestures::before { width: 120px; height: 120px; left: -12px; top: 36px; background: #c9b0ff; }
#gestures::after { width: 180px; height: 180px; right: -12px; bottom: -40px; background: #f0c400; }

#privacy { box-shadow: 0 12px 0 #f0c400; }
#privacy::before { width: 200px; height: 200px; right: -12px; bottom: -50px; background: #d7c4ff; }
#privacy::after { width: 70px; height: 70px; left: 22px; top: -22px; background: #f0c400; }

#plugin { box-shadow: 0 12px 0 #c9b0ff; }
#plugin::before { width: 130px; height: 130px; left: -12px; bottom: 18px; background: #f0c400; }
#plugin::after { width: 160px; height: 160px; right: 24px; top: -48px; background: #c9b0ff; }

#play { box-shadow: 0 12px 0 #f0c400; }
#play::before { width: 220px; height: 220px; right: -12px; top: -30px; background: rgba(190, 156, 255, 0.95); }
#play::after { width: 110px; height: 110px; left: -12px; bottom: 24px; background: #f0c400; }

.hero {
  width: 100%;
  margin: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

.kicker {
  margin: 0 0 10px;
  color: #9a7800;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 18px;
  border-radius: 50%;
  background: #f0c400;
  box-shadow: 14px 0 0 #c9b0ff;
  transform: translateY(-1px);
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

section p {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
}

.gesture-list {
  margin: 8px 0 0;
}

.gesture-list div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  margin-top: 12px;
  padding: 16px 18px;
  background: #fff6c2;
  border-radius: 24px;
  box-shadow: 0 7px 0 #f0c400;
}

.gesture-list div:nth-child(even) {
  background: #f4ecff;
  box-shadow: 0 7px 0 #c9b0ff;
}

.gesture-list dt {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.gesture-list dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.plain {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plain li {
  padding: 12px 16px;
  background: #f0c400;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 6px 0 #e0b000;
}

.plain li:nth-child(even) {
  background: #d7c4ff;
  box-shadow: 0 6px 0 #b79cff;
}

.snippet {
  margin: 22px 0 8px;
  padding: 18px 20px;
  background: #f0c400;
  border-radius: 24px;
  overflow: auto;
  box-shadow: 0 10px 0 #c9b0ff;
}

.snippet code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 15px;
  font-weight: 700;
}

.play-actions { justify-content: flex-start; margin: 8px 0 6px; }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.stage {
  position: relative;
  height: min(72vh, 760px);
  min-height: 460px;
  margin-top: 8px;
  background: radial-gradient(ellipse at 50% 46%, #fff 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 28px;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#gl { z-index: 1; }
#eyes { z-index: 2; }
#blocks { z-index: 3; }
#inspect { z-index: 3; display: none; }
#tele { z-index: 3; display: none; }
#arch { z-index: 3; display: none; }
#desk { z-index: 3; display: none; }
#click { z-index: 3; display: none; }
#zoom { z-index: 3; display: none; }
#hands { z-index: 4; }

#room.is-inspect #gl,
#room.is-inspect #eyes,
#room.is-inspect #blocks { visibility: hidden; }

#room.is-inspect #inspect { display: block; }

#room.is-telekinesis #gl,
#room.is-telekinesis #eyes,
#room.is-telekinesis #blocks { visibility: hidden; }

#room.is-telekinesis #tele { display: block; }

#room.is-archery #gl,
#room.is-archery #eyes,
#room.is-archery #blocks { visibility: hidden; }

#room.is-archery #arch { display: block; }

#room.is-scroll #gl,
#room.is-scroll #eyes,
#room.is-scroll #blocks { visibility: hidden; }

#room.is-scroll #desk { display: block; }

#room.is-click #gl,
#room.is-click #eyes,
#room.is-click #blocks { visibility: hidden; }

#room.is-click #click { display: block; }

#room.is-zoom #gl,
#room.is-zoom #eyes,
#room.is-zoom #blocks { visibility: hidden; }

#room.is-zoom #zoom { display: block; }

.gesture {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  background: rgba(255, 253, 248, 0.92);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  box-shadow: 0 8px 20px rgba(50, 40, 10, 0.06);
}

.gesture[hidden] { display: none; }

.status, .cam-note {
  position: fixed;
  z-index: 34;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status {
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: rgba(255, 253, 248, 0.94);
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(50, 40, 10, 0.06);
}

.status[hidden], .cam-note[hidden] { display: none; }

.status, .cam-note, #cam { pointer-events: none; }

#cam {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 34;
  display: none;
  width: 116px;
  height: 82px;
  object-fit: cover;
  transform: scaleX(-1);
  background: #111;
  border: 4px solid #fff;
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(50, 40, 10, 0.16);
}

#cam.on { display: block; }

.cam-note {
  right: 16px;
  bottom: 108px;
}

#cursor {
  position: fixed;
  z-index: 36;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  pointer-events: none;
  left: 0;
  top: 0;
  box-shadow: 0 6px 0 rgba(36, 31, 26, 0.18);
}

#cursor[hidden] { display: none; }

#cursor.down { transform: scale(0.72); }

footer {
  padding: 12px 24px 72px;
  text-align: center;
}

footer p {
  position: relative;
  margin: 0 auto;
  max-width: 420px;
  padding: 14px 18px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  background: #fffdf8;
  border-radius: 999px;
  box-shadow: 0 8px 0 #c9b0ff;
}

#room {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  background:
    radial-gradient(ellipse 64% 16% at 50% 78%, rgba(232, 214, 170, 0.7), transparent 72%),
    radial-gradient(ellipse 36% 28% at 50% 0%, rgba(240, 196, 0, 0.34), transparent 72%),
    var(--bg);
}

.room-bubbles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.room-bubbles .bubble:nth-child(1) { width: 280px; height: 280px; left: -90px; top: -40px; }
.room-bubbles .bubble:nth-child(2) { width: 220px; height: 220px; right: -60px; top: 8%; }
.room-bubbles .bubble:nth-child(3) { width: 160px; height: 160px; left: -30px; bottom: 12%; }
.room-bubbles .bubble:nth-child(4) { width: 240px; height: 240px; right: -70px; bottom: -40px; }
.room-bubbles .bubble:nth-child(5) { width: 90px; height: 90px; left: 22%; top: 16%; }

#room[hidden] { display: none; }

#room .stage {
  position: absolute;
  inset: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  background: none;
  border-radius: 0;
}

.room-hint {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 6;
  margin: 0;
  transform: translateX(-50%);
  padding: 12px 18px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  width: max-content;
  max-width: min(560px, calc(100% - 48px));
  background: rgba(255, 253, 248, 0.92);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(50, 40, 10, 0.06);
}

#room.is-blocks .room-hint {
  left: auto;
  right: 22px;
  transform: none;
  max-width: min(460px, 58vw);
}

#room.is-inspect .room-hint,
#room.is-telekinesis .room-hint,
#room.is-archery .room-hint,
#room.is-scroll .room-hint,
#room.is-click .room-hint,
#room.is-zoom .room-hint {
  max-width: min(720px, calc(100% - 40px));
}

.model-picker {
  position: absolute;
  top: 118px;
  left: 22px;
  right: 22px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-picker .mode-btn {
  min-height: 42px;
  padding: 10px 16px;
  background: #fff;
  box-shadow: 0 8px 0 #efe4d2;
}

.room-dock {
  position: absolute;
  left: 22px;
  right: 168px;
  bottom: 22px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.room-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 253, 248, 0.9);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(50, 40, 10, 0.08);
}

.room-modes .mode-btn {
  padding: 12px 14px;
  font-size: 15px;
  white-space: nowrap;
}

.mode-btn {
  min-height: 48px;
  box-shadow: none;
}

.mode-btn[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

#blocks-reset,
#assemble-btn { min-height: 48px; }

#room-done {
  margin-left: auto;
  min-height: 58px;
  padding: 14px 28px;
  font-size: 18px;
}

#intro {
  position: fixed;
  inset: 0;
  z-index: 70;
  margin: 0;
  background:
    radial-gradient(ellipse 40% 30% at 50% 46%, rgba(240, 196, 0, 0.2), transparent 70%),
    var(--bg);
  display: grid;
  place-items: center;
  transition: opacity 0.45s ease 0.32s;
}

#intro > * { grid-area: 1 / 1; }

#intro[hidden] { display: none; }

#intro.leaving {
  opacity: 0;
  pointer-events: none;
}

.intro-bloom {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe56a 0%, #f0c400 42%, rgba(240, 196, 0, 0) 70%);
  transform: scale(0.2);
  opacity: 0;
  justify-self: center;
  align-self: center;
}

#intro.leaving .intro-bloom {
  transform: scale(34);
  opacity: 1;
  transition: transform 0.85s cubic-bezier(0.16, 0.84, 0.28, 1), opacity 0.2s ease;
}

#intro video {
  box-sizing: content-box;
  width: min(82vw, calc(68vh * 752 / 416));
  height: auto;
  aspect-ratio: 752 / 416;
  object-fit: contain;
  background: #fffdf8;
  border: 8px solid #fff;
  border-radius: 40px;
  box-shadow: 0 22px 50px rgba(50, 40, 10, 0.14);
  transition: transform 0.8s cubic-bezier(0.16, 0.84, 0.28, 1), filter 0.7s ease, opacity 0.45s ease 0.15s, border-radius 0.8s ease;
}

#intro.leaving video {
  transform: scale(1.14);
  filter: blur(12px) saturate(1.15);
  opacity: 0;
  border-radius: 80px;
}

html.revealing .hero > * {
  animation: rise-in 0.8s cubic-bezier(0.16, 0.84, 0.28, 1) both;
}

html.revealing .hero > *:nth-child(1) { animation-delay: 0.22s; }
html.revealing .hero > *:nth-child(2) { animation-delay: 0.3s; }
html.revealing .hero > *:nth-child(3) { animation-delay: 0.36s; }
html.revealing .hero > *:nth-child(4) { animation-delay: 0.42s; }
html.revealing .hero > *:nth-child(5) { animation-delay: 0.48s; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(36px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #intro,
  #intro video,
  .intro-bloom,
  html.revealing .hero > * {
    animation: none;
    transition: none;
  }
}

#file-warn {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--bg);
  text-align: center;
}

#file-warn[hidden] { display: none; }

#file-warn p {
  max-width: 460px;
  margin: 0;
  padding: 32px 28px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: var(--card);
  border-radius: 36px;
  box-shadow: 0 18px 40px rgba(70, 48, 10, 0.08);
}

#file-warn code {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 14px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  background: #fff6e4;
  border-radius: 999px;
}

@media (max-height: 720px) {
  .hero .sub, .hero .cue { display: none; }
  .hero { padding-bottom: 16px; }
  .hero-copy { padding: 12px 16px 10px; }
}

@media (max-width: 680px) {
  section { padding: 26px 20px 24px; border-radius: 28px; }
  .gesture-list div { grid-template-columns: 1fr; gap: 4px; }
  .status { max-width: 92vw; white-space: normal; text-align: center; }
  #cam { width: 92px; height: 66px; }
  .cam-note { bottom: 92px; }
  .room-dock {
    right: 16px;
    bottom: 96px;
  }
  #room.is-blocks .room-hint,
  #room.is-inspect .room-hint,
  #room.is-telekinesis .room-hint,
  #room.is-archery .room-hint,
  #room.is-scroll .room-hint,
  #room.is-click .room-hint,
  #room.is-zoom .room-hint {
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
  }
  .model-picker { top: 150px; }
}
