:root {
  color-scheme: dark;
  --accent: #fcf5f5;
  --accent-text: #1a070d;
  --bg: #1a070d;
  --surface: #1a070d;
  --surface-2: #2c0d16;
  --text: #f6ecee;
  --muted: #cdb3ba;
  --line: #93505f;
  --error: #f0937f;
  --error-soft: #4a1f22;
  --ok: #7fd0ae;
  --ok-soft: #1f3a30;
  --accent-ink: var(--accent);
  --accent-hover: color-mix(in srgb, var(--accent) 82%, var(--bg));
  --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --focus: color-mix(in srgb, var(--accent) 80%, #3b82f6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); }
h2 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

kbd {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: .85em;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
}
.skip:focus { top: 12px; color: var(--accent-text); }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 40px; padding-bottom: 64px; }
main.narrow { max-width: 480px; }
main.wide { max-width: 1240px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.mark { width: 36px; height: 36px; flex: none; object-fit: contain; }

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a, .linklike {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: .95rem;
}
.site-nav a:hover, .linklike:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; background: var(--surface-2); }
.site-nav .btn { margin-left: 4px; color: var(--accent-text); background: var(--accent); }
.site-nav .btn:hover { color: var(--accent-text); background: var(--accent-hover); }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; cursor: pointer; }

.menu-btn {
  display: none;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.menu-btn[aria-expanded="true"] { background: var(--surface-2); }
.burger { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.top-in { position: relative; }
.has-menu .menu-btn { display: inline-flex; align-items: center; gap: 8px; }
.has-menu .site-nav { display: none; }
.has-menu .site-nav.open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  position: absolute;
  right: 0;
  top: calc(100% - 6px);
  min-width: 220px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.has-menu .site-nav.open a, .has-menu .site-nav.open .linklike { padding: 10px 12px; font-size: 1rem; }
.has-menu .site-nav.open .btn { margin: 6px 0 0; text-align: center; }
.has-menu .site-nav.open form, .has-menu .site-nav.open .linklike { display: block; width: 100%; text-align: left; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: .95rem; }
.btn-wide { width: 100%; margin-top: 8px; }
.btn-ghost { background: transparent; color: var(--accent-ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--accent-hover); }
.btn-tiny { min-height: 34px; padding: 4px 12px; font-size: .9rem; border-radius: 8px; }
.btn-danger { background: var(--error); color: var(--surface); }
.btn-danger:hover { background: var(--error); color: var(--surface); opacity: .9; }

.hero { padding: 32px 0 48px; max-width: 660px; }
.hero h1 { font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); }
.lede { font-size: 1.15rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

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

.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card p:last-child, .panel p:last-child { margin-bottom: 0; }
.panel { padding: 32px 28px; }
.stack { display: grid; gap: 16px; }

.form { display: grid; gap: 6px; }
.form label { font-weight: 600; font-size: .95rem; margin-top: 10px; }
.form label:first-child, .form input[type="hidden"] + label { margin-top: 0; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 0; line-height: 1.5; resize: vertical; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); }
input[type="file"] { padding: 8px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.form .btn:not(.btn-wide) { justify-self: start; margin-top: 12px; }

.hint { font-size: .875rem; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; margin-top: 20px; }
.center + .center { margin-top: 4px; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-size: .95rem; }
.alert p { margin: 0 0 8px; }
.alert-error { background: var(--error-soft); color: var(--error); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--accent-soft); color: var(--text); }
.error-text { color: var(--error); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.empty {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty .btn { margin-top: 8px; }
.code { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: .08em; margin-bottom: 4px; }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; padding: 20px 0; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row input, .row select { flex: 1 1 200px; width: auto; }
.grow { flex: 1 1 auto; min-width: 0; }
.row-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.form .row { margin-top: 12px; }
.form .row .btn { margin-top: 0; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 400 !important; margin-top: 10px; cursor: pointer; }
.checks { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; margin: 10px 0 0; }
.checks legend { font-weight: 600; font-size: .95rem; padding: 0 6px; }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-info { background: var(--accent-soft); color: var(--accent-ink); }
.badge-error { background: var(--error-soft); color: var(--error); }
td > .badge:first-child { margin-left: 0; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: -16px 0 24px; }
.tabs a { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.stat-card { display: block; text-decoration: none; color: var(--text); }
.stat-card:hover { border-color: var(--accent); color: var(--text); }
.stat { display: block; font-size: 2.25rem; font-weight: 700; line-height: 1; margin: 4px 0 8px; }

.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 8px 16px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
tr:last-child td { border-bottom: 0; }

.module { display: grid; gap: 12px; }
.lesson-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lesson-rows li { padding: 8px 0; border-bottom: 1px solid var(--line); }

progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  accent-color: var(--accent);
  appearance: none;
}
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.bar-cell { min-width: 120px; }
.bar-cell span { display: block; margin-bottom: 4px; }
.trend td { white-space: nowrap; }
.announce { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; }
.announce h2 { margin: 0; }
.announce-body { white-space: pre-line; margin: 8px 0 4px; }

.course-card { display: grid; gap: 10px; align-content: start; padding-top: 0; overflow: hidden; }
.course-card h2 { margin: 0; }
.course-card h2 a { color: var(--text); text-decoration: none; }
.course-card h2 a:hover { color: var(--accent-ink); }
.course-card .btn { justify-self: start; margin-top: 4px; }
.course-card p { margin: 0; }
.course-card .prices { margin: 0; }
.cover {
  display: grid;
  place-items: center;
  height: 96px;
  margin: 0 -24px 6px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--surface)));
  color: var(--accent-text);
  font-size: 2.5rem;
  font-weight: 700;
  text-transform: uppercase;
}

