/* Ciudadanía — "Sol · Pintado" visual system. Tokens from SPEC.md / design/. */

@font-face { font-family: "Fraunces"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/fraunces-800.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/atkinson-400.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/atkinson-700.woff2") format("woff2"); }

:root {
  --ground: #F6E3A1;
  --card: #FFF8E6;
  --ink: #2F2A24;
  --muted: #5C534A;
  --primary: #27365F;
  --primary-shadow: #141D38;
  --secondary-shadow: #D9C27A;
  --track: #EADBA8;
  --sky: #DCE5F5;
  --sky-shadow: #A9BBDD;
  --sky-bar: #8EA8D8;
  /* Right / wrong only. Never on ordinary buttons. */
  --correct: #24643F; --correct-bg: #DDF0E3; --correct-text: #1D4F33;
  --wrong: #B5432F;   --wrong-bg: #F7DCD5;   --wrong-text: #7A2A1C;

  --display: "Fraunces", Georgia, serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, p { margin: 0; }
svg { display: block; }

/* One screen = one column, at least the height of the phone. */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.screen--home { padding-top: calc(20px + env(safe-area-inset-top)); gap: 18px; }

.display { font-family: var(--display); font-weight: 800; }
.muted { color: var(--muted); }

/* ---------- Tappable things: solid drop shadow. Plain cards: flat. ---------- */
.btn {
  appearance: none;
  border: none;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.btn-cream { background: var(--card); color: var(--primary); box-shadow: 0 5px 0 var(--secondary-shadow); }
.btn-navy  { background: var(--primary); color: #FFFFFF; box-shadow: 0 5px 0 var(--primary-shadow); }
.btn-sky   { background: var(--sky); color: var(--primary); box-shadow: 0 3px 0 var(--sky-shadow); }
.btn-cream:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--secondary-shadow); }
.btn-navy:active  { transform: translateY(3px); box-shadow: 0 2px 0 var(--primary-shadow); }
.btn-sky:active   { transform: translateY(2px); box-shadow: 0 1px 0 var(--sky-shadow); }

.card { background: var(--card); border-radius: 24px; }

/* Big Fraunces action buttons (end screen, Leer) */
.btn-big {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 62px; padding: 8px 16px; border-radius: 18px;
  font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.1;
}

/* "Inicio" back button, top left */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn-inicio {
  display: flex; align-items: center; gap: 6px;
  min-height: 48px; padding: 0 16px 0 10px; border-radius: 14px;
  font-size: 20px; font-weight: 700;
  box-shadow: 0 4px 0 var(--secondary-shadow);
}
.counter { font-size: 19px; font-weight: 700; color: var(--muted); }

/* ---------- Home ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-head h1 { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.05; }
.home-head p { font-size: 20px; color: var(--muted); margin-top: 4px; }

.home-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 104px; padding: 12px 14px;
  text-align: left; border-radius: 22px; color: var(--ink);
}
.home-card--civismo { min-height: 124px; padding: 14px; }
.home-card__text { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.home-card__title { font-family: var(--display); font-weight: 800; font-size: 25px; line-height: 1.05; }
.home-card__sub { font-size: 17px; color: var(--muted); }
.home-card svg.illo { flex: none; overflow: visible; }
.home-card svg.chev { flex: none; }

.progress { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

.soon-label { font-size: 18px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.soon-row { display: flex; gap: 12px; }
.soon {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px; border: 2.5px dashed var(--secondary-shadow); border-radius: 22px; text-align: center;
}
.soon svg { overflow: visible; opacity: .55; }
.soon span { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--muted); }

/* ---------- Question card ---------- */
.qcard { padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; }
.qcard--es { gap: 12px; }
.qcard__q { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.12; }
.es-line { padding-left: 12px; border-left: 4px solid var(--sky-bar); font-size: 19px; line-height: 1.3; color: #4A4238; }

.tools { display: flex; align-items: center; gap: 14px; }
.btn-listen {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; border-radius: 14px; font-size: 17px; font-weight: 700;
}

/* Español switch (a real checkbox with role="switch") */
.switch { flex: none; position: relative; display: flex; align-items: center; gap: 8px; min-height: 46px; font-size: 17px; font-weight: 700; color: var(--primary); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch__track { position: relative; display: block; width: 52px; height: 30px; border-radius: 99px; background: var(--secondary-shadow); transition: background .15s ease; }
.switch__knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s ease; }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track .switch__knob { left: 25px; }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--primary); outline-offset: 3px; }

/* ---------- Answer options ---------- */
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 62px; padding: 8px 12px;
  text-align: left; border-radius: 18px;
  background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--secondary-shadow);
}
.option:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--secondary-shadow); }
.option:disabled { cursor: default; opacity: 1; }
.option__badge {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ground); display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
}
.option__text { display: flex; flex-direction: column; min-width: 0; }
.option__en { font-size: 20px; font-weight: 700; line-height: 1.2; }
.option__es { font-size: 16px; color: var(--muted); line-height: 1.25; margin-top: 2px; }

