/* SINGULARITY — interface. Deep-space dark, thin-stroke display type on the journey rails. */

:root {
  --ink: #e8ecf8;
  --ink-dim: rgba(232, 236, 248, 0.55);
  --ink-faint: rgba(232, 236, 248, 0.28);
  --accent: #ffb35c;
  --accent-2: #7fd8ff;
  --line: rgba(232, 236, 248, 0.14);
  --panel: rgba(6, 9, 20, 0.55);
  --panel-solid: rgba(6, 9, 20, 0.86);
  --hud-ease: cubic-bezier(0.22, 0.9, 0.24, 1);
  --hud-t: 620ms;
  --edge-safe: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: #04060f;
  color: var(--ink);
  font-family: "Helvetica Neue", "SF Pro Text", Inter, system-ui, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

.hidden { opacity: 0 !important; pointer-events: none !important; }

button {
  font: inherit; color: inherit; background: none; border: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 42%, rgba(4, 6, 15, 0.18) 0%, rgba(4, 6, 15, 0.78) 74%, rgba(3, 4, 11, 0.94) 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 900ms var(--hud-ease), visibility 0s linear 900ms;
  text-align: center; padding: 24px;
}
.overlay.hidden { transition: opacity 700ms var(--hud-ease), visibility 0s linear 700ms; }

.splash-inner { max-width: 640px; }
.splash-kicker {
  font-size: 11px; letter-spacing: 0.52em; color: var(--ink-faint); font-weight: 400;
  margin-bottom: 22px;
}
.splash-title {
  width: max-content;          /* the gradient box must cover every glyph, or
                                  letters that overflow the container lose their paint */
  margin: 0 auto;
  font-weight: 100;
  font-size: clamp(30px, 8.4vw, 108px);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  line-height: 1;
  background: linear-gradient(180deg, #ffffff 0%, #cfd8ff 46%, #7f8cd8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 80px rgba(127, 216, 255, 0.18);
}
.splash-sub {
  margin-top: 14px;
  font-weight: 200; font-size: clamp(13px, 2.4vw, 17px);
  letter-spacing: 0.42em; text-indent: 0.42em; color: var(--ink-dim); text-transform: uppercase;
}
.splash-note {
  margin: 30px auto 0; max-width: 470px;
  font-weight: 300; font-size: 13px; line-height: 1.75; color: var(--ink-dim);
}
.btn-ignite {
  margin-top: 36px;
  padding: 16px 74px;
  border: 1px solid rgba(255, 179, 92, 0.55);
  border-radius: 999px;
  color: var(--accent);
  font-size: 15px; font-weight: 300; letter-spacing: 0.58em; text-indent: 0.58em;
  transition: all 260ms var(--hud-ease);
  box-shadow: 0 0 0 0 rgba(255, 179, 92, 0.0), inset 0 0 24px rgba(255, 179, 92, 0.05);
}
.btn-ignite:hover, .btn-ignite:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 42px 0 rgba(255, 179, 92, 0.28), inset 0 0 30px rgba(255, 179, 92, 0.1);
  color: #ffd9ad;
  transform: translateY(-1px);
}
.btn-ignite:active { transform: translateY(0) scale(0.98); }
.splash-foot { margin-top: 26px; font-size: 10.5px; letter-spacing: 0.3em; color: var(--ink-faint); }

/* ---------- loading ---------- */
.loading-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.loading-ring {
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid rgba(232, 236, 248, 0.12);
  border-top-color: var(--accent-2);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-weight: 200; letter-spacing: 0.5em; text-indent: 0.5em; font-size: 15px; }
.loading-status { font-size: 11px; letter-spacing: 0.24em; color: var(--ink-faint); min-height: 14px; }
.loading-bar { width: 240px; height: 2px; background: rgba(232, 236, 248, 0.12); border-radius: 2px; overflow: hidden; }
.loading-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 300ms ease;
}

/* ---------- HUD chrome ---------- */
.hud {
  position: fixed; left: 0; right: 0; z-index: 30;
  transition: opacity var(--hud-t) var(--hud-ease), transform var(--hud-t) var(--hud-ease);
  padding: 0 clamp(14px, 3vw, 30px);
}
#hudTop { top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding-top: max(16px, env(safe-area-inset-top)); }
#hudTop.hidden { transform: translateY(-14px); }
#hudBottom {
  bottom: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: calc(12px + var(--edge-safe));
  background: linear-gradient(0deg, rgba(3, 4, 11, 0.72) 0%, rgba(3, 4, 11, 0.28) 62%, transparent 100%);
}
#hudBottom.hidden { transform: translateY(16px); }

.hud-brand { display: flex; flex-direction: column; gap: 6px; }
.brand-word { font-weight: 100; font-size: 19px; letter-spacing: 0.5em; color: rgba(232, 236, 248, 0.9); }
.brand-chapter { display: flex; align-items: center; gap: 10px; font-size: 10.5px; letter-spacing: 0.34em; color: var(--accent); font-weight: 300; }
.brand-sep { width: 34px; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); display: inline-block; }
#chapterName { color: var(--ink-dim); }

.hud-top-right { display: flex; align-items: center; gap: 10px; }
.fps { font-size: 10px; letter-spacing: 0.18em; color: var(--ink-faint); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }

