/* Projeto 60 — estilos mobile-first
 * Tema indigo (#4f46e5), fonte Inter, cards limpos, safe-area iPhone. */

:root {
  --indigo: #4f46e5;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-700: #4338ca;
  --indigo-soft: rgba(79, 70, 229, 0.14);
  --bg: #0f1020;
  --bg-2: #15162b;
  --surface: #1b1d33;
  --surface-2: #23253f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f4f8;
  --text-dim: #aeb2c7;
  --text-faint: #797e98;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #38bdf8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --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; }
html, body { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(79, 70, 229, 0.25), transparent 60%),
    var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font-family: inherit; }

a { color: var(--indigo-500); }

/* ---------- Boot splash ---------- */
.boot {
  position: fixed; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 16px;
  background: var(--bg);
  z-index: 60;
  transition: opacity .35s ease;
}
.boot.hide { opacity: 0; pointer-events: none; }
.boot__badge {
  width: 84px; height: 84px; border-radius: 24px;
  display: grid; place-content: center;
  font-weight: 800; font-size: 34px; color: #fff;
  background: linear-gradient(145deg, var(--indigo-500), var(--indigo-700));
  box-shadow: var(--shadow);
  animation: pulse 1.4s ease-in-out infinite;
}
.boot__txt { color: var(--text-dim); font-weight: 600; letter-spacing: .3px; }
@keyframes pulse { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.06);} }

/* ---------- Layout app ---------- */
#app { min-height: 100dvh; }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(16px + var(--sat))
    calc(16px + var(--sar))
    calc(96px + var(--sab))
    calc(16px + var(--sal));
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding-top: var(--sat);
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  margin: -16px -16px 8px;
  padding-left: 16px; padding-right: 16px; padding-bottom: 10px;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar .spacer { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card h2 { margin: 0 0 6px; font-size: 16px; }
.card .muted { color: var(--text-dim); font-size: 13px; }

.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-faint); margin: 18px 4px 8px; font-weight: 700;
}

/* ---------- Tipografia auxiliar ---------- */
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.big-num { font-size: 40px; font-weight: 800; line-height: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }

/* ---------- Botões ---------- */
.btn {
  appearance: none; border: none; cursor: pointer;
  background: var(--indigo); color: #fff;
  font-weight: 600; font-size: 16px;
  padding: 14px 18px; border-radius: 14px;
  min-height: 52px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, background .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.btn.danger { background: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.small { width: auto; min-height: 42px; padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.btn.inline { width: auto; }

.iconbtn {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-grid; place-content: center;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); cursor: pointer;
}

/* ---------- Inputs ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.input, input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  font-size: 16px; /* evita zoom no iOS */
  min-height: 52px;
}
.input:focus, input:focus, select:focus { outline: 2px solid var(--indigo-500); outline-offset: 1px; }
.help { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.error-text { color: var(--bad); font-size: 13px; margin-top: 6px; }

/* ---------- Chips de status ---------- */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.chip {
  border-radius: 12px; padding: 8px 4px; text-align: center;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  display: grid; gap: 3px; cursor: pointer;
  transition: transform .08s ease, border-color .2s;
}
.chip:active { transform: scale(.96); }
.chip .dnum { font-size: 14px; font-weight: 800; color: var(--text); }
.chip[data-status="completo"] { border-color: rgba(34,197,94,.5); background: rgba(34,197,94,.12); }
.chip[data-status="completo"] .dnum { color: var(--ok); }
.chip[data-status="aberto"] { border-color: var(--indigo-500); background: var(--indigo-soft); animation: glow 1.8s ease-in-out infinite; }
.chip[data-status="aberto"] .dnum { color: var(--indigo-500); }
.chip[data-status="zerado"] { border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.10); }
.chip[data-status="zerado"] .dnum { color: var(--bad); }
.chip[data-status="bloqueado-futuro"] { opacity: .7; }
.chip[data-status="baseline"] { border-color: var(--line-strong); }
.chip .tag { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; }
@keyframes glow { 0%,100%{ box-shadow: 0 0 0 0 rgba(99,102,241,.0);} 50%{ box-shadow: 0 0 0 4px rgba(99,102,241,.18);} }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line);
}
.badge.ok { color: var(--ok); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }
.badge.warn { color: var(--warn); border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); }
.badge.bad { color: var(--bad); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.1); }
.badge.info { color: var(--info); border-color: rgba(56,189,248,.4); background: rgba(56,189,248,.1); }

