:root {
  color-scheme: light;
  --ink: #3c3c3c;
  --muted: #777777;
  --paper: #ffffff;
  --cream: #f7f7f7;
  --coral: #ff4b4b;
  --coral-dark: #e33d3d;
  --teal: #58cc02;
  --teal-light: #e5f7d7;
  --gold: #ffc800;
  --green: #46a302;
  --red: #ea2b2b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

::selection {
  background: rgba(239, 112, 93, 0.25);
}

.display-font {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.035em;
}

.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.paper-card {
  background: white;
  border: 2px solid #e5e5e5;
  box-shadow: 0 4px 0 #e5e5e5;
}

.section-number {
  align-items: center;
  background: #1cb0f6;
  border-radius: 999px;
  color: white;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 800;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.exercise-card {
  background: white;
  border: 2px solid #e5e5e5;
  border-radius: 1rem;
  box-shadow: 0 4px 0 #e5e5e5;
  overflow: hidden;
}

.exercise-card__head {
  background: #f7f7f7;
  border-bottom: 2px solid #e5e5e5;
}

.question-row {
  border-bottom: 1px solid rgba(24, 49, 83, 0.08);
  padding: 1rem 0;
  transition: background-color 180ms ease;
}

.question-row:last-child {
  border-bottom: 0;
}

.question-row.is-correct {
  background: rgba(24, 116, 90, 0.07);
}

.question-row.is-incorrect {
  background: rgba(184, 58, 58, 0.06);
}

.question-row.is-unanswered {
  background: rgba(239, 185, 73, 0.1);
}

.question-marker {
  align-items: center;
  background: var(--cream);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 800;
  height: 1.75rem;
  justify-content: center;
  width: 1.75rem;
}

.field,
.select-field,
.text-area {
  background: white;
  border: 1.5px solid #cbd5df;
  border-radius: 0.75rem;
  color: var(--ink);
  min-height: 2.75rem;
  outline: none;
  padding: 0.65rem 0.8rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  width: 100%;
}

.field:focus,
.select-field:focus,
.text-area:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(22, 125, 121, 0.12);
}

.text-area {
  line-height: 1.6;
  min-height: 7rem;
  resize: vertical;
}

.choice-label {
  align-items: flex-start;
  background: white;
  border: 2px solid #e5e5e5;
  border-radius: 0.8rem;
  cursor: pointer;
  display: flex;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.choice-label:hover {
  background: #f7f7f7;
  border-color: #b7b7b7;
}

.choice-label:has(input:checked) {
  background: #ddf4ff;
  border-color: #1cb0f6;
}

.choice-label input {
  accent-color: var(--teal);
  margin-top: 0.18rem;
}

.btn {
  align-items: center;
  border: 2px solid transparent;
  border-radius: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 0.45rem;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  transition: transform 100ms ease, box-shadow 100ms ease, background-color 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: none;
  transform: translateY(3px);
}

.btn:focus-visible {
  outline: 3px solid rgba(239, 185, 73, 0.65);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--teal);
  box-shadow: 0 4px 0 #46a302;
  color: white;
}

.btn-primary:hover {
  background: #61d90b;
}

.btn-secondary {
  background: white;
  border-color: #e5e5e5;
  box-shadow: 0 3px 0 #e5e5e5;
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.result-box {
  border-radius: 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.8rem 1rem;
}

.result-box.good {
  background: #e8f6ef;
  color: #125b47;
}

.result-box.try-again {
  background: #fff1e7;
  color: #8a4925;
}

.answers-panel {
  background: #f2fce9;
  border: 2px solid #a5e374;
  border-radius: 1rem;
  color: #254a4a;
}

.answers-panel[hidden] {
  display: none;
}

.answer-list {
  counter-reset: answer-item;
}

.answer-list li {
  counter-increment: answer-item;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1.6rem 1fr;
  margin-top: 0.55rem;
}

.answer-list li::before {
  align-items: center;
  background: var(--teal);
  border-radius: 999px;
  color: white;
  content: counter(answer-item);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 800;
  height: 1.35rem;
  justify-content: center;
  margin-top: 0.15rem;
  width: 1.35rem;
}

.sticky-progress {
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 2px solid #f0f0f0;
}

.progress-track {
  background: #e5e9ed;
  border-radius: 999px;
  height: 0.45rem;
  overflow: hidden;
}

.progress-fill {
  background: var(--teal);
  border-radius: inherit;
  height: 100%;
  transition: width 260ms ease;
  width: 0;
}

.tense-card {
  border: 2px solid rgba(60, 60, 60, 0.08);
  border-radius: 1.25rem;
  box-shadow: 0 4px 0 rgba(60, 60, 60, 0.08);
  min-height: 100%;
  overflow: hidden;
  position: relative;
}

.tense-card::after {
  border: 1px solid currentColor;
  border-radius: 999px;
  content: "";
  height: 6rem;
  opacity: 0;
  position: absolute;
  right: -1.5rem;
  top: -2rem;
  width: 6rem;
}

.timeline-line {
  background: linear-gradient(90deg, var(--gold) 0 32%, var(--coral) 32% 68%, var(--teal) 68% 100%);
  border-radius: 999px;
  height: 0.45rem;
  position: relative;
}

.timeline-dot {
  background: white;
  border: 4px solid currentColor;
  border-radius: 999px;
  height: 1.25rem;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1.25rem;
}

.seville-scene {
  align-items: flex-end;
  background: linear-gradient(180deg, #e7f7f5 0%, #fff5dc 68%, #e8c78a 68% 100%);
  border: 3px solid #3c3c3c;
  border-radius: 1.5rem;
  box-shadow: 0 7px 0 #3c3c3c;
  display: flex;
  height: 17rem;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.seville-scene .sun {
  background: #f7c85a;
  border-radius: 999px;
  height: 4.5rem;
  left: 12%;
  position: absolute;
  top: 12%;
  width: 4.5rem;
}

.seville-scene .tower {
  background: #df825e;
  border-radius: 0.7rem 0.7rem 0 0;
  bottom: 3.5rem;
  height: 8rem;
  position: absolute;
  right: 17%;
  width: 4.2rem;
}

.seville-scene .tower::before,
.seville-scene .tower::after {
  background: #fff2d1;
  border-radius: 999px 999px 0 0;
  content: "";
  height: 1.8rem;
  position: absolute;
  top: 1.2rem;
  width: 0.9rem;
}

.seville-scene .tower::before {
  left: 0.75rem;
}

.seville-scene .tower::after {
  right: 0.75rem;
}

.seville-scene .arch {
  background: var(--coral);
  border-radius: 8rem 8rem 0 0;
  bottom: 3.5rem;
  height: 5rem;
  left: 15%;
  position: absolute;
  width: 9rem;
}

.seville-scene .arch::after {
  background: #fff0cf;
  border-radius: 5rem 5rem 0 0;
  bottom: 0;
  content: "";
  height: 3.2rem;
  left: 2rem;
  position: absolute;
  width: 5rem;
}

.seville-scene .tree {
  background: #276d59;
  border-radius: 55% 45% 50% 50%;
  bottom: 4.1rem;
  height: 5rem;
  left: 49%;
  position: absolute;
  width: 3.5rem;
}

.seville-scene .tree::after {
  background: #8b5e3c;
  bottom: -2.2rem;
  content: "";
  height: 2.8rem;
  left: 1.45rem;
  position: absolute;
  width: 0.6rem;
}

.seville-scene .caption {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  bottom: 1rem;
  box-shadow: 0 5px 18px rgba(24, 49, 83, 0.11);
  font-size: 0.72rem;
  font-weight: 800;
  left: 50%;
  padding: 0.5rem 0.8rem;
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 3;
}

.reading-text p + p {
  margin-top: 1rem;
}

.verb-indefinido {
  background: rgba(239, 112, 93, 0.15);
  border-bottom: 2px solid var(--coral);
}

.verb-imperfecto {
  background: rgba(239, 185, 73, 0.18);
  border-bottom: 2px solid var(--gold);
}

.verb-perfecto {
  background: rgba(22, 125, 121, 0.14);
  border-bottom: 2px solid var(--teal);
}

.verb-indefinido,
.verb-imperfecto,
.verb-perfecto {
  border-radius: 0.25rem 0.25rem 0 0;
  font-weight: 750;
  padding: 0 0.12rem;
}

.note-paper {
  background-color: #fffef9;
  background-image: linear-gradient(transparent 2.15rem, rgba(22, 125, 121, 0.13) 2.2rem);
  background-size: 100% 2.2rem;
  border: 1px solid rgba(24, 49, 83, 0.12);
  line-height: 2.2rem;
  min-height: 18rem;
  padding: 0.65rem 1rem;
}

.lesson-pill {
  border: 2px solid #e5e5e5;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.4rem 0.65rem;
}

.mini-tag {
  background: var(--cream);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.25rem 0.5rem;
}

.toast {
  background: var(--ink);
  border-radius: 0.8rem;
  bottom: 1rem;
  box-shadow: 0 12px 30px rgba(24, 49, 83, 0.28);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  left: 50%;
  opacity: 0;
  padding: 0.75rem 1rem;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 1rem);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 80;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .exercise-card {
    border-radius: 1rem;
  }

  .btn {
    flex: 1 1 auto;
  }

  .sticky-progress {
    position: static;
  }

  .seville-scene {
    height: 14rem;
  }
}

@media print {
  body {
    background: white;
    font-size: 10pt;
  }

  .no-print,
  .sticky-progress,
  .exercise-actions,
  .toast {
    display: none !important;
  }

  .exercise-card,
  .paper-card {
    box-shadow: none;
    break-inside: avoid;
  }

  .answers-panel {
    display: none !important;
  }
}
