:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-muted: #eef2ef;
  --text: #1d2521;
  --muted: #62706a;
  --line: #d9e0dc;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d8ede9;
  --warning: #8a5a13;
  --warning-soft: #fff3d8;
  --danger-soft: #f8e1df;
  --success-soft: #dff1e6;
  --shadow: 0 14px 40px rgba(24, 38, 33, 0.08);
  --max-content: 850px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(246, 247, 245, 0) 280px),
    var(--bg);
  line-height: 1.6;
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: inherit;
}

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

figure {
  margin: 0;
}

.home-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0;
}

.home-header {
  max-width: 760px;
  margin-bottom: 36px;
}

.eyebrow,
.course-count {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 980px;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.16;
  letter-spacing: 0;
}

h3 {
  margin: 24px 0 10px;
  font-size: 1.08rem;
  line-height: 1.25;
}

.home-header p:not(.eyebrow),
.course-description {
  color: var(--muted);
  font-size: 1.05rem;
}

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

.course-card {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.button-link,
.secondary-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.button-link {
  width: fit-content;
  background: var(--accent);
  color: #fff;
}

.button-link:hover {
  background: var(--accent-strong);
}

.secondary-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.course-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
}

.course-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding: 24px;
  backdrop-filter: blur(16px);
}

.home-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.course-sidebar h1 {
  margin-bottom: 24px;
  font-size: 1.18rem;
  line-height: 1.25;
}

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

.course-sidebar nav a,
.lesson-list a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.course-sidebar nav a {
  padding: 10px;
  font-size: 0.94rem;
}

