/* ---------- Design tokens (sistema Forne Studio) ---------- */
:root {
  --ink: #1a1614;
  --ink-soft: #241f1c;
  --ink-card: #2b2521;
  --ink-border: #3a322c;
  --coral: #e8674a;
  --coral-soft: rgba(232, 103, 74, 0.14);
  --cream: #f3ece4;
  --cream-dim: #b9aea5;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100dvh;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}

p { margin: 0; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Progress header ---------- */
.progress-header[hidden] {
  display: none;
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(16px + var(--safe-top)) 20px 12px;
  position: sticky;
  top: 0;
  background: linear-gradient(var(--ink) 70%, transparent);
  z-index: 10;
}

.progress-track {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--ink-border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--coral);
  border-radius: 4px;
  transition: width 0.35s ease;
}

.back-btn {
  background: none;
  border: none;
  color: var(--cream-dim);
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  order: -1;
}
.back-btn:hover { color: var(--cream); }

/* ---------- Screen stage ---------- */
.screen-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 32px;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: screen-in 0.32s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen.exiting {
  animation: screen-out 0.2s ease both;
}

@keyframes screen-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Intro screen ---------- */
.intro-eyebrow {
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.intro-headline {
  font-size: 34px;
  margin-bottom: 20px;
}

.intro-stat-card {
  background: var(--ink-card);
  border: 1px solid var(--ink-border);
  border-left: 3px solid var(--coral);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 15px;
  color: var(--cream-dim);
  margin-bottom: 20px;
}

.intro-sub {
  font-size: 16px;
  color: var(--cream-dim);
  margin-bottom: auto;
  padding-bottom: 32px;
}

/* ---------- Question screen ---------- */
.question-pillar {
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.question-text {
  font-size: 26px;
  margin-bottom: 24px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink-card);
  border: 1.5px solid var(--ink-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 16px;
  color: var(--cream);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.option-card:active { transform: scale(0.98); }

.option-card.selected {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.option-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}

.option-card.selected .option-check {
  border-color: var(--coral);
  background: var(--coral);
  color: var(--ink);
}

.multi-hint {
  color: var(--cream-dim);
  font-size: 13px;
  margin-top: -12px;
  margin-bottom: 18px;
}

.continue-btn {
  margin-top: 24px;
}

.options-list.shake {
  animation: shake-x 0.32s ease;
}

@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- Name capture ---------- */
.name-input {
  width: 100%;
  background: var(--ink-card);
  border: 1.5px solid var(--ink-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 16px;
  color: var(--cream);
  margin-bottom: 16px;
}
.name-input:focus {
  outline: none;
  border-color: var(--coral);
}
.name-input::placeholder { color: var(--cream-dim); }

.skip-btn {
  background: none;
  border: none;
  color: var(--cream-dim);
  font-size: 14px;
  text-decoration: underline;
  padding: 8px 0;
  align-self: center;
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--coral);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 17px 24px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  width: 100%;
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: none;
  border: 1.5px solid var(--ink-border);
  color: var(--cream);
  border-radius: 999px;
  padding: 15px 24px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

/* ---------- Result screen ---------- */
.case-number {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.gauge-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 8px auto 4px;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track,
.gauge-fill {
  fill: none;
  stroke-width: 10;
}

.gauge-track {
  stroke: var(--ink-border);
}

.gauge-fill {
  stroke: var(--coral);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
}

.gauge-pct {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 700;
  color: var(--cream);
  line-height: 1;
}

.gauge-pct-label {
  font-size: 11px;
  color: var(--cream-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

.gauge-note {
  font-size: 12px;
  color: var(--cream-dim);
  text-align: center;
  opacity: 0.8;
  margin-bottom: 20px;
}

.result-band {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.result-band.fuerte { color: #7fbf8f; }
.result-band.medio { color: var(--coral); }
.result-band.riesgo { color: #e0503a; }

.result-tagline {
  color: var(--cream-dim);
  font-size: 15px;
  text-align: center;
  margin-bottom: 24px;
}

.pillars-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.pillar-row-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--cream-dim);
  margin-bottom: 6px;
}

.pillar-bar-track {
  height: 8px;
  border-radius: 8px;
  background: var(--ink-border);
  overflow: hidden;
}

.pillar-bar-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--coral);
  width: 0%;
  transition: width 0.6s ease;
}

.risk-card {
  background: var(--ink-card);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 15px;
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.share-btn {
  background: none;
  border: none;
  color: var(--cream-dim);
  font-size: 14px;
  text-decoration: underline;
  padding: 8px 0;
  align-self: center;
}

/* ---------- Footer ---------- */
.app-footer {
  padding: 14px 20px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--ink-border);
}

.app-footer p {
  font-size: 11px;
  line-height: 1.4;
  color: var(--cream-dim);
  opacity: 0.75;
}

/* ---------- Responsive: slightly larger on tablets/desktop ---------- */
@media (min-width: 480px) {
  .intro-headline { font-size: 40px; }
  .question-text { font-size: 28px; }
}
