
:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #0f1419;
  --muted: #536471;
  --line: #e6e8eb;
  --green: #00ba7c;
  --active: #f7e7c6;
  --sidebar: #fff;
  --nav: #fff;
  --sidebar-w: 300px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: #1d9bf0; text-decoration: none; }
a:hover { text-decoration: underline; }
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  background: var(--nav); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 10px 20px; position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; cursor: pointer; }
.brand img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.tabs { display: flex; gap: 18px; margin-left: 8px; }
.tabs span { color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 0; border-bottom: 2px solid transparent; }
.tabs span.active { color: var(--text); border-bottom-color: var(--text); }
.search {
  margin-left: auto; width: min(420px, 42vw); border: 1px solid transparent; border-radius: 999px;
  padding: 10px 14px 10px 36px; background: #eef0f2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23536471' viewBox='0 0 16 16'%3E%3Cpath d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3.3 3.3.1.1a1 1 0 0 0 1.4-1.4l-3.4-3.4zM6.5 11a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/%3E%3C/svg%3E") 12px center no-repeat;
  outline: none; font: inherit;
}
.wrap-home { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; width: 100%; }
h1.page-title { margin: 0 0 18px; font-size: 28px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,24,40,.04); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,40,.08); }
.card .cover { aspect-ratio: 16/10; background: #ddd center/cover no-repeat; }
.card .body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; flex: 1; }
.progress {
  height: 8px; background: #eef0f2; border-radius: 999px; overflow: hidden; margin-top: 6px; position: relative;
}
.progress > i { display: block; height: 100%; width: 0; background: var(--green); }
.progress-label {
  height: 22px; background: #eef0f2; border-radius: 999px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 14px;
  overflow: hidden; position: relative;
}
.progress-label > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); opacity: .35; }
.progress-label span { position: relative; z-index: 1; }

/* Course layout: left outline stays, right content changes */
.course-layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--sidebar);
  border-right: 1px solid var(--line); padding: 18px 12px 40px; overflow-y: auto;
  position: sticky; top: 57px; height: calc(100vh - 57px);
}
.sidebar .back-link {
  border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer;
  padding: 0 8px 10px; display: block;
}
.sidebar .back-link:hover { color: var(--text); }
.sidebar h2 { margin: 0 8px 0; font-size: 20px; }
.outline { display: flex; flex-direction: column; gap: 2px; }
.set {
  border: 0; background: transparent; width: 100%; text-align: left; font: inherit;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 10px; border-radius: 10px; cursor: pointer; color: var(--text); font-weight: 700; font-size: 14px;
}
.set:hover { background: #f7f8f9; }
.set .chev { color: var(--muted); font-size: 12px; transition: transform .15s ease; }
.set.open .chev { transform: rotate(180deg); }
.set-body { display: none; padding: 0 0 6px; }
.set-body.open { display: block; }
.lesson-link {
  display: block; padding: 10px 12px 10px 18px; border-radius: 10px; color: var(--text);
  font-size: 14px; line-height: 1.35; cursor: pointer; text-decoration: none;
}
.lesson-link:hover { background: #f7f8f9; text-decoration: none; }
.lesson-link.active { background: var(--active); font-weight: 600; }
.flat-lessons .lesson-link { padding-left: 10px; }

.content {
  flex: 1; min-width: 0; padding: 20px 28px 60px; overflow-y: auto;
}
.lesson-card {
  background: var(--card); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,24,40,.04); padding: 22px 24px 28px; min-height: 320px;
}
.lesson-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.lesson-head h1 { margin: 0; font-size: 26px; line-height: 1.2; }
.mark { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #cfd5dc; color: #9aa3ad;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex: 0 0 auto; }
.empty-state { color: var(--muted); padding: 40px 8px; }
.section-box {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 14px 0; background: #fafafa;
}
.section-box h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600;
}
.chip.gpt { background: #111827; color: #fff; border-color: #111827; }
.chip.gpt:hover, .chip:hover { text-decoration: none; opacity: .92; }
.chip.youtube { background: #ffe5e5; border-color: #fecaca; color: #b91c1c; }
.chip.loom { background: #efe9ff; border-color: #ddd6fe; color: #5b21b6; }
.chip.drive { background: #e8f0fe; border-color: #c5d7f7; color: #1a73e8; }
.lesson-body { line-height: 1.65; color: #1f2937; max-width: 820px; }
.lesson-body h1,.lesson-body h2,.lesson-body h3 { color: var(--text); }
.lesson-body ul,.lesson-body ol { padding-left: 1.2rem; }
.lesson-body img { max-width: 100%; border-radius: 10px; }
video { width: 100%; max-width: 760px; border-radius: 12px; background: #000; margin-bottom: 8px; }
.yt-embed {
  position: relative; width: 100%; max-width: 760px; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden;
  background: #111; margin-bottom: 8px;
}
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 860px) {
  .course-layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; position: relative; top: 0; height: auto; max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
}
