/* =====================================================================
   CHRONUX · Design System
   ===================================================================== */
:root {
  --ink: #0c1220;
  --ink-2: #141c2e;
  --ink-3: #1e2942;
  --paper: #f7f6f3;
  --paper-2: #ffffff;
  --line: #e3e0d9;
  --line-strong: #cfcabf;
  --text: #14181f;
  --text-2: #5b6373;
  --text-3: #8b93a3;
  --gold: #c08b25;
  --gold-2: #e0ab45;
  --gold-soft: #f7edd8;
  --teal: #0f8f7d;
  --teal-soft: #e0f3ef;
  --red: #c0392b;
  --red-soft: #fbeae8;
  --amber: #b7791f;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgba(12, 18, 32, .05), 0 8px 28px rgba(12, 18, 32, .07);
  --shadow-lg: 0 2px 6px rgba(12, 18, 32, .06), 0 24px 60px rgba(12, 18, 32, .13);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- Marca ---------- */
.logo { display: inline-flex; align-items: baseline; gap: .5rem; text-decoration: none; }
.logo-mark {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.02em;
  font-size: 1.35rem;
  color: inherit;
}
.logo-mark em { font-style: normal; color: var(--gold-2); }
.logo-sub { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: .85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar .logo-sub { color: rgba(255,255,255,.5); }
.progresso-wrap { flex: 1; max-width: 380px; }
.progresso-label {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: rgba(255,255,255,.62); margin-bottom: .35rem;
  letter-spacing: .04em;
}
.progresso-trilho { height: 5px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.progresso-barra {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  border-radius: 99px; transition: width .45s cubic-bezier(.4,0,.2,1);
}
.salvo-tag { font-size: .72rem; color: rgba(255,255,255,.45); white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 0 1.25rem 6rem; }
.wrap-lg { max-width: 1080px; }

/* ---------- Capa ---------- */
.capa { padding: 5rem 0 3rem; }
.capa h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  line-height: 1.08; letter-spacing: -.025em; margin: 0 0 1rem;
  font-weight: 600;
}
.capa .lead { font-size: 1.1rem; color: var(--text-2); max-width: 46ch; margin: 0 0 2rem; }
.eyebrow {
  display: inline-block; font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: 1rem;
}
.capa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin: 2.5rem 0; }
.capa-card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem 1.1rem;
}
.capa-card b { display: block; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); margin-bottom: .3rem; font-size: .7rem; }
.capa-card span { font-size: .92rem; color: var(--text-2); }

