:root {
  --bg: #0b0b0f;
  --bg-2: #141419;
  --bg-3: #1c1c23;
  --line: #2a2a33;
  --text: #f4f4f6;
  --muted: #9a9aa6;
  --accent: #fabd36;
  --accent-2: #ffd166;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  --gutter: clamp(16px, 4vw, 56px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* boot / spinner */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; background: var(--bg-3); color: var(--text); transition: .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #212832; }
.btn-white { background: #fff; color: #000; }
.btn-white:hover { filter: none; background: #ddd; }
.btn-ghost { background: rgba(109, 109, 110, .55); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--line); }
.btn-danger { background: transparent; color: #f87171; border: 1px solid #7f1d1d; }
.btn-ok { background: var(--ok); color: #04130a; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
svg.i { width: 18px; height: 18px; flex: none; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; outline: none; transition: .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(250, 189, 54, .2); }
textarea.input { min-height: 120px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px; user-select: none; }
.chip input { display: none; }
.chip:has(input:checked) { background: rgba(250, 189, 54, .15); border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); }
.error-msg { color: #f87171; font-size: 14px; min-height: 20px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% 0%, rgba(250, 189, 54, .25), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(80, 40, 200, .2), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: rgba(20, 20, 25, .85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; padding: 36px 32px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-logo svg { width: 14px; height: 14px; fill: #fff; }
.brand-logo img { width: 22px; height: 22px; object-fit: contain; }

/* topbar */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 50; height: 68px; display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter); background: linear-gradient(to bottom, rgba(0, 0, 0, .85), transparent); transition: background .3s; }
.topbar.solid { background: rgba(11, 11, 15, .97); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 20px; }
.topbar nav a { color: #ccc; font-size: 14px; font-weight: 500; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; }
.topbar .spacer { flex: 1; }
.search { position: relative; display: flex; align-items: center; }
.search input { width: 0; opacity: 0; padding: 8px 12px 8px 36px; background: rgba(0, 0, 0, .7); border: 1px solid transparent; border-radius: 6px; outline: none; transition: .25s; }
.search.open input, .search input:focus, .search input:not(:placeholder-shown) { width: 240px; opacity: 1; border-color: #555; }
.search button { position: absolute; left: 0; }
.avatar { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex: none; }
.menu { position: relative; }
.menu-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 0; }
.dropdown { position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; background: rgba(15, 15, 20, .98); border: 1px solid var(--line); border-radius: 8px; padding: 6px; box-shadow: var(--shadow); display: none; }
.menu.open .dropdown { display: block; }
.dropdown .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 6px; background: none; border: 0; cursor: pointer; font-size: 14px; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg-3); }
.burger { display: none; }

/* hero */
.hero { position: relative; min-height: min(82vh, 760px); display: flex; align-items: flex-end; padding: 120px var(--gutter) 120px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11, 11, 15, .95) 0%, rgba(11, 11, 15, .55) 45%, transparent 75%), linear-gradient(to top, var(--bg) 0%, transparent 35%); }
.hero-content { position: relative; max-width: 620px; }
.hero .tag { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #ddd; margin-bottom: 14px; }
.hero .tag b { color: var(--accent); }
.hero h1 { font-size: clamp(32px, 5.5vw, 64px); font-weight: 800; letter-spacing: -.03em; margin-bottom: 16px; text-shadow: 0 2px 20px rgba(0, 0, 0, .5); }
.hero p { font-size: clamp(15px, 1.4vw, 18px); color: #ddd; margin: 0 0 22px; max-width: 540px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero .meta { display: flex; gap: 14px; align-items: center; color: #ccc; font-size: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .1); }
.pill.ok { background: rgba(34, 197, 94, .15); color: #4ade80; }
.pill.red { background: rgba(250, 189, 54, .18); color: #ffd166; }
.pill.warn { background: rgba(245, 158, 11, .15); color: #fbbf24; }

/* rows / carousel */
.rows { position: relative; z-index: 2; margin-top: -90px; padding-bottom: 60px; }
.rows.flat { margin-top: 0; padding-top: 100px; }
.row-block { margin-bottom: 36px; }
.row-title { padding: 0 var(--gutter); font-size: 20px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: baseline; gap: 12px; }
.row-title .muted { font-size: 13px; font-weight: 500; }
.carousel { position: relative; }
.track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); padding: 6px var(--gutter) 18px; scrollbar-width: none; }
.track::-webkit-scrollbar { display: none; }
.arrow { position: absolute; top: 6px; bottom: 18px; width: calc(var(--gutter) - 6px); min-width: 40px; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; z-index: 3; opacity: 0; transition: .2s; display: grid; place-items: center; }
.arrow svg { width: 30px; height: 30px; }
.carousel:hover .arrow { opacity: 1; }
.arrow.left { left: 0; border-radius: 0 6px 6px 0; }
.arrow.right { right: 0; border-radius: 6px 0 0 6px; }

.card { flex: 0 0 clamp(220px, 23vw, 320px); scroll-snap-align: start; position: relative; border-radius: 8px; overflow: hidden; background: var(--bg-2); cursor: pointer; transition: transform .25s, box-shadow .25s; }
.card:hover { transform: scale(1.05); z-index: 5; box-shadow: var(--shadow); }
.card .thumb { aspect-ratio: 16/9; position: relative; }
.card .thumb .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: .2s; background: rgba(0, 0, 0, .35); }
.card:hover .thumb .play { opacity: 1; }
.play-circle { width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .95); display: grid; place-items: center; }
.play-circle svg { width: 20px; height: 20px; fill: #000; margin-left: 3px; }
.card .body { padding: 12px 14px 14px; }
.card h3 { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; }
.card .done-badge { position: absolute; top: 10px; right: 10px; background: var(--ok); color: #04130a; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.card .new-badge { position: absolute; top: 10px; right: 10px; background: var(--accent); color: #212832; border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.progress { height: 4px; background: rgba(255, 255, 255, .15); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.progress.ok > i { background: var(--ok); }
.card .thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0; height: 4px; }
.card .thumb .progress > i { border-radius: 0; }

/* cover fallback */
.cover { width: 100%; height: 100%; background-size: cover; background-position: center; position: relative; display: flex; align-items: flex-end; padding: 14px; overflow: hidden; }
.cover.gen::before { content: ""; position: absolute; width: 70%; aspect-ratio: 1; right: -15%; top: -30%; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.cover.gen::after { content: ""; position: absolute; width: 40%; aspect-ratio: 1; right: 20%; bottom: -25%; border-radius: 50%; background: rgba(0, 0, 0, .15); }
.cover .cover-title { position: relative; z-index: 1; font-weight: 800; font-size: clamp(16px, 1.6vw, 22px); line-height: 1.1; letter-spacing: -.02em; text-shadow: 0 2px 10px rgba(0, 0, 0, .3); max-width: 80%; }
.cover .cover-cat { position: absolute; z-index: 1; top: 12px; left: 14px; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; opacity: .85; }

/* grid page */
.page { padding: 100px var(--gutter) 60px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.grid .card { flex: none; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 16px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--text); border-color: var(--accent); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .5; }

.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 0 var(--gutter); margin-bottom: 36px; }
.summary-strip .s { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.summary-strip .s b { display: block; font-size: 24px; font-weight: 800; }

/* course detail */
.course-hero { min-height: 480px; padding-bottom: 50px; }
.course-wrap { padding: 0 var(--gutter) 60px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; max-width: 1500px; }
.module { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.module-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; user-select: none; }
.module-head h3 { font-size: 16px; flex: 1; }
.module-head .chev { transition: .2s; }
.module.closed .chev { transform: rotate(-90deg); }
.module.closed .lessons { display: none; }
.lesson-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-top: 1px solid var(--line); cursor: pointer; transition: .15s; }
.lesson-item:hover { background: var(--bg-3); }
.lesson-item.current { background: rgba(250, 189, 54, .1); box-shadow: inset 3px 0 0 var(--accent); }
.lesson-item .num { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); flex: none; }
.lesson-item.done .num { background: var(--ok); border-color: var(--ok); color: #04130a; }
.lesson-item .t { flex: 1; min-width: 0; }
.lesson-item .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: sticky; top: 88px; }
.side-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }
.big-pct { font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border: 0; }

