:root {
  --bg: #121113;
  --bg-2: #1b1a1d;
  --card: #1f1e21;
  --card-2: #26252a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f2f2f0;
  --muted: #9a99a0;
  --lime: #dcff1e;
  --lime-dark: #b8d600;
  --ink: #121113;
  --danger: #ff5c5c;
  --ok: #7cf29a;
  --radius: 22px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 50;
  margin: 12px auto 0; max-width: 1180px; padding: 0 20px;
}
@media (max-width: 600px) { .topbar { padding: 0 12px; } }
.topbar-in {
  display: flex; align-items: center; gap: 12px;
  background: rgba(27, 26, 29, 0.82); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 8px 8px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 30px; flex: none; }
.brand-name { font-size: 17px; }
.brand-name b { color: var(--lime); font-weight: 800; }
.topbar .spacer { flex: 1; }
.user-chip { color: var(--muted); font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .user-chip { display: none; } }
@media (max-width: 480px) {
  .topbar-in { padding-left: 12px; gap: 6px; }
  .brand-name { font-size: 15px; }
  .topbar .btn-sm span { display: none; }
  .topbar .btn-sm { width: 40px; height: 40px; padding: 0; }
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px; cursor: pointer;
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-lime:hover { background: #e8ff5c; }
.btn-ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: #302f35; }
.btn-danger { background: rgba(255, 92, 92, 0.14); color: var(--danger); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

/* ---------- Заголовки ---------- */
.hero { padding: 56px 0 28px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--bg-2);
}
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.h1 { font-size: clamp(38px, 7vw, 76px); line-height: 0.98; letter-spacing: -0.035em; font-weight: 900; margin: 18px 0 14px; }
.h1 .hl { background: var(--lime); color: var(--ink); padding: 0 0.14em; display: inline-block; margin-top: 6px; }
.lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0; }

/* ---------- Плашка прогресса ---------- */
.progress-banner {
  margin: 30px 0 10px; border-radius: var(--radius); padding: 26px 28px;
  background: linear-gradient(120deg, #1f1e21 0%, #19181b 60%), var(--card);
  border: 1px solid var(--line); position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: center;
}
.progress-banner::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 255, 30, 0.18), transparent 70%); pointer-events: none;
}
.pb-title { font-size: 22px; font-weight: 800; margin: 10px 0 14px; letter-spacing: -0.01em; }
.bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--lime); border-radius: 99px; transition: width 0.6s; }
.pb-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-top: 8px; }
@media (max-width: 700px) { .progress-banner { grid-template-columns: 1fr; padding: 22px; } }

/* ---------- Модули и карточки уроков ---------- */
.module { margin: 46px 0 0; }
.module-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.module-head h2 { font-size: 28px; font-weight: 900; letter-spacing: -0.02em; margin: 0; }
.module-head span { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }
.lesson-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 172px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
  transition: transform 0.18s, border-color 0.18s, background 0.18s; overflow: hidden;
}
a.lesson-card:hover { transform: translateY(-3px); border-color: rgba(220, 255, 30, 0.45); }
.lesson-card .num { position: absolute; right: 18px; top: 8px; font-size: 52px; font-weight: 900; color: rgba(255, 255, 255, 0.06); letter-spacing: -0.04em; line-height: 1; }
.lesson-card .ico {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--card-2); color: var(--muted);
}
.lesson-card h3 { margin: 4px 0 0; font-size: 18px; line-height: 1.25; font-weight: 800; padding-right: 54px; }
.lesson-card p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; font-size: 14px; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--card-2); color: var(--muted); }
.lesson-card.current { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.lesson-card.current .num { color: rgba(0, 0, 0, 0.12); }
.lesson-card.current p { color: rgba(18, 17, 19, 0.7); }
.lesson-card.current .ico { background: rgba(18, 17, 19, 0.12); color: var(--ink); }
.lesson-card.current .chip { background: rgba(18, 17, 19, 0.12); color: var(--ink); }
.lesson-card.done .ico { background: rgba(220, 255, 30, 0.12); color: var(--lime); }
.lesson-card.locked { opacity: 0.5; cursor: not-allowed; }
.lesson-card.locked .ico { color: var(--muted); }
.go { font-weight: 800; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Страница урока ---------- */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; padding: 26px 0 60px; }
@media (max-width: 1000px) { .lesson-layout { grid-template-columns: 1fr; } }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.back:hover { color: var(--text); }
.lesson-title { font-size: clamp(26px, 4vw, 40px); font-weight: 900; letter-spacing: -0.025em; line-height: 1.08; margin: 22px 0 10px; }
.lesson-desc { color: #c9c8cd; white-space: pre-wrap; margin: 0; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-top: 22px; padding: 18px 20px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.status-row .bar { flex: 1 1 200px; }
.status-text { font-size: 14px; color: var(--muted); }
.status-text b { color: var(--text); }

.side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; align-self: start; position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; }
@media (max-width: 1000px) { .side { position: static; max-height: none; } }
.side h4 { margin: 6px 8px 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.side-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; font-size: 14px; }
.side-item:hover { background: var(--card-2); }
.side-item.active { background: rgba(220, 255, 30, 0.1); color: var(--lime); }
.side-item.locked { opacity: 0.45; pointer-events: none; }
.side-item .n { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--card-2); font-size: 12px; font-weight: 800; }
.side-item.done .n { background: var(--lime); color: var(--ink); }
.side-mod { font-size: 12px; color: var(--muted); margin: 14px 10px 4px; font-weight: 700; }

