:root {
  --bg: #f7f4fb;
  --surface: #ffffff;
  --ink: #0e0325;
  --ink-soft: #5b5070;
  --line: #e7e1f0;
  --accent: #8e3bc0;
  --accent-strong: #641e8e;
  --accent-soft: #f0d4ff;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --radius: 14px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0325;
    --surface: #170838;
    --ink: #f3eefa;
    --ink-soft: #b3a8c6;
    --line: #2c1a52;
    --accent: #b737f0;
    --accent-strong: #d27cf6;
    --accent-soft: #2e1259;
    --accent-ink: #ffffff;
    --danger: #ff8a7a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand svg { height: 26px; width: auto; color: var(--accent); }

.step-count { color: var(--ink-soft); font-size: 14px; font-variant-numeric: tabular-nums; }

.progress {
  height: 3px;
  background: var(--line);
  max-width: 720px;
  width: calc(100% - 40px);
  margin: 0 auto;
  border-radius: 3px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.35s ease;
}

main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 20px 40px;
}

.card {
  width: 100%;
  max-width: 640px;
  animation: enter 0.35s ease both;
}
.card.back { animation-name: enter-back; }

@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .progress > span { transition: none; }
}

.eyebrow {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  font-weight: 600;
  margin: 0 0 12px;
}

h1, h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 14px;
  text-wrap: balance;
}
h1 { font-size: clamp(30px, 6vw, 42px); }
[tabindex="-1"]:focus { outline: none; }
h2 { font-size: clamp(24px, 4.6vw, 32px); }

.help { color: var(--ink-soft); margin: 0 0 26px; text-wrap: pretty; }
.help:empty { display: none; }

.optional { color: var(--ink-soft); font-size: 14px; font-weight: 400; font-family: var(--font-sans); }

/* Inputs */
input[type="text"], textarea {
  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;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 140px; resize: vertical; }
input[type="text"]:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.options { display: grid; gap: 10px; }

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.option:hover { border-color: var(--accent); }
.option:active { transform: scale(0.99); }
.option:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.option[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option .key {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg);
}
.option[aria-checked="true"] .key {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* NPS */
.nps { display: grid; grid-template-columns: repeat(11, 1fr); gap: 6px; }
.nps button {
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.nps button:hover { border-color: var(--accent); }
.nps button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.scale-legend {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 10px;
}

@media (max-width: 520px) {
  .nps { grid-template-columns: repeat(6, 1fr); }
}

/* Matrix (notas por área) */
.matrix { display: grid; gap: 14px; }
.matrix-row {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.matrix-row .label { font-weight: 600; margin-bottom: 10px; }
.matrix-row .label small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 14px; }
.stars { display: flex; flex-wrap: wrap; gap: 6px; }
.stars button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.stars button:hover { border-color: var(--accent); }
.stars button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stars button.na { font-weight: 500; color: var(--ink-soft); }
.stars button.na[aria-checked="true"] { background: var(--ink-soft); border-color: var(--ink-soft); color: var(--bg); }

/* Actions */
.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  transition: background 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--accent-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  padding: 13px 8px;
}
.btn.ghost:hover { color: var(--ink); }

.hint { color: var(--ink-soft); font-size: 13px; }
.hint kbd {
  font-family: var(--font-sans);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--surface);
}
@media (hover: none) { .hint { display: none; } }

.error { color: var(--danger); font-size: 15px; margin-top: 12px; min-height: 1px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.meta-list { list-style: none; padding: 0; margin: 0 0 26px; color: var(--ink-soft); display: grid; gap: 6px; }
.meta-list li::before { content: "— "; color: var(--accent); }

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 20px;
}
footer a { color: inherit; }

/* Página inicial */
.links { display: grid; gap: 12px; margin-top: 8px; }
.links a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.links a:hover { border-color: var(--accent); }
.links a strong { display: block; font-size: 18px; }
.links a span { color: var(--ink-soft); font-size: 15px; }
