:root {
  --bg: #0b0d12;
  --fg: #e9eef7;
  --muted: #aab4c5;
  --btn: #1f2430;
  --btn2: #141824;
  --good: #1ee56b;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; }

.app { max-width: 980px; margin: 0 auto; padding: 16px; display: grid; gap: 12px; }
.top h1 { margin: 0 0 6px; font-size: 22px; }
.top p { margin: 0; color: var(--muted); }
.installRow { margin-top: 10px; display: flex; gap: 10px; }

.stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: #000;
  min-height: 420px;
}

#video {
  width: 100%;
  height: min(72vh, 640px);
  object-fit: cover;
  display: block;
}

#hud {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(86vw, 520px);
  height: min(86vw, 520px);
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.6));
}

.controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

button {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 10px;
  font-size: 15px;
  color: var(--fg);
  background: var(--btn);
}

button:disabled { opacity: 0.55; }
button.primary { background: #2a3143; }
button.secondary { background: var(--btn2); }
button.capture { background: #2a3143; }
button.capture.ready { background: rgba(30,229,107,0.20); border-color: rgba(30,229,107,0.65); }

.settings {
  position: absolute;
  top: 12px;
  right: 12px;
  width: min(92vw, 360px);
  background: rgba(8,10,14,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--fg);
}

.settings summary { cursor: pointer; color: var(--muted); }
.settings .grid { margin-top: 10px; display: grid; gap: 10px; }
.settings label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.settings input { width: 100%; padding: 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); background: rgba(20,24,36,0.7); color: var(--fg); }

.foot { color: var(--muted); display: grid; gap: 6px; }
.foot .muted { opacity: 0.9; }




/* Splash */
html, body { overscroll-behavior: none; }
body.splashLock { overflow: hidden; }

.splash{
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  opacity: 1;
  transition: opacity 320ms ease;
}
.splash.hidden{ opacity: 0; pointer-events:none; }
.splashVideo{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}


/* Modal viewer */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9998;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 12px;
  gap: 10px;
}
.modalTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modalTitle { font-weight: 600; }
.viewerCanvas {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: #000;
}
.modalHint {
  color: rgba(170,180,197,0.95);
  font-size: 12px;
  text-align: center;
}

.modalBtns{
  display:flex;
  gap: 10px;
  align-items:center;
}

.modalTop{ position: relative; z-index: 3; }
.viewerCanvas{ position: relative; z-index: 1; touch-action: none; }
.modalBtns{ display:flex; gap:10px; align-items:center; }

/* iOS hardening: ensure header area receives taps */
.modalTop, .modalBtns, .modalTitle { pointer-events: auto; }
.modal { pointer-events: auto; }
.viewerCanvas { pointer-events: auto; }
