:root {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #1a2332;
  --border: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sidebar-w: 280px;
  --slide-max-w: min(96vw, 1380px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(56, 189, 248, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(129, 140, 248, 0.1), transparent),
    var(--bg);
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  transition: grid-template-columns 0.28s ease;
}

.app.sidebar-collapsed {
  --sidebar-w: 0px;
  --slide-max-w: min(98vw, 1520px);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow: hidden;
  min-width: 0;
  transition: opacity 0.2s ease;
}

.app.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  border-right: none;
}

.sidebar-collapse {
  position: fixed;
  left: calc(var(--sidebar-w) - 1px);
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  width: 22px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0 10px 10px 0;
  background: rgba(26, 35, 50, 0.95);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: left 0.28s ease, background 0.15s, color 0.15s, border-color 0.15s;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25);
}

.app.sidebar-collapsed .sidebar-collapse {
  left: 0;
  transform: translate(0, -50%);
  border-radius: 0 10px 10px 0;
}

.sidebar-collapse:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.4);
}

.sidebar-collapse-icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.28s ease;
}

.app.sidebar-collapsed .sidebar-collapse-icon {
  transform: rotate(180deg);
}

.sidebar-head {
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-head h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-head p {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.toc {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem 1rem;
}

.toc-group {
  margin-bottom: 0.85rem;
}

.toc-group-label {
  padding: 0.35rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toc-btn:hover {
  background: rgba(56, 189, 248, 0.08);
  color: var(--text);
}

.toc-btn.active {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.18), rgba(129, 140, 248, 0.1));
  color: #fff;
  font-weight: 600;
}

.sidebar-foot {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.5;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.75);
  backdrop-filter: blur(8px);
}

.progress-wrap {
  flex: 1;
  max-width: 420px;
  margin: 0 1rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.progress-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.nav-btns {
  display: flex;
  gap: 0.4rem;
}

.nav-btns button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.nav-btns button:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
}

.nav-btns button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.topbar-edit {
  border-color: rgba(129, 140, 248, 0.45) !important;
  background: rgba(129, 140, 248, 0.1) !important;
}

.topbar-edit[aria-pressed="true"] {
  border-color: var(--warn) !important;
  background: rgba(251, 191, 36, 0.15) !important;
  color: #fde68a;
}

.edit-confirm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
  background: rgba(251, 191, 36, 0.12);
  border-bottom: 1px solid rgba(251, 191, 36, 0.35);
  animation: editBarIn 0.25s ease;
}

.edit-confirm-bar[hidden] {
  display: none !important;
}

@keyframes editBarIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.edit-confirm-hint {
  font-size: 0.82rem;
  color: #fde68a;
}

.edit-confirm-actions {
  display: flex;
  gap: 0.5rem;
}

.edit-btn-discard,
.edit-btn-confirm {
  border-radius: 8px;
  padding: 0.38rem 0.9rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid var(--border);
}

.edit-btn-discard {
  background: var(--surface-2);
  color: var(--muted);
}

.edit-btn-discard:hover {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.edit-btn-confirm {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
  font-weight: 600;
}

.edit-btn-confirm:hover {
  background: rgba(52, 211, 153, 0.28);
}

body.edit-mode .course-editable {
  outline: 1px dashed rgba(56, 189, 248, 0.55);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: text;
}

body.edit-mode .course-editable:focus {
  outline: 2px solid var(--accent);
  background: rgba(56, 189, 248, 0.06);
}

body.edit-mode .btn-detail,
body.edit-mode .toc-btn,
body.edit-mode .tab-btn,
body.edit-mode .acc-trigger {
  pointer-events: none;
  opacity: 0.55;
}

.slide-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 1rem 1.25rem 1.5rem;
  overflow-y: auto;
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.slide.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.slide-inner {
  width: 100%;
  max-width: var(--slide-max-w);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.slide-fusion {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.slide-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.slide h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.slide h3 {
  margin: 1.35rem 0 0.65rem;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  font-weight: 700;
  color: #f1f5f9;
}

.slide p,
.slide li {
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  line-height: 1.65;
  color: #cbd5e1;
}

.slide ul {
  padding-left: 1.2rem;
}

.lead {
  font-size: 1.02rem;
  color: #94a3b8;
  margin: 0 0 1.25rem;
  max-width: 52ch;
}

/* ── 图文融合布局：标题叠在图上，正文在同一卡片内 ── */

.visual-band {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  max-height: min(48vh, 460px);
  flex-shrink: 0;
}

.visual-band img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  object-position: center;
}

.visual-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(
    168deg,
    rgba(11, 18, 32, 0.2) 0%,
    rgba(11, 18, 32, 0.55) 38%,
    rgba(11, 18, 32, 0.92) 100%
  );
}

.visual-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 92% 8%, rgba(56, 189, 248, 0.14), transparent);
  pointer-events: none;
}

.visual-overlay .slide-tag {
  position: relative;
  z-index: 1;
  margin-bottom: 0.6rem;
  backdrop-filter: blur(10px);
  background: rgba(56, 189, 248, 0.18);
}

.visual-overlay h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 0.35rem;
  font-size: clamp(1.85rem, 3.8vw, 2.65rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.55);
  line-height: 1.2;
}

