body { display: flex; flex-direction: column; overflow-x: hidden; }

/* C pixelizado das peças do CRIE, a desenhar-se ao fundo */
.pixel-c {
  position: fixed; right: -6vmin; bottom: -8vmin; width: min(56vmin, 460px); height: auto;
  fill: none; stroke: var(--gold); stroke-width: 1.4; vector-effect: non-scaling-stroke;
  opacity: 0.34; pointer-events: none; z-index: 0;
  stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 3.2s var(--ease) 0.2s forwards;
}
.pixel-c path { vector-effect: non-scaling-stroke; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 16px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.langs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.langs button {
  border: 0; background: transparent; color: var(--muted);
  font-family: var(--display); font-size: 11px; letter-spacing: 0.1em;
  min-width: 40px; min-height: 32px; border-radius: 999px;
}
.langs button[aria-pressed='true'] { background: var(--gold); color: #000; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.6s var(--ease); box-shadow: 0 0 12px var(--gold); }

main {
  position: relative; z-index: 1; flex: 1;
  width: 100%; max-width: 720px; margin: 0 auto;
  padding: clamp(28px, 7vh, 80px) clamp(16px, 4vw, 24px) 40px;
}
.bottom { position: relative; z-index: 1; text-align: center; padding: 0 16px max(18px, env(safe-area-inset-bottom)); min-height: 40px; }
.save { font-size: 13px; color: var(--faint); transition: color 0.3s; }
.save.err { color: var(--danger); }

/* entrada de cada ecrã */
.screen > * { animation: rise 0.7s var(--ease) both; }
.screen > *:nth-child(2) { animation-delay: 0.06s; }
.screen > *:nth-child(3) { animation-delay: 0.12s; }
.screen > *:nth-child(4) { animation-delay: 0.18s; }
.screen > *:nth-child(n + 5) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.q-title {
  font-family: var(--sans); font-weight: 650; font-size: clamp(28px, 5.4vw, 44px);
  line-height: 1.08; letter-spacing: -0.02em; margin: 14px 0 12px; text-wrap: balance;
}
.q-title em { font-style: normal; color: var(--gold); }
.q-hint { color: var(--muted); font-size: 17px; margin: 0 0 28px; max-width: 56ch; }

/* boas-vindas */
.welcome .q-title { font-size: clamp(40px, 9vw, 76px); font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.welcome .meta { display: inline-flex; gap: 10px; align-items: center; margin: 4px 0 28px; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: 14px; }
.welcome .meta i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.welcome .lead { font-size: clamp(18px, 2.6vw, 21px); color: #d9d2c7; max-width: 50ch; margin: 0 0 36px; }

/* opções de escolha única */
.options { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  min-height: 62px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  font-size: 18px; transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.opt:hover { border-color: var(--gold-line); background: var(--surface-2); }
.opt:active { transform: scale(0.99); }
.opt kbd {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px;
  border: 1px solid var(--line-2); border-radius: 7px;
  font-family: var(--display); font-size: 11px; color: var(--muted);
}
.opt[aria-checked='true'] { border-color: var(--gold); background: var(--gold-soft); }
.opt[aria-checked='true'] kbd { background: var(--gold); border-color: var(--gold); color: #000; }

/* o que já têm: item + 3 níveis */
.have { display: grid; gap: 14px; }
.have-row { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: border-color 0.3s; }
.have-row.set { border-color: var(--line-2); }
.have-row p { margin: 0 0 14px; font-size: 18px; font-weight: 500; line-height: 1.3; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lvl {
  min-height: 48px; padding: 8px 10px; line-height: 1.2;
  background: transparent; border: 1px solid var(--line-2); border-radius: 10px;
  color: var(--muted); font-size: 14px; transition: all 0.2s;
}
.lvl:hover { color: var(--text); border-color: var(--gold-line); }
.lvl[aria-checked='true'] { color: #000; font-weight: 600; border-color: var(--gold); }
.lvl[data-v='0'][aria-checked='true'] { background: #5a4c3b; color: var(--text); border-color: #7a6650; }
.lvl[data-v='1'][aria-checked='true'] { background: var(--gold-lo); color: #000; border-color: var(--gold-lo); }
.lvl[data-v='2'][aria-checked='true'] { background: var(--gold); }

/* prioridades: tocar por ordem */
.prio-count { font-family: var(--display); font-size: 12px; letter-spacing: 0.12em; color: var(--gold); margin: -8px 0 18px; }
.prio-group { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 26px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.prio-group b { font-family: var(--display); font-weight: 500; font-size: 11px; color: var(--faint); letter-spacing: 0.1em; white-space: nowrap; }
.prio-group b.ok { color: var(--gold); }
.prio-group b.ok::before { content: '✓ '; }
.prio-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.pick {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 64px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}
.pick:hover { border-color: var(--gold-line); }
.pick .n {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 1px dashed var(--line-2); font-family: var(--display); font-size: 13px; color: transparent;
  transition: all 0.25s var(--ease);
}
.pick .t { display: grid; gap: 2px; }
.pick .t b { font-weight: 500; font-size: 16px; line-height: 1.25; }
.pick .t small { font-size: 12px; color: var(--faint); }
.pick[aria-pressed='true'] { border-color: var(--gold); background: var(--gold-soft); }
.pick[aria-pressed='true'] .n { background: var(--gold); border: 0; color: #000; transform: scale(1.08); }
.prio-full .pick[aria-pressed='false'] { opacity: 0.45; }
.other { margin-top: 26px; }

/* pergunta 4: equipe */
.team { display: grid; gap: 22px; margin-top: 18px; padding: 20px; border: 1px solid var(--gold-line); border-radius: var(--r); background: var(--gold-soft); animation: rise 0.5s var(--ease) both; }
.team label { color: var(--text); font-size: 16px; font-weight: 500; }
.team label small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 22px; line-height: 1; }
.stepper button:hover { border-color: var(--gold-line); }
.stepper input { width: 84px; height: 48px; text-align: center; font-size: 20px; font-weight: 600; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; border-color: var(--gold); }
.stepper span { color: var(--muted); margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip { min-height: 42px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-size: 15px; transition: all 0.2s; }
.chip:hover { color: var(--text); border-color: var(--gold-line); }
.chip[aria-pressed='true'] { background: var(--gold); border-color: var(--gold); color: #000; font-weight: 600; }

/* fecho */
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.consent { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font-size: 15px; color: #d9d2c7; }
.consent input { appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border: 1px solid var(--line-2); border-radius: 7px; display: grid; place-items: center; }
.consent input:checked { background: var(--gold); border-color: var(--gold); }
.consent input:checked::after { content: ''; width: 7px; height: 12px; border: solid #000; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }

.nav { display: flex; align-items: center; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.nav .hint { color: var(--faint); font-size: 13px; }
.err-msg { color: var(--danger); font-size: 14px; margin-top: 14px; }

/* concluído */
.done-grid { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 5vw, 44px); align-items: center; margin: 30px 0; padding: clamp(20px, 4vw, 32px); border: 1px solid var(--line); border-radius: 22px; background: radial-gradient(120% 140% at 0% 0%, rgba(210, 176, 138, 0.08), transparent 60%), var(--surface); }
.ring { position: relative; width: clamp(120px, 28vw, 168px); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1.6s var(--ease); }
.ring .v { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .v b { font-family: var(--display); font-size: clamp(30px, 7vw, 42px); font-weight: 600; line-height: 1; }
.ring .v span { font-size: 11px; line-height: 1.25; color: var(--muted); max-width: 9ch; margin: 6px auto 0; }
.done-prio ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.done-prio li { display: flex; gap: 12px; align-items: center; font-size: 17px; line-height: 1.3; }
.done-prio li span small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 2px; }
.done-prio li i { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #000; font-style: normal; font-family: var(--display); font-size: 12px; }

.center-msg { text-align: center; padding-top: 10vh; }
.center-msg .q-hint { margin-inline: auto; }

@media (max-width: 560px) {
  .brand span { display: none; }
  .done-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .done-prio li { text-align: left; }
  .nav .hint { display: none; }
  .nav .btn-gold { flex: 1; }
  .lvl { font-size: 13px; padding: 6px; }
  .pixel-c { width: 62vmin; right: -20vmin; bottom: -12vmin; opacity: 0.16; }
}