/* ---------- Плеер ---------- */
.player {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9;
  user-select: none; -webkit-user-select: none; border: 1px solid var(--line);
}
.player video { width: 100%; height: 100%; display: block; background: #000; pointer-events: none; }
.player .hit { position: absolute; inset: 0; }
.player.fs, .player:fullscreen { border-radius: 0; border: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.player.fs { position: fixed; inset: 0; z-index: 1000; }
.wm {
  position: absolute; z-index: 3; pointer-events: none; color: rgba(255, 255, 255, 0.32);
  font-size: clamp(11px, 1.4vw, 15px); font-weight: 600; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: left 1.2s ease, top 1.2s ease;
}
.ctrl {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 30px 14px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); transition: opacity 0.25s;
}
.player.idle .ctrl { opacity: 0; }
.player.idle { cursor: none; }
.seek { position: relative; height: 16px; cursor: pointer; display: flex; align-items: center; }
.seek .track { position: relative; width: 100%; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, 0.22); }
.seek .allowed { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.25); border-radius: 9px; }
.seek .played { position: absolute; left: 0; top: 0; bottom: 0; background: var(--lime); border-radius: 9px; }
.seek .knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--lime); }
.ctrl-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #fff; }
.ctrl-row button { background: none; border: 0; color: #fff; cursor: pointer; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.ctrl-row button:hover { background: rgba(255, 255, 255, 0.12); }
.ctrl-row .time { font-size: 13px; font-variant-numeric: tabular-nums; opacity: 0.9; margin-left: 4px; }
.ctrl-row .sp { flex: 1; }
.ctrl-row .rate { width: auto; padding: 0 10px; font-weight: 700; font-size: 13px; }
.ctrl-row input[type=range] { width: 80px; accent-color: var(--lime); }
@media (max-width: 600px) { .ctrl-row input[type=range] { display: none; } }
.big-play {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 78px; height: 78px; border-radius: 50%; border: 0; background: var(--lime); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 40px rgba(220, 255, 30, 0.35);
}
.player.playing .big-play { display: none; }
.player-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); z-index: 5; background: #000; }

/* ---------- Формы, вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 30px; }
.auth-logo { width: 100%; display: block; margin: 0 0 24px; border-radius: 16px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input, textarea.input, select.input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--lime); }
textarea.input { resize: vertical; min-height: 90px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.note { color: var(--muted); font-size: 13px; text-align: center; margin-top: 16px; }

/* ---------- Админка ---------- */
.tabs { display: inline-flex; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px; margin: 26px 0 18px; }
.tabs button { border: 0; background: none; padding: 9px 18px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--lime); color: var(--ink); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 14px; font-size: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.form-row .field { margin: 0; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
}
.row .n { font-weight: 900; color: var(--muted); text-align: center; }
.row .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--muted); }
.row .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 760px) { .row { grid-template-columns: 30px minmax(0, 1fr); } .row .acts { grid-column: 1 / -1; justify-content: flex-start; } }
.st-ready { color: var(--ok); } .st-processing { color: var(--lime); } .st-error { color: var(--danger); } .st-empty { color: var(--muted); }
.upbar { height: 6px; border-radius: 9px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 6px; }
.upbar i { display: block; height: 100%; background: var(--lime); width: 0; }

dialog {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 24px;
  padding: 24px; width: min(560px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
dialog h3 { margin: 0 0 16px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--bg); border: 1px dashed rgba(220, 255, 30, 0.5); border-radius: 12px; padding: 14px; white-space: pre-wrap; user-select: all; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 2000;
  background: var(--text); color: var(--ink); padding: 12px 20px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: 0.25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.footer { color: var(--muted); font-size: 13px; text-align: center; padding: 50px 0 30px; }
