/* Sua Posse — client page (mobile first). Broadcast look: charcoal, news red, gold. */
:root {
  --bg: #0e0e12; --bg2: #15151b; --panel: #1c1c24; --panel2: #24242e; --line: #30303c;
  --text: #f4f1ea; --muted: #a6a2b2; --dim: #6f6b7c;
  --red: #d10a11; --red2: #ff313a; --redDark: #7d0000;
  --gold: #f2c94c; --gold2: #ffe08a; --ink: #1a1306;
  --r: 16px;
  --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; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--text); font: 16px/1.4 Inter, "Segoe UI", system-ui, Arial, sans-serif;
  overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(209, 10, 17, .22), transparent 60%),
    var(--bg);
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app {
  height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto;
  display: grid; grid-template-rows: auto 1fr auto; position: relative;
}

/* ---------- header ---------- */
.top {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--sat)) calc(16px + var(--sar)) 12px calc(16px + var(--sal));
  min-height: 56px;
}
.back {
  width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 12px; background: transparent;
  display: grid; place-items: center; color: var(--text);
}
.back:active { background: var(--panel); }
.brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.live {
  font: 600 12px/1 Oswald, "Arial Narrow", sans-serif; letter-spacing: .08em;
  background: var(--red); color: #fff; padding: 5px 7px 4px; border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset;
}
.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 5px; vertical-align: 1px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.bname { font: 700 20px/1 Oswald, "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: .02em; }
.stepno { font: 600 14px/1 Oswald, sans-serif; color: var(--muted); letter-spacing: .06em; }
.progress { position: absolute; left: calc(16px + var(--sal)); right: calc(16px + var(--sar)); bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.progress i { height: 3px; border-radius: 2px; background: var(--line); transition: background .3s; }
.progress i.on { background: var(--gold); }

/* ---------- main / steps ---------- */
main { min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.step { display: none; flex: 1 0 auto; flex-direction: column; padding: 14px calc(16px + var(--sar)) 8px calc(16px + var(--sal)); gap: 14px; min-height: 0; }
body[data-step="foto"] #s-foto, body[data-step="ajuste"] #s-ajuste, body[data-step="dados"] #s-dados,
body[data-step="previa"] #s-previa, body[data-step="video"] #s-video { display: flex; }
/* steps with a big canvas fill the screen exactly (no page scroll) */
body[data-step="ajuste"] main, body[data-step="previa"] main { overflow: hidden; }
body[data-step="ajuste"] .step, body[data-step="previa"] .step { flex: 1 1 auto; }
.foot { text-align: center; color: var(--dim); font-size: 12px; letter-spacing: .04em; padding: 6px 0 10px; text-transform: uppercase; }
body[data-step="ajuste"] .foot, body[data-step="previa"] .foot { padding: 0 0 6px; }
.credits { margin: 2px 0 0; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }
.credits a { color: var(--gold); text-underline-offset: 3px; }
.pet { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; padding: 10px 12px; border-radius: 14px;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.4; }
.pet[hidden] { display: none; }
.pet svg { flex: none; width: 44px; height: 44px; border-radius: 10px; }
.pet b { color: #c5ef32; }
.pet:active { background: var(--panel2); }
.foot a { color: var(--muted); text-transform: none; letter-spacing: 0; text-underline-offset: 3px; display: inline-block; padding: 6px 2px; }

h1, h2 { font-family: Oswald, "Arial Narrow", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; margin: 0; line-height: 1.05; }
h1 { font-size: 34px; }
h2 { font-size: 28px; }
.lead { color: var(--muted); margin: 0; font-size: 16px; }

/* ---------- 1. foto ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-top: 6px; }
.hero-art { position: relative; width: 132px; height: 132px; margin-bottom: 6px; }
.hero-art .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--red), var(--gold), var(--red2), var(--red));
  padding: 4px; -webkit-mask: radial-gradient(circle, transparent 60px, #000 61px); mask: radial-gradient(circle, transparent 60px, #000 61px);
  animation: spin 9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero-art .face { position: absolute; inset: 14px; color: var(--text); opacity: .9; }
.hero-art .star { position: absolute; right: -2px; top: 4px; color: var(--gold); font-size: 30px; text-shadow: 0 2px 10px rgba(242,201,76,.5); }
.hero h1 span { color: var(--gold); }
.choices { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.tips { list-style: none; margin: 4px 0 0; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
.tips b { color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 20px; border: 0; border-radius: 14px; width: 100%;
  font: 700 18px/1 Oswald, "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: .04em;
  text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform .08s, filter .15s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 24px; height: 24px; flex: none; }
.btn.big { min-height: 64px; font-size: 20px; }
.btn.primary { background: linear-gradient(180deg, var(--red2), var(--red) 55%, #b0070d); color: #fff; box-shadow: 0 8px 24px rgba(209,10,17,.35), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: var(--ink); box-shadow: 0 8px 22px rgba(242,201,76,.22), inset 0 1px 0 rgba(255,255,255,.5); }
.btn.ghost { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn:disabled, .btn.disabled { opacity: .45; filter: grayscale(.4); cursor: default; transform: none; }
.btn input[type=file], .chipbtn input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }
.linkbtn { border: 0; background: none; color: var(--gold); font-weight: 700; font-size: 15px; padding: 12px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(242,201,76,.4); }
.linkbtn.subtle { color: var(--dim); font-weight: 600; font-size: 14px; margin-top: auto; }

.bar-bottom {
  padding: 10px calc(16px + var(--sar)) calc(12px + var(--sab)) calc(16px + var(--sal));
  background: linear-gradient(180deg, rgba(14,14,18,0), var(--bg) 35%);
  display: flex; gap: 10px;
}

/* ---------- stage / canvas ---------- */
.stage { position: relative; flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.stage canvas {
  display: block; border-radius: 14px; background: #000;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 14px 40px rgba(0,0,0,.55);
}
.stage.small { flex: none; height: clamp(180px, 30vh, 300px); height: clamp(180px, 30dvh, 300px); }
body[data-step="dados"] .stage.small {
  position: sticky; top: 0; z-index: 3; margin: -14px -16px 0; padding: 8px 16px 10px; background: var(--bg);
}
body[data-step="dados"] .stage.small::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px; pointer-events: none;
  background: linear-gradient(180deg, var(--bg), rgba(14,14,18,0));
}
#s-ajuste .stage canvas { touch-action: none; cursor: grab; }
#s-ajuste .stage canvas:active { cursor: grabbing; }
.gesture-hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 2; pointer-events: none;
  background: rgba(0,0,0,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: opacity .5s;
}
.gesture-hint.off { opacity: 0; }

.controls { display: flex; flex-direction: column; gap: 12px; flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border-radius: 12px; padding: 4px; gap: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: transparent; min-height: 42px; border-radius: 9px; font-weight: 700; font-size: 15px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--gold); color: var(--ink); }
.slider { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.slider svg { width: 22px; height: 22px; flex: none; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--gold); height: 32px; }
.row2 { display: flex; gap: 8px; }
.chipbtn {
  position: relative; flex: 1; border: 0; min-height: 40px; padding: 0 8px; border-radius: 10px;
  background: var(--panel); color: var(--text); font-weight: 600; font-size: 13.5px; box-shadow: inset 0 0 0 1px var(--line);
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
}
.chipbtn:active { background: var(--panel2); }
.note { margin: 0; color: var(--muted); font-size: 13px; text-align: center; min-height: 1em; }
.note:empty { display: none; }

/* ---------- 2. dados ---------- */
.form { display: flex; flex-direction: column; gap: 20px; padding-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.flabel { display: flex; justify-content: space-between; align-items: baseline; font: 600 14px/1 Oswald, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.flabel em { font: 600 13px/1 Inter, sans-serif; font-style: normal; letter-spacing: 0; color: var(--dim); text-transform: none; }
.flabel em.warn { color: var(--gold); }
#name {
  width: 100%; min-height: 58px; padding: 0 16px; border-radius: 14px; border: 0;
  background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line);
  font: 600 22px/1 Oswald, "Arial Narrow", sans-serif; letter-spacing: .02em; text-transform: none;
  outline: none; -webkit-appearance: none; appearance: none;
}
#name:focus { box-shadow: inset 0 0 0 2px var(--gold); }
#name::placeholder { color: var(--dim); }
.hint { color: var(--dim); font-size: 13px; overflow-wrap: anywhere; }
.hint b { color: var(--muted); font-weight: 600; }
.group { display: flex; flex-direction: column; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; min-height: 46px; padding: 0 16px; border-radius: 999px;
  background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-checked="true"] { background: var(--gold); color: var(--ink); box-shadow: 0 4px 16px rgba(242,201,76,.25); }

.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.card {
  border: 0; padding: 0; border-radius: 14px; overflow: hidden; text-align: left;
  background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line); display: flex; flex-direction: column;
}
.card .thumb { display: block; width: 100%; aspect-ratio: 4 / 3; background: #000 center / cover no-repeat; }
.card .cl { padding: 8px 10px 9px; font-weight: 700; font-size: 14px; line-height: 1.15; }
.card[aria-checked="true"] { box-shadow: inset 0 0 0 2.5px var(--gold), 0 4px 18px rgba(242,201,76,.22); }
.card[aria-checked="true"] .cl { color: var(--gold); }

.flags { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flagopt {
  border: 0; padding: 8px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line);
  display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.flagopt .thumb { display: block; width: 100%; aspect-ratio: 568 / 320; border-radius: 8px; background: #222 center / cover no-repeat; }
.flagopt .cl { font-weight: 700; font-size: 14px; line-height: 1.15; padding: 0 2px; }
.flagopt .cl small { display: block; color: var(--dim); font-weight: 600; font-size: 12px; margin-top: 2px; }
.flagopt[aria-checked="true"] { box-shadow: inset 0 0 0 2.5px var(--gold); }
.flagopt[aria-checked="true"] .cl { color: var(--gold); }

/* ---------- 3. prévia ---------- */
.scrub { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.scrub span { min-width: 44px; }
.scrub span:last-child { text-align: right; }

/* ---------- 4. vídeo ---------- */
.gen-pre, .gen-run, .gen-done { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.gen-pre h2 { margin-top: 6px; }
.recap { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 16px; background: var(--bg2); box-shadow: inset 0 0 0 1px var(--line); }
.recap img { width: 78px; height: 139px; border-radius: 10px; object-fit: cover; background: #000; flex: none; }
.recap-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.recap-t b { font: 700 24px/1.05 Oswald, sans-serif; text-transform: uppercase; overflow-wrap: anywhere; }
.recap-t span { color: var(--muted); font-size: 14px; }
.recap-t span:last-child { color: var(--gold); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.consents { display: flex; flex-direction: column; gap: 10px; }
.check {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 14px; border-radius: 14px;
  background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: 15.5px; line-height: 1.3; cursor: pointer;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { flex: none; width: 28px; height: 28px; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--dim); display: grid; place-items: center; transition: background .15s; }
.check input:checked + .box { background: var(--gold); box-shadow: none; }
.check input:checked + .box::after { content: ""; width: 12px; height: 7px; border: solid var(--ink); border-width: 0 0 3px 3px; transform: translateY(-2px) rotate(-45deg); }
.check:has(input:checked) { box-shadow: inset 0 0 0 1.5px rgba(242,201,76,.55); }
.check input:focus-visible + .box { outline: 2px solid var(--gold); outline-offset: 2px; }
.xstage { flex: 1 1 0; min-height: 200px; }
.bar { height: 10px; border-radius: 6px; background: var(--panel); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .2s; }
.status { margin: 0; text-align: center; font: 600 18px/1.2 Oswald, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.awake { margin: 0; text-align: center; color: var(--gold); font-weight: 700; font-size: 14px; }
.vidwrap { flex: 1 1 0; min-height: 220px; display: flex; justify-content: center; }
.vidwrap video { height: 100%; max-width: 100%; aspect-ratio: 9 / 16; border-radius: 14px; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 14px 40px rgba(0,0,0,.55); }
.meta { margin: -4px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inapp { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(242,201,76,.1); box-shadow: inset 0 0 0 1px rgba(242,201,76,.35); color: var(--gold2); font-size: 14px; }
.inapp b { color: var(--gold); }
.banner { margin: 10px 16px 0; }
.sharelinks { display: flex; flex-direction: column; gap: 10px; }
.social { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.soc {
  border: 0; min-height: 46px; border-radius: 12px; display: grid; place-items: center; text-align: center;
  font-weight: 700; font-size: 13px; color: #fff; text-decoration: none; padding: 0 4px; line-height: 1.1;
}
.soc.wa { background: #1fa855; }
.soc.x { background: #000; box-shadow: inset 0 0 0 1px #3a3a44; }
.soc.fb { background: #1f5fd6; }
.soc.ig { background: linear-gradient(45deg, #f9a825 0%, #e1306c 45%, #c13584 65%, #5b51d8 100%); }
.soc.copy { background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(8,8,11,.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: grid; place-items: center; padding: 24px; }
.busy-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.busy-card p { margin: 6px 0 0; font: 600 22px/1.2 Oswald, sans-serif; text-transform: uppercase; letter-spacing: .03em; }
.busy-card small { color: var(--muted); font-size: 14px; }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 5px solid var(--panel2); border-top-color: var(--gold); border-right-color: var(--red); animation: spin .8s linear infinite; }

.camera { position: fixed; inset: 0; z-index: 30; background: #000; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-guide { position: absolute; left: 50%; top: 42%; width: 62vw; max-width: 300px; aspect-ratio: 0.8; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.7), 0 0 0 200vmax rgba(0,0,0,.35); }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 28px calc(24px + var(--sab)); display: flex; align-items: center; justify-content: space-between; }
.cam-close { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 22px; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--red); box-shadow: 0 0 0 3px rgba(0,0,0,.35); }
.shutter:active { transform: scale(.94); }
.cam-spacer { width: 52px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--sab)); transform: translate(-50%, 20px); z-index: 40;
  max-width: calc(100% - 32px); width: max-content; padding: 12px 16px; border-radius: 12px; background: #2b2b35; color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: rgba(14,14,18,.6); }
}
@media (prefers-reduced-motion: reduce) { .hero-art .ring, .live::before { animation: none; } }

/* first page (foto): compact so it fits a phone screen without scrolling */
#s-foto { gap: 10px; padding-top: 6px; }
#s-foto .hero { gap: 6px; padding-top: 0; }
#s-foto .hero-art { width: 84px; height: 84px; margin-bottom: 0; }
#s-foto .hero-art .face { inset: 9px; }
#s-foto .hero-art .ring { -webkit-mask: radial-gradient(circle, transparent 38px, #000 39px); mask: radial-gradient(circle, transparent 38px, #000 39px); padding: 3px; }
#s-foto .hero-art .star { font-size: 20px; top: 1px; right: -3px; }
#s-foto h1 { font-size: 28px; }
#s-foto .lead { font-size: 15px; line-height: 1.35; }
#s-foto .choices { gap: 8px; margin-top: 2px; }
#s-foto .btn.big { min-height: 52px; font-size: 18px; }
#s-foto #btnNoPhoto { padding: 6px 12px; }
#s-foto .tips { padding: 9px 14px; font-size: 13px; margin: 0; }
#s-foto .credits { margin: 0; font-size: 12px; }
#s-foto .pet { padding: 7px 10px; font-size: 12px; margin: 0; gap: 10px; }
#s-foto .pet svg { width: 36px; height: 36px; border-radius: 8px; }
body[data-step="foto"] .foot { padding: 0 0 4px; }
body[data-step="foto"] .foot a { padding: 3px 2px; }
@media (max-height: 640px) {
  #s-foto .hero-art { display: none; }
}
@media (max-height: 560px) {
  #s-foto { gap: 8px; }
  #s-foto h1 { font-size: 24px; }
  #s-foto .lead { font-size: 14px; }
  #s-foto .btn.big { min-height: 46px; font-size: 16px; }
  #s-foto .tips { padding: 7px 12px; font-size: 12px; }
}
