:root {
  --bg: #14101f;
  --surface: #1e1832;
  --surface-2: #2a2244;
  --border: #3a3160;
  --text: #f2eefc;
  --text-muted: #a89ecb;
  --accent: #c9a4ff;
  --accent-strong: #9b6bff;
  --success: #7fe0b0;
  --radius: 12px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

a { color: var(--accent); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* --- Auth screen --- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.auth-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-card p.sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--accent-strong); }

.btn {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: none;
  background: var(--accent-strong);
  color: #14101f;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: var(--accent); }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.error-msg {
  background: #3a1f2a;
  color: #ff9db3;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.demo-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #14101f; cursor: pointer;
}

/* --- Course grid --- */
h2 { font-size: 20px; margin: 24px 0 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.course-card:hover { border-color: var(--accent-strong); }
.course-icon { font-size: 22px; color: var(--accent); }
.course-card h3 { margin: 10px 0 4px; font-size: 15px; }
.course-card p { margin: 0 0 10px; font-size: 13px; color: var(--text-muted); }

.progress-bar {
  background: var(--surface-2);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill { background: var(--accent-strong); height: 100%; }

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  display: inline-block;
}
.badge.success { background: #1f3a2c; color: var(--success); }
.badge.accent { background: #33285c; color: var(--accent); }

/* --- Course detail --- */
.back-link { font-size: 13px; color: var(--text-muted); cursor: pointer; margin-bottom: 14px; display: inline-block; }
.lesson-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lesson-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.lesson-row:hover { border-color: var(--accent-strong); }
.lesson-row .check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.lesson-row .check.done { background: var(--success); border-color: var(--success); color: #14101f; }
.lesson-row .lesson-title { flex: 1; font-size: 14px; }
.lesson-row .lesson-type { font-size: 12px; color: var(--text-muted); }

/* --- Lesson viewer --- */
.viewer video { width: 100%; border-radius: var(--radius); background: #000; }
.ebook-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  line-height: 1.7;
  font-size: 15px;
}
.ebook-content h1 { font-size: 22px; }
.ebook-content h2 { font-size: 18px; margin-top: 20px; }

.viewer-actions { margin-top: 16px; display: flex; gap: 10px; }
.viewer-actions .btn { width: auto; padding: 10px 20px; }