/* player */
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 100vh; padding-top: 68px; }
.player-main { min-width: 0; }
.player-top { display: flex; align-items: center; gap: 14px; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); }
.player-top .crumbs { min-width: 0; flex: 1; }
.player-top .crumbs a { color: var(--muted); font-size: 13px; }
.player-top .crumbs h2 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-box { position: relative; background: #000; aspect-ratio: 16/9; max-height: 72vh; width: 100%; }
.video-box iframe, .video-box video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.video-box.no-video { aspect-ratio: auto; max-height: none; background: linear-gradient(135deg, var(--bg-2), var(--bg-3)); padding: 40px; display: flex; align-items: center; gap: 16px; }
.autonext { position: absolute; inset: 0; background: rgba(0, 0, 0, .82); display: grid; place-items: center; text-align: center; z-index: 5; }
.autonext .ring { font-size: 46px; font-weight: 800; margin: 8px 0 16px; }
.lesson-bar { display: flex; align-items: center; gap: 12px; padding: 16px var(--gutter); border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg-2); }
.lesson-bar .grow { flex: 1; }
.lesson-content { padding: 28px var(--gutter) 80px; max-width: 900px; }
.prose h1, .prose h2, .prose h3 { margin: 1.2em 0 .5em; }
.prose h2 { font-size: 22px; }
.prose h3 { font-size: 18px; }
.prose p, .prose li { color: #d8d8de; }
.prose a { color: var(--accent-2); text-decoration: underline; }
.prose code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; }
.prose blockquote { margin: 1em 0; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--bg-2); color: #ccc; }
.attachment { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; margin-top: 16px; }
.player-side { border-left: 1px solid var(--line); background: var(--bg-2); height: calc(100vh - 68px); position: sticky; top: 68px; overflow-y: auto; }
.player-side .side-head { padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
.player-side .mod-title { padding: 14px 18px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.player-side .lesson-item { border-top: 0; }

/* congrats */
.congrats { text-align: center; padding: 30px 10px 10px; }
.congrats .trophy { font-size: 64px; line-height: 1; }
.congrats h2 { font-size: 26px; margin: 12px 0 8px; }

/* certificate */
.cert-page { min-height: 100vh; padding: 100px 16px 40px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.cert { width: min(1000px, 100%); aspect-ratio: 1.414; background: #fffdf7; color: #1a1a1a; border-radius: 4px; padding: 5%; position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-size: clamp(8px, 1.4vw, 15px); }
.cert::before { content: ""; position: absolute; inset: 2.2%; border: 2px solid #c8a24a; pointer-events: none; }
.cert::after { content: ""; position: absolute; inset: 3.2%; border: 1px solid #e3cf9a; pointer-events: none; }
.cert .c-brand { font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-size: 1em; }
.cert h1 { font-family: Georgia, serif; font-size: 3.6em; font-weight: 400; margin: .4em 0 .3em; letter-spacing: .02em; }
.cert .c-name { font-family: Georgia, serif; font-size: 2.6em; font-style: italic; border-bottom: 1px solid #c8a24a; padding: 0 1em .1em; margin: .3em 0 .6em; }
.cert .c-text { font-size: 1.15em; max-width: 75%; line-height: 1.6; color: #333; }
.cert .c-foot { display: flex; justify-content: space-between; width: 80%; margin-top: 3em; font-size: .9em; color: #555; }
.cert .c-foot div { border-top: 1px solid #999; padding-top: .5em; min-width: 30%; }
.cert .seal { position: absolute; right: 8%; bottom: 10%; width: 9em; height: 9em; border-radius: 50%; background: radial-gradient(circle, #e0c068, #b8902f); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9em; letter-spacing: .1em; box-shadow: 0 0 0 .4em #fffdf7, 0 0 0 .55em #c8a24a; transform: rotate(-12deg); }

/* ===== admin ===== */
.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { padding: 4px 8px 20px; }
.sidebar a.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #bbb; font-weight: 500; font-size: 14px; }
.sidebar a.nav:hover { background: var(--bg-3); color: #fff; }
.sidebar a.nav.active { background: rgba(250, 189, 54, .14); color: #fff; }
.sidebar a.nav.active svg { color: var(--accent); }
.sidebar .sep { height: 1px; background: var(--line); margin: 12px 0; }
.sidebar .bottom { margin-top: auto; }
.admin-main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.admin-head p { margin: 4px 0 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16px; }
.panel-body { padding: 18px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; min-width: 220px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255, 255, 255, .02); }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell .avatar { width: 36px; height: 36px; border-radius: 50%; }
.mini-progress { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.mini-progress .progress { flex: 1; height: 6px; }
.thumb-sm { width: 96px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; flex: none; }
.thumb-sm .cover { padding: 6px; }
.thumb-sm .cover-title { font-size: 10px; }
.thumb-sm .cover-cat { display: none; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed-item:last-child { border: 0; }
.feed-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-top: 7px; flex: none; }
.heat { display: inline-block; min-width: 46px; text-align: center; padding: 3px 6px; border-radius: 4px; font-weight: 700; font-size: 12px; }

/* course editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.mod-edit { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; background: var(--bg); }
.mod-edit-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg-3); border-radius: var(--radius) var(--radius) 0 0; }
.mod-edit-head .input { background: transparent; border-color: transparent; font-weight: 700; padding: 6px 8px; }
.mod-edit-head .input:hover { border-color: var(--line); }
.les-edit { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.les-edit:last-of-type { border-bottom: 0; }
.les-edit .t { flex: 1; min-width: 0; }
.les-edit .t div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drag { cursor: grab; color: var(--muted); }
.dragging { opacity: .4; }
.drop-target { box-shadow: inset 0 2px 0 var(--accent); }
.cover-preview { aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); }
.upload-line { display: flex; gap: 8px; }
.upload-line .input { flex: 1; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); animation: pop .2s; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--bg-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* toast */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-3); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow); min-width: 240px; max-width: 360px; font-size: 14px; animation: pop .2s; }
.toast.err { border-left-color: #ef4444; }

.notice { background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .35); color: #fcd34d; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }


/* quiz */
.quiz-block { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-top: 4px; border-radius: var(--radius); border: 1px solid rgba(250, 189, 54, .45); background: linear-gradient(90deg, rgba(250, 189, 54, .14), rgba(250, 189, 54, .03)); transition: .15s; }
.quiz-block:hover { filter: brightness(1.15); }
.quiz-block.locked { border-color: var(--line); background: var(--bg-2); }
.quiz-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #212832; flex: none; }
.quiz-block.locked .quiz-icon { background: var(--bg-3); color: var(--muted); }
.quiz-page { max-width: 860px; }
.quiz-head { margin: 14px 0 18px; }
.quiz-head h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.tag-sm { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 6px; }
.quiz-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.quiz-facts > div { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.quiz-facts b { display: block; font-size: 20px; }
.quiz-state { text-align: center; padding: 48px 20px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
.quiz-state > svg { width: 52px; height: 52px; color: var(--muted); margin-bottom: 10px; }
.quiz-state.ok > svg { color: var(--ok); }
.quiz-state.bad > svg { color: #ef4444; }
.quiz-state h2 { font-size: 24px; margin-bottom: 6px; }
.q-card { border: 1px solid var(--line); background: var(--bg-2); border-radius: 12px; padding: 18px 20px 14px; margin: 0 0 14px; min-width: 0; }
.q-card legend, .q-card .legend { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; font-size: 16px; padding: 0; margin-bottom: 14px; float: left; width: 100%; }
.q-card legend + * { clear: both; }
.q-num { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.q-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: .12s; background: var(--bg); clear: both; }
.q-opt:hover { border-color: #555; }
.q-opt input { position: absolute; opacity: 0; pointer-events: none; }
.q-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #555; flex: none; transition: .12s; }
.q-opt.selected { border-color: var(--accent); background: rgba(250, 189, 54, .08); }
.q-opt.selected .q-radio { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 9px var(--accent); }
.q-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.review .q-opt { cursor: default; }
.review .q-opt.right { border-color: var(--ok); background: rgba(34, 197, 94, .1); }
.review .q-opt.right .q-radio { border-color: var(--ok); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 9px var(--ok); }
.review .q-opt.wrong { border-color: #b91c1c; background: rgba(239, 68, 68, .1); }
.review .q-opt.wrong .q-radio { border-color: #ef4444; box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 9px #ef4444; }
.review .q-opt:not(.selected):not(.right) .q-radio { box-shadow: none; }
.q-verdict { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.is-right .q-verdict { color: #4ade80; }
.is-wrong .q-verdict { color: #f87171; }
.q-expl { display: flex; gap: 8px; font-size: 14px; color: #ccc; background: var(--bg-3); border-radius: 8px; padding: 10px 12px; margin-top: 4px; }
.quiz-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin: 20px -18px 0; background: rgba(11, 11, 15, .96); border-top: 1px solid var(--line); backdrop-filter: blur(8px); z-index: 5; }
.quiz-bar .progress { margin-top: 6px; }
.quiz-result { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; margin-top: 20px; padding: 28px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
.quiz-result h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.quiz-result > div:last-child { flex: 1 1 280px; }
.score-ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; flex: none; background: conic-gradient(var(--c) calc(var(--pct) * 1%), var(--bg-3) 0); }
.score-ring > div { width: 124px; height: 124px; border-radius: 50%; background: var(--bg-2); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring b { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }

/* quiz editor (admin) */
.qe-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; background: var(--bg); }
.qe-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qe-opt { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qe-opt input[type=radio] { accent-color: var(--ok); width: 18px; height: 18px; flex: none; cursor: pointer; }
.qe-opt .input { flex: 1; }
.qe-opt.is-correct .input { border-color: var(--ok); }


/* audience selector + badges */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); user-select: none; transition: .12s; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt svg.i { width: 15px; height: 15px; }
.seg-opt:hover { color: var(--text); }
.seg-opt:has(input:checked) { background: var(--accent); color: #212832; }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.aud { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.aud-func { background: rgba(37, 99, 235, .18); color: #93b4ff; }
.aud-aluno { background: rgba(124, 58, 237, .2); color: #c4a8ff; }


.aud-all { background: rgba(255, 255, 255, .08); color: var(--muted); }
.mod-aud { width: auto !important; flex: none; font-size: 13px; padding: 6px 8px !important; font-weight: 500 !important; background: var(--bg) !important; border-color: var(--line) !important; }
.mod-aud:disabled { opacity: .6; cursor: not-allowed; }
.seg.is-locked { opacity: .85; }
.seg-opt.on { background: var(--bg-3); color: var(--text); cursor: default; }

/* responsive */
.admin-burger { display: none !important; }
@media (max-width: 1100px) {
  .course-wrap, .editor, .two-col { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .player-layout { grid-template-columns: 1fr; }
  .player-side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .topbar { gap: 14px; }
  .topbar nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0; background: rgba(11, 11, 15, .98); border-bottom: 1px solid var(--line); }
  .topbar nav.open { display: flex; }
  .topbar nav a { padding: 14px var(--gutter); }
  .burger { display: inline-grid; }
  .search.open input, .search input:focus, .search input:not(:placeholder-shown) { width: 150px; }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; width: 260px; transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .admin-burger { display: inline-grid !important; }
  .hero { min-height: 70vh; padding-bottom: 100px; }
  .card { flex-basis: 70vw; }
  .card:hover { transform: none; }
  .arrow { display: none; }
}

@media print {
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: fixed; inset: 0; width: 100%; box-shadow: none; font-size: 14px; }
  @page { size: A4 landscape; margin: 0; }
}
