:root {
  --bg: #eef5f7;
  --panel: #fff;
  --line: #d5e4e9;
  --text: #22313a;
  --muted: #657781;
  --blue: #2f6fb2;
  --green: #2b7c4b;
  --yellow: #fff8d8;
  --orange: #d98447;
}

* {
  box-sizing: border-box;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background:
    linear-gradient(90deg, rgba(47,111,178,.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47,111,178,.05) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.75;
}

button,
input,
textarea {
  font: inherit;
}

.drill-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid #c8d8de;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
}

.drill-topbar p {
  margin: 0 0 2px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.drill-topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.drill-topbar a {
  padding: 8px 12px;
  border: 1px solid #cbdce3;
  border-radius: 8px;
  color: var(--blue);
  background: #fff;
  font-weight: 700;
  text-decoration: none;
}

.drill-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.drill-sidebar,
.drill-main {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(31, 58, 68, .07);
}

.drill-sidebar {
  position: sticky;
  top: 94px;
  align-self: start;
  padding: 20px;
}

.label,
.kicker {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.drill-sidebar h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
}

.drill-progress {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #c9dfe8;
  border-radius: 10px;
  background: #f6fbfd;
}

.drill-progress span {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-weight: 700;
}

.drill-progress div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce7f2;
}

.drill-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2f8c65;
}

.grade-button {
  width: 100%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #2f6fb2;
  border-radius: 10px;
  background: #2f6fb2;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.score-summary {
  min-height: 0;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.score-summary strong {
  display: block;
  color: var(--green);
  font-size: 22px;
  line-height: 1.2;
}

.score-summary span,
.score-summary small {
  display: block;
}

.drill-nav {
  display: grid;
  gap: 8px;
}

.drill-nav a {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dce8ec;
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  text-decoration: none;
  font-weight: 600;
}

.drill-nav span,
.section-head > span,
.question-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

.drill-nav span {
  width: 28px;
  height: 28px;
}

.drill-main {
  overflow: hidden;
}

.drill-content {
  display: grid;
  gap: 22px;
  padding: 22px;
}

.drill-lead,
.drill-section,
.drill-question,
.word-bank,
.checklist,
.reflection {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.drill-lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
  align-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fbfc 100%);
  border-color: #c2dde7;
}

.drill-lead h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
}

.drill-lead p:last-child {
  margin: 0;
  font-size: 16px;
  line-height: 2;
}

.drill-lead img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.styled.keyword {
  background: #e8f2ff;
  color: #135fa5;
  font-weight: 700;
}

.styled.focus {
  background: #fff7cf;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.styled.choice_label {
  color: #9e4c1d;
  font-weight: 700;
}

.drill-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: rgba(255,255,255,.82);
  scroll-margin-top: 104px;
}

.section-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #c2d8ea;
  border-radius: 12px;
  background: linear-gradient(90deg, #f8fbff 0%, #fff 100%);
}

.section-head > span {
  width: 48px;
  height: 48px;
  font-size: 25px;
}

.section-head h2 {
  margin: 0;
  color: var(--blue);
  font-size: 22px;
  font-weight: 700;
}

.section-head p {
  margin: 0;
  font-weight: 500;
}

.drill-nav a[href="#section-section-summary"] span,
#section-section-summary .section-head > span {
  background: var(--green);
}

#section-section-summary .section-head {
  border-color: #9fcf9f;
  background: linear-gradient(90deg, #f7fff7 0%, #fff 100%);
}

#section-section-summary .section-head h2 {
  color: var(--green);
}

.word-bank {
  padding: 14px;
  background: #f5fbff;
  border-color: #9fc6ec;
}

.word-bank strong {
  display: block;
  margin-bottom: 8px;
}

.word-bank div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-bank span {
  padding: 5px 10px;
  border: 1px solid #8fbbe7;
  border-radius: 999px;
  background: #eaf5ff;
  color: #1f5f9d;
  font-weight: 600;
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

.term-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid #d8e5e9;
  border-radius: 12px;
  background: #fff;
}

.term-item.is-correct,
.drill-question.is-correct {
  border-color: #80c69a;
  background: #f7fff9;
}

.term-item.is-incorrect,
.drill-question.is-incorrect {
  border-color: #e4a2a2;
  background: #fff8f8;
}

.term-item.is-pending,
.drill-question.is-pending {
  border-color: #d8c27c;
  background: #fffdf4;
}

.term-number {
  color: var(--blue);
  font-weight: 700;
}

.term-text {
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.8;
}

.term-item input {
  grid-column: 1 / -1;
  height: 38px;
  padding: 7px 9px;
  border: 1px solid #bfd2e4;
  border-radius: 8px;
}

.answer-feedback {
  display: none;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.answer-feedback:not(:empty) {
  display: block;
}

.is-correct .answer-feedback {
  color: var(--green);
}

.is-incorrect .answer-feedback {
  color: #b34444;
}

.is-pending .answer-feedback {
  color: #9b7619;
}

.drill-question {
  padding: 16px;
}

.question-text {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 500;
  line-height: 2;
}

.question-label {
  min-width: 42px;
  height: 27px;
  margin-top: 3px;
  font-size: 14px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin: 10px 0 4px;
}

.choices label {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #efd2bd;
  border-radius: 10px;
  background: #fff8f2;
  font-weight: 500;
  cursor: pointer;
}

.choices input {
  width: 16px;
  height: 16px;
}

.choices label > span {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}

.short-answer,
.writing,
.reflection label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.short-answer input,
.writing textarea,
.reflection textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #b8c9e6;
  border-radius: 10px;
  color: var(--text);
}

.short-answer input {
  min-height: 42px;
}

.writing textarea,
.reflection textarea {
  min-height: 90px;
  resize: vertical;
}

.assets {
  display: grid;
  gap: 10px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #cfe5d6;
  border-radius: 12px;
  background: #f8fdf9;
}

.assets.material-assets {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.assets.figure-assets {
  grid-template-columns: 1fr;
}

.figure,
.material {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
}

.material {
  display: grid;
  grid-template-rows: 120px 1fr;
}

.material img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  border-bottom: 1px solid var(--line);
  background: #f9fbfc;
}

.material div {
  padding: 10px;
}

.material strong {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.material strong span {
  margin-right: 6px;
  color: var(--blue);
}

.material p {
  margin: 0;
  font-size: 13px;
}

.checklist,
.reflection {
  padding: 16px;
  background: #fbfff8;
  border-color: #cde5c6;
}

.checklist h3,
.reflection h3 {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 700;
}

.checklist p {
  margin: 0 0 10px;
  font-weight: 500;
}

.checklist > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px 18px;
}

.checklist label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checklist input {
  width: 15px;
  height: 15px;
}

@media (max-width: 1100px) {
  .assets.material-assets,
  .checklist > div,
  .choices,
  .term-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .drill-topbar {
    display: block;
  }

  .drill-topbar a {
    display: inline-flex;
    margin-top: 10px;
  }

  .drill-shell,
  .drill-lead,
  .section-head,
  .assets.material-assets,
  .choices,
  .term-grid,
  .checklist > div {
    grid-template-columns: 1fr;
  }

  .drill-shell {
    padding: 14px;
  }

  .drill-sidebar {
    position: static;
  }
}
