/* SINGULARITY — minimal dissolving interface */
@font-face {
  font-family: 'Orbitron';
  src: url('../assets/fonts/orbitron-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Orbitron';
  src: url('../assets/fonts/orbitron-600.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Orbitron';
  src: url('../assets/fonts/orbitron-800.woff2') format('woff2');
  font-weight: 800; font-display: swap;
}

:root {
  --ink: #e8ecf4;
  --dim: rgba(232, 236, 244, 0.55);
  --glass: rgba(8, 10, 18, 0.42);
  --edge: rgba(255, 255, 255, 0.09);
  --accent: #ffb45e;
  --accent2: #7ecbff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #02030a; }
body {
  font-family: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* ---------- dissolving chrome ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; transition: opacity 0.9s ease; }
#ui > * { pointer-events: auto; }
body.dissolved #ui { opacity: 0; }
body.dissolved { cursor: none; }
body.dissolved #ui > * { pointer-events: none; }

/* ---------- header ---------- */
#brand {
  position: absolute; top: max(20px, env(safe-area-inset-top)); left: 26px;
  letter-spacing: 0.42em; font-weight: 800; font-size: 15px;
  text-shadow: 0 0 18px rgba(255, 180, 94, 0.35);
}
#brand small {
  display: block; letter-spacing: 0.32em; font-weight: 400; font-size: 8.5px;
  color: var(--dim); margin-top: 6px;
}

/* ---------- chapter card ---------- */
#chapter {
  position: absolute; left: 50%; top: 18%;
  transform: translateX(-50%) translateY(8px);
  font-size: clamp(15px, 2.6vw, 26px); font-weight: 600;
  letter-spacing: 0.5em; text-indent: 0.5em; white-space: nowrap;
  color: var(--ink); text-shadow: 0 0 26px rgba(126, 203, 255, 0.55);
  opacity: 0; transition: opacity 1.1s ease, transform 1.1s ease;
  pointer-events: none;
}
#chapter.show { opacity: 0.92; transform: translateX(-50%) translateY(0); }

/* ---------- hero (pre-play) ---------- */
#hero {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(2, 3, 10, 0.55) 100%);
  transition: opacity 0.8s ease;
}
#hero.gone { opacity: 0; pointer-events: none; }
#hero h1 {
  font-size: clamp(34px, 8vw, 84px); font-weight: 800;
  letter-spacing: 0.34em; text-indent: 0.34em; text-align: center;
  background: linear-gradient(180deg, #fff 20%, #ffb45e 55%, #b34a1f 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 34px rgba(255, 150, 60, 0.4));
}
#hero p { font-size: 11px; letter-spacing: 0.4em; color: var(--dim); text-indent: 0.4em; text-align: center; line-height: 2; }
#hero .bigplay {
  width: 92px; height: 92px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 180, 94, 0.07);
  color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s;
  animation: breathe 2.6s ease-in-out infinite;
}
#hero .bigplay:hover { transform: scale(1.08); background: rgba(255, 180, 94, 0.16); box-shadow: 0 0 44px rgba(255, 160, 60, 0.35); }
#hero .bigplay svg { margin-left: 6px; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 18px rgba(255, 170, 80, 0.18); } 50% { box-shadow: 0 0 44px rgba(255, 170, 80, 0.42); } }

/* ---------- transport deck ---------- */
#deck {
  position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--edge);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  max-width: min(680px, calc(100vw - 24px));
}
.tbtn {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, transform 0.15s, border-color 0.2s;
}
.tbtn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.35); }
.tbtn:active { transform: scale(0.92); }
.tbtn.main { width: 54px; height: 54px; border-color: rgba(255, 180, 94, 0.5); background: rgba(255, 180, 94, 0.12); }
.tbtn.main:hover { background: rgba(255, 180, 94, 0.25); }
.tbtn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

#seekwrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#seeklabels { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: 0.18em; color: var(--dim); }
#seclabel { color: var(--accent); }
#seek {
  position: relative; width: min(46vw, 380px); height: 22px;
  display: flex; align-items: center; cursor: pointer; touch-action: none;
}
#seek .rail {
  position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.13); overflow: hidden;
}
#seek .fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 180, 94, 0.6);
}
#seek .ticks { position: absolute; inset: 0; display: flex; }
#seek .ticks i { flex: 1; border-right: 1px solid rgba(255, 255, 255, 0.25); height: 100%; }
#seek .ticks i:last-child { border-right: none; }
#seek .thumb {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8); left: 0%;
}

/* ---------- right cluster: presets + quality ---------- */
#panel {
  position: absolute; top: max(20px, env(safe-area-inset-top)); right: 26px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
#presets { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  font-family: inherit; font-size: 9px; letter-spacing: 0.22em;
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  color: var(--dim); background: var(--glass); border: 1px solid var(--edge);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chip:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); }
.chip.on { color: #0a0c14; background: var(--accent); border-color: var(--accent); font-weight: 600; }
#qsel {
  font-family: inherit; font-size: 9px; letter-spacing: 0.22em;
  color: var(--dim); background: var(--glass); border: 1px solid var(--edge);
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#qsel:hover { color: var(--ink); }
#hint {
  position: absolute; bottom: max(26px, env(safe-area-inset-bottom)); left: 26px;
  font-size: 8.5px; letter-spacing: 0.26em; color: rgba(232, 236, 244, 0.32);
}
#fail {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  text-align: center; font-size: 12px; letter-spacing: 0.2em; line-height: 2.2; color: var(--dim);
  padding: 30px;
}

/* ---------- mobile ---------- */
@media (max-width: 700px) {
  #brand { left: 16px; font-size: 12px; }
  #panel { right: 16px; }
  #presets { max-width: 46vw; }
  .chip { padding: 9px 10px; }
  #deck { gap: 10px; padding: 10px 12px; width: calc(100vw - 20px); }
  #seek { width: auto; flex: 1; }
  #seekwrap { flex: 1; }
  #hint { display: none; }
  #chapter { top: 24%; font-size: 14px; }
  .tbtn { width: 46px; height: 46px; }
  .tbtn.main { width: 56px; height: 56px; }
}
@media (max-width: 420px) {
  #hero h1 { letter-spacing: 0.2em; text-indent: 0.2em; }
}