.chip {
  font-size: 10px; font-weight: 400; letter-spacing: 0.26em; text-indent: 0.26em;
  color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 14px;
  background: var(--panel);
  transition: all 220ms var(--hud-ease);
  min-height: 34px;
}
.chip:hover { color: var(--ink); border-color: rgba(232, 236, 248, 0.4); }
.chip.active { color: #0b0d18; background: var(--ink); border-color: var(--ink); }
.chip svg { display: block; }
#btnMute.wave-off-only .wave-on { display: none; }
#btnMute:not(.wave-off-only) .wave-off { display: none; }

/* ---------- preset rail (panoramic horizontal journey) ---------- */
.rail-wrap { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.rail-label { font-size: 9px; letter-spacing: 0.4em; color: var(--ink-faint); white-space: nowrap; }
.rail {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  padding: 6px 2px;
  cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
}
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { cursor: grabbing; }
.pcard {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 10px 18px 12px;
  text-align: left;
  min-width: 148px;
  transition: border-color 240ms var(--hud-ease), background 240ms var(--hud-ease), transform 240ms var(--hud-ease);
  user-select: none; -webkit-user-select: none;
}
.pcard:hover { border-color: rgba(232, 236, 248, 0.38); transform: translateY(-2px); }
.pcard.active { border-color: rgba(255, 179, 92, 0.75); background: rgba(255, 179, 92, 0.07); }
.pcard-num { font-size: 8.5px; letter-spacing: 0.34em; color: var(--ink-faint); }
.pcard-name {
  margin-top: 4px;
  font-weight: 100; font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--ink); white-space: nowrap;
}
.pcard.active .pcard-name { color: var(--accent); }
.pcard-desc { margin-top: 4px; font-size: 9.5px; letter-spacing: 0.12em; color: var(--ink-faint); white-space: nowrap; }

/* ---------- transport ---------- */
.transport { display: flex; align-items: center; gap: 14px; }
.tbtn {
  width: 46px; height: 46px; flex: 0 0 46px;
  border: 1px solid var(--line); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); background: var(--panel);
  transition: all 200ms var(--hud-ease);
}
.tbtn:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 22px rgba(255, 179, 92, 0.18); }
.timecode { font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

.seek-wrap { position: relative; flex: 1 1 auto; height: 34px; cursor: pointer; min-width: 120px; touch-action: none; }
.seek-track {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px; transform: translateY(-50%);
  background: rgba(232, 236, 248, 0.14); border-radius: 3px; overflow: visible;
}
.seek-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 3px;
}
.seek-head {
  position: absolute; top: 50%; left: 0%;
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.65);
  transition: transform 180ms var(--hud-ease);
}
.seek-wrap:hover .seek-head, .seek-wrap.scrubbing .seek-head { transform: translate(-50%, -50%) scale(1.35); }
.seek-notches { position: absolute; inset: 0; pointer-events: none; }
.seek-notch {
  position: absolute; top: 50%; width: 1px; height: 9px; transform: translate(-50%, -50%);
  background: rgba(232, 236, 248, 0.35);
}
.seek-notch.major { height: 15px; background: rgba(255, 179, 92, 0.5); }
.seek-tip {
  position: absolute; bottom: 100%; transform: translateX(-50%);
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 6px;
  font-size: 9px; letter-spacing: 0.22em; color: var(--ink-dim);
  padding: 5px 9px; white-space: nowrap; pointer-events: none;
}

.quality { display: flex; gap: 6px; }
.qchip { padding: 9px 11px; min-height: 34px; min-width: 44px; }

.hint { text-align: center; font-size: 9px; letter-spacing: 0.26em; color: var(--ink-faint); }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: max(72px, calc(env(safe-area-inset-top) + 60px)); left: 50%; z-index: 50;
  transform: translateX(-50%) translateY(-6px);
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 22px; font-size: 10.5px; letter-spacing: 0.3em; color: var(--ink-dim);
  transition: opacity 380ms var(--hud-ease), transform 380ms var(--hud-ease);
  pointer-events: none;
}
.toast:not(.hidden) { transform: translateX(-50%) translateY(0); }

/* ---------- fatal ---------- */
.fatal-inner { max-width: 440px; }
.fatal-title { font-weight: 200; letter-spacing: 0.44em; text-indent: 0.44em; font-size: 17px; color: var(--accent); margin-bottom: 14px; }
.fatal-inner p { font-weight: 300; font-size: 13px; line-height: 1.7; color: var(--ink-dim); }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .brand-word { font-size: 14px; letter-spacing: 0.4em; }
  .brand-chapter { font-size: 9px; letter-spacing: 0.24em; }
  .brand-sep { width: 18px; }
  .hint { display: none; }
  .transport { flex-wrap: wrap; gap: 10px; }
  .seek-wrap { flex-basis: 100%; order: 5; }
  .fps { display: none; }
  .pcard { min-width: 128px; padding: 8px 14px 10px; }
  .pcard-name { font-size: 13px; }
  #btnExport { display: none; }
  .splash-title { letter-spacing: 0.1em; text-indent: 0.1em; }
  .btn-ignite { padding: 15px 54px; }
}

@media (max-width: 400px) {
  .quality { display: none; }  /* quality stays switchable via auto-scaling on tiny screens */
}
