:root {
  --paper: #F2EADB;
  --mute: rgba(242, 234, 219, 0.46);
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", serif;
  --mono: "SF Mono", Menlo, "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050505; overflow: hidden; color: var(--paper); font-family: var(--sans); }
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }

#nav { position: fixed; left: 28px; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none;
  transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1); }
#nav.on { opacity: 1; pointer-events: auto; }
#nav::before { content: ""; position: absolute; z-index: -1; left: -28px; top: -40vh; width: 220px; height: 80vh;
  background: linear-gradient(90deg, rgba(5,5,5,0.86) 0%, rgba(5,5,5,0.6) 55%, rgba(5,5,5,0) 100%); pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%); }
#nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#nav button { all: unset; cursor: pointer; display: grid; grid-template-columns: 22px 30px 1fr; align-items: center; gap: 8px;
  font-size: 14px; color: var(--mute); padding: 3px 0; transition: color 160ms ease-out; }
#nav button .n { font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; }
#nav button .bar { height: 1px; width: 10px; background: currentColor; transition: width 220ms cubic-bezier(0.23, 1, 0.32, 1); }
#nav button .t { font-family: var(--serif); font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
#nav button:hover { color: var(--paper); }
#nav button.active { color: var(--paper); }
#nav button.active .bar { width: 28px; }
#nav button:focus-visible { outline: 1px solid var(--paper); outline-offset: 4px; }
#nav button:active { transform: translateY(1px); }

#hud-cm { position: fixed; right: 28px; top: 24px; font-family: var(--mono); font-size: 13px; color: var(--paper);
  opacity: 0; transition: opacity 400ms ease-out; font-variant-numeric: tabular-nums; }
#hud-cm.on { opacity: 1; }
#hud-cm .unit { color: var(--mute); }

#controls { position: fixed; left: 28px; bottom: 24px; }
#play { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: 1px;
  padding: 9px 14px 9px 12px; border: 1px solid rgba(242, 234, 219, 0.28); border-radius: 999px; background: rgba(5, 5, 5, 0.55);
  backdrop-filter: blur(6px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); transition: border-color 160ms ease-out, transform 120ms ease-out; }
#play:hover { border-color: rgba(242, 234, 219, 0.6); }
#play:active { transform: scale(0.98); }
#play:focus-visible { outline: 1px solid var(--paper); outline-offset: 3px; }
#play svg { width: 12px; height: 12px; fill: var(--paper); }
#play .i-pause { display: none; }
#play[aria-pressed="true"] .i-play { display: none; }
#play[aria-pressed="true"] .i-pause { display: block; }

#hint { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); font-size: 13px; letter-spacing: 1px; color: var(--paper);
  opacity: 0.85; pointer-events: none; transition: opacity 300ms ease-out; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35); }
#path { position: fixed; right: 28px; bottom: 24px; font-family: var(--mono); font-size: 10.5px; color: rgba(242, 234, 219, 0.5);
  max-width: 46ch; text-align: right; line-height: 1.5; }
#fps { position: fixed; right: 28px; top: 46px; font-family: var(--mono); font-size: 10.5px; color: rgba(242, 234, 219, 0.5); display: none; }
#fps.on { display: block; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 15px; letter-spacing: 2px;
  color: var(--mute); background: #050505; transition: opacity 500ms ease-out; }
#loading.done { opacity: 0; pointer-events: none; }

@media (max-width: 767px) {
  #nav { left: 14px; }
  #nav button { grid-template-columns: 18px 14px 1fr; font-size: 12px; }
  #nav button .t { font-size: 13px; }
  #controls { left: 14px; bottom: 14px; }
  #path { right: 14px; bottom: 14px; max-width: 26ch; }
  #hud-cm { right: 14px; top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #nav, #hud-cm, #hint, #loading { transition: none; }
}
