/* OTHERWHERE — native CSS, no external assets. System serif only. */
:root {
  --accent: #ffcf5a;
  --accent-ink: #1a1203;
  --bg0: #0d0903;
  --bg1: #020201;
  --title: #fff3d6;
  --paper: #f3ece0;
  --muted: rgba(243, 236, 224, 0.68);
  --line: rgba(243, 236, 224, 0.22);
  --serif: "Bodoni 72", "Didot", "Playfair Display", "Iowan Old Style", "Hoefler Text", "Palatino Linotype", Georgia, "Noto Serif", "Songti SC", "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, "SF Pro Text", "Helvetica Neue", "Segoe UI", system-ui, "PingFang SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --charge: 0;
  --pad: clamp(14px, 2.4vmin, 28px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg1);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

.scene {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 46%, var(--bg0) 0%, var(--bg1) 62%),
    var(--bg1);
  isolation: isolate;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* ---------- title: part of the scene ---------- */
.title {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs, 14vw);
  line-height: 0.86;
  letter-spacing: -0.015em;
  color: var(--title);
  text-shadow: 0 0 0.35em color-mix(in srgb, var(--accent) 38%, transparent);
  pointer-events: none;
  white-space: nowrap;
  gap: var(--gap, 0px);
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) scale(var(--ts, 1));
  will-change: transform;
}
.title .line { display: block; }
.title.one .line { display: inline; }
.title.one { flex-direction: row; }
/* ---------- layers ---------- */
.gl { z-index: 2; }
.dust { z-index: 3; }
.flash {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0;
  background: radial-gradient(70% 70% at 50% 50%, #fff 0%, var(--accent) 40%, transparent 100%);
  mix-blend-mode: screen;
}
.stage { position: absolute; inset: 0; z-index: 5; cursor: grab; touch-action: none; outline: none; }
.stage.dragging { cursor: grabbing; }
.stage:focus-visible { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 0; right: 0; z-index: 6; pointer-events: none; padding: var(--pad); }
.hud > * { pointer-events: auto; }
.hud.top {
  top: 0;
  padding-top: calc(var(--pad) + env(safe-area-inset-top, 0px));
  padding-left: calc(var(--pad) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--pad) + env(safe-area-inset-right, 0px));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.hud.bottom {
  bottom: 0;
  padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom, 0px));
  padding-left: calc(var(--pad) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--pad) + env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "hint travel dots";
  align-items: end;
  gap: 16px;
}

.world {
  margin: 0; padding-top: 12px; pointer-events: none;
  font: 500 12px/1.2 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.world-num { color: var(--accent); }
.world-sep { margin: 0 0.3em; opacity: 0.5; }
.world-name { margin-left: 0.9em; color: var(--paper); }

.tools { display: flex; gap: 8px; flex-wrap: nowrap; }

.chip {
  appearance: none; -webkit-appearance: none;
  min-height: 44px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 9px;
  font: 600 13px/1 var(--sans); letter-spacing: 0.02em; color: var(--paper);
  background: rgba(8, 7, 5, 0.52);
  border: 1px solid var(--line); border-radius: 999px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  cursor: pointer; white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s;
}
.chip:hover { border-color: var(--accent); }
.chip:focus-visible, .travel:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chip.solid { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip-ico { width: 12px; height: 12px; position: relative; display: inline-block; }
.chip-ico::before, .chip-ico::after { content: ""; position: absolute; top: 0; bottom: 0; width: 4px; background: currentColor; border-radius: 1px; }
.chip-ico::before { left: 0; } .chip-ico::after { right: 0; }
#pause[aria-pressed="true"] .chip-ico::before { left: 1px; width: 11px; right: auto; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
#pause[aria-pressed="true"] .chip-ico::after { display: none; }
#pause[aria-pressed="true"] { border-color: var(--accent); }

.hint {
  grid-area: hint; margin: 0; max-width: 46ch; align-self: end;
  font: 500 12px/1.55 var(--mono); letter-spacing: 0.04em; color: var(--muted);
  text-shadow: 0 1px 12px #000;
  pointer-events: none;
}
.hint-touch { display: none; }
kbd {
  font: 600 0.92em/1 var(--mono); padding: 0.18em 0.5em; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; color: var(--paper); background: rgba(255,255,255,0.05);
}

.travel-wrap { grid-area: travel; display: grid; place-items: center; }
.travel {
  appearance: none; -webkit-appearance: none; position: relative;
  width: 104px; height: 104px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--paper); cursor: pointer;
  touch-action: none; -webkit-tap-highlight-color: transparent;
  transform: scale(calc(1 + var(--charge) * 0.14));
  transition: transform .12s ease-out;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 2; }
.ring-fill {
  fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 339.292; stroke-dashoffset: 339.292;
  filter: drop-shadow(0 0 calc(2px + var(--charge) * 10px) var(--accent));
}
.travel-core {
  position: absolute; inset: 9px; border-radius: 50%;
  display: grid; place-content: center; text-align: center; gap: 3px;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--accent) calc(10% + var(--charge) * 55%), rgba(10,8,5,0.82)) 0%, rgba(6,5,3,0.86) 78%);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px var(--line), 0 0 calc(18px + var(--charge) * 46px) color-mix(in srgb, var(--accent) calc(18% + var(--charge) * 50%), transparent);
}
.travel-label { font: 600 17px/1 var(--serif); letter-spacing: 0.22em; text-transform: uppercase; padding-left: 0.22em; }
.travel-sub { font: 500 9.5px/1 var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); padding-left: 0.22em; }
.travel.charging .travel-sub { color: var(--accent); }

