:root {
  --legacy-gray: #eeeeee;
  --legacy-card: #e6e6e6;
  --blue: #4f73ef;
  --blue-dark: #2850c6;
  --blue-soft: #edf3ff;
  --green: #58a940;
  --green-soft: #eef9ec;
  --ink: #171717;
  --muted: #666;
  --line: #d6dbe8;
  --white: #fff;
  --danger: #bd2222;
  --shadow: 0 18px 50px rgba(35, 63, 120, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #ffffff;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

/* Pantalla inicial: look actual */

.legacy-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, #ffffff 0%, #eeeeee 16%, #eeeeee 84%, #ffffff 100%);
}

.legacy-card {
  width: min(1350px, 100%);
  min-height: min(860px, calc(100vh - 56px));
  background: var(--legacy-card);
  border-radius: 0 0 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 68px 46px 54px;
}

.legacy-promo {
  width: min(980px, 82vw);
  height: auto;
  display: block;
  margin: 0 auto 58px;
}

.legacy-title {
  margin: 0 0 34px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  font-size: clamp(25px, 2.5vw, 35px);
  line-height: 1.2;
}

.legacy-form {
  width: min(530px, 90%);
  display: grid;
  gap: 14px;
}

.legacy-form input {
  width: 100%;
  height: 66px;
  border: 1px solid #888;
  background: #ffffff;
  border-radius: 3px;
  font-size: 38px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  outline: none;
}

.legacy-form input:focus {
  border-color: #4a74d9;
  box-shadow: 0 0 0 4px rgba(79, 115, 239, 0.16);
}

.scan-error {
  margin: 0;
  color: var(--danger);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

/* Transición paciente encontrado */

.found-shell,
.question-shell,
.final-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(79, 115, 239, 0.10), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

.found-card {
  width: min(720px, 94vw);
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  background: white;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  text-align: center;
  padding: 42px;
}

.found-card img {
  width: min(250px, 60vw);
  border-radius: 10px;
}

.found-check {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: var(--green);
  display: grid;
  place-items: center;
  color: white;
  font-size: 62px;
  font-weight: 900;
}

.found-card h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: -0.04em;
}

.found-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 2.3vw, 28px);
}

/* Preguntas */

.question-card {
  width: min(1220px, 100%);
  min-height: min(720px, calc(100vh - 48px));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  background: var(--white);
  padding: clamp(26px, 4vw, 46px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(18px, 3vw, 30px);
  transition: background 260ms ease, transform 260ms ease;
}

.question-card.answering {
  background: linear-gradient(180deg, #ffffff 0%, var(--green-soft) 100%);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.question-logo {
  width: min(230px, 36vw);
  height: auto;
  border-radius: 8px;
  display: block;
}

.progress-copy {
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 800;
}

.progress-bar {
  height: 12px;
  border-radius: 99px;
  background: var(--blue-soft);
  overflow: hidden;
}

.progress-bar div {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: inherit;
  width: 0;
  transition: width 160ms ease;
}

.question-header {
  border: 2px solid var(--blue);
  overflow: hidden;
  text-align: center;
  transition: border-color 220ms ease;
}

.question-header p {
  margin: 0;
  padding: 14px 22px 0;
  background: var(--blue);
  color: white;
  font-size: clamp(22px, 2.8vw, 34px);
  font-weight: 500;
  transition: background 220ms ease;
}

.question-header h1 {
  margin: 0;
  padding: 8px 24px 20px;
  background: var(--blue);
  color: white;
  font-size: clamp(22px, 2.6vw, 31px);
  font-weight: 500;
  line-height: 1.18;
  transition: background 220ms ease;
}

.question-card.answering .question-header {
  border-color: var(--green);
}

.question-card.answering .question-header p,
.question-card.answering .question-header h1 {
  background: var(--green);
}

.answer-feedback {
  min-height: 78px;
  border: 2px solid var(--green);
  border-radius: 22px;
  background: #ffffff;
  color: var(--green);
  display: grid;
  place-items: center;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 12px 24px;
  animation: popIn 180ms ease-out;
}

.answer-feedback[hidden] {
  display: none;
}

.answer-feedback span {
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 900;
}

.answer-feedback strong {
  width: clamp(62px, 7vw, 92px);
  aspect-ratio: 1;
  border-radius: 18px;
  background: var(--green);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 950;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4px;
}

.scale-labels strong {
  font-size: clamp(26px, 3vw, 42px);
  font-weight: 500;
}

.scale-labels strong:last-child {
  text-align: right;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(9px, 1.2vw, 16px);
}

.scale-button {
  min-height: clamp(104px, 11vw, 150px);
  border: 2px solid #dfe4f1;
  border-radius: 22px;
  background: #ffffff;
  color: var(--blue);
  font-size: clamp(36px, 4.8vw, 70px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(40, 80, 198, 0.08);
  transition: transform 90ms ease, background 90ms ease, color 90ms ease, border-color 90ms ease, opacity 90ms ease;
}

.scale-button:hover,
.scale-button:focus {
  outline: none;
  border-color: var(--blue);
  background: #f6f9ff;
}

.scale-button.selected {
  background: var(--green);
  color: white;
  border-color: var(--green);
  transform: scale(1.03);
}

.scale-button:disabled:not(.selected) {
  opacity: 0.38;
  cursor: default;
}

.tap-copy {
  margin: -4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 700;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pantalla final: look QuiroFácil actual */

.final-shell {
  background: #ffffff;
}

.qf-final-card {
  width: 754px;
  max-width: calc(100vw - 48px);
  height: 447px;
  background-image: url("assets/quirofacil-final-bg.jpg");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  border: 1px solid #6d7e9d;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  display: grid;
  place-items: center;
  position: relative;
}

.qf-final-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32px;
  border-top: 1px solid #8e9eb8;
  background: linear-gradient(180deg, rgba(230,235,246,0.9), rgba(207,216,234,0.95));
}

.final-message {
  width: 92%;
  text-align: center;
  transform: translateY(18px);
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
}

.thanks {
  margin: 0 0 18px;
  font-size: 26px;
  line-height: 1.15;
}

.next-appointment {
  margin: 0 0 36px;
  font-size: 23px;
  line-height: 1.25;
}

.recommended {
  margin: 0;
  font-size: 21px;
}

.return-copy {
  margin: 36px 0 0;
  font-size: 14px;
  color: #6d6d6d;
}

@media (max-width: 900px) {
  .legacy-shell,
  .found-shell,
  .question-shell,
  .final-shell {
    padding: 12px;
  }

  .legacy-card,
  .question-card {
    min-height: calc(100vh - 24px);
    border-radius: 18px;
    padding: 22px;
  }

  .legacy-promo {
    width: 100%;
    margin-bottom: 34px;
  }

  .legacy-title {
    font-size: 24px;
  }

  .top-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .scale-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .scale-button {
    min-height: 78px;
    font-size: 36px;
    border-radius: 16px;
  }

  .scale-labels strong {
    font-size: 24px;
  }

  .answer-feedback {
    grid-template-columns: 1fr;
  }

  .qf-final-card {
    height: 60vw;
    min-height: 330px;
  }

  .thanks {
    font-size: 22px;
  }

  .next-appointment {
    font-size: 19px;
    margin-bottom: 24px;
  }

  .recommended {
    font-size: 18px;
  }
}
