/* ============================================================
   Moldura · Missão Sobrevivência 2027
   Paleta do site diegoctvv.com.br · Fonte: Archivo
   ============================================================ */
:root {
  --bg:       #F3F5FA;
  --card:     #FFFFFF;
  --navy:     #0C1828;
  --navy-2:   #243050;
  --text:     #3A4560;
  --muted:    #6B7690;
  --line:     #DDE3EF;

  --gold:     #FCB50B;
  --gold-2:   #FFC93D;
  --gold-ink: #7A5500;
  --blue:     #2E489C;
  --blue-2:   #3E5BB7;

  --r-lg: 22px;
  --r-md: 16px;
  --shadow: 0 18px 40px -22px rgba(12, 24, 40, .35);
  --font: "Archivo", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(520px 320px at 100% -40px, rgba(252,181,11,.22), transparent 70%),
    radial-gradient(480px 300px at -10% 0, rgba(46,72,156,.10), transparent 70%),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
svg { display: block; }

.wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---------- Topo ---------- */
.head { display: flex; justify-content: center; padding: 6px 0 14px; }
.logo { width: 132px; height: auto; }

/* ---------- Passos ---------- */
.step { display: flex; flex-direction: column; gap: 14px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.eyebrow {
  align-self: center;
  font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue);
  background: rgba(46,72,156,.08);
  padding: 6px 12px; border-radius: 999px;
}
.title {
  text-align: center;
  font-size: clamp(30px, 9vw, 40px);
  line-height: .98;
  font-weight: 900; font-style: italic; text-transform: uppercase;
  color: var(--navy-2);
  letter-spacing: -.01em;
}
.title span {
  display: block;
  color: var(--navy);
  background: linear-gradient(transparent 58%, var(--gold) 58%, var(--gold) 92%, transparent 92%);
  width: fit-content; margin: 2px auto 0; padding: 0 6px;
}
.title-sm { font-size: clamp(26px, 7.6vw, 32px); }
.lead { text-align: center; font-size: 16px; line-height: 1.45; color: var(--text); padding: 0 6px; }

/* ---------- Prévia da moldura (passo 1) ---------- */
.preview, .stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--frame-ratio, 4 / 5);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #E6EAF3;
  box-shadow: var(--shadow), 0 0 0 1px rgba(12,24,40,.06);
}
.preview { align-self: center; }
.preview-ph { position: absolute; inset: 0; display: grid; place-items: end center; }
.preview-ph svg { width: 70%; fill: #C9D1E2; margin-bottom: 12%; }
.preview-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Editor ---------- */
.stage { align-self: center; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.stage.dragging { cursor: grabbing; }
.stage canvas { display: block; width: 100%; height: 100%; }
.hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  font-size: 12px; font-weight: 700;
  color: #fff; background: rgba(12,24,40,.72);
  padding: 7px 12px; border-radius: 999px;
  pointer-events: none;
  transition: opacity .4s ease;
}
.hint svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hint.gone { opacity: 0; }

.zoom {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
}
.zoom svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.zoom input { flex: 1; accent-color: var(--blue); height: 28px; }

/* ---------- Botões ---------- */
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px;
  padding: 14px 20px;
  border: 0; border-radius: 999px;
  font-size: 16px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  overflow: hidden;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.btn:focus-visible, .btn:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 3px; }
.btn[disabled] { opacity: .6; pointer-events: none; }

.btn-gold { background: var(--gold); color: var(--navy); box-shadow: 0 10px 22px -10px rgba(252,181,11,.9); }
.btn-gold:hover { background: var(--gold-2); }
.btn-blue { background: linear-gradient(90deg, var(--blue), var(--blue-2) 50%, var(--blue)); color: #fff; box-shadow: 0 10px 22px -12px rgba(46,72,156,.8); }
.btn-line { background: var(--card); color: var(--navy-2); box-shadow: inset 0 0 0 2px var(--navy-2); }
.btn-ghost { background: transparent; color: var(--blue); min-height: 48px; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }

.fine { text-align: center; font-size: 13px; line-height: 1.45; color: var(--muted); }
.fine strong { color: var(--navy-2); }

.foot {
  margin-top: auto; padding-top: 28px;
  text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Folha "toque e segure" ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: end center;
  background: rgba(12,24,40,.6);
  padding: 16px;
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.sheet-card {
  width: 100%; max-width: 448px;
  max-height: 100%; overflow: auto;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px 16px 16px;
  display: flex; flex-direction: column; gap: 10px;
  text-align: center;
}
.sheet-card strong { font-size: 20px; font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--navy-2); }
.sheet-card p { font-size: 14px; color: var(--text); }
.sheet-card img { width: 100%; border-radius: var(--r-md); -webkit-touch-callout: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 30;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--navy); color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 12px 18px; border-radius: 14px;
  box-shadow: var(--shadow);
  animation: rise .25s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Contagem regressiva na headline ---------- */
.title .t-pre, .title .t-post { display: block; font-size: .62em; line-height: 1.05; }
.title .t-num {
  display: block;
  font-size: 1.9em; line-height: .95;
  margin: 4px auto 6px;
  padding: 0 10px;
}
.title .t-num b { font-weight: 900; }

/* Prévia e editor dimensionados pela altura: cabem na tela com moldura vertical (9:16) ou de post (4:5). */
.preview { width: auto; height: min(40dvh, 480px); max-width: 100%; }
.stage { width: auto; height: min(60dvh, 680px); max-width: 100%; }
