/* Светлая бело-голубая тема. Цвета — только здесь, в переменных. */
:root {
  --bg: #f4f8fd;
  --card: #ffffff;
  --line: #dbe7f5;
  --text: #0f1f3d;
  --muted: #5b6b86;
  --faint: #8a9ab3;

  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-deep: #1e3a8a;
  --sky: #0ea5e9;
  --blue-soft: #e8f1fe;
  --blue-softer: #f2f7ff;

  --done: #0891b2;
  --done-soft: #e0f5fa;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #b91c1c;
  --danger-soft: #fdecec;

  --shadow: 0 1px 2px rgba(15, 31, 61, .04), 0 8px 24px rgba(37, 99, 235, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -200px, #dbeafe 0%, rgba(219, 234, 254, 0) 70%) no-repeat,
    var(--bg);
  color: var(--text);
  font: 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.page { max-width: 780px; margin: 0 auto; padding: 32px 16px 48px; }

h1 { font-size: 30px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; margin: 0; }

/* ---------- шапка курса ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 32px 28px; margin-bottom: 28px; border-radius: 24px;
  background: linear-gradient(135deg, var(--blue) 0%, #3b82f6 55%, var(--sky) 100%);
  color: #fff; box-shadow: 0 12px 32px rgba(37, 99, 235, .25);
}
.hero::after {
  /* мягкий блик справа — чтобы шапка не была плоской плашкой */
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .14);
}
.hero-label {
  display: inline-block; margin-bottom: 10px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.hero-top { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hero-top .hero-label { margin-bottom: 0; }
.hero-hello { position: relative; margin-top: 8px; font-size: 16px; opacity: .92; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: rgba(255, 255, 255, .16); color: #fff;
}
.chip strong { font-weight: 700; }
.chip-warn { background: #fff; color: var(--warn); }

/* путь по урокам: кружки, соединённые линией */
.steps {
  position: relative; list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.step { position: relative; display: grid; justify-items: center; gap: 6px; }
.step + .step::before {
  /* линия от предыдущего кружка к этому */
  content: ""; position: absolute; top: 17px; right: 50%; width: 100%; height: 3px;
  background: rgba(255, 255, 255, .28); z-index: 0;
}
.step.is-done + .step::before { background: #fff; }
.step-dot {
  position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 700; text-decoration: none;
  background: rgba(255, 255, 255, .2); color: #fff; border: 2px solid rgba(255, 255, 255, .45);
}
.step.is-done .step-dot { background: #fff; color: var(--blue); border-color: #fff; }
.step.is-open .step-dot {
  background: #fff; color: var(--blue); border-color: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .28);
  animation: pulse 2.4s ease-in-out infinite;
}
.step.is-locked .step-dot { color: rgba(255, 255, 255, .7); }
.step-label { font-size: 12px; font-weight: 500; opacity: .9; white-space: nowrap; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(255, 255, 255, .28); }
  50% { box-shadow: 0 0 0 9px rgba(255, 255, 255, .12); }
}
@media (prefers-reduced-motion: reduce) { .step.is-open .step-dot { animation: none; } }

.next-step {
  position: relative; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center;
  margin-top: 24px; padding: 14px 18px; border-radius: 16px; text-decoration: none;
  background: #fff; color: var(--text); box-shadow: 0 6px 18px rgba(15, 31, 61, .12);
  transition: transform .15s;
}
.next-step:hover { transform: translateY(-1px); }
.next-step-kicker { grid-column: 1; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--blue); }
.next-step-title { grid-column: 1; font-weight: 700; line-height: 1.35; }
.next-step-meta { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.next-step-arrow {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; font-weight: 700;
}

/* ---------- уроки ---------- */
.lessons { display: grid; gap: 18px; }
.lesson {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); scroll-margin-top: 16px;
}
.lesson.is-open { border-color: #bfd6fb; box-shadow: 0 0 0 4px var(--blue-softer), var(--shadow); }
.lesson.is-locked { background: var(--blue-softer); box-shadow: none; }

.lesson-head { display: flex; align-items: flex-start; gap: 14px; padding: 18px 22px; }
.lesson-num {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  background: var(--blue-soft); color: var(--blue);
}
.is-open .lesson-num { background: var(--blue); color: #fff; }
.is-done .lesson-num { background: var(--done-soft); color: var(--done); }
.is-locked .lesson-num { background: #e6edf6; color: var(--faint); }
.lesson-num svg { width: 18px; height: 18px; }

.lesson-meta { flex: 1; min-width: 0; }
.lesson-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.lesson-title { margin-top: 2px; font-size: 17px; font-weight: 700; line-height: 1.35; }
.is-locked .lesson-title { color: var(--muted); }
.status { margin-top: 4px; font-size: 13px; color: var(--muted); }
.status.ok { color: var(--done); font-weight: 600; }
.badge {
  display: inline-block; padding: 2px 9px; text-transform: none; letter-spacing: 0; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: linear-gradient(90deg, var(--blue-soft), #e0f2fe); color: var(--blue);
}

.bar { height: 6px; margin: 0 22px 14px; background: var(--blue-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--sky)); transition: width .3s; }

.player {
  position: relative; aspect-ratio: 16 / 9; margin: 0 22px 20px;
  background: #0b1530; border-radius: 16px; overflow: hidden;
}
.player video, .player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* свои кнопки плеера (player.js, mountControls) */
.vp:focus { outline: none; }
.vp:focus-visible { box-shadow: 0 0 0 3px var(--sky); }
.vp video { cursor: pointer; }
.vp:fullscreen { border-radius: 0; }
.vp-big {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--sky));
  box-shadow: 0 10px 30px rgba(37, 99, 235, .45); transition: transform .15s, opacity .2s;
}
.vp-big:hover { transform: translate(-50%, -50%) scale(1.06); }
.vp-big svg { width: 30px; height: 30px; margin-left: 4px; }
.vp.is-playing .vp-big { opacity: 0; pointer-events: none; }
.vp-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px;
  padding: 28px 12px 10px; color: #fff;
  background: linear-gradient(0deg, rgba(8, 18, 40, .75), rgba(8, 18, 40, 0));
  transition: opacity .25s;
}
.vp.is-playing:not(.is-awake) .vp-bar { opacity: 0; }
.vp.is-playing:not(.is-awake) { cursor: none; }
.vp-bar button {
  width: 36px; height: 36px; border: 0; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: #fff;
}
.vp-bar button:hover { background: rgba(255, 255, 255, .16); }
.vp-bar svg { width: 20px; height: 20px; }
.vp-time { font-size: 13px; font-variant-numeric: tabular-nums; opacity: .9; }
.vp-gap { flex: 1; }

.hint {
  margin: -6px 22px 20px; padding: 10px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--warn); font-size: 14px;
}
/* Описание видно и у закрытого урока: человек заранее знает, что его ждёт. */
.lesson-desc { margin-top: 4px; font-size: 14px; line-height: 1.45; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 22px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.button:active { transform: translateY(1px); }
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-hover); }
.button-soft { background: var(--blue-soft); color: var(--blue-deep); border-color: #cfe0fb; }
.button-soft:hover { background: #dbe9fd; }
.button-accent { background: #fbbf24; color: #1f1300; font-weight: 700; }
.button-accent:hover { background: #f59e0b; }
.button.is-off { opacity: .55; cursor: not-allowed; }
.button.is-off:active { transform: none; }

.materials-title { margin: 4px 22px 10px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
/* Промо под уроком: предложение со сроком — должно читаться отдельно от кнопок. */
.promo {
  margin: 0 22px 16px; padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(135deg, #fff7e6, #fff1d6); border: 1px solid #fcd9a0;
}
.promo-note { margin: 0 0 12px; font-size: 15px; font-weight: 700; line-height: 1.4; color: #92400e; }
.promo-text { margin: -6px 0 14px; font-size: 14px; line-height: 1.5; color: #78350f; }

.rewatch { margin: 0 22px 18px; }
.rewatch summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 8px 14px; border-radius: 10px; background: var(--blue-softer);
  color: var(--blue); font-size: 14px; font-weight: 600;
}
.rewatch summary::-webkit-details-marker { display: none; }
.rewatch summary::before { content: "▶"; font-size: 10px; transition: transform .15s; }
.rewatch[open] summary::before { transform: rotate(90deg); }
.rewatch[open] summary { margin-bottom: 14px; }
.rewatch .player { margin: 0; }

.finish {
  display: flex; align-items: center; gap: 16px; padding: 22px;
  border-radius: 20px; border: 2px dashed #c7dbf8; background: var(--blue-softer);
}
.finish.is-done {
  border: 0; color: #fff;
  background: linear-gradient(135deg, var(--done) 0%, var(--sky) 100%);
  box-shadow: 0 12px 32px rgba(14, 165, 233, .25);
}
.finish.is-done .muted { color: rgba(255, 255, 255, .9); }
.finish-icon {
  flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-size: 26px; background: #fff;
}
.finish-title { font-size: 18px; font-weight: 700; }

/* ---------- низ страницы ---------- */
.footer { margin-top: 36px; display: grid; justify-items: center; gap: 12px; }
.support {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--blue); font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.support:hover { border-color: #bfd6fb; }
.support svg { width: 16px; height: 16px; }
.footer form { margin: 0; }
.logout { background: none; border: 0; color: var(--faint); font: inherit; font-size: 13px; cursor: pointer; }
.logout:hover { color: var(--muted); }

/* ---------- вход ---------- */
.login {
  max-width: 420px; margin: 48px auto 0; padding: 32px 28px; border-radius: 24px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.login-mark {
  width: 48px; height: 48px; margin-bottom: 16px; border-radius: 14px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--sky));
}
.login-mark svg { width: 22px; height: 22px; }
.login h1 { font-size: 24px; }
.login > .muted { margin-top: 8px; }
.login form { display: grid; gap: 16px; margin-top: 24px; }
.login label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.login input {
  font: inherit; padding: 12px 14px; border-radius: 12px;
  background: var(--blue-softer); border: 1px solid var(--line); color: var(--text);
}
.login input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px var(--blue-soft); }
.login .button { width: 100%; margin-top: 4px; }
.alert { margin-top: 16px; padding: 10px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }

@media (max-width: 560px) {
  .page { padding-top: 16px; }
  h1 { font-size: 24px; }
  .hero { padding: 24px 18px; border-radius: 20px; }
  .step-label { font-size: 11px; }
  .next-step { grid-template-columns: 1fr; row-gap: 2px; }
  .next-step-meta { grid-column: 1; grid-row: auto; margin-top: 8px; justify-content: space-between; }
  .rewatch { margin: 0 16px 16px; }
  .rewatch .player { margin: 0 -16px; }
  .finish { padding: 18px; }
  .lesson-head { padding: 16px; }
  .bar { margin: 0 16px 12px; }
  .player { margin: 0 0 16px; border-radius: 0; }
  .hint { margin-left: 16px; margin-right: 16px; }
  .actions { padding: 0 16px 16px; }
  .actions .button { width: 100%; }
  .promo { margin: 0 16px 14px; }
  .materials-title { margin: 4px 16px 10px; }
  .promo .button { width: 100%; }
}

/* Вход по ссылке — главный путь, с паролем — запасной, свёрнут. */
.notice { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--done-soft); color: var(--done); font-size: 14px; font-weight: 600; line-height: 1.45; }
.login-continue { width: 100%; margin-top: 16px; }
.login-other { margin-top: 20px; }
.login-help { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.login-help a { color: var(--blue); font-weight: 600; }
.apply-notes { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.apply-choice { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.apply-choice legend { padding: 0 0 2px; font-size: 14px; font-weight: 500; color: var(--muted); }
.login .apply-check, .login .apply-choice label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; color: var(--text); line-height: 1.4; cursor: pointer; }
.login .apply-check input, .login .apply-choice input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; padding: 0; accent-color: var(--blue); }
.login-pass form { margin-top: 16px; }

/* Несколько курсов: выбор на /course и ссылка назад со страницы курса. */
.course-list { display: grid; gap: 12px; margin-top: 16px; }
.hero-back { color: inherit; text-decoration: none; }
.hero-back:hover { text-decoration: underline; }
.course-list .next-step { margin-top: 0; }

/* Академия: заголовки модулей и домашки (templates/academy.html). */
.module { margin: 22px 0 10px; padding: 16px 20px; border-radius: 18px; background: var(--blue-soft); border: 1px solid var(--line); }
.module.is-closed { background: var(--card); opacity: .8; }
.module.is-done { background: var(--done-soft); }
.module-head { display: flex; align-items: center; gap: 16px; }
.module-img { flex: none; width: 120px; height: 68px; object-fit: cover; border-radius: 12px; }
.lesson-img { flex: none; width: 96px; height: 54px; object-fit: cover; border-radius: 10px; }
@media (max-width: 520px) { .module-img { width: 88px; height: 50px; } .lesson-img { display: none; } }
.module-head .lesson-kicker { margin: 0; }
.module-title { margin: 2px 0 4px; font-size: 20px; font-weight: 800; }
.module .status { margin: 0; }
.hw { margin: 8px 22px 18px; padding: 14px 16px; border-radius: 14px; background: var(--blue-softer); border: 1px solid var(--line); }
.hw .materials-title { margin: 0 0 6px; }
.hw-task { margin: 0 0 10px; }
.hw-task summary { cursor: pointer; list-style: revert; }
.hw-text { line-height: 1.55; font-size: 15px; }
.hw-text p { margin: 0 0 6px; }
.hw-text .hw-step { margin: 16px 0 6px; font-size: 16px; font-weight: 800; color: var(--blue-deep); }
.hw-text .hw-lead { margin-top: 10px; font-weight: 700; }
.hw-text .hw-num { padding-left: 14px; }
.hw-status { margin: 8px 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: var(--card); border: 1px solid var(--line); }
.hw-status.is-approved { background: var(--done-soft); color: var(--done); }
.hw-status.is-rework { background: var(--warn-soft); color: var(--warn); }
.hw-comment { margin: 6px 0 0; color: var(--text); white-space: pre-line; }
.hw-form { display: grid; gap: 10px; margin-top: 10px; }
.hw-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.hw-form textarea, .hw-form input[type=url] { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.hw-form .button { justify-self: start; }