.modulos-lista { display: grid; gap: .5rem; margin: 2rem 0; }
.modulo-item {
  display: flex; gap: 1rem; align-items: center;
  padding: .85rem 1.1rem; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.modulo-item .num { font-family: var(--serif); color: var(--gold); font-size: 1rem; min-width: 1.6rem; }
.modulo-item .nome { font-weight: 600; font-size: .95rem; }
.modulo-item .desc { font-size: .85rem; color: var(--text-3); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.6rem; border-radius: 99px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primario { background: var(--ink); color: #fff; }
.btn-primario:hover { background: var(--ink-3); box-shadow: var(--shadow); }
.btn-ouro { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #2a1d00; }
.btn-ouro:hover { box-shadow: 0 8px 24px rgba(192,139,37,.32); }
.btn-fantasma { background: transparent; color: var(--text-2); border-color: var(--line-strong); }
.btn-fantasma:hover { background: var(--paper-2); color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }

/* ---------- Etapas ---------- */
.etapa { display: none; animation: sobe .32s cubic-bezier(.2,.7,.3,1); }
.etapa.ativa { display: block; }
@keyframes sobe { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.modulo-cabecalho { padding: 2.75rem 0 1.25rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.modulo-cabecalho .kicker { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.modulo-cabecalho h2 { font-family: var(--serif); font-size: 1.9rem; margin: .4rem 0 .3rem; letter-spacing: -.02em; font-weight: 600; }
.modulo-cabecalho p { margin: 0; color: var(--text-2); font-size: .95rem; }

.pergunta {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.6rem 1.6rem 1.4rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.pergunta > h3 {
  font-size: 1.12rem; line-height: 1.35; margin: 0 0 .35rem; font-weight: 650; letter-spacing: -.01em;
}
.pergunta .num-q { color: var(--gold); font-family: var(--serif); font-size: .95rem; margin-right: .45rem; }
.pergunta .ajuda { font-size: .88rem; color: var(--text-3); margin: 0 0 1.3rem; }

/* ---------- Campos ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem 1rem; }
.campo { grid-column: span 12; }
@media (min-width: 720px) {
  .w2 { grid-column: span 2; } .w3 { grid-column: span 3; } .w4 { grid-column: span 4; }
  .w6 { grid-column: span 6; } .w8 { grid-column: span 8; } .w9 { grid-column: span 9; } .w12 { grid-column: span 12; }
}
.campo > label.rot {
  display: block; font-size: .84rem; font-weight: 600; margin-bottom: .45rem; color: var(--text);
}
.campo .req { color: var(--gold); margin-left: .2rem; }
.campo .dica { font-size: .78rem; color: var(--text-3); margin: -.2rem 0 .5rem; }

.inp, textarea.inp, select.inp {
  width: 100%; padding: .72rem .9rem; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s; font-size: .95rem;
}
.inp:focus, textarea.inp:focus, select.inp:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}
textarea.inp { resize: vertical; min-height: 68px; line-height: 1.55; }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6373' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.2rem; }
.inp.erro { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* opções */
.opcoes { display: grid; gap: .5rem; }
.opcoes.duas { grid-template-columns: 1fr; }
@media (min-width: 640px) { .opcoes.duas { grid-template-columns: 1fr 1fr; } }
.opc {
  display: flex; align-items: flex-start; gap: .7rem; cursor: pointer;
  padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; transition: all .15s; font-size: .92rem;
}
.opc:hover { border-color: var(--line-strong); background: #fdfdfc; }
.opc input { margin: .22rem 0 0; accent-color: var(--gold); flex: none; width: 16px; height: 16px; }
.opc.marcada { border-color: var(--gold); background: var(--gold-soft); }

/* escala 0-10 */
.escala { display: flex; gap: .35rem; flex-wrap: wrap; }
.escala button {
  flex: 1; min-width: 40px; padding: .6rem .2rem; border: 1px solid var(--line);
  background: #fff; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; color: var(--text-2);
  transition: all .15s;
}
.escala button:hover { border-color: var(--gold); }
.escala button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* slider tom de voz */
.slider-linha { display: flex; align-items: center; gap: .8rem; }
.slider-linha span { font-size: .78rem; color: var(--text-3); white-space: nowrap; min-width: 78px; }
.slider-linha span:last-child { text-align: right; }
input[type=range] { flex: 1; accent-color: var(--gold); height: 4px; }

/* cores */
.cor-linha { display: flex; align-items: center; gap: .6rem; }
.cor-linha input[type=color] {
  width: 46px; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 3px; background: #fff; cursor: pointer;
}
.cor-linha .hex { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* tags */
.tags-box {
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem .6rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; min-height: 46px;
}
.tags-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.tag {
  display: inline-flex; align-items: center; gap: .35rem; background: var(--ink);
  color: #fff; border-radius: 99px; padding: .22rem .6rem; font-size: .8rem;
}
.tag button { background: none; border: 0; color: rgba(255,255,255,.6); cursor: pointer; padding: 0; line-height: 1; font-size: 1rem; }
.tags-box input { border: 0; outline: none; flex: 1; min-width: 110px; padding: .25rem; font-size: .9rem; }

/* repeater */
.rep-linha {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: .6rem;
  padding: .9rem; border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  margin-bottom: .6rem; background: #fcfcfb; position: relative;
}
.rep-linha .rep-del {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: #fff; cursor: pointer; color: var(--text-3); line-height: 1;
}
.rep-add { font-size: .85rem; color: var(--gold); background: none; border: 0; cursor: pointer; font-weight: 600; padding: .3rem 0; }

/* ---------- Navegação ---------- */
.nav-etapa {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.aviso-erro {
  background: var(--red-soft); border: 1px solid #f0c8c2; color: #8c2318;
  padding: .8rem 1rem; border-radius: var(--r-sm); font-size: .88rem; margin-bottom: 1rem; display: none;
}
.aviso-erro.on { display: block; }

/* ---------- Final ---------- */
.final-card {
  background: var(--ink); color: #fff; border-radius: var(--r-lg);
  padding: 2.5rem; text-align: center; margin: 3rem 0 1.5rem;
}
.final-card h2 { font-family: var(--serif); font-size: 2rem; margin: 0 0 .6rem; font-weight: 600; }
.final-card p { color: rgba(255,255,255,.7); margin: 0 auto 1.5rem; max-width: 46ch; }

.mini-diag { display: grid; gap: .6rem; margin-top: 1.5rem; }
.mini-barra { text-align: left; }
.mini-barra .mb-top { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .3rem; color: rgba(255,255,255,.8); }
.mini-barra .mb-trilho { height: 7px; background: rgba(255,255,255,.12); border-radius: 99px; overflow: hidden; }
.mini-barra .mb-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .8s ease; }

.rodape { text-align: center; color: var(--text-3); font-size: .8rem; padding: 2rem 0 3rem; }
.rodape a { color: var(--text-2); }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 99px; animation: gira .7s linear infinite; display: inline-block;
}
@keyframes gira { to { transform: rotate(360deg); } }

@media (max-width: 680px) {
  .topbar-inner { flex-wrap: wrap; }
  .progresso-wrap { order: 3; max-width: 100%; flex-basis: 100%; }
  .pergunta { padding: 1.2rem; border-radius: var(--r); }
  .capa { padding: 3rem 0 2rem; }
}
