:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-alt: #eef3f9;
  --line: #d7e1ee;
  --text: #142033;
  --muted: #5f6f86;
  --accent: #0068b3;
  --accent-2: #0b8bd6;
  --good: #1f8b4c;
  --warn: #c05b11;
  --bad: #b42318;
  --shadow: 0 14px 34px rgba(15, 35, 62, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #eef4fb 0%, #f8fbff 100%);
  color: var(--text);
}

button {
  font: inherit;
}

.app-shell {
  max-width: 1340px;
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(236,245,255,0.96) 100%);
  border: 1px solid rgba(205, 231, 250, 0.9);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 1.95rem;
  line-height: 1.05;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 60ch;
}

.status-chip {
  background: #e9f5ff;
  color: var(--accent);
  border: 1px solid #cde7fa;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
}

.progress-panel,
.sidebar,
.content-panel,
.sidebar-card,
.card,
.ecg-strip,
.quiz-option,
.feedback-box,
.result-box {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.progress-panel {
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

#step-label {
  color: var(--muted);
  font-weight: 600;
}

#step-title {
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  transition: width 180ms ease;
}

.course-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
}

.sidebar,
.content-panel {
  border-radius: 18px;
  padding: 18px;
}

.sidebar {
  font-size: 0.88rem;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  position: sticky;
  top: 120px;
}

.sidebar h2,
.content-panel h2,
.content-panel h3 {
  margin-top: 0;
}

.sidebar ol {
  padding-left: 18px;
  margin: 0 0 18px;
}

.sidebar li {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  list-style: none;
}

.sidebar li.active {
  color: var(--accent);
  font-weight: 700;
}

.sidebar li.complete {
  color: var(--good);
}

.course-map-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.course-map-btn:hover {
  background: #f3f8fd;
  border-color: #d7e7f6;
  transform: translateY(-1px);
}

.course-map-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #edf5fc;
  color: #44627f;
  font-size: 0.74rem;
  font-weight: 700;
}

.course-map-title {
  display: block;
}

.sidebar li.active .course-map-btn {
  background: linear-gradient(180deg, #eef7ff 0%, #f7fbff 100%);
  border-color: #bddcf3;
}

.sidebar li.active .course-map-step {
  background: var(--accent);
  color: #fff;
}

.sidebar li.complete .course-map-step {
  background: var(--good);
  color: #fff;
}

.sidebar-card {
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6fd 100%);
  font-size: 0.78rem;
  display: none; /* hidden — not useful for learners */
}

#slide-host {
  min-height: 520px;
}

.slide-title {
  margin: 0 0 6px;
  font-size: 1.65rem;
}

.slide-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.02rem;
}

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

.card {
  border-radius: 16px;
  padding: 16px 18px;
}

.card h3 {
  margin-bottom: 8px;
}

.card ul,
.card ol {
  margin: 0;
  padding-left: 20px;
}

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

.ecg-strip {
  border-radius: 14px;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fff7f7 0%, #fffdfd 100%);
  border: 1px solid rgba(200, 120, 120, 0.25);
}

.ecg-strip canvas {
  border-radius: 8px;
  display: block;
}

.ecg-strip-clickable {
  cursor: zoom-in;
  transition: box-shadow 150ms ease, border-color 150ms ease;
}

.ecg-strip-clickable:hover {
  box-shadow: 0 0 0 2px rgba(0, 104, 179, 0.40);
  border-color: rgba(0, 104, 179, 0.35);
}

.ecg-strip-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin: 5px 0 0 0;
  opacity: 0.80;
  letter-spacing: 0.01em;
}

/* Strip expand modal */
.strip-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 38, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.strip-modal-inner {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 20px 20px;
  max-width: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.strip-modal-hint {
  font-size: 0.80rem;
  color: var(--muted);
  margin: 0;
  text-align: center;
}

.strip-modal-close {
  align-self: flex-end;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

.strip-modal-close:hover {
  background: var(--line);
}

/* Smooth page transitions */
#slide-host section {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ecg-strip::after {
  content: none;
}

.ecg-wave {
  width: 100%;
  height: 120px;
}

.highlight-list {
  display: grid;
  gap: 12px;
}

.highlight-item {
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  background: var(--panel-alt);
  border-radius: 10px;
}

.quiz-question {
  margin-bottom: 18px;
}

.quiz-option {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.quiz-option:hover {
  transform: translateY(-1px);
  border-color: #aacfeb;
}

.quiz-option.selected {
  border-color: var(--accent);
  background: #eef7ff;
}

.quiz-option.correct {
  border-color: #a7d8b9;
  background: #effaf3;
}

.quiz-option.incorrect {
  border-color: #efb4b0;
  background: #fff2f1;
}

.feedback-box,
.result-box {
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.feedback-box.good,
.result-box.pass {
  border-color: #b9e1c7;
  background: #f1fbf5;
}

.feedback-box.bad,
.result-box.fail {
  border-color: #efb4b0;
  background: #fff3f2;
}

.practice-lab-section {
  margin-top: 18px;
}

.practice-lab-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.practice-lab-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.practice-lab-head h3 {
  margin: 0 0 6px;
}

.practice-lab-head p {
  margin: 0;
  color: var(--muted);
}

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

.practice-strip-shell .ecg-strip {
  overflow-x: auto;
}

.practice-strip-shell .ecg-strip canvas {
  min-width: 760px;
}

.practice-rhythm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.practice-rhythm-btn {
  border: 1px solid rgba(0, 104, 179, 0.18);
  background: #f7fbff;
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.practice-rhythm-btn:hover {
  border-color: rgba(0, 104, 179, 0.4);
  transform: translateY(-1px);
}

.practice-rhythm-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.practice-rhythm-btn.correct {
  background: #e8f7ed;
  border-color: #6bb58b;
  color: #165c30;
}

.practice-rhythm-btn.incorrect {
  background: #fff1ef;
  border-color: #d27f76;
  color: #8b2f22;
}

.practice-answer-box {
  margin-top: 0;
}

.result-box h3 {
  margin-top: 0;
}

.score-pill {
  display: inline-block;
  background: #eaf5ff;
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.nav-row {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
}

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

.btn-primary:hover {
  background: #055892;
}

.btn-secondary {
  background: white;
  border-color: var(--line);
  color: var(--text);
}

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

.tag-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  background: #eff6fc;
  color: #31506f;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
}

.decision-intro-card {
  background: linear-gradient(180deg, #f7fbff 0%, #eef6fd 100%);
  border-color: #cfe4f5;
}

.decision-intro-card ul {
  margin: 0;
  padding-left: 20px;
}

.decision-tag-row {
  margin-top: 14px;
}

.decision-tag {
  background: #fff4e8;
  color: #9a5a00;
}

.decision-card {
  border-color: #d9e5f2;
}

.decision-card-head {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.decision-card-label {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #edf5fc;
  color: #355a7f;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.decision-options {
  display: grid;
  gap: 8px;
}

.decision-option {
  font-weight: 700;
}

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

  .grid-two {
    grid-template-columns: 1fr;
  }

  .topbar,
  .progress-copy,
  .nav-row {
    flex-direction: column;
  }

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

  .btn {
    width: 100%;
  }
}