.outline { display: grid; gap: 20px; margin-top: 16px; }
.outline h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.outline-list, .checklist { list-style: none; margin: 0; padding: 0; }
.outline-list li, .checklist li { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.outline-list a { color: var(--text); text-decoration: none; }
.outline-list a:hover { color: var(--accent-ink); text-decoration: underline; }
.outline-list a[aria-current="page"] { font-weight: 650; color: var(--accent-ink); }
.outline-list .badge { margin-left: 0; }
.tick {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  font-size: .75rem;
  transform: translateY(3px);
}
.done > .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.checklist .done > span:not(.tick) { color: var(--muted); text-decoration: line-through; }
.outline-list .locked { color: var(--muted); }
.meta { margin-left: auto; font-size: .8rem; color: var(--muted); }
.outline-list .meta { white-space: nowrap; }

.offers { margin: 8px 0 0; }
.offers li.row + li.row { border-top: 1px solid var(--line); }
.locked-panel { max-width: 560px; margin: 0 auto; }
.lock-mark { font-size: 2rem; line-height: 1; margin-bottom: 12px; }

.lesson-layout { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.lesson-outline { margin-top: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; }
.player video { display: block; width: 100%; height: 100%; }
.player-wait { display: grid; place-items: center; color: #e8e6e1; padding: 24px; text-align: center; margin-bottom: 24px; }
.player-msg { position: absolute; left: 12px; right: 12px; bottom: 56px; margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(0, 0, 0, .75); color: #fff; font-size: .9rem; }
.keys { margin-bottom: 20px; }
.lesson-body { max-width: 70ch; overflow-wrap: anywhere; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.prevnext { display: flex; gap: 8px; flex-wrap: wrap; }

.plain { list-style: none; padding: 0; margin: 8px 0 16px; }
.plain li { padding: 6px 0; }
.plain li.row + li.row { border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-outline { position: static; max-height: none; }
  .player { border-radius: 0; margin-left: -16px; margin-right: -16px; }
}

@media (max-width: 720px) {
  .has-menu .site-nav.open { left: 0; min-width: 0; }
}

@media (max-width: 560px) {
  main.wrap { padding-top: 24px; }
  .panel { padding: 24px 18px; }
  .card { padding: 20px 18px; }
  .cover { margin: 0 -18px 6px; }
  .course-card { padding-top: 0; }
  .top-in { padding-top: 10px; padding-bottom: 10px; }
  .actions .btn { flex: 1 1 100%; }
  .row-actions { margin-left: 0; }
  .lesson-actions .btn, .lesson-actions form { width: 100%; }
}

.top-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.preview-switch {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 4px 10px 4px 6px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.preview-switch:hover { color: var(--text); }
.preview-switch .track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.preview-switch .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.preview-switch[aria-checked="true"] { color: var(--text); border-color: var(--accent); }
.preview-switch[aria-checked="true"] .track { background: var(--accent); border-color: var(--accent); }
.preview-switch[aria-checked="true"] .knob { left: 16px; background: var(--accent-text); }
.preview-bar { background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--text); font-size: .9rem; padding: 8px 0; }
.title-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.title-row { margin-bottom: .5em; }
.title-row h1 { margin: 0 4px 0 0; }
.preview-bar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.classrooms { position: relative; }
.classrooms summary {
  display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer;
  min-height: 36px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: .9rem; font-weight: 600;
}
.classrooms summary::-webkit-details-marker { display: none; }
.classrooms summary:hover, .classrooms[open] summary { background: var(--surface-2); }
.chev { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.classrooms[open] .chev { transform: rotate(180deg); }
.classrooms ul {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px;
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.classrooms li a, .classrooms .soon { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; text-decoration: none; }
.classrooms li a { color: var(--text); font-weight: 600; }
.classrooms li a:hover { background: var(--surface-2); }
.classrooms .soon { color: var(--muted); cursor: default; }
.classrooms .tag { font-size: .75rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
