:root {
  /* FluxDance brand — deep purple surfaces, coral accent */
  --bg: hsl(280 40% 10%);
  --bg-soft: hsl(280 30% 13%);
  --card: hsl(280 40% 14%);
  --line: hsl(280 25% 22%);
  --line-soft: hsl(280 25% 18%);
  --text: hsl(280 10% 98%);
  --muted: hsl(280 10% 70%);
  --faint: hsl(280 12% 52%);
  --accent: hsl(10 90% 72%);        /* coral */
  --accent-ink: hsl(280 40% 10%);
  --good: hsl(135 65% 51%);
  --bad: hsl(0 84% 64%);
  --radius: clamp(16px, 2vw, 26px);
  --display: "Anton", "Archivo Narrow", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1100px 600px at 50% -10%, hsl(280 40% 14%) 0%, var(--bg) 62%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: clamp(16px, 4vw, 56px) 18px;
}

.shell {
  width: 100%;
  max-width: 680px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 44px);
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.8);
}

.card.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
  margin: 0 0 22px;
}

/* ---------- Language switch ---------- */
.lang-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}
.lang-opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.lang-opt:hover { color: var(--text); }
.lang-opt.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 500;
  line-height: 1;
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 8.5vw, 68px);
  line-height: 1.04;
  margin: 0 0 20px;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  overflow-wrap: break-word;
  text-wrap: balance;
}

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 4.4vw, 36px);
  margin: 0;
  letter-spacing: 0.008em;
  text-transform: uppercase;
}

.lede {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 28px;
}
.lede strong { color: var(--text); font-weight: 600; }

/* ---------- Start form ---------- */
.fields { display: flex; flex-direction: column; gap: 22px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 460px) { .row { grid-template-columns: 1fr; } }

label > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: #1b1b20;
}

fieldset.momentum { border: 0; padding: 0; margin: 0; }
fieldset legend {
  font-size: 13px;
  color: var(--muted);
  padding: 0;
  margin-bottom: 10px;
}

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 460px) { .seg { grid-template-columns: 1fr; } }

.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: block;
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.15s ease;
}
.seg input:checked + span {
  border-color: var(--accent);
  background: hsl(10 90% 72% / 0.12);
  color: var(--text);
}
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.note { font-size: 13px; color: var(--faint); margin: 0; line-height: 1.6; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 15px 26px;
  min-height: 46px;
  cursor: pointer;
  transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
}
.btn:hover { background: hsl(10 90% 67%); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--text); background: hsl(280 10% 98% / 0.05); }

.error { color: var(--bad); font-size: 14px; margin: 4px 0 0; }

/* ---------- Quiz ---------- */
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.quiz-head .eyebrow { margin-bottom: 6px; }

.quiz-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.timer {
  font-family: var(--display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.timer.warn { color: var(--accent); }
.timer.crit {
  color: var(--bad);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.55; } }

.progress { text-align: right; min-width: 130px; }
#progress-label { font-size: 13px; color: var(--muted); }
.bar {
  margin-top: 8px;
  height: 4px;
  width: 130px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
#bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.q-text {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(19px, 3vw, 23px);
  line-height: 1.4;
  margin: 0 0 6px;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}
.q-kind {
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--faint);
  margin: 0 0 22px;
}
.q-kind .hint { text-transform: none; letter-spacing: 0; color: var(--muted); }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { position: relative; cursor: pointer; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice .box {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
  transition: all 0.13s ease;
}
.choice .box .key {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--faint);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  transition: all 0.13s ease;
}
.choice[data-multi="true"] .box .key { border-radius: 6px; }
.choice[data-multi="false"] .box .key { border-radius: 50%; }
.choice .box .label { font-size: 15px; line-height: 1.5; color: var(--text); }
.choice:hover .box { border-color: var(--faint); }
.choice input:checked + .box {
  border-color: var(--accent);
  background: hsl(10 90% 72% / 0.1);
}
.choice input:checked + .box .key {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.choice input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 15px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  transition: border-color 0.15s ease;
}
textarea:focus { outline: none; border-color: var(--accent); }

.quiz-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.quiz-foot .btn { min-width: 120px; }

/* ---------- Resume ---------- */
#resume-host { display: flex; flex-direction: column; gap: 28px; margin: 26px 0 6px; }
.resume-group {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 20px 20px 8px;
  background: var(--bg-soft);
}
.resume-group-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 14px;
  color: var(--text);
}
.resume-item { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.resume-item:first-of-type { border-top: 0; }
.resume-q { font-size: 15px; font-weight: 600; line-height: 1.45; margin: 0 0 6px; color: var(--text); }
.resume-a { font-size: 14px; line-height: 1.55; margin: 0; color: var(--muted); }
.resume-a-label { color: var(--faint); }
.resume-a-val { color: var(--text); }
.resume-foot { justify-content: flex-end; }
.resume-foot .btn { min-width: 180px; }

#next-btn.is-submit { background: var(--good); color: #fff; }
#next-btn.is-submit:hover { background: hsl(135 65% 45%); }

/* ---------- Spinner ---------- */
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }

/* ---------- Phone / small-tablet responsive ---------- */
@media (max-width: 600px) {
  .quiz-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 22px;
    padding-bottom: 18px;
  }
  .quiz-head-meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .progress { min-width: 0; }
  .bar { width: 120px; }
  .timer { font-size: 24px; }
}

@media (max-width: 480px) {
  .quiz-foot { gap: 10px; }
  .quiz-foot .btn { min-width: 0; flex: 1; }
  .resume-foot .btn { flex: 1; min-width: 0; }
  .lang-switch { width: 100%; justify-content: space-between; }
  .lang-opt { flex: 1; text-align: center; padding: 9px 10px; }
}