.course-sidebar nav a span,
.lesson-list a span {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.course-sidebar nav a:hover,
.course-sidebar nav a.active,
.lesson-list a:hover {
  background: var(--accent-soft);
}

.course-main {
  min-width: 0;
  padding: 48px 32px;
}

.lesson-page {
  width: min(var(--max-content), 100%);
  margin: 0 auto;
  min-width: 0;
}

.lesson-header {
  margin-bottom: 34px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.lesson-header h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

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

.lesson-list a {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.lesson-content {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.content-block {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.rich-text,
.note-block,
.quote-block,
.callout-block,
.list-block,
.process-block,
.tabs-block,
.accordion-block,
.scenario-block,
.quiz-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
}

.rich-text > :first-child,
.note-block > div > :first-child,
.quote-block > div > :first-child,
.process-block li > :first-child,
.tabs-block details > div > :first-child,
.accordion-block details > div > :first-child,
.scenario-node > :first-child {
  margin-top: 0;
}

.rich-text > :last-child,
.note-block > div > :last-child,
.quote-block > div > :last-child,
.process-block li > :last-child,
.tabs-block details > div > :last-child,
.accordion-block details > div > :last-child,
.scenario-node > :last-child,
.quiz-question > :last-child,
.quiz-option-content > :last-child,
.quiz-result > :last-child {
  margin-bottom: 0;
}

.rich-text h2,
.rich-text h3,
.rich-text h4 {
  color: var(--text);
}

.rich-text p,
.rich-text li,
.note-block,
.quote-block,
.list-block,
.process-block,
.tabs-block,
.accordion-block,
.scenario-block,
.quiz-block {
  font-size: 1.02rem;
}

.rich-text ul,
.rich-text ol,
.list-block ul,
.list-block ol,
.process-block ol,
.scenario-options {
  padding-left: 1.35rem;
}

.mention {
  color: var(--accent-strong);
  font-weight: 700;
}

.media-block {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.media-block img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}

.media-hero img {
  max-height: 380px;
}

.media-block figcaption {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.note-block {
  border-color: #c7ddd7;
  background: #f2faf7;
}

.quote-block {
  margin: 0;
  border-left: 5px solid var(--accent);
}

.quote-block footer {
  margin-top: 14px;
  color: var(--muted);
}

.callout-block {
  background: var(--accent-soft);
  border-color: #b9ddd6;
}

.callout-block p {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
}

.process-block ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.4rem;
}

.process-block li {
  padding-left: 8px;
}

.tabs-block,
.accordion-block {
  display: grid;
  gap: 10px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 800;
}

details > div {
  padding: 0 16px 16px;
}

.scenario-block {
  display: grid;
  gap: 16px;
}

.quiz-block {
  display: grid;
  gap: 18px;
}

.quiz-question h2 {
  margin-top: 0;
}

.quiz-options,
.sorting-items,
.matching-items,
.ranking-items {
  display: grid;
  gap: 12px;
}

.quiz-option,
.sorting-row,
.matching-row,
.ranking-row {
  display: grid;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 14px;
}

.quiz-option {
  grid-template-columns: auto minmax(0, 1fr);
  cursor: pointer;
}

.quiz-option input {
  margin-top: 7px;
}

.quiz-option-content {
  min-width: 0;
}

.quiz-option-feedback {
  grid-column: 2;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  padding-left: 12px;
}

.sorting-row,
.matching-row {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.65fr);
}

.ranking-row {
  grid-template-columns: 90px minmax(0, 1fr);
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quiz-actions button,
.scenario-option-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 16px;
  text-align: left;
}

.quiz-actions button[type="reset"] {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.scenario-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.scenario-option-button.is-selected {
  background: var(--accent-strong);
}

.quiz-option.is-correct,
.sorting-row.is-correct,
.matching-row.is-correct,
.ranking-row.is-correct {
  border-color: #8cc9a5;
  background: var(--success-soft);
}

.quiz-option.is-incorrect,
.sorting-row.is-incorrect,
.matching-row.is-incorrect,
.ranking-row.is-incorrect {
  border-color: #e2aaa6;
  background: var(--danger-soft);
}

.quiz-result,
.quiz-message {
  border-radius: 8px;
  margin: 0;
  padding: 14px 16px;
}

.quiz-score-panel {
  margin-top: 24px;
  border: 1px solid #b9ddd6;
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 20px 24px;
}

.quiz-score-panel h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.quiz-score-panel p {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 800;
}

.quiz-result-correct {
  background: var(--success-soft);
}

.quiz-result-incorrect,
.quiz-message {
  background: var(--warning-soft);
  color: var(--warning);
}

.rating-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rating-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 10px 14px;
}

.scenario-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 18px;
}

.scenario-node.result-correct {
  background: var(--success-soft);
}

.scenario-node.result-incorrect {
  background: var(--danger-soft);
}

.scenario-image {
  margin: 0 0 16px;
  overflow: hidden;
  border-radius: 8px;
}

.scenario-image img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.lesson-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.lesson-footer.single-action {
  justify-content: flex-start;
}

@media (max-width: 860px) {
  .course-grid {
    grid-template-columns: 1fr;
  }

  .course-shell {
    display: block;
  }

  .course-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }

  .course-sidebar nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .course-sidebar nav a {
    min-width: 220px;
  }

  .course-main {
    padding: 28px 16px;
  }

  .home-page {
    padding: 40px 0;
  }
}

@media (max-width: 560px) {
  .home-page {
    width: min(100% - 24px, 1120px);
    padding: 28px 0;
  }

  .home-header {
    margin-bottom: 22px;
  }

  h1,
  .lesson-header h1 {
    font-size: 1.75rem;
    line-height: 1.15;
  }

  h2 {
    font-size: 1.42rem;
  }

  .course-main {
    padding: 20px 12px;
  }

  .course-sidebar h1 {
    margin-bottom: 14px;
    font-size: 1rem;
  }

  .lesson-header {
    margin-bottom: 18px;
    padding-bottom: 16px;
  }

  .lesson-content {
    gap: 16px;
  }

  .course-card,
  .rich-text,
  .note-block,
  .quote-block,
  .callout-block,
  .list-block,
  .process-block,
  .tabs-block,
  .accordion-block,
  .scenario-block {
    padding: 18px;
  }

  .quiz-block {
    padding: 18px;
  }

  .quiz-score-panel {
    padding: 18px;
  }

  .media-block figcaption {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .media-block img {
    max-height: 340px;
  }

  .rich-text p,
  .rich-text li,
  .note-block,
  .quote-block,
  .list-block,
  .process-block,
  .tabs-block,
  .accordion-block,
  .scenario-block {
    font-size: 1rem;
  }

  .quiz-block {
    font-size: 1rem;
  }

  .sorting-row,
  .matching-row,
  .ranking-row {
    grid-template-columns: 1fr;
  }

  .quiz-option {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .quiz-option-feedback {
    grid-column: 1 / -1;
  }

  .quiz-actions button,
  .scenario-option-button {
    width: 100%;
  }

  .callout-block p {
    font-size: 1rem;
  }

  .lesson-footer {
    flex-direction: column;
  }

  .button-link,
  .secondary-link {
    width: 100%;
  }
}