/* Right and wrong: the ONLY places green and red appear. Always with ✓ / ✗. */
.option--correct { border: 3px solid var(--correct); background: var(--correct-bg); color: var(--correct-text); box-shadow: 0 4px 0 var(--correct); }
.option--correct .option__badge { background: var(--correct); }
.option--correct .option__en { font-size: 21px; }
.option--wrong { border: 3px solid var(--wrong); background: var(--wrong-bg); color: var(--wrong-text); box-shadow: 0 4px 0 var(--wrong); }
.option--wrong .option__badge { background: var(--wrong); }
.option--correct .option__es, .option--wrong .option__es { color: inherit; }
/* Faded: no longer tappable, so no shadow. */
.option--faded { background: #FBEFC8; color: #6B6158; box-shadow: none; }
.option--faded .option__badge { background: var(--track); }

/* ---------- Bottom of the question screen ---------- */
.bottom { margin-top: auto; padding-bottom: 8px; }
.hint { text-align: center; font-size: 19px; color: var(--muted); }
.feedback { display: flex; flex-direction: column; align-items: center; text-align: center; }
.feedback--right { gap: 4px; }
.feedback--wrong { gap: 6px; }
.feedback--right .cheer { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.05; color: var(--correct-text); }
.feedback__title { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.05; }
.feedback__explain { font-size: 20px; line-height: 1.35; }

.thumb { transform-origin: 50% 90%; animation: thumbPop .6s cubic-bezier(.34,1.56,.64,1) both, thumbWiggle 1.6s ease-in-out .6s infinite; }
.twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.2s ease-in-out infinite; }
.cheer { animation: cheerIn .4s ease-out .25s both; }
@keyframes thumbPop { 0% { transform: scale(0) rotate(-20deg) } 100% { transform: scale(1) rotate(0) } }
@keyframes thumbWiggle { 0%,60%,100% { transform: rotate(0) } 20% { transform: rotate(-10deg) } 40% { transform: rotate(6deg) } }
@keyframes twinkle { 0%,100% { transform: scale(1); opacity: 1 } 50% { transform: scale(.6); opacity: .5 } }
@keyframes cheerIn { 0% { opacity: 0; transform: translateY(8px) } 100% { opacity: 1; transform: none } }

/* ---------- End of session ---------- */
.screen--end { padding-top: calc(18px + env(safe-area-inset-top)); align-items: center; gap: 10px; text-align: center; }
.end__art { max-width: 100%; height: auto; }
.end__title { font-family: var(--display); font-weight: 800; font-size: 36px; line-height: 1.05; animation-delay: .35s; }
.end__score { display: flex; align-items: baseline; gap: 8px; background: var(--card); border-radius: 22px; padding: 6px 20px; }
.end__num { font-family: var(--display); font-weight: 800; font-size: 48px; line-height: 1.1; }
.end__of { font-size: 21px; font-weight: 700; }
.end__note { font-size: 19px; line-height: 1.3; }
.end__actions { margin-top: auto; width: 100%; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }

.pop { transform-origin: 50% 80%; animation: pop .6s cubic-bezier(.34,1.56,.64,1) both; }
.clap { transform-box: fill-box; transform-origin: 50% 100%; animation: clap 2.4s ease-in-out .5s infinite; }
.burst { animation: burst 2.4s ease-in-out .5s infinite; opacity: 0; }
.twinkle2 { transform-box: fill-box; transform-origin: center; animation: twinkle 1.4s ease-in-out .7s infinite; }
.end__art .twinkle { animation-duration: 1.4s; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }
@keyframes clap { 0%,20%,40%,60%,100% { transform: rotate(0) } 10%,30%,50% { transform: rotate(9deg) } }
@keyframes burst { 0%,60%,100% { opacity: 0 } 10%,30%,50% { opacity: 1 } 20%,40% { opacity: .25 } }

/* ---------- "Agregar a inicio" walkthrough ---------- */
.screen--install { padding-top: calc(20px + env(safe-area-inset-top)); gap: 16px; }
.install-title { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.08; }
.install-why { font-size: 20px; line-height: 1.35; color: var(--muted); margin-top: 8px; }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
/* Steps are plain cards: flat, nothing tappable here. */
.install-step { display: flex; gap: 12px; padding: 14px; align-items: flex-start; }
.install-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 20px;
}
.install-text { flex: 1; min-width: 0; font-size: 20px; line-height: 1.35; display: flex; flex-direction: column; gap: 8px; }
.install-chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Pictures of Safari's buttons: flat (not tappable in our app), outlined like Safari's. */
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 48px; height: 48px; padding: 0 10px; border-radius: 14px;
  background: #FFFFFF; color: #2F6FDB; border: 2px solid #D8DCE4;
}
.chip--label { color: var(--ink); font-size: 18px; font-weight: 700; padding: 0 14px 0 10px; }
.chip--label svg { color: var(--ink); }
.chip-or { font-size: 18px; color: var(--muted); }
.install-small { font-size: 17px; line-height: 1.35; color: var(--muted); }
.install-icon-row { display: flex; align-items: center; gap: 12px; }
.install-icon { border-radius: 14px; box-shadow: 0 0 0 1px rgba(47,42,36,.12); }
.install-icon-label { font-size: 17px; font-weight: 700; }
.install-actions { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; }

/* ---------- Motion (keyframes copied from design/) ---------- */
.wave { transform-box: fill-box; transform-origin: 50% 100%; animation: wave 2.6s ease-in-out .4s infinite; }
@keyframes wave { 0%,50%,100% { transform: rotate(0) } 10%,30% { transform: rotate(14deg) } 20%,40% { transform: rotate(-8deg) } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .burst { opacity: 1; }
}
