:root {
  --accent: #00ff66;
  --bg: #000;
  --fg: #c8ffd9;
  --dim: rgba(200, 255, 217, 0.65);
  --panel: rgba(0, 0, 0, 0.6);
  --font: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  background: #000;
}

/* iOS: video must stay "visible" to keep decoding frames */
#cam {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- start screen ---------- */
.start {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal));
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.15) 70%);
}
.start[hidden] { display: none; }

.start__box {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.start__title {
  margin: 0 0 12px;
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(0, 255, 102, 0.55), 0 0 2px #fff;
}

.start__desc {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  text-shadow: 0 1px 3px #000;
}

.start__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.start__privacy {
  margin: 20px 0 8px;
  font-size: 13px;
  color: var(--dim);
  text-shadow: 0 1px 3px #000;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  font: 600 16px/1 var(--font);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  color: #000;
}
.btn:focus-visible, .link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.link {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--dim);
  font: 14px var(--font);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- messages ---------- */
.message {
  position: fixed;
  left: calc(16px + var(--sal));
  right: calc(16px + var(--sar));
  top: 50%;
  transform: translateY(-50%);
  max-width: 460px;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid #ff5a5a;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.9);
  color: #ffd0d0;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-line;
}
.message[hidden] { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--sab));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--accent);
  font-size: 14px;
}
.toast[hidden] { display: none; }
