:root { color-scheme: dark; }
html, body { margin: 0; height: 100%; }
body {
  background: #0d0c0b radial-gradient(ellipse 70% 55% at 50% 46%, #221d19 0%, #0d0c0b 70%);
  color: #eee8e1;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
#stage:active { cursor: grabbing; }
.ready #stage { opacity: 1; }

/* The word as text: for screen readers and search engines, and on screen only without WebGL. */
.name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  margin: 0;
}
.no-webgl .name {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  clip-path: none;
  display: grid;
  place-items: center;
  font-size: clamp(56px, 16vw, 180px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #e8e1d9;
}

.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  margin: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(238, 232, 225, 0.38);
  transition: opacity 1s ease;
  pointer-events: none;
}
.hint.gone, .no-webgl .hint { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  #stage { transition: none; }
}

/* The doors that open after a good spin. */
.portal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 56px);
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.portal.open { opacity: 1; transform: none; }
.door {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 132px;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 240, 225, 0.16);
  background: rgba(30, 27, 24, 0.88);
  color: #f1ebe4;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.door:hover { background: rgba(48, 42, 37, 0.85); border-color: rgba(226, 170, 118, 0.5); }
.door:active { transform: scale(0.97); }
.door:focus-visible { outline: 2px solid #e2aa76; outline-offset: 3px; }
.door .t { font-weight: 650; font-size: 16px; }
.door .m { font-size: 12px; color: rgba(238, 232, 225, 0.55); }
@media (prefers-reduced-motion: reduce) { .portal { transition: none; transform: none; } }

/* What the visitors make of it, while they're scanning. */
.scan {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  left: 16px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(110, 255, 160, 0.22);
  background: rgba(8, 22, 14, 0.78);
  font: 11px/1.5 ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color: #8dffb6;
  text-shadow: 0 0 8px rgba(90, 255, 150, 0.45);
  white-space: pre;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.scan.on { opacity: 1; transform: none; }
@media (max-width: 420px) { .scan { font-size: 10px; padding: 8px 10px; } }
.scan:empty { display: none; }

/* Behind the word while the visitors are here: Fuji at night, and sakura in the corners. */
.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s ease;
  will-change: opacity;
}
.backdrop.on { opacity: 1; }
.backdrop .sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.backdrop .branch { position: absolute; transform-origin: 0 0; will-change: transform; }
.backdrop .right { top: 0; right: 0; width: min(62vw, 560px); transform-origin: 100% 0; animation: sway 7s ease-in-out infinite alternate; }
.backdrop .left { top: 19vh; left: 0; width: min(34vw, 300px); animation: sway 9s ease-in-out -3s infinite alternate-reverse; }
@keyframes sway { from { transform: rotate(-1.4deg); } to { transform: rotate(1.6deg); } }
@media (prefers-reduced-motion: reduce) {
  .backdrop .branch { animation: none; }
}