.visual-overlay .lead {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 68ch;
  color: rgba(226, 232, 240, 0.94);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.55;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.45);
}

.content-body {
  padding: 1.35rem 2rem 1.75rem;
  background: linear-gradient(180deg, rgba(26, 35, 50, 0.85) 0%, rgba(17, 24, 39, 0.95) 100%);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  flex: 1;
}

.slide-fusion .content-body .card {
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(4px);
}

.slide-fusion .content-body .table-wrap {
  background: rgba(11, 18, 32, 0.45);
}

.slide-fusion .content-body .quote {
  border-left-color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
}

.content-body > .flow:first-child {
  margin-top: 0.25rem;
  padding: 0.75rem 1rem;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 10px;
}

.slide-fusion.fusion-cover .visual-band {
  min-height: min(52vh, 480px);
  max-height: min(56vh, 520px);
}

.slide-fusion.fusion-cover .content-body {
  text-align: center;
  padding: 1.35rem 1.75rem 1.75rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.hero-meta span {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 1.35rem;
  margin-bottom: 0.45rem;
}

.card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: #f8fafc;
}

.card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.card.clickable {
  cursor: pointer;
}

.card.clickable.selected {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: rgba(56, 189, 248, 0.08);
  color: #e2e8f0;
  font-weight: 600;
  white-space: nowrap;
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 1.25rem 0;
  font-size: 0.78rem;
}

.flow-step {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #cbd5e1;
}

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

.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.15rem;
  padding-left: 0.75rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.22rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.timeline-item h4 {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  color: #f1f5f9;
}

.timeline-item p {
  margin: 0;
  font-size: 0.8rem;
}

.quote {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  border-left: 3px solid var(--accent-2);
  background: rgba(129, 140, 248, 0.08);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  color: #e2e8f0;
  font-style: italic;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.compare-bad {
  border-color: rgba(248, 113, 113, 0.35);
}

.compare-good {
  border-color: rgba(52, 211, 153, 0.35);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0.75rem;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  color: #fff;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

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

.checklist {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.checklist li:last-child {
  border-bottom: none;
}

.check-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--muted);
  flex-shrink: 0;
  margin-top: 0.15rem;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  transition: all 0.15s;
}

.checklist li.done .check-box {
  background: var(--accent-3);
  border-color: var(--accent-3);
  color: #052e16;
}

.checklist li.done .check-text {
  color: var(--muted);
  text-decoration: line-through;
}

.interactive-img {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.interactive-img img {
  width: 100%;
  display: block;
}

kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.mobile-toggle {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 30;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

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

  .app.sidebar-collapsed {
    --sidebar-w: 0px;
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-toggle {
    display: grid;
    place-items: center;
  }

  .slide-fusion .visual-band {
    min-height: 180px;
    max-height: min(36vh, 280px);
  }

  .slide-fusion.fusion-cover .visual-band {
    min-height: min(42vh, 320px);
    max-height: min(46vh, 360px);
  }

  .visual-overlay {
    padding: 1.1rem 1.25rem;
  }

  .content-body {
    padding: 1rem 1.15rem 1.25rem;
  }

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

  .slide {
    padding: 1.25rem 1rem 2rem;
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-toggle,
  .course-modal {
    display: none !important;
  }

  .app {
    display: block;
  }

  .slide {
    position: relative;
    opacity: 1 !important;
    transform: none !important;
    page-break-after: always;
    pointer-events: auto;
  }
}

/* ── v2 互动组件 ── */

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.btn-detail {
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
  color: #e0f2fe;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-detail:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent);
}

.btn-detail.secondary {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.btn-detail.secondary:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.45);
}

.prompt-block {
  display: block;
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: #cbd5e1;
  white-space: pre-wrap;
  overflow-x: auto;
}

.muted,
.slide .muted {
  color: var(--muted);
  font-size: 0.8rem;
}

[data-accordion] .acc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: var(--surface-2);
}

[data-accordion] .acc-trigger {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #f1f5f9;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-accordion] .acc-trigger::after {
  content: '+';
  color: var(--accent);
  font-weight: 700;
}

[data-accordion] .acc-item.open .acc-trigger::after {
  content: '−';
}

[data-accordion] .acc-body {
  display: none;
  padding: 0 1rem 0.85rem;
  font-size: 0.82rem;
  color: #cbd5e1;
}

[data-accordion] .acc-item.open .acc-body {
  display: block;
}

.flow-step {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.flow-step:hover,
.flow-step.active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-1px);
}

/* legacy banner helpers — superseded by slide-fusion */

/* Modal */
body.modal-open {
  overflow: hidden;
}

.course-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.course-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(85vh, 900px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.course-modal.open .modal-panel {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.modal-header button {
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.modal-header button:hover {
  color: #fff;
  background: rgba(248, 113, 113, 0.2);
}

.modal-body {
  padding: 1rem 1.15rem 1.25rem;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.65;
}

.modal-body h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body .card-grid {
  margin-top: 0.5rem;
}

@media (max-width: 900px) {
  .modal-panel {
    max-height: 92vh;
  }
}