.dots { grid-area: dots; justify-self: end; margin: 0 0 8px; padding: 0; list-style: none; display: flex; gap: 10px; pointer-events: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line); background: transparent; transition: background-color .4s, border-color .4s, transform .4s; }
.dot[data-i="0"] { --c: #ffcf5a; } .dot[data-i="1"] { --c: #b98cff; } .dot[data-i="2"] { --c: #3df0c8; }
.dot.on { background: var(--c); border-color: var(--c); transform: scale(1.25); box-shadow: 0 0 12px var(--c); }

.fallback {
  position: absolute; z-index: 7; left: 50%; top: 22%; transform: translateX(-50%); width: min(92vw, 520px); margin: 0;
  padding: 12px 16px; text-align: center; font: 500 13px/1.5 var(--sans); color: var(--paper);
  background: rgba(8,7,5,0.7); border: 1px solid var(--accent); border-radius: 12px;
}

.skip { position: absolute; left: 8px; top: -60px; z-index: 20; padding: 10px 14px; background: var(--accent); color: var(--accent-ink); border-radius: 8px; font: 600 13px var(--sans); }
.skip:focus { top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }

/* ---------- dialog ---------- */
.dialog {
  width: min(92vw, 560px); max-height: 86dvh; overflow: auto; padding: 0;
  color: var(--paper); background: rgba(10, 8, 6, 0.94); border: 1px solid var(--accent); border-radius: 18px;
  box-shadow: 0 30px 120px rgba(0,0,0,0.8), 0 0 60px color-mix(in srgb, var(--accent) 22%, transparent);
}
.dialog::backdrop { background: rgba(0,0,0,0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-body { padding: clamp(18px, 4vw, 30px); display: grid; gap: 16px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog h2 { margin: 0; font: 400 clamp(30px, 6vw, 44px)/1 var(--serif); color: var(--title); }
.keys { margin: 0; display: grid; gap: 12px; }
.keys > div { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 14px; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.keys dt { font: 600 12.5px/1.6 var(--mono); color: var(--accent); }
.keys dd { margin: 0; font: 400 14px/1.5 var(--sans); color: var(--paper); }
.note { margin: 0; font: 400 12.5px/1.6 var(--sans); color: var(--muted); }
.dialog .chip.solid { justify-self: start; }

/* ---------- small / portrait screens ---------- */
@media (max-width: 720px), (orientation: portrait) and (max-width: 900px) {
  .hud.top { flex-direction: column; align-items: stretch; gap: 8px; }
  .world { padding-top: 4px; font-size: 11px; }
  .tools { justify-content: flex-start; }
  .chip { padding: 0 14px; }
  .hud.bottom {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "hint hint hint" ". travel dots";
    row-gap: 12px;
  }
  .hint { max-width: none; text-align: center; font-size: 11px; line-height: 1.5; }
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
  .dots { margin-bottom: 4px; }
  .keys > div { grid-template-columns: 1fr; gap: 4px; }
}
@media (hover: none) and (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .travel { width: 84px; height: 84px; }
  .travel-label { font-size: 14px; }
  .travel-sub { display: none; }
  .hint { font-size: 11px; max-width: 28ch; }
}

@media (prefers-reduced-motion: reduce) {
  .travel, .dot, .chip { transition: none; }
}
