/* ─── Стереоскоп · палитра «ночная обсерватория»: глубокий тил + коралл ─── */

:root {
  --bg: #04121c;
  --ink: #eafcf7;
  --dim: #8fb3ba;
  --aqua: #53ffe4;
  --aqua-soft: rgba(83, 255, 228, 0.16);
  --aqua-line: rgba(83, 255, 228, 0.24);
  --coral: #ff7a59;
  --panel: rgba(7, 24, 34, 0.66);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Onest', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ─── разделитель между «глазами» в VR-режиме ─── */

#divider {
  position: fixed;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(234, 252, 247, 0.30) 18%,
    rgba(234, 252, 247, 0.30) 82%,
    transparent 100%);
  z-index: 5;
  pointer-events: none;
}

/* ─── стартовое меню поверх живой сцены ─── */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 22px;
  overflow: auto;
  background: radial-gradient(130% 130% at 50% -10%,
    rgba(4, 18, 28, 0.10) 0%,
    rgba(2, 8, 14, 0.72) 100%);
  transition: opacity 0.45s ease;
}

#overlay.away {
  opacity: 0;
  pointer-events: none;
}

.panel {
  position: relative;
  max-width: 480px;
  padding: 34px 38px 30px;
  border: 1px solid var(--aqua-line);
  border-radius: 20px;
  background: linear-gradient(160deg, var(--panel), rgba(4, 12, 20, 0.62));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(234, 252, 247, 0.08);
}

.panel::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--aqua), transparent);
  opacity: 0.7;
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--aqua);
  opacity: 0.85;
  margin-bottom: 14px;
}

.title {
  margin: 0 0 10px;
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  background: linear-gradient(92deg, var(--ink) 20%, var(--aqua) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title span {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--coral);
}

.subtitle {
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.55;
  color: var(--dim);
}

.steps {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 10px;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.88;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  flex: 0 0 auto;
  font-family: 'Unbounded', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--aqua);
  border: 1px solid var(--aqua-line);
  border-radius: 6px;
  padding: 3px 6px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.btn {
  font-family: 'Unbounded', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 15px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn.primary {
  color: #04222b;
  background: linear-gradient(135deg, var(--aqua), #2ad4c0);
  box-shadow: 0 8px 30px rgba(83, 255, 228, 0.30);
}

.btn.primary:not(:disabled):hover,
.btn.primary:not(:disabled):focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(83, 255, 228, 0.45);
}

.btn.ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--aqua-line);
}

.btn.ghost:not(:disabled):hover,
.btn.ghost:not(:disabled):focus-visible {
  background: var(--aqua-soft);
  transform: translateY(-2px);
}

/* ─── выбор локации ─── */

.locs {
  margin: 4px 0 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(143, 179, 186, 0.25);
}

.loc-title {
  color: var(--aqua) !important;
}

.locs .actions {
  margin-bottom: 0;
}

.locs .pair-hint {
  margin-top: 10px;
}

.btn.loc {
  padding: 12px 16px;
  font-size: 11.5px;
}

.btn.loc.on {
  background: var(--aqua-soft);
  border-color: var(--aqua);
  color: var(--aqua);
}

/* ─── совместный режим: пульт + экран ─── */

.pair {
  margin: 4px 0 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(143, 179, 186, 0.25);
}

.pair-title {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--coral);
  opacity: 0.9;
  margin-bottom: 12px;
}

.pair .actions {
  margin-bottom: 10px;
}

.pair-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--dim);
  opacity: 0.85;
}

.btn.coral {
  color: var(--ink);
  background: transparent;
  border-color: rgba(255, 122, 89, 0.45);
}

.btn.coral:not(:disabled):hover,
.btn.coral:not(:disabled):focus-visible {
  background: rgba(255, 122, 89, 0.14);
  transform: translateY(-2px);
}

/* ─── калибровка стереобазы ─── */

.calib {
  margin: 0 0 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(143, 179, 186, 0.25);
}

.calib-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.calib-row label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--aqua);
  opacity: 0.9;
}

.calib-row span {
  font-family: 'Unbounded', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.calib input[type="range"] {
  width: 100%;
  margin: 0 0 10px;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--aqua-soft), var(--aqua-line));
  outline: none;
  cursor: pointer;
}

.calib input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--aqua);
  border: 3px solid #04222b;
  box-shadow: 0 0 12px rgba(83, 255, 228, 0.5);
  cursor: pointer;
}

.calib input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--aqua);
  border: 3px solid #04222b;
  box-shadow: 0 0 12px rgba(83, 255, 228, 0.5);
  cursor: pointer;
}

.note {
  margin: 0;
  font-size: 12px;
  color: var(--dim);
  opacity: 0.9;
}

.footnote {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  opacity: 0.6;
  text-align: center;
}

/* ─── всплывающее сообщение ─── */

#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: 86vw;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--aqua-line);
  background: rgba(7, 24, 34, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  color: var(--ink);
  text-align: center;
  transition: opacity 0.4s ease;
}

/* ─── HUD пульта (виден только в режиме управления) ─── */

#hud {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 122, 89, 0.35);
  background: rgba(7, 24, 34, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

#hudPeers {
  font-family: 'Unbounded', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral);
}

#hudSep {
  font-size: 11.5px;
  color: var(--aqua);
}

.hud-keys {
  font-size: 11.5px;
  color: var(--dim);
}

/* ─── зерно поверх всего, едва заметное ─── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

.hidden { display: none !important; }

/* ─── телефон в альбомной ориентации: компактное меню ─── */

@media (max-height: 480px) {
  .panel { padding: 20px 26px 18px; }
  .steps { display: none; }
  .subtitle { margin-bottom: 14px; }
  .title { font-size: clamp(1.6rem, 6vh, 2.2rem); }
  .btn { padding: 12px 18px; }
}
