:root {
  --bg: #0b0b0d;
  --panel: #151518;
  --line: #2a2a30;
  --ink: #f4f1ea;
  --muted: #9a978f;
  --accent: #e8c26a;
  --accent-ink: #1a1408;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; background: var(--bg); color: var(--ink); font-family: "DM Sans", system-ui, sans-serif; }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; user-select: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ---------- escolher efeito ---------- */
#scr-pick { --pick-gutter: clamp(16px, 4vw, 48px); overflow-y: auto; padding: 0 var(--pick-gutter) 48px; }
#scr-pick > * { flex-shrink: 0; }
.top { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; align-items: center; gap: 20px; margin-inline: calc(-1 * var(--pick-gutter)); padding: 12px var(--pick-gutter); min-height: 112px; background: #f7f3ea; border-bottom: 2px solid #d7b56d; color: #29231a; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-logo { display: block; flex: none; width: 116px; height: 113px; object-fit: contain; filter: brightness(0); }
.brand-signature { color: #29231a; font-size: 11px; font-weight: 800; letter-spacing: .19em; white-space: nowrap; }
.brand-promise { color: #514a3f; font-family: "Instrument Serif", serif; font-size: clamp(19px, 2.2vw, 29px); line-height: 1.1; text-align: center; white-space: nowrap; }
.brand-promise em { color: #a37d34; }
.top-tools { display: flex; gap: 8px; align-items: center; justify-content: flex-end; min-width: 0; }
#search { background: #fff; color: #29231a; border: 1px solid #ded5c5; border-radius: 999px; padding: 10px 16px; width: min(250px, 24vw); outline: none; }
#search::placeholder { color: #8a8378; }
#search:focus { border-color: var(--accent); }
.credits { padding: 9px 14px; border-radius: 999px; background: #f4e7c8; border: 1px solid #ddc387; color: #71541c; font-size: 13px; font-weight: 700; white-space: nowrap; }
.credits.empty { background: #f8e4e0; border-color: #e6b2a9; color: #8a352b; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: #40372a; border: 1px solid #ded5c5; font-size: 18px; flex: none; }
.icon-btn:hover, .icon-btn:focus-visible { border-color: #b08b43; background: #f5ead2; outline: none; }
.headline { font-family: "Instrument Serif", serif; font-weight: 400; font-size: clamp(40px, 6vw, 76px); line-height: 1; margin: 38px 0 18px; letter-spacing: -0.01em; }
.headline em { color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.chip { flex: none; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 14px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card { position: relative; display: block; min-width: 0; aspect-ratio: 3 / 4; border: 1px solid #e9e4da; border-radius: 12px; overflow: hidden; background: #e8e3d9; color: #24221f; text-align: start; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.card:hover, .card:focus-visible { border-color: #d0a852; transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.18); outline: none; }
.card:active { transform: translateY(-1px); }
.card-photo { position: absolute; inset: 0; display: block; overflow: hidden; background: #e8e3d9; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.card:hover .card-photo img, .card:focus-visible .card-photo img { transform: scale(1.035); }
.card .cap { position: absolute; inset: auto auto 10px 10px; display: block; max-width: calc(100% - 20px); }
.card .name { display: block; width: fit-content; color: #fff; font-weight: 750; font-size: 16px; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 2px 9px rgba(0,0,0,.85); -webkit-text-stroke: .2px rgba(0,0,0,.65); }
.card .badge { position: absolute; top: 10px; inset-inline-start: 10px; padding: 5px 8px; border-radius: 5px; background: rgba(250,248,243,.94); color: #3e372c; font-size: 11px; font-weight: 750; }
.card .flag { position: absolute; top: 10px; inset-inline-end: 10px; font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 5px 8px; border-radius: 5px; background: #f2d897; color: #3d2c0b; }
.card .flag.hot { background: #eac4b9; color: #6c281f; }
.style-preview { width: min(860px, calc(100% - 32px)); max-height: min(90vh, 900px); padding: 0; border: 1px solid #e7dfd1; border-radius: 16px; background: #faf8f3; color: #24221f; overflow: auto; }
.style-preview[open] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.style-preview::backdrop { background: rgba(0,0,0,.7); }
.preview-image { min-height: 460px; background: #e8e3d9; }
.preview-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview-content { display: flex; flex-direction: column; justify-content: center; align-items: start; padding: clamp(26px, 4vw, 48px); }
.preview-eyebrow { color: #9a7528; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.preview-content h2 { margin: 12px 0 10px; font-family: "Instrument Serif", serif; font-size: clamp(38px, 4vw, 58px); font-weight: 400; line-height: 1; }
.preview-content > p:not(.preview-eyebrow) { line-height: 1.5; color: #665f54; }
.preview-people { margin-top: 20px; font-size: 13px; font-weight: 700; }
.preview-credit { margin-top: 28px; font-size: 12px; }
.preview-choose { width: 100%; margin-top: 18px; padding: 15px 20px; border-radius: 8px; background: #d8af5b; color: #2a210f; font-weight: 800; text-align: center; }
.preview-choose:hover, .preview-choose:focus-visible { background: #e8c475; outline: 2px solid #8b691f; outline-offset: 2px; }
.preview-close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 36px; height: 36px; border-radius: 50%; background: #faf8f3; color: #24221f; font-size: 25px; line-height: 1; }

/* ---------- câmera / palco ---------- */
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#video, #shot, #result, .before, .wait-img { max-width: 100%; max-height: 100%; object-fit: contain; }
#video { width: 100%; height: 100%; object-fit: cover; }
#video.mirror { transform: scaleX(-1); }
.guide { position: absolute; border: 2px solid rgba(255,255,255,.55); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); pointer-events: none; }
.countdown { position: absolute; font-family: "Instrument Serif", serif; font-size: min(40vh, 320px); line-height: 1; color: #fff; text-shadow: 0 8px 40px rgba(0,0,0,.5); pointer-events: none; }
.countdown.tick { animation: tick .9s ease-out; }
@keyframes tick { from { transform: scale(1.4); opacity: 0; } 30% { opacity: 1; } to { transform: scale(.9); opacity: .9; } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .5s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.cam-error { position: absolute; max-width: 420px; padding: 20px; text-align: center; background: var(--panel); border-radius: var(--radius); line-height: 1.5; }

.cam-top { position: absolute; top: 16px; inset-inline: 16px; display: flex; align-items: center; gap: 12px; }
.cam-style { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: rgba(0,0,0,.55); backdrop-filter: blur(10px); font-weight: 700; }
.cam-style img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.cam-bottom { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); inset-inline: 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.cam-bottom > :first-child { justify-self: start; }
.cam-bottom > :last-child { justify-self: end; }
.shutter { width: 88px; height: 88px; border-radius: 50%; border: 5px solid #fff; padding: 6px; background: transparent; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active span { transform: scale(.9); }
.shutter:disabled { opacity: .4; }
.pill { display: inline-flex; align-items: center; padding: 11px 18px; border-radius: 999px; background: rgba(20,20,24,.75); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px); font-size: 15px; font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer; }
.pill.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.cta { padding: 13px 26px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 16px; }

.fields { position: absolute; top: 76px; inset-inline-start: 16px; display: flex; flex-direction: column; gap: 8px; width: min(320px, calc(100% - 32px)); padding: 14px; border-radius: var(--radius); background: rgba(10,10,12,.78); backdrop-filter: blur(12px); }
.fields label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.fields input { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; user-select: text; }
.fields input:focus { border-color: var(--accent); }

.people-seg { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(10,10,12,.7); backdrop-filter: blur(10px); }
.people-seg .seg { padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); }
.people-seg .seg.on { background: var(--ink); color: var(--bg); }
.people-seg .seg:disabled { opacity: .35; cursor: not-allowed; }
.quality-box { position: absolute; top: 70px; inset-inline-end: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.quality-box .q-row { position: static; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 32px); border-radius: 22px; }
.q-note { margin: 0; max-width: 260px; padding: 6px 12px; border-radius: 12px; background: rgba(10,10,12,.7); backdrop-filter: blur(10px); font-size: 12px; line-height: 1.35; color: #d6d2c8; text-align: end; }
.q-note:empty { display: none; }
@media (max-width: 640px) { .quality-box { top: 64px; } .people-seg .seg { padding: 7px 11px; font-size: 13px; } }

/* ---------- conferir / resultado ---------- */
.review-bar { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); inset-inline: 16px; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.result-stage .before { position: absolute; }
.result-info { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 7px 14px; border-radius: 999px; background: rgba(10,10,12,.7); backdrop-filter: blur(10px); font-size: 13px; color: #d6d2c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- espera ---------- */
.wait-img { filter: blur(18px) brightness(.55); transform: scale(1.05); }
.wait-box { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
#wait-msg { font-family: "Instrument Serif", serif; font-size: clamp(28px, 4vw, 46px); max-width: 780px; line-height: 1.1; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.4; }

/* ---------- ajustes ---------- */
dialog { margin: auto; width: min(460px, calc(100% - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { font-size: 20px; margin-bottom: 16px; }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
dialog label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); }
dialog select { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
dialog menu { display: flex; justify-content: flex-end; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 12px; background: #3a1414; border: 1px solid #7a2a2a; max-width: calc(100% - 32px); z-index: 9; }

@media (max-width: 1080px) {
  .top { grid-template-columns: auto minmax(0, 1fr); }
  .brand-promise { display: none; }
  #search { width: min(240px, 28vw); }
}
@media (max-width: 600px) {
  .top { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 8px; padding-bottom: 13px; }
  .brand-logo { width: 88px; height: 85px; }
  .brand-signature { font-size: 9px; }
  .top-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; justify-content: stretch; }
  .credits { grid-column: 1 / -1; justify-self: start; }
  #search { width: 100%; min-width: 0; }
  .icon-btn { width: 40px; height: 40px; }
  .headline { margin-top: 28px; }
  .credits { padding: 7px 10px; font-size: 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card .name { font-size: 14px; }
  .style-preview[open] { display: block; }
  .preview-image { height: min(48vh, 390px); min-height: 0; }
  .preview-content { padding: 24px; }
  .preview-content h2 { font-size: 38px; }
  .shutter { width: 74px; height: 74px; }
  .pill { padding: 9px 14px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card-photo img { transition: none; }
}
