:root {
  --bg: #686446;
  --ink: #ffffff;
  --panel: #35393d;
  --lime: #83d10b;
  --gold: #d6bc6c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(53, 57, 61, 0.22), rgba(104, 100, 70, 0) 340px),
    var(--bg);
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  display: flex;
  align-items: center;
  min-height: 82px;
  padding: 22px clamp(18px, 4vw, 64px);
  background: rgba(53, 57, 61, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  width: min(381px, calc(100vw - 36px));
  height: auto;
}

.brand:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 8px;
  border-radius: 8px;
}

.content-shell {
  width: min(920px, calc(100% - 36px));
  margin: clamp(32px, 6vw, 72px) auto;
}

.panel {
  padding: clamp(22px, 4vw, 38px);
  color: #211f19;
  background: #f7f4e8;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel h1 {
  margin: 0 0 22px;
  color: #284c48;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  font-weight: 900;
}

.panel h2 {
  margin: 0 0 14px;
  color: #284c48;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
}

.home-shell {
  width: min(1120px, calc(100% - 36px));
}

.home-intro {
  max-width: 760px;
  margin: -8px 0 28px;
  color: #6f6a58;
  font-size: 1.05rem;
  line-height: 1.55;
}

.exercise-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.exercise-card {
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 18px;
  color: #211f19;
  background: #fff;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.exercise-card:hover,
.exercise-card:focus-visible {
  border-color: rgba(131, 209, 11, 0.72);
  box-shadow: 0 18px 34px rgba(23, 22, 15, 0.18);
  transform: translateY(-2px);
}

.exercise-card:focus-visible {
  outline: 3px solid rgba(131, 209, 11, 0.32);
  outline-offset: 2px;
}

.exercise-card span {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.exercise-card strong {
  color: #284c48;
  font-size: 1.28rem;
  line-height: 1.12;
}

.exercise-card p {
  margin: 0;
  color: #6f6a58;
  line-height: 1.45;
}

.character-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.character-card {
  display: grid;
  overflow: hidden;
  color: #211f19;
  background: #fff;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 16px 34px rgba(23, 22, 15, 0.14);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.character-card:hover,
.character-card:focus-visible {
  border-color: rgba(131, 209, 11, 0.72);
  box-shadow: 0 22px 44px rgba(23, 22, 15, 0.22);
  transform: translateY(-2px);
}

.character-card:focus-visible {
  outline: 3px solid rgba(131, 209, 11, 0.32);
  outline-offset: 2px;
}

.character-card img {
  width: 100%;
  height: clamp(280px, 42vw, 520px);
  object-fit: contain;
  background: #f7f4e8;
}

.character-card span,
.character-card strong {
  padding: 0 20px;
}

.character-card span {
  margin-top: 18px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.character-card strong {
  margin: 4px 0 20px;
  color: #284c48;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  font-weight: 900;
}

.story-intro {
  display: grid;
  gap: 22px;
}

.story-intro h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  text-transform: none;
}

.story-intro > img {
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
}

.story-intro .home-intro {
  margin: -6px 0 4px;
}

.continue-button {
  justify-self: center;
  min-height: 50px;
  padding: 0 28px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(180deg, var(--lime), #4f9f00);
  box-shadow: 0 12px 28px rgba(52, 95, 0, 0.3);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.continue-button:focus-visible {
  outline: 3px solid rgba(131, 209, 11, 0.32);
  outline-offset: 3px;
}

.chapter-comic {
  width: 100%;
  margin: 0;
}

.comic-zoom-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.comic-zoom-toolbar button {
  min-width: 46px;
  min-height: 38px;
  padding: 0 14px;
  box-shadow: none;
}

.comic-zoom-toolbar button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.comic-zoom-toolbar span {
  min-width: 58px;
  color: #284c48;
  font-weight: 900;
  text-align: center;
}

.comic-zoom-viewport {
  overflow: auto;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
  background: #fff;
  user-select: none;
}

.comic-zoom-viewport.is-zoomed {
  max-height: min(78vh, 760px);
  cursor: grab;
  touch-action: none;
}

.comic-zoom-viewport.is-dragging {
  cursor: grabbing;
}

.chapter-comic img {
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  pointer-events: none;
  user-select: none;
}

.chapter-exercise {
  display: grid;
  gap: 18px;
}

.student-data {
  display: grid;
  gap: 12px;
  margin: 0;
}

.student-data div {
  display: grid;
  grid-template-columns: minmax(170px, 0.42fr) 1fr;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #d7cfb5;
}

.student-data div:first-child {
  border-top: 0;
}

.student-data dt {
  color: #6f6a58;
  font-weight: 700;
}

.student-data dd {
  margin: 0;
  font-weight: 900;
}

.student-form {
  display: grid;
  gap: 16px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-form label {
  display: grid;
  gap: 7px;
  color: #6f6a58;
  font-size: 0.94rem;
  font-weight: 700;
}

.student-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d7cfb5;
  border-radius: 7px;
  color: #211f19;
  background: #fff;
  font: inherit;
}

.student-form input:focus {
  outline: 3px solid rgba(131, 209, 11, 0.32);
  border-color: var(--lime);
}

.student-form button,
.exercise-form button {
  justify-self: start;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(180deg, var(--lime), #4f9f00);
  box-shadow: 0 12px 28px rgba(52, 95, 0, 0.3);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.exercise-shell {
  display: grid;
  gap: 22px;
}

.exercise-form {
  display: grid;
  gap: 26px;
}

.form-section {
  padding-top: 22px;
  border-top: 1px solid #d7cfb5;
}

.form-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.help-text {
  margin: -4px 0 18px;
  color: #6f6a58;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.cost-table th,
.cost-table td {
  padding: 13px 15px;
  border-bottom: 1px solid #e5dec9;
  text-align: left;
}

.cost-table th {
  color: #fff;
  background: #35393d;
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cost-table tr:last-child td {
  border-bottom: 0;
}

.cost-table td:last-child,
.cost-table th:last-child {
  text-align: right;
  font-weight: 900;
}

.total-row td {
  color: #284c48;
  background: #e4efdf;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-bottom: 20px;
}

.answer-grid label {
  display: grid;
  gap: 7px;
  color: #6f6a58;
  font-size: 0.94rem;
  font-weight: 700;
}

.answer-grid input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d7cfb5;
  border-radius: 7px;
  color: #211f19;
  background: #fff;
  font: inherit;
}

.answer-grid input:focus {
  outline: 3px solid rgba(131, 209, 11, 0.32);
  border-color: var(--lime);
}

.total-answer {
  grid-column: 1 / -1;
}

.result-panel h2 {
  margin-bottom: 10px;
}

.score {
  margin: 0 0 18px;
  color: #284c48;
  font-size: 1.25rem;
  font-weight: 900;
}

.result-list {
  display: grid;
  gap: 10px;
}

.result-list div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
  background: #fff;
}

.result-list span {
  color: #6f6a58;
}

.result-list .is-correct {
  border-color: rgba(27, 143, 90, 0.4);
  background: #e4efdf;
}

.result-list .is-wrong {
  border-color: rgba(188, 59, 59, 0.38);
  background: #f8e7e2;
}

body > form,
body > h1,
body > table,
body > .calificacion {
  width: min(1080px, calc(100% - 36px));
  margin-left: auto;
  margin-right: auto;
}

body > form {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: clamp(32px, 6vw, 72px);
  margin-bottom: clamp(32px, 6vw, 72px);
  padding: clamp(22px, 4vw, 38px);
  color: #211f19;
  background: #f7f4e8;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

body > h1 {
  margin-top: clamp(32px, 6vw, 72px);
  margin-bottom: 22px;
  padding: clamp(22px, 4vw, 34px);
  color: #f7f4e8;
  background: rgba(53, 57, 61, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
}

form h2,
body > table + table {
  margin-top: 10px;
}

form h2 {
  margin-bottom: 0;
  color: #284c48;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

form p {
  margin: 0;
  color: #6f6a58;
  line-height: 1.5;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  color: #211f19;
  background: #fff;
  border: 1px solid #d7cfb5;
  border-radius: 8px;
}

body > table {
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid #e5dec9;
  text-align: left;
}

tr:last-child td {
  border-bottom: 0;
}

tr:has(.resultado-incorrecto) {
  background: #f8e7e2;
}

tr:has(.resultado-incorrecto) td {
  background: #f8e7e2;
  border-bottom-color: rgba(188, 59, 59, 0.28);
}

.resultado-incorrecto {
  color: #bc3b3b;
  font-weight: 900;
}

.resultado-correcto {
  color: #1b8f5a;
  font-weight: 900;
}

th,
body > table tr:first-child td {
  color: #fff;
  background: #35393d;
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  background: #fff;
}

td:last-child,
th:last-child {
  text-align: right;
}

input,
select,
textarea {
  font: inherit;
}

input[type="text"],
input[type="mail"],
input[type="email"],
input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d7cfb5;
  border-radius: 7px;
  color: #211f19;
  background: #fff;
}

input[type="text"]:focus,
input[type="mail"]:focus,
input[type="email"]:focus,
input[type="number"]:focus {
  outline: 3px solid rgba(131, 209, 11, 0.32);
  border-color: var(--lime);
}

form > div,
.dataEjercicio {
  display: grid;
  gap: 12px;
}

form > div:not(.dataEjercicio) {
  grid-template-columns: minmax(210px, 0.42fr) 1fr;
  align-items: center;
}

.chapter-exercise {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.chapter-exercise > * {
  min-width: 0;
}

.chapter-exercise h2 {
  margin-top: 0;
}

form label {
  color: #6f6a58;
  font-weight: 700;
}

.dataEjercicio {
  padding-top: 8px;
}

.tablacolumnas {
  display: grid;
  gap: 12px;
}

.tablacolumnas > div,
.dataEjercicio > div:not(.tablacolumnas) {
  display: grid;
  grid-template-columns: minmax(210px, 0.45fr) 1fr;
  align-items: center;
  gap: 16px;
}

.tablacolumnas > div:first-child,
.dataEjercicio > div:first-child {
  padding: 10px 0;
  border-bottom: 1px solid #d7cfb5;
}

hr {
  width: 100%;
  border: 0;
  border-top: 1px solid #d7cfb5;
}

button {
  justify-self: start;
  align-self: start;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(180deg, var(--lime), #4f9f00);
  box-shadow: 0 12px 28px rgba(52, 95, 0, 0.3);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.calificacion {
  margin-top: 0;
  margin-bottom: clamp(32px, 6vw, 72px);
  padding: 22px;
  color: #f7f4e8;
  background: #284c48;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  font-weight: 900;
}

@media (max-width: 560px) {
  .site-header {
    justify-content: center;
    min-height: 74px;
    padding: 18px;
  }

  .student-data div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .exercise-list {
    grid-template-columns: 1fr;
  }

  .character-choice {
    grid-template-columns: 1fr;
  }

  body > form,
  body > h1,
  body > table,
  body > .calificacion {
    width: min(100% - 24px, 1080px);
  }

  form > div:not(.dataEjercicio),
  .tablacolumnas > div,
  .dataEjercicio > div:not(.tablacolumnas) {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  th,
  td {
    padding: 11px 12px;
  }
}
