:root {
  color-scheme: light;
  --bg: #ede9df;
  --bg-deep: #e4dfd3;
  --geometry: #202321;
  --geometry-light: #303431;
  --player: #ff5b3d;
  --collectible: #45d9ec;
  --rope: #343936;
  --ui: #202321;
  --muted: #6f746e;
  --paper: rgba(249, 247, 240, .94);
  --focus: #008a9d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ui);
}

body { touch-action: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }

.game-shell { position: relative; width: 100%; height: 100%; height: 100svh; isolation: isolate; }
#game { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#game.is-held { cursor: grabbing; }

.home-link {
  position: absolute;
  z-index: 5;
  top: max(22px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  color: var(--muted);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 140ms ease;
}
.home-link::before { content: "← "; }
.home-link:hover { color: var(--ui); }

.hud {
  position: absolute;
  z-index: 4;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 13px;
  border: 1px solid rgba(32, 35, 33, .12);
  border-radius: 999px;
  background: rgba(237, 233, 223, .72);
  box-shadow: 0 6px 22px rgba(32, 35, 33, .06);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: .08em;
  backdrop-filter: blur(9px);
  transform: translateX(-50%);
}
.counter { display: flex; align-items: center; gap: 5px; }
.slash { color: var(--muted); }
.orb-icon { width: 9px; height: 9px; margin-right: 2px; border-radius: 50%; background: var(--collectible); box-shadow: 0 0 8px var(--collectible); }

.tools {
  position: absolute;
  z-index: 6;
  top: max(17px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  gap: 7px;
}
.tools button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(32, 35, 33, .15);
  border-radius: 50%;
  background: rgba(237, 233, 223, .76);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  backdrop-filter: blur(9px);
  transition: background 130ms ease, transform 130ms ease;
}
.tools button:hover { background: #f7f4ec; transform: translateY(-1px); }
.tools button:active { transform: translateY(1px) scale(.96); }
.sound-off { display: none; }
#sound.is-muted .sound-on { display: none; }
#sound.is-muted .sound-off { display: inline; }

.intro {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 400ms ease, transform 400ms ease;
}
.intro.is-dismissed { opacity: 0; transform: translateY(-9px); }
.input-mark {
  position: relative;
  width: 45px;
  height: 58px;
  margin-bottom: 18px;
  border: 2px solid var(--ui);
  border-radius: 23px;
}
.input-mark span { position: absolute; top: 8px; left: 50%; width: 4px; height: 12px; border-radius: 3px; background: var(--player); transform: translateX(-50%); animation: press 1.8s ease-in-out infinite; }
.intro h1 { margin: 0 0 6px; font-size: clamp(1.25rem, 4vw, 2rem); letter-spacing: .11em; line-height: 1; }
.intro p { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.intro small { margin-top: 28px; padding-top: 12px; border-top: 1px solid rgba(32,35,33,.18); color: var(--muted); font-size: .58rem; font-weight: 800; letter-spacing: .17em; }

.complete {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(32, 35, 33, .18);
  backdrop-filter: blur(6px);
  animation: reveal 260ms ease-out both;
}
.complete-card {
  width: min(100%, 390px);
  padding: clamp(26px, 6vw, 42px);
  border: 1px solid rgba(32, 35, 33, .18);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 10px 12px 0 rgba(32, 35, 33, .14);
}
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: .6rem; font-weight: 900; letter-spacing: .19em; text-transform: uppercase; }
.complete h2 { margin: 0 0 28px; font-size: clamp(2.7rem, 10vw, 4.5rem); letter-spacing: -.06em; line-height: .9; text-transform: uppercase; }
.complete h2 span { color: var(--player); }
.complete dl { margin: 0; }
.complete dl div { display: flex; justify-content: space-between; padding: 11px 0; border-top: 1px solid rgba(32,35,33,.13); }
.complete dt { color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.complete dd { margin: 0; font-size: .76rem; font-variant-numeric: tabular-nums; font-weight: 900; }
.complete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 25px; }
.complete-actions button { min-height: 48px; border: 1.5px solid var(--ui); border-radius: 2px; background: transparent; cursor: pointer; font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.complete-actions button:hover { background: #fff; }
.complete-actions .primary { background: var(--ui); color: #fff; }
.complete-actions .primary:hover { background: var(--player); }
.seed-label { margin: 17px 0 0; color: var(--muted); font: 700 .57rem/1.2 ui-monospace, monospace; letter-spacing: .08em; text-align: center; text-transform: uppercase; }

@keyframes press { 0%, 25%, 100% { transform: translate(-50%, 0); } 45%, 68% { transform: translate(-50%, 8px); } }
@keyframes reveal { from { opacity: 0; } }

@media (max-width: 620px) {
  .home-link { top: auto; bottom: max(22px, env(safe-area-inset-bottom)); }
  .home-link::before { content: "← "; }
  .hud { top: max(14px, env(safe-area-inset-top)); }
  .tools { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
  .tools button { width: 36px; height: 36px; }
  .intro { padding-top: 13vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
