:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e6e4df;
  --active: #fbe6a6;
  --accent: #7b5cff;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: inherit; text-decoration: none; }

/* Header */
.header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1120px; margin: 0 auto; padding: 14px 16px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; }
.brand img { width: 36px; height: 36px; border-radius: 8px; }
.header-top { display: flex; justify-content: space-between; align-items: center; }
.signout { font-size: 14px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.signout:hover { color: var(--text); }
.tabs { display: flex; gap: 32px; margin-top: 14px; }
.tabs a { padding: 10px 0 12px; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--text); border-color: var(--text); font-weight: 500; }

main { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }

/* Classroom grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
a.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.card.soon { cursor: default; }
.cover { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 16px; overflow: hidden; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-title { font-weight: 800; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; color: #2c3a66; line-height: 1.15; }
.cover-tag { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px; background: #3b4a8c; color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.soon-badge { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.card.soon .cover > :not(.soon-badge) { opacity: .55; }
.card-body { padding: 16px; }
.card-body h2 { font-size: 20px; margin: 0 0 8px; }
.card-body p { margin: 0; color: #444; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.theme-sky    { background: linear-gradient(135deg, #c9d6ff, #e2f0ff 60%, #b8e1ff); }
.theme-blue   { background: linear-gradient(135deg, #b6d4ff, #e0ecff 55%, #a9c8f7); }
.theme-teal   { background: linear-gradient(135deg, #a8d8f0, #d6ecf7 55%, #9cc7e8); }
.theme-pink   { background: linear-gradient(135deg, #f3c4e4, #fbe3f2 55%, #e6b6dc); }
.theme-violet { background: linear-gradient(135deg, #c9bdf5, #e6defc 55%, #b8a8ef); }
.theme-purple { background: linear-gradient(135deg, #d6c4ff, #efe6ff 55%, #c3b0f7); }
.theme-pink .cover-title, .theme-violet .cover-title, .theme-purple .cover-title { color: #6a2a8c; }
.theme-pink .cover-tag, .theme-violet .cover-tag, .theme-purple .cover-tag { background: #8a3dc4; }

/* Course page */
.course { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; }
.sidebar { position: sticky; top: 16px; }
.sidebar h1 { font-size: 20px; font-weight: 600; margin: 4px 12px 20px; }
.back { display: inline-block; font-size: 14px; color: var(--muted); margin: 0 12px 12px; }
.back:hover { color: var(--text); }
.section { margin-bottom: 8px; }
.section > button { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; padding: 10px 12px; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.section > button::after { content: "⌃"; font-size: 14px; color: var(--muted); transition: transform .15s; }
.section.closed > button::after { transform: rotate(180deg); }
.section.closed ul { display: none; }
.section ul { list-style: none; margin: 0; padding: 0; }
.section li a { display: block; padding: 11px 18px; border-radius: 8px; line-height: 1.35; }
.section li a:hover { background: #efede8; }
.section li a.on { background: var(--active); }

.lesson { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 40px; }
.lesson h2 { font-size: 26px; margin: 0 0 24px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #14122b; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .empty { position: absolute; inset: 0; display: grid; place-items: center; color: #c9c4ef; font-size: 15px; }
.lesson-text { margin-top: 24px; line-height: 1.65; font-size: 17px; }
.lesson-text p { margin: 0 0 14px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.lesson-nav a { padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.lesson-nav a:hover { background: var(--bg); }
.msg { text-align: center; color: var(--muted); padding: 60px 0; }

@media (max-width: 860px) {
  .course { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .lesson { padding: 20px 16px; order: -1; }
  .lesson h2 { font-size: 22px; }
}

/* Access page */
.access { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at top, #3a2d7a 0%, #14122b 70%); }
.access-box { width: 100%; max-width: 400px; background: var(--card); border-radius: 16px; padding: 36px 28px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.access-box img { width: 72px; height: 72px; border-radius: 14px; }
.access-box h1 { font-size: 22px; margin: 16px 0 6px; }
.access-box p { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.access-box input { width: 100%; padding: 13px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px; }
.access-box input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.access-box button { width: 100%; margin-top: 12px; padding: 13px; font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; }
.access-box button:disabled { opacity: .6; cursor: wait; }
.access-error { color: #c0392b; font-size: 14px; min-height: 20px; margin-top: 12px; }
