:root {
  --bg1: #0d1023; --bg2: #2a0f2e; --gold: #d4a94e; --txt: #f5efe4;
  --card: rgba(255,255,255,.06); --line: rgba(212,169,78,.25);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--txt);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100vh; padding-bottom: env(safe-area-inset-bottom);
}
header { display: flex; align-items: center; gap: 10px; padding: 14px 16px 4px; }
header h1 { font-size: 1.25rem; margin: 0; }
.badge { font-size: .68rem; background: var(--gold); color: #241a08; border-radius: 20px; padding: 3px 10px; font-weight: 700; }
.privacy {
  margin: 8px 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); font-size: .82rem; line-height: 1.35;
}
main { padding: 0 16px 24px; max-width: 640px; margin: 0 auto; }
.hidden { display: none !important; }
.hero { text-align: center; padding: 34px 8px; }
.hero-title { font-size: 1.25rem; line-height: 1.45; }
.hero-sub { opacity: .75; margin: 6px 0 22px; }
.hint { font-size: .8rem; opacity: .65; line-height: 1.5; margin-top: 14px; }
.btn-primary {
  font-size: 1.05rem; font-weight: 700; color: #241a08; background: linear-gradient(135deg, #f0cd7e, var(--gold));
  border: 0; border-radius: 16px; padding: 15px 34px; cursor: pointer; box-shadow: 0 6px 24px rgba(212,169,78,.35);
}
.btn-primary:active { transform: scale(.97); }
.stage-wrap { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #000; }
#stage { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.warn {
  position: absolute; left: 8px; right: 8px; top: 8px; padding: 8px 10px; border-radius: 10px;
  background: rgba(0,0,0,.62); font-size: .8rem; text-align: center; pointer-events: none;
}
.perf {
  position: absolute; left: 8px; bottom: 8px; padding: 6px 9px; border-radius: 9px;
  background: rgba(0,0,0,.62); font-size: .68rem; line-height: 1.5; font-variant-numeric: tabular-nums; pointer-events: none;
}
.loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5,6,15,.78); font-size: .95rem;
}
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab {
  flex: 1; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  color: var(--txt); font-size: .95rem; font-weight: 600; cursor: pointer;
}
.tab.active { background: linear-gradient(135deg, rgba(212,169,78,.35), rgba(212,169,78,.12)); border-color: var(--gold); }
.panel { display: flex; flex-direction: column; gap: 12px; }
.effect { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.label { font-weight: 600; font-size: .92rem; }
.label-sm { font-size: .8rem; opacity: .75; min-width: 64px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line); background: transparent; color: var(--txt);
  border-radius: 20px; padding: 7px 12px; font-size: .78rem; cursor: pointer;
}
.seg button.active { background: var(--gold); color: #241a08; border-color: var(--gold); font-weight: 700; }
.swatches { display: flex; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.swatches button {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer;
}
.swatches.big button { width: 52px; height: 52px; }
.swatches button.active { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
input[type=range] { flex: 1; accent-color: var(--gold); height: 32px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #555; border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span:before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span:before { transform: translateX(20px); }
.note { font-size: .76rem; opacity: .65; line-height: 1.45; margin: 2px 0; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  flex: 1; min-width: 100px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--txt); font-size: .85rem; font-weight: 600; cursor: pointer;
}
.btn.toggle.on { border-color: var(--gold); color: var(--gold); }
.foot { text-align: center; font-size: .72rem; opacity: .55; margin: 12px 0 0; }
.error { background: rgba(160,30,30,.25); border: 1px solid #a33; border-radius: 14px; padding: 16px; margin-top: 16px; text-align: center; }
#cam { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
