:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e2e6ea;
  --text: #1f2933;
  --muted: #5c6b7a;
  --accent: #0b7285;
  --accent-dark: #095c6c;
  --accent-soft: #e3f2f5;
  --danger: #b02a37;
  --danger-soft: #fbe9eb;
  --success: #1b7f4b;
  --success-soft: #e6f5ec;
  --warning: #8a6100;
  --warning-soft: #fdf3dd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 14px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 18px;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-dark);
}

h1, h2, h3 {
  line-height: 1.25;
  color: var(--text);
}

p {
  margin: 0 0 1em;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.trainee-name {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.95rem;
  padding: 8px 6px;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent-dark);
}

main {
  padding-top: 26px;
  padding-bottom: 60px;
}

.hero {
  margin-bottom: 22px;
}

.hero h1 {
  font-size: 1.7rem;
  margin: 0 0 6px;
}

.lede {
  color: var(--muted);
  margin: 0;
}

.breadcrumb {
  margin: 0 0 18px;
  font-size: 0.95rem;
}

.lesson-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin-bottom: 26px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.lesson-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.lesson-card:hover {
  color: inherit;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(16, 24, 40, 0.08), 0 10px 24px rgba(16, 24, 40, 0.1);
}

.lesson-card:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
.option:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.15rem;
  margin: 0;
}

.card-summary {
  color: var(--muted);
  margin: 0 0 10px;
}

.card-score {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-notstarted {
  background: #eef1f4;
  color: var(--muted);
  border-color: #dbe1e7;
}

.badge-progress {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: #f0dcae;
}

.badge-passed {
  background: var(--success-soft);
  color: var(--success);
  border-color: #bfe3cd;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 13px 20px;
  min-height: 48px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: #eccdd1;
}

.btn-danger:hover {
  background: var(--danger-soft);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
}

.notice-error {
  border-color: #eccdd1;
  background: var(--danger-soft);
  color: var(--danger);
}

.notice-error .btn {
  margin-top: 8px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  max-width: 420px;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.modal p {
  color: var(--muted);
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  font: inherit;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 48px;
  background: #ffffff;
  color: var(--text);
}

.text-input:focus {
  border-color: var(--accent);
}

.field-error {
  color: var(--danger);
  font-size: 0.92rem;
  margin: 8px 0 0;
}

.field-error.hidden {
  display: none;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.lesson-header {
  margin-bottom: 20px;
}

.lesson-header h1 {
  font-size: 1.6rem;
  margin: 10px 0 0;
}

.lesson-section {
  margin-bottom: 22px;
}

.lesson-section h2 {
  font-size: 1.25rem;
  margin: 0 0 10px;
}

.lesson-figure {
  margin: 0 0 18px;
  text-align: center;
}

.lesson-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.lesson-figure figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.quiz-root {
  margin-top: 30px;
  scroll-margin-top: 80px;
}

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

.quiz-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.quiz-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.question-text {
  font-size: 1.2rem;
  margin: 0 0 18px;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px 16px;
  min-height: 52px;
  cursor: pointer;
  color: var(--text);
}

.option:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option:disabled {
  cursor: default;
}

.option-marker {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid #b9c2cc;
  background: #ffffff;
}

.option-text {
  flex: 1 1 auto;
}

.option-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.option-correct .option-marker {
  border-color: var(--success);
  background: var(--success);
}

.option-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.option-wrong .option-marker {
  border-color: var(--danger);
  background: var(--danger);
}

.feedback {
  margin-top: 20px;
  padding: 16px;
  border-radius: 10px;
  background: #f7f9fb;
  border: 1px solid var(--border);
}

.feedback.hidden {
  display: none;
}

.feedback-title {
  font-weight: 700;
  margin: 0 0 8px;
}

.feedback-correct {
  color: var(--success);
}

.feedback-wrong {
  color: var(--danger);
}

.feedback-text {
  margin: 0 0 8px;
}

.feedback-reveal {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--success-soft);
  border-radius: 8px;
}

.feedback-reveal strong {
  color: var(--success);
}

.quiz-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.result {
  text-align: center;
}

.result-pass {
  border-color: #bfe3cd;
}

.result-fail {
  border-color: #eccdd1;
}

.result h2 {
  margin: 0 0 6px;
}

.result-pass h2 {
  color: var(--success);
}

.result-fail h2 {
  color: var(--danger);
}

.result-score {
  font-size: 2.6rem;
  font-weight: 800;
  margin: 6px 0;
  line-height: 1;
}

.result-detail {
  color: var(--muted);
  margin: 0 0 4px;
}

.result-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.review {
  margin-top: 20px;
}

.review h2 {
  margin-top: 0;
}

.review-intro {
  color: var(--muted);
}

.review-item {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.review-item:first-of-type {
  border-top: none;
}

.review-question {
  font-weight: 600;
  margin: 0 0 10px;
}

.review-line {
  margin: 0 0 6px;
}

.review-your {
  color: var(--danger);
}

.review-correct {
  color: var(--success);
  font-weight: 600;
}

.review-explanation {
  margin: 8px 0 0;
  color: var(--muted);
}

.review-empty {
  color: var(--success);
  font-weight: 600;
  margin: 0;
}

.course-note {
  margin-bottom: 22px;
}

.course-note p {
  margin: 0;
  color: var(--muted);
}

.course-step {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 24px;
}

.step-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.step-read {
  margin: 0 0 16px;
}

.step-complete {
  color: var(--success);
  font-weight: 600;
  margin: 0 0 12px;
}

.hidden {
  display: none;
}

@media (min-width: 640px) {
  body {
    font-size: 18px;
  }
  .lesson-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hero h1 {
    font-size: 2rem;
  }
}
