/* Zen Creative: tela única, celular primeiro. Alvos de toque ≥ 44 px; sem fontes externas (4G). */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --ink: #1c1b1f;
  --muted: #625f69;
  --line: #e7e2da;
  --accent: #4b2fd6;
  --accent-ink: #ffffff;
  --accent-soft: #ece8ff;
  --ok: #157f3b;
  --warn: #9a5b00;
  --danger: #b42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141317;
    --surface: #1d1c21;
    --ink: #f2f0f5;
    --muted: #a8a4b0;
    --line: #2e2c34;
    --accent: #8f7bff;
    --accent-ink: #141317;
    --accent-soft: #2a2545;
    --ok: #4cc27a;
    --warn: #f0b04a;
    --danger: #ff7a6b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 560px; margin: 0 auto; padding: 8px 16px 48px; }
h1 { font-size: 28px; line-height: 1.15; margin: 12px 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.fine { color: var(--muted); font-size: 14px; text-align: center; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
small { color: var(--muted); font-weight: 400; }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }

.field { margin: 0 0 16px; }
.label { display: block; font-weight: 600; margin-bottom: 8px; }
textarea, input[type=url], input[readonly], .edit-row input {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; outline: none;
}
textarea { resize: vertical; min-height: 140px; padding-right: 60px; }
textarea:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.intent { position: relative; }
.mic {
  position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; cursor: pointer;
}
.mic[aria-pressed=true] { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 1.5px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; margin-top: 4px; }
.pickers { display: flex; gap: 10px; }
.pickers .btn { flex: 1; }

.thumbs { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0; margin: 12px 0 0; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.logo img { object-fit: contain; background: repeating-conic-gradient(#0000 0 25%, #8881 0 50%) 0 0 / 16px 16px; }
.thumb .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width 0.2s; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 60%); color: #fff; font-size: 18px; cursor: pointer; }
.thumb .chip { position: absolute; left: 6px; bottom: 8px; border: 0; border-radius: 999px; padding: 4px 10px; min-height: 30px; font: 600 13px/1 inherit; background: rgb(0 0 0 / 60%); color: #fff; cursor: pointer; }
.thumb.logo .chip { background: var(--accent); }
.thumb .state { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 600; background: rgb(0 0 0 / 45%); text-align: center; padding: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 15px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

details.link summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 6px; }
details.link input { margin-top: 6px; }
.error { color: var(--danger); font-weight: 600; margin: 0 0 12px; }

/* campanha */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.steps { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.steps li .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 13px; }
.steps li.running { color: var(--ink); font-weight: 600; }
.steps li.running .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.done .dot::after { content: "✓"; }
.steps li.failed { color: var(--danger); }
.steps li.failed .dot { border-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; box-shadow: var(--shadow); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 14px; padding: 10px 12px; }
.resume p { margin: 0 0 8px; }

.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; -webkit-overflow-scrolling: touch; }
.piece { scroll-snap-align: center; flex: 0 0 86%; max-width: 420px; }
.piece .media { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 4 / 5; box-shadow: var(--shadow); }
.piece.f916 .media { aspect-ratio: 9 / 16; max-height: 72vh; margin: 0 auto; }
.piece video, .piece img.prev { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.piece .wait { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #fff; font-weight: 600; background: linear-gradient(110deg, #26232d 30%, #3a3545 50%, #26232d 70%); background-size: 200% 100%; animation: shimmer 1.6s infinite; }
.piece .wait.bad { animation: none; background: #3a1d1d; }
@keyframes shimmer { to { background-position: -200% 0; } }
.piece .meta { display: flex; justify-content: space-between; align-items: center; margin: 10px 2px 6px; font-weight: 600; }
.piece .meta small { font-weight: 500; }
.piece .actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.piece .actions .btn { padding: 8px 6px; font-size: 15px; }
.edit-row { display: flex; gap: 8px; margin-top: 8px; }
.edit-row input { padding: 10px 12px; font-size: 16px; }
.edit-note { font-size: 14px; color: var(--muted); margin: 6px 2px 0; }
.edit-note.bad { color: var(--danger); }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { min-height: 40px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); padding: 6px 14px; font: 600 15px/1 inherit; cursor: pointer; }
.tabs button[aria-checked=true],
.tabs button[aria-selected=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.caption { white-space: pre-wrap; margin: 0 0 10px; }

.swatches { display: flex; gap: 8px; margin: 4px 0 12px; }
.swatches span { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); }
.found-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 12px; }
.found-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.found-logo { max-height: 56px; max-width: 70%; background: repeating-conic-gradient(#0000 0 25%, #8881 0 50%) 0 0 / 12px 12px; border-radius: 8px; padding: 4px; }
dl.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
ul.facts { padding-left: 18px; margin: 6px 0; }
.b-input { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; outline: none; }
.b-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.b-input:disabled { opacity: 0.6; }
ul.facts.plain { list-style: none; padding: 0; margin: 4px 0 12px; display: grid; gap: 6px; }
.fact { display: flex; gap: 10px; align-items: flex-start; }
.fact input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.q label { display: block; font-size: 15px; margin-bottom: 4px; }
#b-go { width: 100%; margin-top: 4px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; }
.warn { color: var(--warn); }

.viewer { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; }
.viewer .track { display: flex; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer .slide { flex: 0 0 100%; height: 100%; display: grid; place-items: center; scroll-snap-align: center; }
/* altura pela tela: o 100% da célula do grid não limita, e o story 9:16 passava da tela no desktop */
.viewer video, .viewer img { max-width: 100%; max-height: 100vh; max-height: 100dvh; }
.viewer .close { position: absolute; z-index: 2; top: calc(env(safe-area-inset-top) + 8px); right: 12px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgb(255 255 255 / 18%); color: #fff; font-size: 30px; cursor: pointer; }
.viewer .nav { display: none; position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgb(255 255 255 / 18%); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.viewer .prev { left: 16px; }
.viewer .next { right: 16px; }
@media (hover: hover) and (pointer: fine) { .viewer .nav { display: grid; place-items: center; } }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }
/* carrinho e pagamento */
.pick { display: flex; align-items: center; gap: 8px; margin: 8px 2px 0; font-weight: 600; }
.pick input { width: 22px; height: 22px; accent-color: var(--accent); }
.paid-tag { color: var(--ok); font-weight: 700; margin: 8px 2px 0; }
.cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgb(0 0 0 / 8%); font-weight: 700; }
.cart .btn { min-width: 132px; }
body.has-cart main { padding-bottom: 110px; }
.sheet { position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / 45%); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); }
.sheet-body .btn.primary:not(.big) { width: 100%; }
.sheet-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 28px; cursor: pointer; }
.code { font-size: 26px; letter-spacing: 0.4em; text-align: center; }
.qr { display: none; width: 220px; margin: 12px auto; }
@media (min-width: 700px) and (hover: hover) { .qr { display: block; } }
.qr svg { width: 100%; height: auto; display: block; }
.wait-msg { text-align: center; color: var(--muted); margin: 12px 0; }
.ok-big { font-size: 22px; font-weight: 800; color: var(--ok); text-align: center; margin: 12px 0; }
.file-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.hint-wide { display: none; }

/* tablet e desktop: a tela de entrada continua estreita; a da campanha alarga e as peças viram grade */
@media (min-width: 760px) {
  :root {
    --col: 1200px;
    /* altura das peças: as três (4:5, 4:5, 9:16) cabem numa linha da coluna */
    --piece-h: clamp(340px, min(56vh, 39vw), 500px);
  }
  main:has(> #campanha:not([hidden])) { max-width: var(--col); }
  #notify, #resume, #delivered, #c-message { max-width: 760px; }
  .hint-touch { display: none; }
  .hint-wide { display: inline; }
  .carousel { flex-wrap: wrap; gap: 20px; overflow: visible; scroll-snap-type: none; margin: 0; padding: 4px 0 12px; }
  .piece { flex: 0 0 auto; width: max(300px, calc(var(--piece-h) * 4 / 5)); max-width: none; }
  .piece.f916 { width: max(300px, calc(var(--piece-h) * 9 / 16)); }
  .piece .media { width: calc(var(--piece-h) * 4 / 5); height: var(--piece-h); margin: 0 auto; }
  .piece.f916 .media { width: calc(var(--piece-h) * 9 / 16); max-height: none; }
  .piece video, .piece img.prev { cursor: zoom-in; }
  /* barra de pagar: fundo de ponta a ponta, conteúdo na coluna, total junto do botão */
  .cart { justify-content: flex-end; gap: 20px; padding-left: max(16px, calc((100% - var(--col)) / 2 + 16px)); padding-right: max(16px, calc((100% - var(--col)) / 2 + 16px)); }
}
/* tablet em pé: duas peças por linha, ocupando a largura */
@media (min-width: 760px) and (max-width: 959px) {
  :root { --piece-h: clamp(340px, min(56vh, calc(57vw - 20px)), 460px); }
}
@media (min-width: 960px) {
  .extras { columns: 2; column-gap: 24px; margin-top: 16px; }
  .extras > * { break-inside: avoid; }
  .extras > .card { margin: 0 0 16px; }
  .extras > .fine { margin: 0 0 16px; }
}
[hidden] { display: none !important; }
