:root {
  --ink: #050506;
  --quiet: rgba(226, 226, 224, 0.34);
  --quieter: rgba(226, 226, 224, 0.20);
}

* { box-sizing: border-box; }

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

body {
  font: 400 13px/1.55 "Didot", "Bodoni 72", "Hoefler Text", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 1.4s ease 0.15s;
}

body.ready #stage { opacity: 1; }
#stage.grabbing { cursor: grabbing; }

.chrome {
  position: fixed;
  top: max(30px, env(safe-area-inset-top));
  left: max(30px, env(safe-area-inset-left));
  margin: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease 0.6s;
}

body.ready .chrome { opacity: 1; }

.chrome h1 {
  margin: 0 0 0.5em;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: rgba(226, 226, 224, 0.52);
}

.chrome p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.chrome span { color: var(--quieter); }

.hint {
  position: fixed;
  bottom: max(30px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: lowercase;
  color: var(--quieter);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s ease;
}

body.ready .hint { opacity: 1; transition-delay: 2.2s; }
body.touched .hint { opacity: 0; transition-delay: 0s; }

.fallback {
  position: fixed;
  inset: 0;
  display: none;
  place-content: center;
  margin: 0;
  padding: 0 2rem;
  text-align: center;
  line-height: 1.7;
}

body.failed .fallback { display: grid; }
body.failed #stage,
body.failed .chrome,
body.failed .hint { display: none; }

@media (max-width: 640px) {
  .chrome {
    top: max(22px, env(safe-area-inset-top));
    left: max(22px, env(safe-area-inset-left));
  }
  .chrome h1 { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  #stage, .chrome, .hint { transition-duration: 0.01ms; }
}

/* The adjust panel. Hidden until T. */
.tweak {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: 270px;
  max-height: 100dvh;
  background: rgba(8, 8, 9, 0.88);
  backdrop-filter: blur(14px);
  border-left: 1px solid rgba(226, 226, 224, 0.10);
  font: 400 11px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  color: rgba(226, 226, 224, 0.62);
}

.tweak[hidden] { display: none; }

.tweak header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(226, 226, 224, 0.09);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  color: rgba(226, 226, 224, 0.45);
}

.tweak .key {
  padding: 1px 6px;
  border: 1px solid rgba(226, 226, 224, 0.20);
  border-radius: 3px;
  letter-spacing: 0;
}

.tweak-body {
  overflow-y: auto;
  padding: 4px 0 8px;
}

.tweak h2 {
  margin: 14px 14px 6px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(127, 217, 200, 0.55);
}

.tweak-row {
  display: grid;
  grid-template-columns: 84px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 2px 14px;
}

.tweak-row:hover { background: rgba(226, 226, 224, 0.04); }
.tweak-name { color: rgba(226, 226, 224, 0.52); white-space: nowrap; }
.tweak output { text-align: right; color: rgba(226, 226, 224, 0.80); font-variant-numeric: tabular-nums; }

.tweak input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  background: none;
  cursor: ew-resize;
}

.tweak input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(226, 226, 224, 0.22);
}
.tweak input[type="range"]::-moz-range-track {
  height: 1px;
  background: rgba(226, 226, 224, 0.22);
}
.tweak input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-radius: 50%;
  background: #7fd9c8;
}
.tweak input[type="range"]::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  background: #7fd9c8;
}
.tweak input[type="range"]:focus-visible { outline: 1px solid rgba(127, 217, 200, 0.6); }

.tweak footer {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid rgba(226, 226, 224, 0.09);
}

.tweak button {
  flex: 1;
  padding: 6px 4px;
  background: rgba(226, 226, 224, 0.05);
  border: 1px solid rgba(226, 226, 224, 0.14);
  border-radius: 3px;
  color: rgba(226, 226, 224, 0.70);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.tweak button:hover {
  background: rgba(127, 217, 200, 0.10);
  border-color: rgba(127, 217, 200, 0.35);
  color: rgba(226, 226, 224, 0.92);
}

@media (max-width: 640px) {
  .tweak { width: 100%; max-height: 62dvh; top: auto; bottom: 0; border-left: 0; border-top: 1px solid rgba(226, 226, 224, 0.10); }
}
