:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: rgba(14, 20, 34, 0.76);
  --panel2: rgba(20, 28, 46, 0.72);
  --border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #8ea1bd;
  --accent: #8b5cf6;
  --accent2: #22d3ee;
  --good: #22c55e;
  --danger: #fb7185;
  --warn: #f59e0b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(circle at 14% 12%, rgba(34, 211, 238, 0.22), transparent 26%),
    radial-gradient(circle at 86% 8%, rgba(139, 92, 246, 0.26), transparent 24%),
    radial-gradient(circle at 60% 92%, rgba(16, 185, 129, 0.16), transparent 28%),
    linear-gradient(180deg, #07101d 0%, #05070d 58%, #03040a 100%);
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 80%);
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card { width: min(560px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 30px; background: linear-gradient(145deg, rgba(15,23,42,.86), rgba(2,6,23,.72)); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-kicker { color: var(--accent2); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 800; }
.login-card h1 { font-size: clamp(32px, 6vw, 54px); line-height: .95; margin: 14px 0 12px; letter-spacing: -0.06em; }
.login-card p { color: var(--muted); line-height: 1.65; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); background: rgba(5, 7, 13, .82); backdrop-filter: blur(18px); }
.logo { display: flex; flex-direction: column; gap: 2px; min-width: 210px; }
.logo b { letter-spacing: -0.04em; font-size: 18px; }
.logo span { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search { width: min(340px, 38vw); border: 1px solid var(--border); background: rgba(15,23,42,.72); color: var(--text); border-radius: 999px; padding: 11px 14px; outline: none; }
.btn { border: 1px solid var(--border); color: var(--text); background: rgba(15,23,42,.72); border-radius: 999px; padding: 10px 14px; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); border-color: rgba(34,211,238,.38); background: rgba(30,41,59,.8); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: 0; color: white; font-weight: 800; }
.btn.good { border-color: rgba(34,197,94,.38); color: #bbf7d0; }
.btn.danger { border-color: rgba(251,113,133,.42); color: #fecdd3; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.layout { display: grid; grid-template-columns: 310px 1fr 300px; gap: 18px; padding: 18px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.sidebar { position: sticky; top: 90px; height: calc(100vh - 108px); padding: 16px; overflow: auto; }
.content { min-width: 0; }
.rightbar { position: sticky; top: 90px; height: calc(100vh - 108px); padding: 16px; overflow: auto; }
.course-hero { padding: 26px; margin-bottom: 18px; background: linear-gradient(135deg, rgba(139,92,246,.20), rgba(34,211,238,.10)), var(--panel); }
.course-hero h1 { font-size: clamp(28px, 4vw, 52px); margin: 0; letter-spacing: -0.06em; }
.course-hero p { color: var(--muted); max-width: 840px; line-height: 1.65; }
.progress-shell { height: 12px; background: rgba(148,163,184,.14); border-radius: 999px; overflow: hidden; border: 1px solid rgba(148,163,184,.12); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2), var(--good)); border-radius: 999px; transition: width .25s ease; }
.group { margin-bottom: 18px; }
.group-head { padding: 18px 20px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.group-head h2 { margin: 0; letter-spacing: -0.04em; }
.group-head p { margin: 6px 0 0; color: var(--muted); }
.block { padding: 18px; margin: 12px; border-radius: 20px; border: 1px solid rgba(148,163,184,.14); background: linear-gradient(180deg, rgba(15,23,42,.76), rgba(15,23,42,.42)); }
.block.done { border-color: rgba(34,197,94,.38); background: linear-gradient(180deg, rgba(22,101,52,.18), rgba(15,23,42,.42)); }
.block-top { display:flex; gap:12px; justify-content:space-between; align-items:flex-start; }
.block h3 { margin: 0; font-size: 22px; letter-spacing: -0.04em; }
.check { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(148,163,184,.36); display: grid; place-items:center; flex: 0 0 auto; background: rgba(2,6,23,.5); }
.done .check { background: var(--good); color: #02120a; font-weight: 900; }
.badge { display:inline-flex; gap:6px; align-items:center; padding: 5px 9px; border-radius: 999px; font-size: 11px; color: #c4b5fd; background: rgba(139,92,246,.16); border: 1px solid rgba(139,92,246,.22); text-transform: uppercase; letter-spacing: .06em; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.md { color: #dbeafe; line-height: 1.72; overflow-wrap: anywhere; }
.md pre { background: rgba(2,6,23,.72); border: 1px solid var(--border); border-radius: 16px; padding: 14px; overflow:auto; }
.md code { color: #bae6fd; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.link-card { display:block; text-decoration:none; padding: 14px; border: 1px solid rgba(34,211,238,.18); border-radius: 16px; background: rgba(8,47,73,.22); }
.link-card b { display:block; }
.link-card span { display:block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.image-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top:12px; }
.image-grid img { width:100%; border-radius: 16px; border:1px solid var(--border); object-fit: cover; max-height: 260px; }
.nav-item { display:flex; justify-content:space-between; gap:8px; padding: 10px 12px; border-radius: 14px; color: var(--muted); text-decoration:none; }
.nav-item:hover { background: rgba(148,163,184,.10); color: var(--text); }
.session { padding: 12px; border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; background: rgba(15,23,42,.45); }
.session.active { border-color: rgba(34,211,238,.42); background: rgba(8,47,73,.32); }
.session h4 { margin: 0 0 6px; }
.session p { color: var(--muted); margin: 0; font-size: 13px; }
.tag { display:inline-flex; margin: 3px 4px 3px 0; padding: 4px 8px; border-radius:999px; background: rgba(148,163,184,.14); color:#dbeafe; font-size:11px; }
.form { display:grid; gap: 10px; }
.field { display:grid; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--border); color: var(--text); background: rgba(2,6,23,.48); border-radius: 14px; padding: 11px 12px; outline: none; }
.textarea { min-height: 120px; resize: vertical; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.64); display:grid; place-items:center; padding: 18px; }
.modal { width:min(920px, 100%); max-height: 88vh; overflow:auto; padding: 18px; border:1px solid var(--border); border-radius: 24px; background: rgba(10,16,28,.96); box-shadow: var(--shadow); }
.modal-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:14px; }
.result { display:block; padding: 12px; border:1px solid var(--border); border-radius: 16px; margin-bottom: 8px; text-decoration:none; background:rgba(15,23,42,.5); }
.result small { color: var(--accent2); text-transform: uppercase; letter-spacing:.08em; }
.presentation { min-height: calc(100vh - 72px); padding: 18px; display:grid; grid-template-rows: auto 1fr auto; gap: 18px; }
.presentation-card { display:grid; align-content:center; padding: clamp(24px, 5vw, 72px); border-radius: 34px; background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(34,211,238,.08)), var(--panel); border:1px solid var(--border); box-shadow: var(--shadow); }
.presentation-card h1 { font-size: clamp(36px, 7vw, 86px); line-height:.95; letter-spacing:-.07em; margin: 0 0 20px; }
.presentation-card .md { font-size: clamp(18px, 2vw, 28px); }
.empty { color: var(--muted); padding: 24px; text-align:center; border: 1px dashed var(--border); border-radius: 18px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; background: rgba(2,6,23,.92); border:1px solid var(--border); color: var(--text); padding: 12px 16px; border-radius: 999px; box-shadow: var(--shadow); }
@media (max-width: 1100px) { .layout { grid-template-columns: 240px 1fr; } .rightbar { grid-column: 1 / -1; position: static; height: auto; } }
@media (max-width: 760px) { .topbar { align-items:flex-start; flex-direction:column; } .top-actions { width:100%; justify-content:flex-start; } .search { width:100%; } .layout { grid-template-columns: 1fr; padding: 12px; } .sidebar, .rightbar { position: static; height: auto; } .logo { min-width: 0; } .block-top { flex-direction: column; } }
.mini-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 0; border-bottom:1px solid rgba(148,163,184,.10); }
.mini-row span { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.btn:disabled { opacity:.45; cursor:not-allowed; transform:none; }
.badge.warning { border-color: rgba(251,191,36,.45); color: #fbbf24; background: rgba(251,191,36,.08); }
.checkline { display:flex; align-items:center; gap:10px; color: var(--muted); font-size: 14px; }
.checkline input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Live lesson mode: adapted from PDF Live Questions MVP for course cards. */
.live-app { min-height: 100vh; background: radial-gradient(circle at top left, rgba(34,211,238,.10), transparent 34%), radial-gradient(circle at 78% 12%, rgba(139,92,246,.12), transparent 30%); }
.live-topbar { position: sticky; top: 0; z-index: 30; min-height: 74px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px 18px; border-bottom:1px solid var(--border); background: rgba(5,7,13,.86); backdrop-filter: blur(20px); }
.live-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.live-layout { display:grid; grid-template-columns: minmax(0, 1fr) 390px; gap:18px; padding:18px; align-items:start; }
.live-main, .live-side { display:grid; gap:18px; min-width:0; }
.live-side { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow:auto; padding-right:2px; }
.live-stage { min-height: calc(100vh - 190px); display:grid; align-content:center; padding: clamp(22px, 5vw, 64px); background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(34,211,238,.08)), var(--panel); }
.live-stage h1 { font-size: clamp(34px, 5.6vw, 76px); line-height: .95; letter-spacing: -.07em; margin: 16px 0 22px; }
.live-stage .md { font-size: clamp(17px, 1.55vw, 24px); }
.live-stage-meta { display:flex; gap:8px; flex-wrap:wrap; }
.live-controls, .live-presence, .live-questions, .live-ask, .live-chat { padding:16px; }
.panel-title-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.panel-title-row h3 { margin:0; letter-spacing:-.04em; }
.pill { display:inline-flex; align-items:center; justify-content:center; border:1px solid rgba(34,211,238,.26); border-radius:999px; padding:5px 9px; color:#bae6fd; background:rgba(8,47,73,.25); font-size:12px; }
.live-control-row { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
.presence-stats { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:10px 0; }
.presence-stats span { border:1px solid rgba(148,163,184,.12); border-radius:14px; padding:10px; background:rgba(15,23,42,.35); color:var(--muted); }
.presence-stats strong { display:block; color:var(--text); font-size:22px; }
.viewer-list { display:grid; gap:8px; margin-top:10px; }
.viewer-row { display:flex; align-items:center; gap:10px; padding:9px; border:1px solid rgba(148,163,184,.12); border-radius:14px; background:rgba(15,23,42,.35); }
.viewer-row small { display:block; color:var(--muted); margin-top:2px; }
.viewer-dot { width:9px; height:9px; border-radius:999px; background:var(--good); box-shadow:0 0 16px rgba(34,197,94,.75); }
.live-question { border:1px solid rgba(148,163,184,.16); border-radius:16px; padding:12px; background:rgba(15,23,42,.46); margin-bottom:10px; }
.live-question.is-closed { opacity:.68; }
.question-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; color:var(--muted); font-size:12px; }
.status-dot { width:9px; height:9px; border-radius:999px; background:#f59e0b; display:inline-block; }
.status-dot.answered { background:var(--good); }
.status-dot.closed { background:#64748b; }
.answer-box, .closed-box { border:1px solid rgba(34,197,94,.18); border-radius:14px; padding:10px; background:rgba(22,101,52,.12); margin:10px 0; }
.answer-box p { margin:6px 0 0; color:#dcfce7; }
.answer-textarea { min-height:74px; margin-top:8px; }
.answer-actions, .form-footer-row { display:flex; justify-content:space-between; gap:8px; align-items:center; flex-wrap:wrap; margin-top:8px; }
.live-chat-list { display:grid; gap:8px; max-height:220px; overflow:auto; margin-bottom:10px; }
.chat-row { display:grid; gap:3px; border:1px solid rgba(148,163,184,.12); border-radius:14px; padding:9px; background:rgba(15,23,42,.38); }
.chat-row.host { border-color:rgba(34,211,238,.22); background:rgba(8,47,73,.18); }
.chat-row strong { font-size:12px; color:#bae6fd; }
.chat-row span { color:#e2e8f0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
@media (max-width: 1080px) { .live-layout { grid-template-columns: 1fr; } .live-side { position: static; max-height:none; padding-right:0; } .live-stage { min-height:auto; } }
@media (max-width: 720px) { .live-topbar { align-items:flex-start; flex-direction:column; } .live-layout { padding:12px; } .live-actions { justify-content:flex-start; } .live-stage { padding:22px; } .live-stage h1 { font-size:36px; } }

/* v0.1.0 — richer card types and live lesson picker */
.card-skin { position: relative; overflow: hidden; }
.card-skin::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background: rgba(148,163,184,.28); }
.card-skin-copy::before { background: linear-gradient(180deg, #22d3ee, #8b5cf6); }
.card-skin-practice::before { background: linear-gradient(180deg, #22c55e, #84cc16); }
.card-skin-flow::before { background: linear-gradient(180deg, #38bdf8, #22c55e); }
.card-skin-split::before { background: linear-gradient(180deg, #f59e0b, #8b5cf6); }
.card-skin-warning::before { background: linear-gradient(180deg, #fb7185, #f59e0b); }
.card-skin-metric::before { background: linear-gradient(180deg, #facc15, #22c55e); }
.card-skin-interactive::before { background: linear-gradient(180deg, #c084fc, #22d3ee); }
.card-skin-resource::before { background: linear-gradient(180deg, #94a3b8, #38bdf8); }
.card-type-hint { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin:14px 0 0; padding:10px 12px; border:1px solid rgba(148,163,184,.14); border-radius:16px; background:rgba(2,6,23,.24); }
.card-type-hint span { color:#bae6fd; font-weight:800; }
.card-type-hint small { color:var(--muted); max-width:68%; text-align:right; }
.visual-checklist, .visual-flow, .visual-split, .visual-warning, .visual-copy, .visual-interactive, .visual-metric, .visual-resource { margin-top:14px; }
.visual-checklist { display:grid; gap:8px; }
.visual-checklist div { display:flex; gap:10px; align-items:flex-start; padding:10px; border:1px solid rgba(34,197,94,.18); border-radius:14px; background:rgba(22,101,52,.10); }
.visual-checklist span { width:22px; height:22px; display:grid; place-items:center; border-radius:50%; background:rgba(34,197,94,.18); color:#bbf7d0; flex:0 0 auto; }
.visual-checklist p, .visual-split p, .visual-warning p, .visual-copy p, .visual-interactive p, .visual-resource p { margin:0; color:#e2e8f0; }
.visual-flow { display:grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap:10px; }
.visual-flow div { padding:12px; border:1px solid rgba(34,211,238,.18); border-radius:16px; background:rgba(8,47,73,.18); }
.visual-flow b { display:inline-grid; place-items:center; width:26px; height:26px; border-radius:50%; margin-bottom:8px; background:linear-gradient(135deg, var(--accent), var(--accent2)); }
.visual-flow span { display:block; color:#dbeafe; }
.visual-split { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:10px; }
.visual-split > div { border:1px solid rgba(148,163,184,.16); border-radius:16px; padding:12px; background:rgba(15,23,42,.34); }
.visual-split b { display:block; margin-bottom:8px; color:#fde68a; }
.visual-warning { border:1px solid rgba(251,113,133,.22); border-radius:16px; padding:12px; background:rgba(127,29,29,.16); }
.visual-warning b { display:block; color:#fecdd3; margin-bottom:8px; }
.visual-metric { display:grid; gap:6px; border:1px solid rgba(250,204,21,.22); border-radius:18px; padding:18px; background:linear-gradient(135deg, rgba(250,204,21,.12), rgba(34,197,94,.08)); }
.visual-metric strong { font-size: clamp(22px, 3vw, 34px); letter-spacing:-.05em; color:#fef9c3; }
.visual-metric span { color:#bbf7d0; }
.visual-interactive { border:1px solid rgba(192,132,252,.24); border-radius:18px; padding:14px; background:rgba(88,28,135,.14); }
.visual-interactive b { color:#e9d5ff; }
.visual-interactive small { display:block; margin-top:8px; color:var(--muted); }
.visual-copy { display:flex; gap:12px; align-items:flex-start; border:1px solid rgba(34,211,238,.20); border-radius:18px; padding:14px; background:rgba(8,47,73,.16); }
.visual-copy > span { width:36px; height:36px; display:grid; place-items:center; border-radius:14px; background:rgba(34,211,238,.14); color:#bae6fd; font-weight:900; }
.visual-resource { border:1px solid rgba(148,163,184,.20); border-radius:18px; padding:14px; background:rgba(15,23,42,.38); }
.visual-resource b { display:block; color:#bae6fd; margin-bottom:8px; }
.card-type-picker { display:grid; gap:10px; }
.picker-selected { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px; border:1px solid rgba(34,211,238,.20); border-radius:16px; background:rgba(8,47,73,.18); }
.picker-selected span { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.favorite-type-strip { display:flex; gap:8px; flex-wrap:wrap; }
.type-chip { border:1px solid rgba(250,204,21,.22); border-radius:999px; padding:7px 10px; background:rgba(250,204,21,.08); color:#fef3c7; }
.card-type-options { display:grid; gap:8px; max-height:320px; overflow:auto; padding-right:4px; }
.card-type-option { display:grid; grid-template-columns: 38px 1fr; gap:8px; align-items:stretch; }
.type-fav { border:1px solid rgba(148,163,184,.18); border-radius:14px; background:rgba(15,23,42,.5); color:#64748b; }
.type-fav.active { color:#facc15; border-color:rgba(250,204,21,.38); background:rgba(250,204,21,.10); }
.type-select, .live-card-select { text-align:left; border:1px solid rgba(148,163,184,.16); border-radius:16px; padding:10px 12px; background:rgba(15,23,42,.42); color:var(--text); }
.type-select.active, .live-card-option.active .live-card-select { border-color:rgba(34,211,238,.45); background:rgba(8,47,73,.28); }
.type-select strong, .type-select small, .type-select span, .live-card-select strong, .live-card-select small { display:block; }
.type-select small, .live-card-select small { color:#bae6fd; margin:3px 0; font-size:12px; }
.type-select span { color:var(--muted); font-size:12px; line-height:1.4; }
.live-card-picker { display:grid; gap:10px; margin:12px 0; }
.live-card-options { display:grid; gap:8px; max-height:340px; overflow:auto; padding-right:4px; }
.live-card-option { display:grid; grid-template-columns: 38px 1fr; gap:8px; }
.live-card-option[hidden], .card-type-option[hidden] { display:none; }
@media (max-width: 720px) { .visual-split { grid-template-columns: 1fr; } .card-type-hint { flex-direction:column; } .card-type-hint small { max-width:none; text-align:left; } }
