:root {
  --bg: #faf7f2; --bg-alt: #f1ece3; --card: #ffffff; --ink: #1d2733; --muted: #65707c; --line: #e3ddd2;
  --accent: #0f6e64; --accent-ink: #ffffff; --accent-soft: #dcefeb; --warm: #e0794a;
  --ok: #1d7a46; --ok-bg: #e2f3e8; --wait: #8a5a00; --wait-bg: #fbefd2; --bad: #b3261e; --bad-bg: #fbe3e1;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.05);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d; --bg-alt: #1a1f26; --card: #1f252d; --ink: #e8e6e1; --muted: #9aa3ad; --line: #2e3640;
    --accent: #3fb3a3; --accent-ink: #0b1714; --accent-soft: #183a36; --warm: #f0946a;
    --ok: #6fd39a; --ok-bg: #173325; --wait: #f1c46b; --wait-bg: #3a2f14; --bad: #ff8a80; --bad-bg: #3d1f1d;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.2rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted, .meta { color: var(--muted); }
.meta { font-size: .88rem; margin: 0 0 .5em; }
.hidden { display: none !important; }

.btn { display: inline-block; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  padding: .7em 1.4em; font: 600 1rem var(--sans); text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn-big { font-size: 1.15rem; padding: .9em 1.8em; }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.danger { color: var(--bad) !important; }

.brand { font: 700 1.35rem var(--serif); color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); margin-left: .3em; font-style: italic; }

/* ---- визитка ---- */
.draft { background: var(--wait-bg); color: var(--wait); text-align: center; font-size: .9rem; padding: .45em 16px; }
.site-head { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.head-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.head-in nav { display: flex; gap: 20px; margin-left: auto; }
.head-in nav a { color: var(--ink); text-decoration: none; }
.head-in nav a:hover { color: var(--accent); }
.head-in .btn { padding: .5em 1.1em; font-size: .95rem; }
.hero { padding: 72px 0 64px; }
.hero-in { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.kicker { color: var(--warm); font-weight: 600; letter-spacing: .02em; margin: 0 0 .7em; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-card { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 28px;
  display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.bubble { padding: .65em 1em; border-radius: 18px; max-width: 80%; font-size: 1.02rem; }
.b1 { background: var(--accent-soft); align-self: flex-start; border-bottom-left-radius: 4px; }
.b2 { background: var(--accent); color: var(--accent-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.sec { padding: 64px 0; }
.sec.alt { background: var(--bg-alt); }
.two { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: center; }
.photo { aspect-ratio: 4/5; border-radius: 24px; background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 12px, var(--line) 12px, var(--line) 24px);
  display: grid; place-items: center; color: var(--muted); font-weight: 600; }
.ticks { padding: 0; list-style: none; }
.ticks li { padding-left: 1.6em; position: relative; margin: .4em 0; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card p { margin: 0; color: var(--muted); }
.price { font: 700 1.8rem var(--serif); color: var(--ink) !important; margin: .2em 0 !important; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 36px; }
.how div { display: flex; gap: 14px; align-items: flex-start; }
.how b { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--warm); color: #fff; display: grid; place-items: center; }
.how p { margin: .3em 0 0; }
.contacts { display: flex; flex-wrap: wrap; gap: 16px; }
.contact { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 24px;
  text-decoration: none; color: var(--muted); min-width: 220px; }
.contact span { display: block; color: var(--ink); font-weight: 600; font-size: 1.1rem; }
.contact:hover { border-color: var(--accent); }
.foot { padding: 28px 0; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }

/* ---- вход ---- */
.login-box { max-width: 380px; margin: 10vh auto; padding: 0 16px; }
.login-box h1 { margin-top: 1em; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); flex: 1; }
input, textarea, select { font: 1rem var(--sans); color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: .6em .75em; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.err { background: var(--bad-bg); color: var(--bad); padding: .6em .9em; border-radius: 10px; }

/* ---- кабинет ---- */
.topbar { border-bottom: 1px solid var(--line); background: var(--card); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.who { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: .92rem; }
.who form { margin: 0; }
.cab { padding-top: 28px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 32px; }
.cab section > h2 { font-size: 1.5rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { min-width: 160px; }
.student { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 10px; }
.student h3 { margin: 0 0 .2em; }
.student p { margin: 0; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .2em .7em; border-radius: 999px;
  background: var(--bg-alt); color: var(--muted); margin: 0 6px 0 0; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.wait { background: var(--wait-bg); color: var(--wait); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.group { font-family: var(--sans); font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 20px 0 10px; }
.group span { background: var(--bg-alt); border-radius: 999px; padding: 0 .55em; }
.hw { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.hw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hw-head h3 { margin: 0 0 .2em; }
.hw-body { margin: .4em 0 .8em; }
.answer { border-left: 3px solid var(--accent); padding: .3em 0 .3em 14px; margin: .8em 0; }
.review { display: flex; gap: 14px; align-items: flex-start; background: var(--bg-alt); border-radius: 10px; padding: 12px 14px; margin: .8em 0; }
.grade { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font: 700 1.5rem var(--serif); display: grid; place-items: center; }
.review .meta { margin-bottom: .2em; }
.row-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: .6em; }
.row-form label { flex: 0 0 100px; }
.row-form input { flex: 1; min-width: 200px; }
.hw-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .8em; font-size: .88rem; gap: 12px; }
.hw-foot form { margin-left: auto; }
.hw form.stack { margin-top: .6em; }
.hw form.stack .btn { align-self: flex-start; }
.lesson-call { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.lesson-call h2 { margin: 0 0 .3em; }
.lesson-call p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stats b { display: block; font: 700 1.8rem var(--serif); }
.stats span { color: var(--muted); font-size: .9rem; }
details summary { cursor: pointer; color: var(--muted); }
.events { font-size: .88rem; padding-left: 1.2em; }

/* ---- тесты ---- */
.btn-tests { background: var(--warm); color: #fff; padding: .5em 1.1em; font-size: .95rem; }
.who a { color: var(--accent); }
.tests { padding-top: 36px; padding-bottom: 64px; }
.tests h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.tests .lead { margin-top: 0; }
.level { font-size: 1.4rem; margin: 40px 0 16px; display: flex; align-items: center; gap: 10px; }
.lvl { display: inline-block; font: 700 .85rem var(--sans); background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; padding: .25em .55em; vertical-align: middle; }
.test-card, .ext-card { text-decoration: none; color: var(--ink); display: block; }
.test-card:hover, .ext-card:hover { border-color: var(--accent); }
.test-card h3, .ext-card h3 { color: var(--ink); }
.test-card .meta { margin: .8em 0 0; }
.quiz { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; max-width: 760px; }
.quiz .btn { align-self: flex-start; margin-top: 8px; }
fieldset.q { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 14px 18px 16px; margin: 0; }
fieldset.q legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-size: 1.08rem; }
.opts { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
label.opt { position: relative; flex: 0 0 auto; flex-direction: row; align-items: center; gap: 0; color: var(--ink); font-size: 1rem; cursor: pointer; }
label.opt input { position: absolute; left: 50%; bottom: 0; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; }
.fill { color: var(--accent); }
div.q.wrong .fill { color: var(--ok); }
label.opt span { border: 1.5px solid var(--line); border-radius: 999px; padding: .4em 1em; background: var(--bg); }
label.opt:hover span { border-color: var(--accent); }
label.opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
label.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.gap { display: inline-block; min-width: 3.5em; border-bottom: 2px solid var(--accent); color: transparent; line-height: 1.1; }
.score { display: flex; align-items: center; gap: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin: 20px 0 12px; max-width: 760px; }
.score b { font: 700 2rem var(--serif); white-space: nowrap; }
div.q { max-width: 760px; border: 1px solid var(--line); border-left-width: 4px; background: var(--card);
  border-radius: var(--radius); padding: 12px 18px; margin: 10px 0; }
div.q p { margin: .25em 0; }
div.q.right { border-left-color: var(--ok); }
div.q.wrong { border-left-color: var(--bad); }
div.q.right .verdict { color: var(--ok); }
div.q.wrong .verdict { color: var(--bad); }
.expl { color: var(--muted); font-size: .95rem; }
.tests .cta { margin-top: 28px; }
.results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.results .meta { display: inline-block; min-width: 92px; margin: 0; }
.tests-row { margin-top: 6px !important; }
.tests-row .tag { margin-bottom: 4px; }

/* ---- урок ---- */
.lesson-body { background: #0d1114; color: #eef1f3; overflow: hidden; }
.lesson { position: fixed; inset: 0; }
#remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0d1114; }
.remote-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; font-size: 1.1rem; color: #b7c0c7; }
.lesson.connected .remote-empty { display: none; }
#local { position: absolute; right: 16px; bottom: 96px; width: min(240px, 32vw); aspect-ratio: 4/3; object-fit: cover;
  border-radius: 12px; background: #222a31; box-shadow: 0 4px 18px rgba(0,0,0,.5); z-index: 2; transform: scaleX(-1); }
.lesson.sharing #local { transform: none; }
.prejoin { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(13,17,20,.72); padding: 16px; }
.prejoin[hidden] { display: none; }
.prejoin-card { background: #1b2228; border-radius: 20px; padding: 28px; max-width: 420px; text-align: center; }
.prejoin-card .muted { color: #a9b3bb; }
.prejoin-card a { color: #7fd6ca; }
.lesson:not(.joined) #local { right: 50%; transform: translateX(50%) scaleX(-1); top: 24px; bottom: auto; width: min(320px, 70vw); z-index: 5; }
.lesson:not(.joined) .prejoin { place-items: end center; padding-bottom: max(16px, 8vh); }
.controls { position: absolute; left: 0; right: 0; bottom: 16px; display: flex; justify-content: center; gap: 12px; z-index: 3; }
.lesson:not(.joined) .controls { display: none; }
.controls button { width: 64px; height: 64px; border-radius: 50%; border: 0; background: #2b343c; color: #fff; font-size: 1.4rem;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.controls button span { font-size: .6rem; margin-top: 2px; }
.controls button.off { background: #c0392b; }
.controls button.on { background: #0f8a7c; }
.controls button.hang { background: #c0392b; }
.controls button:disabled { opacity: .4; }
.unmute { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 5; border: 0; border-radius: 999px;
  background: #f0b429; color: #111; padding: .7em 1.3em; font: 600 1rem var(--sans); cursor: pointer; }

@media (max-width: 760px) {
  .head-in nav { display: none; }
  .head-in { gap: 10px; }
  .head-in .btn-tests { margin-left: auto; }
  .head-in .btn { padding: .45em .9em; font-size: .88rem; white-space: nowrap; }
  .head-in .wide { display: none; }
  .brand { font-size: 1.15rem; }
  .score { flex-direction: column; align-items: flex-start; gap: 4px; }
  .hero { padding: 40px 0; }
  .hero-in, .two { grid-template-columns: 1fr; gap: 28px; }
  .photo { max-width: 240px; }
  .cards, .how, .stats { grid-template-columns: 1fr; }
  .student { flex-direction: column; align-items: stretch; }
  .who span { display: none; }
  #local { width: 34vw; bottom: 92px; }
}