/* ---------- Barra de progresso ---------- */
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--indigo-500), var(--indigo-700)); border-radius: 999px; transition: width .4s ease; }

/* ---------- Countdown ---------- */
.countdown { display: flex; gap: 10px; justify-content: center; }
.countdown .unit { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; min-width: 64px; text-align: center; }
.countdown .unit b { display: block; font-size: 26px; font-weight: 800; }
.countdown .unit span { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }

/* ---------- Leaderboard ---------- */
.leader { display: grid; gap: 10px; }
.leader .who { display: flex; align-items: center; gap: 12px; }
.leader .avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-content: center; font-weight: 800; color: #fff;
  background: linear-gradient(145deg, var(--indigo-500), var(--indigo-700));
}
.leader .score { font-size: 22px; font-weight: 800; }
.leader .lead-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.leader .lead-row:last-child { border-bottom: none; }
.leader .crown { color: var(--warn); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-content: center; font-weight: 800; font-size: 30px; color: #fff; background: linear-gradient(145deg, var(--indigo-500), var(--indigo-700)); box-shadow: var(--shadow); }

/* ---------- Bottom nav ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(21,22,43,.92);
  backdrop-filter: saturate(140%) blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + var(--sab));
}
.tabbar button {
  background: none; border: none; color: var(--text-faint);
  display: grid; justify-items: center; gap: 3px; font-size: 10px; font-weight: 600;
  padding: 4px 8px; cursor: pointer; flex: 1; border-radius: 10px;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--indigo-500); }

/* ---------- Wizard ---------- */
.wizard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.wizard-steps { display: flex; gap: 5px; flex: 1; }
.wizard-steps .dot { height: 6px; flex: 1; border-radius: 999px; background: var(--surface-2); }
.wizard-steps .dot.done { background: var(--ok); }
.wizard-steps .dot.now { background: var(--indigo-500); }

.pose-card { text-align: center; }
.pose-svg { width: 120px; height: 200px; margin: 6px auto 4px; display: block; color: var(--indigo-500); }
.pose-tips { text-align: left; font-size: 13px; color: var(--text-dim); margin: 8px 0 0; padding-left: 18px; }
.pose-tips li { margin: 3px 0; }

.uploader {
  border: 2px dashed var(--line-strong); border-radius: 16px;
  padding: 18px; text-align: center; position: relative;
  background: var(--bg-2);
}
.uploader.has { border-style: solid; border-color: rgba(34,197,94,.5); }
.uploader input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb-preview { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; background: #000; }
.thumb-row { display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center; }
.thumb-row img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; background: #000; }

.wizard-foot { position: sticky; bottom: 0; display: flex; gap: 10px; padding-top: 12px; padding-bottom: var(--sab); background: linear-gradient(0deg, var(--bg) 70%, transparent); margin: 12px -16px 0; padding-left: 16px; padding-right: 16px; }

.celebrate { text-align: center; padding: 24px 8px; }
.celebrate .ring { font-size: 60px; }

/* ---------- Timeline ---------- */
.tl-metric { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.tl-metric .lab { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; }
.tl-metric .v { font-size: 22px; font-weight: 800; }
.tl-metric .arrow { color: var(--text-faint); }
.delta-up { color: var(--ok); font-weight: 700; }
.delta-down { color: var(--bad); font-weight: 700; }
.delta-flat { color: var(--text-faint); }

.thumbs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.thumbs-grid figure { margin: 0; }
.thumbs-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #000; cursor: pointer; border: 1px solid var(--line); }
.thumbs-grid figcaption { font-size: 9px; color: var(--text-faint); text-align: center; margin-top: 2px; }

.tl-cycle { border-left: 3px solid var(--line-strong); padding-left: 12px; margin-left: 4px; }
.tl-cycle.baseline { border-left-color: var(--indigo-500); }
.tl-cycle.zerado { border-left-color: var(--bad); }

/* ---------- Lightbox (visualizador em tela cheia) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.96);
  display: flex; flex-direction: column;
  padding-top: var(--sat); padding-bottom: var(--sab);
}
.lightbox[hidden] { display: none; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: var(--text); }
.lightbox__img { flex: 1; display: grid; place-items: center; overflow: hidden; }
.lightbox__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__meta { padding: 12px 16px; font-size: 12px; color: var(--text-dim); display: grid; gap: 4px; border-top: 1px solid var(--line); }
.lightbox__meta code { color: var(--text); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--sab)); z-index: 90; display: grid; gap: 8px; width: min(440px, 92vw); }
.toast { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); padding: 12px 14px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); animation: toastin .2s ease; }
.toast.ok { border-color: rgba(34,197,94,.5); }
.toast.bad { border-color: rgba(239,68,68,.5); }
.toast.info { border-color: rgba(56,189,248,.5); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none; } }

/* ---------- Card de instalação iOS ---------- */
.ios-card { background: linear-gradient(160deg, var(--surface), var(--surface-2)); border: 1px solid var(--indigo-500); }
.ios-steps { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-dim); }
.ios-steps li { margin: 4px 0; }
.share-ico { display: inline-block; vertical-align: -3px; }

/* ---------- Utilidades de carregamento ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 12px; }
@keyframes shimmer { 0%{ background-position: 100% 0;} 100%{ background-position: -100% 0;} }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg);} }

.empty { text-align: center; color: var(--text-faint); padding: 28px 12px; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-dim); }
.kv .val { font-weight: 600; }

.prompt-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; color: var(--text-dim); font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

/* ---------- Acordeão de dicas de foto ---------- */
.tips-acc { text-align: left; margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); overflow: hidden; }
.tips-acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.tips-acc > summary::-webkit-details-marker { display: none; }
.tips-acc > summary::after { content: '▾'; margin-left: auto; color: var(--text-faint); transition: transform .2s; }
.tips-acc[open] > summary::after { transform: rotate(180deg); }
.tips-acc .tips-ico svg { width: 18px; height: 18px; color: var(--indigo-500); display: block; }
.tips-acc .pose-tips { padding: 0 14px 12px 30px; }

/* ---------- Câmera in-app com fantasma ---------- */
.lightbox.camera-mode { background: #000; }
.cam-stage { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; background: #000; }
.cam-stage > video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.cam-controls { padding: 12px 16px calc(16px + var(--sab)); background: rgba(0,0,0,.85); display: grid; gap: 12px; }
.cam-slider label { display: block; }
.cam-slider .row { align-items: center; }
.cam-slider input[type="range"] { flex: 1; min-height: 0; }
.cam-pct { font-size: 12px; font-weight: 700; color: var(--text); min-width: 40px; text-align: right; }
.cam-shoot-row { display: grid; place-items: center; }
.cam-shoot {
  width: 70px; height: 70px; border-radius: 50%;
  background: #fff; border: 4px solid rgba(255,255,255,.4);
  box-shadow: 0 0 0 3px rgba(0,0,0,.4) inset; cursor: pointer;
  transition: transform .08s ease;
}
.cam-shoot:active { transform: scale(.92); }
.cam-shoot:disabled { opacity: .5; }

/* Range estilizado (slider de opacidade) */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); padding: 0; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--indigo-500); border: 2px solid #fff; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--indigo-500); border: 2px solid #fff; cursor: pointer; }

/* ---------- Comparação fantasma (fallback / conferência) ---------- */
.ghost-compare { border-top: 1px solid var(--line); padding-top: 10px; }
.ghost-view.side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ghost-view.side figure { margin: 0; }
.ghost-view.side img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; background: #000; border: 1px solid var(--line); }
.ghost-view.side figcaption { font-size: 10px; color: var(--text-faint); text-align: center; margin-top: 2px; }
.ghost-view.overlay { position: relative; max-width: 280px; margin: 0 auto; }
.ghost-view.overlay img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; background: #000; display: block; }
.ghost-view.overlay .gv-ghost { position: absolute; inset: 0; pointer-events: none; }

/* ---------- Avaliação: selo automático, overall, rationale ---------- */
.badge.auto { color: var(--indigo-500); border-color: rgba(99,102,241,.45); background: var(--indigo-soft); }
.method-card { background: linear-gradient(160deg, var(--surface), var(--surface-2)); }
.overall-box { background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px; }
.overall-score { font-size: 26px; font-weight: 800; color: var(--indigo-500); }
.cycle-row .cycle-detail > summary,
.cycle-row details > summary { list-style: none; }
.cycle-row details > summary::-webkit-details-marker { display: none; }
.rationale .why { padding: 8px 0; border-bottom: 1px solid var(--line); }
.rationale .why:last-child { border-bottom: none; }
.rationale .why-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rationale .why-lab { font-weight: 700; font-size: 13px; }
.rationale .why-val { font-weight: 800; color: var(--indigo-500); }

@media (min-width: 640px) {
  .screen { padding-top: calc(20px + var(--sat)); }
}
