/* Тёмный полноэкранный видоискатель. Крупные цели: телефон на штативе,
   попадать по кнопке приходится не глядя. */

:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #fff;
  --dim: #9a9a9a;
  --ok: #2ecc71;
  --err: #ff4d4d;
  --panel: rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.3 -apple-system, system-ui, sans-serif;
  overscroll-behavior: none;
  /* Телефон стоит на штативе — прокрутка и выделение только мешают. */
  overflow: hidden;
  user-select: none;
}

#viewfinder {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* Вспышка вместо вибрации: Safari не поддерживает Vibration API (раздел 9.2 ТЗ). */
#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: var(--ok);
}
#flash.on { opacity: 0.45; }
#flash.err { background: var(--err); }
#flash:not(.on) { transition: opacity 0.35s ease-out; }

header, footer {
  position: fixed;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(to bottom, var(--panel), transparent);
}
header { top: 0; padding-top: max(12px, env(safe-area-inset-top)); }
footer {
  bottom: 0;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--panel), transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Имя получателя намеренно крупное: главная защита от «отправил не тому». */
#recipient {
  display: block;
  width: 100%;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--fg);
  text-align: left;
  font: inherit;
}
#recipient .label { display: block; font-size: 13px; color: var(--dim); }
#recipient-name {
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}
#recipient-name.empty { color: var(--err); font-size: 22px; }

#status {
  margin-top: 6px;
  font-size: 15px;
  color: var(--dim);
}
#status.busy { color: var(--fg); }
#status.err { color: var(--err); font-weight: 600; }

#counters {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: var(--dim);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#counters b { color: var(--fg); font-size: 16px; }

#shutter {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.25);
  padding: 0;
}
#shutter:active { background: rgba(255, 255, 255, 0.6); }
#shutter:disabled { opacity: 0.35; }

/* Настройки — оверлей поверх ТОГО ЖЕ документа.
   Ни роутинга, ни hash: смена hash отзывает разрешение камеры на iOS. */
#settings {
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
#settings[hidden] { display: none; }
#settings h2 { margin: 0 0 4px; font-size: 20px; }
#settings .hint { margin: 0 0 18px; font-size: 14px; color: var(--dim); }

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 14px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 12px;
  background: #1c1c1c;
  color: var(--fg);
  font: inherit;
  text-align: left;
}
.person.active { background: #16512f; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 17px; }
.person .who small { color: var(--dim); }
.person .drop {
  flex: none;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #3a1f1f;
  color: var(--err);
  font: inherit;
}

.wide {
  width: 100%;
  padding: 15px;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  background: #2a2a2a;
  color: var(--fg);
  font: inherit;
}
