/* Eye Cam: видоискатель. Чёрный экран, картинка во всё окно, подписи моноширинным, один акцент — оранжевый, как на самой камере. */

:root {
  --accent: #ffb020;
  --ink: #f4f1ea;
  --dim: rgba(244, 241, 234, 0.64);
  --line: rgba(244, 241, 234, 0.24);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  height: 100%;
  margin: 0;
  background: #000;
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; overflow: hidden; }
#gl, #hud { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }
/* Видео нужно только как источник кадров. Совсем прятать нельзя: браузер перестанет его обновлять. */
#cam { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash 0.38s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- полосы поверх картинки ---------- */

.bar {
  position: absolute; left: 0; right: 0;
  display: flex;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease-out, visibility 0s 0.3s;
  pointer-events: none;
}
body.live .bar { opacity: 1; visibility: visible; transition-delay: 0s; }
.bar > * { pointer-events: auto; }

.top {
  top: 0;
  align-items: baseline; justify-content: space-between; gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 18px 30px;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}
.mark { font: 700 13px/1 var(--mono); letter-spacing: 0.22em; }
.mark i { font-style: normal; color: var(--accent); }
.keys { font: 500 11px/1.6 var(--mono); letter-spacing: 0.04em; color: var(--dim); text-align: right; }
kbd {
  font: inherit; color: var(--ink);
  display: inline-block; min-width: 1.7em; margin: 0 2px 0 10px; padding: 1px 5px;
  border: 1px solid var(--line); border-radius: 2px; text-align: center;
}
kbd + kbd { margin-left: 0; }

.bottom {
  bottom: 0;
  flex-direction: column; align-items: center; gap: 8px;
  padding: 44px 12px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.72));
}

.lenses { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.lenses::-webkit-scrollbar { display: none; }
.lenses button {
  flex: none;
  font: 600 12px/1 var(--mono); letter-spacing: 0.12em;
  color: var(--dim); background: none; border: 0;
  border-bottom: 2px solid transparent;
  padding: 13px 13px 10px; cursor: pointer;
  transition: color 0.15s ease-out, border-color 0.15s ease-out;
}
.lenses button:hover { color: var(--ink); }
.lenses button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.tools button, .knob span { font: 500 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.tools button {
  min-height: 32px; padding: 0 11px;
  color: var(--dim); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
  transition: color 0.15s ease-out, border-color 0.15s ease-out, background-color 0.15s ease-out;
}
.tools button:hover:not(:disabled) { color: var(--ink); border-color: rgba(244, 241, 234, 0.55); }
.tools button:active:not(:disabled) { transform: translateY(1px); }
.tools button:disabled { opacity: 0.35; cursor: default; }
.tools button[aria-pressed="true"] { color: #000; background: var(--accent); border-color: var(--accent); }
#film { min-width: 9ch; color: var(--ink); }
.knob { display: inline-flex; align-items: center; margin: 0 4px; }
.knob span { min-width: 10ch; text-align: center; color: var(--ink); }
.knob button { width: 32px; padding: 0; font-size: 15px; }

.hint {
  position: absolute; left: 50%; bottom: 128px;
  width: max-content; max-width: min(92vw, 600px); margin: 0; padding: 9px 14px;
  font: 500 14px/1.35 var(--sans); text-align: center; text-wrap: balance;
  background: rgba(0, 0, 0, 0.6); border-radius: 3px;
  opacity: 0; transform: translate(-50%, 6px);
  transition: opacity 0.2s ease-out, transform 0.25s var(--out);
  pointer-events: none;
}
.hint.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- первый экран ---------- */

#start, #fatal {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 28px 24px; overflow: auto;
  background: #060606;
}
#start[hidden], #fatal[hidden] { display: none; }
#fatal p { max-width: 46ch; font-size: 17px; line-height: 1.5; text-align: center; }

.intro {
  width: min(100%, 980px);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center; gap: clamp(28px, 6vw, 80px);
}
.how { width: 100%; height: auto; overflow: visible; }
.how .hand { fill: none; stroke: var(--ink); stroke-width: 24; stroke-linecap: round; stroke-linejoin: round; }
.how .lens { color: var(--accent); fill: currentColor; }
.how .edge { fill: none; stroke: currentColor; stroke-width: 1.5; }
.how pattern circle { fill: var(--accent); }
.how .left { animation: comeL 4.6s var(--out) infinite; }
.how .right { animation: comeR 4.6s var(--out) infinite; }
.how .lens { animation: glow 4.6s ease-out infinite; }
@keyframes comeL { 0%, 8% { transform: translate(-34px, 22px); } 30%, 88% { transform: none; } 100% { transform: translate(-34px, 22px); } }
@keyframes comeR { 0%, 8% { transform: translate(34px, -22px); } 30%, 88% { transform: none; } 100% { transform: translate(34px, -22px); } }
@keyframes glow { 0%, 26% { opacity: 0; } 40%, 86% { opacity: 1; } 96%, 100% { opacity: 0; } }

.say { display: grid; justify-items: start; gap: 16px; }
h1 { margin: 0; font-size: clamp(34px, 4.6vw, 58px); line-height: 1.02; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
.lead { margin: 0; max-width: 34ch; font-size: 18px; line-height: 1.45; color: var(--dim); }
.steps { margin: 4px 0 6px; padding: 0; list-style: none; counter-reset: n; display: grid; gap: 9px; }
.steps li { counter-increment: n; display: grid; grid-template-columns: 30px 1fr; font-size: 15px; line-height: 1.4; }
.steps li::before { content: counter(n, decimal-leading-zero); font: 600 12px/1.75 var(--mono); color: var(--accent); }
.cta {
  min-height: 52px; padding: 0 26px;
  font: 700 13px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: #000; background: var(--accent); border: 0; border-radius: 2px; cursor: pointer;
  transition: background-color 0.15s ease-out, transform 0.12s ease-out;
}
.cta:hover { background: #ffc24d; }
.cta:active { transform: scale(0.98); }
#start.busy .cta { opacity: 0.6; pointer-events: none; }
.note { margin: 0; font-size: 13px; color: var(--dim); }
.msg { margin: 0; max-width: 46ch; font-size: 14px; line-height: 1.45; color: #ff8f7a; }
.msg:empty { display: none; }

/* ---------- узкий экран и палец вместо мыши ---------- */

@media (max-width: 760px) {
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .how { max-width: 320px; }
  .keys { display: none; }
  .hint { bottom: 150px; }
}
@media (pointer: coarse) {
  .tools button { min-height: 44px; padding: 0 14px; }
  .knob button { width: 44px; }
  .lenses button { padding: 16px 13px 13px; }
  .keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .how .hand, .how .lens { animation: none; }
  .hint, .bar, .cta, .tools button, .lenses button { transition: none; }
  #flash.go { animation: none; }
}
