.training-home-hero {
  min-height: 0;
  padding-block: clamp(25px, 4.5vw, 47px);
  grid-template-columns: minmax(0, 1.65fr) minmax(0, .85fr);
}

.training-home-hero h1 { font-size: clamp(3rem, 7vw, 5.5rem); }
.training-home-hero .mission-brief { max-width: 41ch; margin-top: 17px; }
.training-home-hero .mission-actions { margin-top: 20px; }
.training-home-hero .mission-rules { margin-top: 14px; }
.training-home-hero .mission-art { max-width: 310px; }

.focus-row, .extra-round {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: clamp(18px, 3vw, 25px);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.focus-row {
  margin-top: 26px;
  background: #fff7d7;
  border-color: #ead48e;
}

.focus-label {
  margin-bottom: 3px;
  color: #6b4e09;
  font-size: .875rem;
  font-weight: 800;
}

.focus-row h2, .extra-round h2, .topic-heading h2 {
  font-size: clamp(1.125rem, 2.8vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: -.027em;
}

.focus-row h2 + p, .extra-round h2 + p {
  margin-top: 6px;
  font-size: .95rem;
  line-height: 1.45;
  color: #474a67;
}

.focus-action {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  flex: none;
  padding: 8px 15px;
  border-radius: 8px;
  background: #2b2857;
  color: white;
  font-weight: 760;
  text-decoration: none;
}
.focus-action:hover { background: #3f3877; }

.topic-section { margin-top: 29px; }
.topic-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 12px;
}

.topic-heading p { color: #4c5476; font-size: .9rem; font-weight: 700; }

.topic-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

[data-color] { --topic-accent: #30678e; --topic-pale: #e4f0fa; }
[data-color="purple"] { --topic-accent: #70468b; --topic-pale: #f0e8f6; }
[data-color="gold"] { --topic-accent: #74510a; --topic-pale: #fff2c9; }
[data-color="red"] { --topic-accent: #934549; --topic-pale: #fbeaec; }

.topic-tile {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 115px;
  padding: 15px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--topic-accent);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
}
.topic-tile:hover { background: var(--topic-pale); }
.topic-tile h3 { font-size: 1.03rem; line-height: 1.25; }
.topic-tile p { font-size: .925rem; color: var(--subtle); line-height: 1.4; }
.topic-tile span { color: var(--topic-accent); margin-top: auto; font-size: .875rem; font-weight: 750; }

.extra-round { margin-top: 17px; background: #f8f9ff; }
.extra-round h2 { font-size: 1.08rem; }
.extra-actions { display: flex; gap: 8px 16px; flex-wrap: wrap; }
.extra-actions a { color: var(--blue-dark); font-size: .9375rem; font-weight: 700; text-underline-offset: 3px; }

.workbook {
  --book-paper: #fffcf4;
  --book-line: #648aaa22;
  --book-margin: #d2928d6e;
  --book-ink: #263942;
  background: #edeae4;
  color: var(--book-ink);
}

.workbook-main {
  --binding: clamp(23px, 6vw, 66px);
  width: min(100% - 36px, 820px);
  margin-block: clamp(22px, 4vw, 41px) 40px;
}

.book-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 9px;
  font-size: .92rem;
  font-weight: 760;
}
.book-kicker { color: #355e80; }
.book-counter { color: #4d5b66; }

.book-progress {
  display: flex;
  gap: 5px;
  margin-bottom: 16px;
}
.book-progress span { flex: 1; height: 5px; border-radius: 4px; background: #d4d9dd; }
.book-progress .is-current { background: #406b8e; }
.book-progress .is-done { background: #7ca499; }

.paper {
  min-height: 475px;
  border: 1px solid #d4ccc0;
  border-top: 5px solid var(--topic-accent, #30678e);
  border-radius: 6px 7px 9px 6px;
  background:
    linear-gradient(90deg, transparent var(--binding), var(--book-margin) var(--binding), var(--book-margin) calc(var(--binding) + 1px), transparent calc(var(--binding) + 1px)),
    repeating-linear-gradient(0deg, transparent 0 22px, var(--book-line) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, var(--book-line) 22px 23px),
    var(--book-paper);
  box-shadow: 0 4px 0 #e4ded2, 0 5px 0 #cfc6b8, 0 13px 27px #55483417;
}

.paper-content {
  max-width: 100%;
  padding: clamp(22px, 5vw, 44px) clamp(16px, 5vw, 44px) 34px calc(var(--binding) + clamp(13px, 3vw, 24px));
}

.sheet-topic {
  display: inline-block;
  padding: 4px 8px;
  margin-bottom: 13px;
  border-radius: 4px;
  background: var(--topic-pale);
  color: var(--topic-accent);
  font-size: .9rem;
  font-weight: 800;
}

.paper h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.8rem);
  letter-spacing: -.039em;
  line-height: 1.11;
}

.paper h1:focus { outline: none; }

.problem-text, .problem-statement {
  max-width: 47ch;
  margin-top: 15px;
  font-size: clamp(1rem, 2.5vw, 1.16rem);
  line-height: 1.55;
}
.problem-statement { font-weight: 720; }
.problem-expression {
  margin-top: 18px;
  font: 740 clamp(1.34rem, 4.8vw, 2.3rem)/1.35 var(--mono);
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.paper-answers {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 13px 24px;
  margin-top: 20px;
}

.paper-field {
  display: grid;
  width: min(100%, 210px);
  gap: 4px 9px;
  color: #385364;
  font-size: 1rem;
  font-weight: 720;
}

.paper-field:has(.inline-equation) {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
}

.inline-equation { font: 730 clamp(1.28rem, 3vw, 1.65rem)/1.5 var(--mono); color: var(--book-ink); }
.answer-line { display: flex; align-items: baseline; gap: 5px; }

.answer-line input {
  width: min(100%, 112px);
  min-height: 42px;
  padding: 3px 7px;
  background: #fffcf4cc;
  border: 1px solid #9cb4c0;
  border-bottom: 2px solid #486c86;
  border-radius: 4px 4px 2px 2px;
  color: #214667;
  font: 730 1.45rem/1 var(--mono);
}
.answer-line input:disabled { color: #4b535e; opacity: 1; }

.place-table {
  table-layout: fixed;
  border-collapse: collapse;
  width: min(100%, 307px);
  margin-top: 15px;
  background: #fbfcfc;
  text-align: center;
}

.place-table th, .place-table td {
  border: 1px solid #8299a8;
  width: 25%;
  padding: 6px 4px;
}
.place-table th { background: #e2edf5; font-size: .9rem; }
.place-table td { height: 58px; font: 700 1.1rem/1.2 var(--mono); }

.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: min(100%, 42px);
  margin-inline: auto;
}
.counters i { display: inline-block; aspect-ratio: 1; border-radius: 50%; background: #437dab; }

.place-answers { max-width: 307px; gap: 0; }
.place-answers .paper-field {
  width: 25%;
  text-align: center;
  background: #eef4f8;
  border: 1px solid #91a6b5;
  padding: 4px;
}
.place-answers .paper-field + .paper-field { border-left: 0; }
.place-answers .answer-line input { text-align: center; }

.answer-choices { min-width: 0; padding: 0; margin: 0; border: none; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.paper-choice { position: relative; cursor: pointer; }
.paper-choice > input {
  position: absolute;
  opacity: 0;
  margin: 0;
}

.paper-choice > span {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-height: 44px;
  align-content: center;
  padding: 8px 12px;
  border: 1px solid #9cb4c0;
  border-radius: 5px;
  background: #fbfcfc;
  font-weight: 700;
}
.paper-choice input:checked + span { outline: 2px solid #315f82; outline-offset: -2px; background: #deedf8; }
.paper-choice input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 3px; }

.cube-diagram {
  display: block;
  width: min(100%, 184px);
  height: auto;
  margin: 5px 0 0;
}

.view-grid { display: grid; grid-template-columns: repeat(var(--columns), 14px); }
.view-grid i { aspect-ratio: 1; background: white; border: 1px solid #a0b2c1; margin: -.5px; }
.view-grid .view-filled { background: #729fc1; }

.scratch, .review {
  width: fit-content;
  max-width: 100%;
  margin-top: 17px;
  color: #385364;
}
.scratch summary, .review summary { cursor: pointer; text-underline-offset: 3px; font-weight: 680; }
.scratch textarea {
  display: block;
  width: min(360px, 100%);
  margin-top: 7px;
  border: 1px solid #a0b2c1;
  border-radius: 4px;
  padding: 7px;
  background: repeating-linear-gradient(0deg, #fffcf4 0 22px, #d6e3ec 22px 23px);
  color: #214667;
  font: 1rem/23px var(--mono);
  resize: vertical;
}

.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.sheet-actions .primary { min-height: 46px; }
.paper-skip {
  background: transparent;
  color: #405a70;
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 44px;
  padding: 7px 8px;
  font-weight: 680;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.paper-skip:hover { background: #e4edf4; }
.paper-link { display: inline-flex; align-items: center; justify-content: center; }
.paper-link:not(.paper-skip) { text-decoration: none; }

.paper-message {
  margin-top: 18px;
  padding: 10px 12px;
  border-radius: 5px;
  border-left: 3px solid #9b6d10;
  background: #fff0c2;
  line-height: 1.5;
}
.paper-message strong { display: block; }
.paper-correct { border-color: #498063; background: #e7f3e8; }

.score-line { margin-top: 16px; font-size: 1.12rem; }
.earned-star {
  display: inline-block;
  margin-left: 9px;
  padding: 3px 8px;
  background: #fff0bb;
  border-radius: 5px;
  color: #74510a;
  font-weight: 780;
}

.test-breakdown { margin: 16px 0 0; padding: 0; list-style: none; }
.test-breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #c4d1d8;
  line-height: 1.35;
}
.test-breakdown a { color: #214f76; text-underline-offset: 3px; }
.test-breakdown span { white-space: nowrap; }
.review ol { padding-left: 21px; }
.review li { margin-bottom: 6px; line-height: 1.4; }
.review strong { margin-right: 5px; }

.next-practice {
  margin-top: 18px;
  padding: 12px;
  border-radius: 5px;
  background: #e7f0f7;
}
.next-practice h2 { font-size: .94rem; color: #3f6380; }
.next-practice p { margin-top: 3px; font-weight: 780; }

.workbook-division .practice {
  background:
    linear-gradient(90deg, transparent 17px, var(--book-margin) 17px, var(--book-margin) 18px, transparent 18px),
    repeating-linear-gradient(0deg, transparent 0 22px, var(--book-line) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, var(--book-line) 22px 23px),
    var(--book-paper);
  border-color: #d4ccc0;
  padding-left: max(28px, 4vw);
  box-shadow: 0 5px 0 #e4ded2;
}
.workbook-division .reference { background: #fffcf4; border-color: #d4ccc0; box-shadow: 0 5px 0 #e4ded2; }

@media (max-width: 790px) {
  .topic-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575px) {
  .training-home-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 19px;
  }
  .training-home-hero h1 { font-size: clamp(2.5rem, 12vw, 4rem); }
  .training-home-hero .mission-art { display: none; }
  .focus-row, .extra-round { align-items: flex-start; flex-direction: column; }
  .topic-list { grid-template-columns: minmax(0, 1fr); }
  .topic-tile { min-height: 0; }
}

@media (max-width: 420px) {
  .workbook-main { --binding: 12px; width: calc(100% - 20px); }
  .paper-content { padding-left: 23px; }
  .paper-answers { gap: 10px 14px; }
  .place-answers { gap: 0; }
  .view-grid { grid-template-columns: repeat(var(--columns), 12px); }
  .paper-choice > span { padding-inline: 8px; }
  .earned-star { margin: 5px 0 0; }
}

.topic-tile .readiness, .ready-message {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid #a7c7ae;
  border-radius: 7px;
  background: #e8f4e9;
  color: #285839;
  font-size: .875rem;
  font-weight: 780;
}

.topic-tile .readiness { margin-top: 0; }
.ready-message { margin-top: 10px; }
