:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: #172033;
  background: #f6f3ec;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

.site-header {
  padding: 2.75rem 2rem;
  border-bottom: 1px solid #ded8ca;
  background: #fffaf0;
}

.site-header__inner {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.site-header h1 {
  margin: 0 0 0.8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 4.15rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-header h1::after {
  content: "";
  display: block;
  width: 5rem;
  height: 1px;
  margin-top: 0.9rem;
  background: #8a6f38;
}

.site-header p {
  max-width: 760px;
  margin: 0;
  color: #596070;
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: #8a6f38;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 1.25rem;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 1.5rem 2rem 2.5rem;
}

.panel {
  background: #fffdf8;
  border: 1px solid #ded8ca;
  border-radius: 1.15rem;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgb(23 32 51 / 0.06);
}

.sidebar-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar-panel::-webkit-scrollbar {
  display: none;
}

.side-nav {
  display: grid;
  gap: 1.35rem;
}

.side-nav h2,
.content-panel h2 {
  margin-top: 0;
}

.side-nav h2 {
  margin-bottom: 0;
}

.nav-section {
  display: grid;
  gap: 0.7rem;
}

.section-nav-section {
  display: none;
}

.side-nav.has-active-chapter .chapter-nav-section {
  display: none;
}

.side-nav.has-active-chapter .section-nav-section {
  display: grid;
}

.nav-section h3 {
  margin: 0;
  color: #596070;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.content-panel {
  min-width: 0;
  padding: 2rem;
}

.chapter-header {
  scroll-margin-top: 1.25rem;
  margin: -0.25rem -0.25rem 1.75rem;
  padding: 1.5rem 1.5rem 1.35rem;
  border: 1px solid #e7dfcf;
  border-radius: 0.95rem;
  background: #fffaf0;
}

.chapter-header h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.chapter-header p:not(.eyebrow):not(.keywords) {
  max-width: 820px;
  margin: 0;
  color: #424a5b;
  font-size: 1.02rem;
}

.content-section {
  scroll-margin-top: 1.25rem;
  margin-block: 1.75rem;
}

.content-section > h3 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.chapter-list,
.section-list,
.section-links {
  display: grid;
  gap: 0.85rem;
}

.section-list,
.section-links {
  gap: 0.45rem;
}

.chapter-button {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 1rem;
  text-align: left;
  border: 1px solid #ded8ca;
  border-radius: 0.8rem;
  background: #ffffff;
  color: inherit;
  cursor: pointer;
}

.chapter-button:hover,
.chapter-button:focus,
.chapter-button.is-active {
  border-color: #9d7f45;
  outline: none;
  box-shadow: 0 0 0 3px rgb(157 127 69 / 0.13);
}

.chapter-button.is-active {
  background: #fffaf0;
}

.chapter-button span,
.keywords,
.muted {
  color: #646b7a;
  font-size: 0.92rem;
}

.keywords {
  margin-top: 0.85rem;
}

.current-chapter {
  margin: 0 0 0.4rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid #e4ded1;
  border-radius: 0.75rem;
  background: #fffaf0;
  color: #30384a;
  font-weight: 700;
  line-height: 1.35;
}

.back-to-chapters,
.section-link {
  display: block;
  width: 100%;
  padding: 0.62rem 0.78rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  background: transparent;
  color: #30384a;
  text-align: left;
  text-decoration: none;
  font: inherit;
}

.back-to-chapters {
  margin-bottom: 0.45rem;
  border-color: #ded8ca;
  background: #ffffff;
  cursor: pointer;
}

.back-to-chapters:hover,
.back-to-chapters:focus {
  border-color: #ded8ca;
  background: #fffaf0;
  outline: none;
}

.section-link:hover,
.section-link:focus {
  background: #fffaf0;
  outline: none;
}

.section-link.is-active {
  color: #172033;
  font-weight: 700;
}

.card {
  padding: 1.2rem 1.25rem;
  border: 1px solid #e4ded1;
  border-radius: 0.85rem;
  margin: 0.85rem 0;
  background: #ffffff;
}

.card h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.card p {
  margin-top: 0;
}

.exercise-prompt {
  line-height: 1.75;
}

.prompt-token {
  white-space: pre-wrap;
}

.latin-token {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.target-token {
  display: inline-block;
  padding: 0.02rem 0.25rem;
  border-radius: 0.35rem;
  background: #fff0b8;
  box-shadow: inset 0 -0.12rem 0 rgb(157 127 69 / 0.28);
}

.exercise-type {
  display: inline-flex;
  margin: 0 0 0.65rem;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  background: #f0eadc;
  color: #6f5a2f;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.answer-input {
  display: block;
  width: 100%;
  margin: 0.9rem 0;
  padding: 0.72rem 0.82rem;
  border: 1px solid #d8cfbf;
  border-radius: 0.65rem;
  background: #fffdf8;
  color: #172033;
  font: inherit;
}

textarea.answer-input {
  resize: vertical;
}

.answer-input:focus {
  border-color: #9d7f45;
  box-shadow: 0 0 0 3px rgb(157 127 69 / 0.13);
  outline: none;
}

.case-grid {
  margin: 0.9rem 0 1rem;
  max-width: 440px;
}

.morphology-note {
  margin: 0 0 0.45rem;
  color: #596070;
  font-size: 0.92rem;
}

.case-grid-wrap {
  overflow-x: auto;
  border: 1px solid #e4ded1;
  border-radius: 0.85rem;
}

.case-grid-table {
  min-width: 360px;
}

.case-grid-table th,
.case-grid-table td {
  padding: 0.65rem;
  text-align: center;
}

.case-grid-table tbody th {
  background: #fffaf0;
  color: #30384a;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-cell {
  width: 1.55rem;
  height: 1.55rem;
  border: 1px solid #cfc5b4;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
}

.case-cell:hover,
.case-cell:focus {
  border-color: #9d7f45;
  box-shadow: 0 0 0 3px rgb(157 127 69 / 0.13);
  outline: none;
}

.case-cell.is-selected {
  border-color: #172033;
  background: #172033;
  box-shadow: inset 0 0 0 4px #fffdf8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e4ded1;
  border-radius: 0.85rem;
  background: #ffffff;
}

.vocab-wrap {
  max-width: 920px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.vocab-table {
  table-layout: fixed;
}

.vocab-table.has-forms th:nth-child(1),
.vocab-table.has-forms td:nth-child(1) {
  width: 22%;
}

.vocab-table.has-forms th:nth-child(2),
.vocab-table.has-forms td:nth-child(2) {
  width: 36%;
}

.vocab-table.has-forms th:nth-child(3),
.vocab-table.has-forms td:nth-child(3) {
  width: 16%;
  white-space: nowrap;
}

.vocab-table.no-forms th:nth-child(1),
.vocab-table.no-forms td:nth-child(1) {
  width: 28%;
}

.vocab-table.no-forms th:nth-child(2),
.vocab-table.no-forms td:nth-child(2) {
  width: 18%;
  white-space: nowrap;
}

.vocab-forms {
  color: #424a5b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid #e4ded1;
  text-align: left;
  vertical-align: top;
}

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

th {
  background: #f0eadc;
  color: #30384a;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.choices {
  display: grid;
  gap: 0.55rem;
  margin: 0.9rem 0;
}

.choices label {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.check-button {
  padding: 0.65rem 0.95rem;
  border: 0;
  border-radius: 0.6rem;
  background: #172033;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.check-button:hover,
.check-button:focus {
  filter: brightness(1.08);
  outline: none;
}

.result {
  font-weight: 650;
}

.error {
  color: #a61b1b;
}

@media (max-width: 760px) {
  .site-header {
    padding: 2rem 1rem;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .sidebar-panel {
    position: static;
    max-height: none;
  }

  .content-panel,
  .panel {
    padding: 1.2rem;
  }

  .chapter-header {
    margin: 0 0 1.4rem;
    padding: 1.2rem;
  }
}
