/* REM Encuesta 2026 — UI */
:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --text: #1A1A1A;
  --text-2: #6E6E73;
  --text-3: #A1A1A6;
  --accent: #3D6FD6;
  --accent-soft: rgba(61, 111, 214, 0.07);
  --accent-border: rgba(61, 111, 214, 0.55);
  --brand-green: #54C88B;
  --brand-blue: #5D8FE8;
  --brand-pink: #EA5860;
  --brand-orange: #F49B4E;
  --border: #E5E5E0;
  --danger: #D93025;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
input, textarea { font: inherit; color: inherit; }

/* Progress */
#progress {
  position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 50;
  background: rgba(0, 0, 0, 0.05);
}
#progress .bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-blue), var(--brand-pink), var(--brand-orange));
  border-radius: 0 2px 2px 0;
  transition: width 400ms var(--ease);
}

/* Shell */
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 24px 40px;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Back */
#back {
  position: fixed; top: 14px; left: 14px; z-index: 40;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: transparent;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease), background 150ms;
}
#back.visible { opacity: 1; pointer-events: auto; }
#back:active { background: rgba(0, 0, 0, 0.06); }

/* Screens */
.screen {
  flex: 1;
  display: flex; flex-direction: column; justify-content: flex-start;
  padding-top: 6vh;
  animation: slideIn 340ms var(--ease) both;
}
.screen.leaving { animation: slideOut 260ms var(--ease) both; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-24px); }
}
@media (prefers-reduced-motion: reduce) {
  .screen, .screen.leaving { animation: none; }
  #progress .bar { transition: none; }
}

.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.q-text {
  font-size: 24px; font-weight: 650; line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.q-hint { font-size: 15px; color: var(--text-2); margin-bottom: 8px; }
.q-sub {
  font-size: 21px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em;
  color: var(--text); margin-bottom: 8px;
}
.spacer-md { height: 20px; }

/* Option cards */
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 16.5px; line-height: 1.35;
  text-align: left;
  transition: border-color 140ms, background 140ms, transform 140ms var(--ease);
}
.opt:active { transform: scale(0.985); }
.opt.selected {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}
.opt .check {
  flex: 0 0 22px; width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all 140ms;
  font-size: 13px; color: transparent;
}
.opt.multi .check { border-radius: 7px; }
.opt.selected .check {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.opt .rankbadge {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: transparent;
  transition: all 140ms;
}
.opt.selected .rankbadge { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Chips (matrix multi) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.chip {
  padding: 13px 18px; min-height: 48px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 16px;
  box-shadow: var(--shadow);
  transition: all 140ms;
}
.chip:active { transform: scale(0.96); }
.chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Scale 1–5 */
.scale { display: flex; gap: 8px; margin-top: 26px; }
.scale button {
  flex: 1; height: 64px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 19px; font-weight: 600;
  box-shadow: var(--shadow);
  transition: all 140ms var(--ease);
}
.scale button:active { transform: scale(0.94); }
.scale button.selected { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.04); }
.scale-labels { display: flex; justify-content: space-between; margin-top: 10px; }
.scale-labels span { font-size: 13px; color: var(--text-2); max-width: 45%; }
.scale-labels span:last-child { text-align: right; }

.battery-count { font-size: 13.5px; font-weight: 600; color: var(--text-3); margin-bottom: 16px; }
.battery-item {
  display: inline-flex; align-items: center; align-self: flex-start;
  padding: 12px 18px; border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 19px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em;
}

/* Inputs */
.text-input, .num-input {
  width: 100%;
  margin-top: 22px;
  padding: 16px;
  font-size: 17px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color 140ms;
}
.text-input:focus, .num-input:focus { border-color: var(--accent); }
.num-input { font-size: 24px; font-weight: 600; text-align: center; letter-spacing: 0.02em; max-width: 220px; align-self: flex-start; }
textarea.text-input { min-height: 110px; resize: none; }
.input-error { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 20px; }

/* CTA */
.cta-row { margin-top: 28px; padding-bottom: 12px; }
.cta {
  width: 100%; min-height: 54px;
  background: var(--accent); color: #fff;
  border-radius: var(--radius);
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 160ms, transform 140ms var(--ease);
  box-shadow: 0 2px 10px rgba(61, 111, 214, 0.25);
}
.cta:active { transform: scale(0.98); }
.cta:disabled { opacity: 0.35; box-shadow: none; }
.cta.secondary { background: transparent; color: var(--accent); box-shadow: none; }

/* Welcome / end screens */
.hero { padding-top: 14vh; }
.hero .brandmark { margin-bottom: 34px; }
.hero .brandmark svg { height: 62px; width: auto; display: block; }
.hero h1 {
  font-size: 32px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.15;
  margin-bottom: 16px;
}
.hero p { font-size: 17px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }
.hero .meta-pills { display: flex; gap: 10px; margin: 22px 0 8px; flex-wrap: wrap; }
.hero .pill {
  font-size: 14px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 7px;
}
.hero .pill svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.hero .privacy { font-size: 13.5px; color: var(--text-3); margin-top: 18px; line-height: 1.5; }

.endcard { text-align: center; padding-top: 16vh; }
.endcard .mark {
  width: 84px; height: 84px; margin: 0 auto 28px;
}
.endcard .mark circle { stroke: var(--accent); stroke-width: 3; fill: none;
  stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 600ms var(--ease) forwards; }
.endcard .mark path { stroke: var(--accent); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 450ms 350ms var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.endcard h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.endcard p { font-size: 16.5px; color: var(--text-2); line-height: 1.55; max-width: 420px; margin: 0 auto 8px; }
.endcard .redirect-note { font-size: 14px; color: var(--text-3); margin-top: 20px; }

.almost { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 12px; }

@media (min-width: 640px) {
  .q-text { font-size: 28px; }
  .q-sub { font-size: 24px; }
  .hero h1 { font-size: 40px; }
}
