/* Шрифты лежат на своём домене (scripts/fetch_vendor.sh): страница изолирована COOP/COEP */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("/static/vendor/fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("/static/vendor/fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("/static/vendor/fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("/static/vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f4f2ff;
  --bg2: #ebe7ff;
  --card: #ffffff;
  --text: #1d1838;
  --muted: #6b6690;
  --line: #ded9f5;
  --accent: #7b2ff7;
  --accent2: #ff7a1a;
  --ok: #10a36b;
  --ok-bg: #dff7ec;
  --bad: #e0344f;
  --bad-bg: #ffe3e8;
  --wait: #b7791f;
  --wait-bg: #fff2d6;
  --gold: #ffc531;
  --code-bg: #1e1b33;
  --code-text: #f1efff;
  --shadow: 0 4px 0 rgba(60, 30, 130, .12), 0 10px 30px rgba(60, 30, 130, .08);
  --radius: 16px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14112a; --bg2: #1c1838; --card: #221e40; --text: #f1efff; --muted: #a39fc7; --line: #34305a;
    --ok-bg: #123a2c; --bad-bg: #44192a; --wait-bg: #3d2f12; --code-bg: #0e0c1d;
    --shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
.codebox { min-width: 0; max-width: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; margin: .2em 0 .5em; line-height: 1.2; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .6em; }
h3 { margin: .2em 0 .5em; }
code { font-family: var(--mono); background: var(--bg2); padding: .05em .35em; border-radius: 6px; font-size: .92em; }
pre { font-family: var(--mono); }
small { font-size: .82em; }
.muted { color: var(--muted); }
.small { font-size: .88em; }
.plus { color: var(--ok); }
.minus { color: var(--bad); }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; background: linear-gradient(90deg, #5b1bd6, #8a2be2 55%, #ff6a3d);
  color: #fff; box-shadow: 0 2px 12px rgba(40, 0, 90, .3);
}
.logo { color: #fff; font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.hud { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hud-item { color: #fff; background: rgba(255, 255, 255, .16); padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-size: .92rem; }
.hud-item:hover { background: rgba(255, 255, 255, .28); text-decoration: none; }
.hud-item.hot { background: rgba(255, 180, 40, .45); }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0 4px; }

.sidenav {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 220px; padding: 14px 10px; overflow-y: auto;
  background: var(--card); border-right: 1px solid var(--line); z-index: 20;
}
.sidenav a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--text); margin-bottom: 2px; }
.sidenav a:hover { background: var(--bg2); text-decoration: none; }
.sidenav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 12px 6px; }
.badge { background: var(--accent2); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .78rem; margin-left: 4px; }
.logout { margin-top: 16px; padding: 0 12px; }
main.with-nav { margin-left: 220px; padding: 22px 28px 60px; max-width: 1220px; }
main.plain { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidenav { transform: none; }
  main.with-nav { margin-left: 0; padding: 16px 16px 60px; }
  .hud-item { padding: 3px 8px; font-size: .82rem; }
  .hud-item:first-child b { display: none; }
}
@media (max-width: 480px) {
  .hud-item:first-child { display: none; }
  .hud { gap: 4px; flex-wrap: nowrap; }
  .logo { font-size: 1rem; }
  h1 { font-size: 1.5rem; }
}

/* ---------- элементы ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 18px; }
.grid-home { grid-template-columns: repeat(3, 1fr); }
.grid-home .span2 { grid-column: span 2; }
@media (max-width: 1000px) { .grid-home { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-home { grid-template-columns: 1fr; } .grid-home .span2 { grid-column: auto; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.wrap label { flex: 0 0 auto; }
.grow { flex: 1 1 220px !important; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .93rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; }
input[type=file] { padding: 6px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input.num { width: 110px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  background: var(--accent); color: #fff; padding: 9px 18px; border-radius: 12px; box-shadow: 0 3px 0 #4c149e;
  transition: transform .05s, filter .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #4c149e; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-alt { background: var(--accent2); box-shadow: 0 3px 0 #b84c00; }
.btn-ghost { background: var(--bg2); color: var(--text); box-shadow: 0 3px 0 var(--line); }
.btn-small { padding: 6px 12px; font-size: .88rem; }
.btn-big { padding: 12px 22px; font-size: 1.1rem; justify-content: center; }
.btn-run { background: var(--ok); box-shadow: 0 3px 0 #0a7049; }
.btn-stop { background: var(--bad); box-shadow: 0 3px 0 #9b1c31; }
.btn-check { background: var(--accent2); box-shadow: 0 3px 0 #b84c00; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.linklike.danger, .danger { color: var(--bad); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg2); font-size: .82rem; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.alert { padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }

.progress { height: 12px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .6s; }
.progress.small { height: 6px; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: var(--bg2); font-size: .85rem; }
.table .actions form { display: inline; }
.row-current { background: rgba(255, 122, 26, .08); }
.row-ok td:nth-child(4) { color: var(--ok); }
@media (max-width: 640px) { .table { display: block; overflow-x: auto; } }

.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.pager { display: flex; justify-content: space-between; margin-top: 30px; font-weight: 700; }
.center-card { text-align: center; max-width: 560px; margin: 30px auto; }
.big-emoji { font-size: 3.5rem; }
.plain-list { list-style: none; padding: 0; margin: 0 0 16px; }
.plain-list li { padding: 4px 0; }
.plain-list a.active { font-weight: 700; }
.small-list { padding-left: 18px; margin: 0; }
.pre-line { white-space: pre-line; }

/* ---------- вход ---------- */
.login-page { background: linear-gradient(135deg, #5b1bd6, #8a2be2 50%, #ff6a3d); min-height: 100vh; }
.login-card { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login-card form { text-align: left; margin-top: 16px; }
.login-hero { font-size: 4rem; }

/* ---------- главная ---------- */
.hello { margin-bottom: 18px; }
.hero-card { background: linear-gradient(135deg, var(--card), var(--bg2)); }
.hero-card h2 { margin: .1em 0 .3em; font-size: 1.6rem; }
.next-lesson { margin-top: 12px; padding: 10px 14px; background: var(--wait-bg); border-radius: 12px; }
.levelbar-top { display: flex; align-items: center; gap: 12px; }
.lvl-emoji { font-size: 2.4rem; }
.lvl-xp { margin-left: auto; font-weight: 800; font-size: 1.15rem; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.mini-stats b { display: block; font-size: 1.4rem; }
.mini-stats small { color: var(--muted); }
.daily-card { border: 2px solid var(--gold); }
.daily-card.done { border-color: var(--ok); }
.arena-card { background: linear-gradient(135deg, #ff7a1a22, var(--card)); }
.warn-card { border: 2px solid var(--bad); }
.code-mini { background: var(--code-bg); color: var(--code-text); padding: 10px 12px; border-radius: 10px; overflow-x: auto; font-size: .88rem; margin: 8px 0; white-space: pre; }
.code-big { background: var(--code-bg); color: var(--code-text); padding: 16px 18px; border-radius: 12px; font-size: 1.05rem; overflow-x: auto; }
.path-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.node {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem;
  background: var(--bg2); border: 2px solid var(--line);
}
.node:hover { text-decoration: none; transform: scale(1.1); }
.node.done { background: var(--ok-bg); border-color: var(--ok); }
.node.current { border-color: var(--accent2); box-shadow: 0 0 0 4px rgba(255, 122, 26, .25); animation: pulse 1.6s infinite; }
.node.locked { opacity: .45; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 122, 26, .05); } }
.ach-mini { list-style: none; padding: 0; margin: 0 0 10px; }
.ach-mini li { display: flex; gap: 10px; align-items: center; padding: 5px 0; }
.ach-mini li > span { font-size: 1.6rem; }
.ach-mini small { display: block; color: var(--muted); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.feed li:last-child { border-bottom: 0; }

/* ---------- карта ---------- */
.world { margin-bottom: 26px; }
.world-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.world-head h2 { margin: 0; }
.world-emoji { font-size: 2.6rem; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lesson-tile {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; color: var(--text);
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow); min-height: 120px;
}
.lesson-tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.lesson-tile.done { border-color: var(--ok); }
.lesson-tile.current { border-color: var(--accent2); }
.lesson-tile.locked { opacity: .55; }
.tile-num { position: absolute; top: 8px; right: 12px; font-weight: 800; color: var(--muted); }
.tile-emoji { font-size: 1.8rem; }
.tile-meta { margin-top: auto; font-size: .82rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- урок ---------- */
.lesson-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.lesson-emoji { font-size: 3.4rem; line-height: 1; }
.lead { font-size: 1.1rem; margin: 0; }
.teacher-box { border: 2px dashed var(--accent); margin-bottom: 18px; }
.plan li { margin-bottom: 4px; }
.learn li { margin-bottom: 4px; }
.wow-card { background: linear-gradient(135deg, #ffc53122, var(--card)); }
.example { margin-bottom: 20px; }
.example h3 { font-size: 1.05rem; }
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.task-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); color: var(--text); box-shadow: var(--shadow); }
.task-tile:hover { text-decoration: none; border-color: var(--accent); }
.task-tile.solved { border-color: var(--ok); background: var(--ok-bg); }
.task-tile small { color: var(--muted); }
.hw-card .star-task { background: var(--wait-bg); padding: 8px 12px; border-radius: 10px; }
.submission { border-top: 1px solid var(--line); padding: 10px 0; }
.resubmit summary { list-style: none; margin: 8px 0; }
.resubmit summary::-webkit-details-marker { display: none; }
.resubmit[open] summary { margin-bottom: 12px; }
.teacher-comment { background: var(--bg2); padding: 8px 12px; border-radius: 10px; margin: 6px 0; }

/* ---------- задача ---------- */
.task-head h1 { margin-bottom: .2em; }
.statement { margin-bottom: 16px; }
.examples-io { display: flex; flex-wrap: wrap; gap: 10px; }
.io { display: flex; gap: 10px; background: var(--bg2); border-radius: 10px; padding: 8px 12px; }
.io pre { margin: 2px 0 0; font-size: .9rem; white-space: pre-wrap; }
.hint-card { margin-top: 10px; background: var(--wait-bg); }
.solution-card { margin-top: 16px; border: 2px solid var(--ok); }

/* ---------- редактор ---------- */
.codebox { margin: 10px 0 16px; }
.cb-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.cb-status { color: var(--muted); font-size: .9rem; }
.codebox .CodeMirror, .cb-plain {
  height: auto; min-height: 90px; border-radius: 12px; font-family: var(--mono); font-size: 15px; line-height: 1.5;
  background: var(--code-bg); color: var(--code-text); border: 2px solid #2d2850;
}
.cb-plain { width: 100%; min-height: 180px; padding: 10px; resize: vertical; }
.codebox .CodeMirror-scroll { min-height: 90px; max-height: 70vh; }
.codebox .CodeMirror-gutters { background: #18152b; border-right: 1px solid #2d2850; }
.codebox .CodeMirror-linenumber { color: #6d6896; }
.codebox .CodeMirror-cursor { border-left: 2px solid #ffd166; }
.codebox .CodeMirror-selected, .codebox .CodeMirror-focused .CodeMirror-selected { background: #3b3570; }
.codebox .cm-keyword { color: #ff7ab8; font-weight: 600; }
.codebox .cm-builtin { color: #6fd3ff; }
.codebox .cm-string { color: #b5f07b; }
.codebox .cm-number { color: #ffb86c; }
.codebox .cm-comment { color: #8b86b3; font-style: italic; }
.codebox .cm-def { color: #ffd166; }
.codebox .cm-variable-2 { color: #c9b6ff; }
.codebox .cm-operator { color: #f1efff; }
.codebox .cm-error-line { background: rgba(224, 52, 79, .3); }
.codebox .CodeMirror-matchingbracket { color: #fff !important; background: #5a4ca8; }
.cb-stdin { font-family: var(--mono); font-size: .9rem; margin-bottom: 8px; }
.cb-panels { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.cb-console { background: #0f0d1d; border-radius: 12px; padding: 10px 12px; border: 2px solid #2d2850; }
.cb-out { margin: 0; color: #e8e6ff; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow-y: auto; }
.cb-out .err { color: #ff8095; }
.cb-out .in { color: #ffd166; }
.cb-input { display: flex; gap: 8px; margin-top: 8px; }
.cb-input input { background: #1e1b33; color: #fff; border-color: #ffd166; font-family: var(--mono); }
.cb-turtle { position: relative; width: 100%; max-width: 700px; aspect-ratio: 7 / 5; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: #fff; }
.cb-turtle canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cb-error { background: var(--bad-bg); border-radius: 12px; padding: 10px 14px; border: 2px solid var(--bad); }
.cb-error-hint b { color: var(--bad); }
.cb-error pre { white-space: pre-wrap; font-size: .85rem; margin: 6px 0 0; }
.cb-error summary { cursor: pointer; color: var(--muted); margin-top: 6px; }
.cb-results { background: var(--card); border-radius: 12px; padding: 12px 14px; border: 2px solid var(--line); }
.cb-results-head { font-weight: 800; margin-bottom: 6px; }
.cb-results-head.ok { color: var(--ok); }
.cb-results-head.bad { color: var(--bad); }
.cb-tests { list-style: none; padding: 0; margin: 0; }
.cb-tests li { padding: 4px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.cb-tests .detail { flex-basis: 100%; margin: 4px 0 4px 28px; background: var(--bg2); padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; font-size: .85rem; }

/* ---------- задача дня ---------- */
.daily-result { margin: 10px 0; padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.daily-result.ok { background: var(--ok-bg); color: var(--ok); }
.daily-result.bad { background: var(--bad-bg); color: var(--bad); }
.why { color: var(--muted); }
.history { display: flex; flex-wrap: wrap; gap: 6px; }
.hist { padding: 4px 10px; border-radius: 8px; background: var(--bg2); font-size: .85rem; }
.hist.ok { background: var(--ok-bg); }

/* ---------- арена ---------- */
.trainer { max-width: 760px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.mode-btn {
  font: inherit; color: var(--text); cursor: pointer; text-align: left; padding: 14px; border-radius: 14px;
  background: var(--bg2); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.mode-btn:hover { border-color: var(--accent2); }
.tr-top { display: flex; gap: 16px; flex-wrap: wrap; font-size: 1.05rem; }
.tr-mode { font-weight: 700; color: var(--accent); }
.tr-bar { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.tr-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--ok), var(--gold), var(--bad)); }
.tr-q { font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 800; text-align: center; margin: 20px 0; font-family: var(--mono); }
.tr-form { display: flex; gap: 10px; max-width: 360px; margin: 0 auto; }
.tr-input { font-size: 1.8rem; text-align: center; font-family: var(--mono); }
.tr-flash { text-align: center; font-size: 1.3rem; font-weight: 800; min-height: 2em; margin-top: 12px; opacity: 0; }
.tr-flash.show { animation: flash .9s; }
.tr-flash.ok { color: var(--ok); }
.tr-flash.bad { color: var(--bad); }
@keyframes flash { 0% { opacity: 1; transform: scale(1.3); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }
.tr-end { text-align: center; }

/* ---------- награды, бойцы ---------- */
.brawlers { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.brawler {
  border-radius: 16px; padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 4px; color: #fff;
  background: linear-gradient(160deg, #3b82f6, #1e40af); box-shadow: var(--shadow); border: 3px solid rgba(255, 255, 255, .25);
}
.brawler .b-emoji { font-size: 2.8rem; }
.brawler .b-rarity { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; opacity: .9; }
.brawler small { opacity: .9; }
.brawler.rarity-1 { background: linear-gradient(160deg, #94a3b8, #475569); }
.brawler.rarity-2, .brawler.rarity-3 { background: linear-gradient(160deg, #34d399, #047857); }
.brawler.rarity-4, .brawler.rarity-5 { background: linear-gradient(160deg, #38bdf8, #1d4ed8); }
.brawler.rarity-6, .brawler.rarity-7 { background: linear-gradient(160deg, #c084fc, #7e22ce); }
.brawler.rarity-8, .brawler.rarity-9 { background: linear-gradient(160deg, #fb7185, #be123c); }
.brawler.rarity-10 { background: linear-gradient(160deg, #fde047, #f59e0b); color: #3b2500; }
.brawler.locked { filter: grayscale(1) brightness(.6); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 12px; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.ach small { display: block; }
.ach-emoji { font-size: 2rem; }
.ach.got { border-color: var(--gold); background: linear-gradient(135deg, #ffc53122, var(--card)); }
.ach.locked { opacity: .55; }
.ach.locked .ach-emoji { filter: grayscale(1); }
.ranks { display: flex; flex-wrap: wrap; gap: 8px; }
.rank { display: flex; flex-direction: column; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); min-width: 100px; opacity: .55; }
.rank.got { opacity: 1; border-color: var(--accent); }
.rank span { font-size: 1.6rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.reward { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.reward .r-emoji { font-size: 2.8rem; }
.reward .r-cost { font-weight: 800; font-size: 1.1rem; }
.reward.cant { opacity: .8; }
.reward .progress { width: 100%; }

/* ---------- шпаргалка ---------- */
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.cheat table { width: 100%; border-collapse: collapse; }
.cheat td { padding: 5px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; font-size: .9rem; }
.cheat pre { margin: 0; white-space: pre-wrap; color: var(--accent); font-size: .85rem; }
@media (max-width: 400px) { .cheat-grid { grid-template-columns: 1fr; } }

/* ---------- портфолио ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.project { color: var(--text); display: flex; flex-direction: column; gap: 6px; }
a.project:hover { text-decoration: none; border-color: var(--accent); }
.project-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; background: var(--bg2); }
.project-img.placeholder { display: grid; place-items: center; font-size: 3rem; }
.thumb { max-width: 200px; border-radius: 8px; margin-top: 6px; }
.title-input { max-width: 340px; font-weight: 700; }
.danger-zone { margin-top: 20px; }
.public-project .cover { max-width: 100%; border-radius: 14px; margin: 10px 0; }
.grid-play { grid-template-columns: minmax(0, 1fr) 240px; align-items: start; }
@media (max-width: 900px) { .grid-play { grid-template-columns: 1fr; } }

/* ---------- преподаватель ---------- */
.schedule { margin-top: 14px; }
.schedule label { flex-direction: row; align-items: center; gap: 8px; }
.schedule input { width: auto; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--accent2), var(--accent)); border-radius: 6px 6px 0 0; }
.bar small { color: var(--muted); }
.review { margin-bottom: 18px; }
.attempt { margin-bottom: 10px; }
.attempt.ok { border-left: 5px solid var(--ok); }
.attempt.bad { border-left: 5px solid var(--bad); }

/* ---------- уведомления ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: center; background: var(--card); color: var(--text); padding: 12px 16px; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); border: 2px solid var(--accent); transform: translateY(30px); opacity: 0; transition: all .35s;
}
.toast.show { transform: none; opacity: 1; }
.toast.big { border-color: var(--gold); font-weight: 700; font-size: 1.05rem; }
.toast-emoji { font-size: 1.6rem; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; }

/* ------------------------------------------------------------------ проверки */
.check-list { display: grid; gap: 12px; }
.check-item, .check-banner { display: flex; align-items: center; gap: 14px; color: var(--text); }
.check-item:hover, .check-banner:hover { text-decoration: none; border-color: var(--accent); }
.check-item.locked { opacity: .6; }
.check-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.check-emoji { font-size: 1.9rem; line-height: 1; }
.check-banner { margin-bottom: 18px; border: 2px solid var(--accent2); }
.check-banner > span:nth-child(2) { flex: 1; }
.check-intro { font-size: 1.05rem; max-width: 760px; }
.check-part-head h2 { margin: .8em 0 .2em; }
.check-q { margin-bottom: 4px; }
.check-q .code-big { white-space: pre; }
.check-text { font-size: 1.08rem; margin: .2em 0 .7em; }
.check-options { display: grid; gap: 8px; }
.check-option { display: flex; flex-direction: row; font-weight: 500; gap: 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.check-option:has(input:checked) { border-color: var(--accent); background: var(--bg2); }
.check-option input { width: auto; margin: 0; flex: none; }
.check-short { max-width: 260px; }
textarea.mono { font-family: var(--mono); }
.check-skip { display: inline-flex; flex-direction: row; font-weight: 500; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted); cursor: pointer; }
.check-skip input { width: auto; margin: 0; }
.check-q.skipped { opacity: .55; }
.check-preview-opts li.ok { color: var(--ok); font-weight: 700; }
.check-score { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.check-big { font-size: 3rem; font-weight: 800; line-height: 1; }
.check-big small { font-size: 1.2rem; color: var(--muted); font-weight: 600; }
.check-topics .topic-bar { width: 32%; }
.q-ok { border-left: 5px solid var(--ok); }
.q-bad { border-left: 5px solid var(--bad); }
.q-skip { border-left: 5px solid var(--line); }
code.answer { white-space: pre-wrap; }

/* ------------------------------------------------------------------ сертификаты */
.cert-list { display: grid; gap: 12px; margin-top: 18px; }
.cert-item { display: flex; align-items: center; gap: 14px; }
.cert-item form { display: inline; }
@media (max-width: 640px) {
  .check-item, .cert-item { flex-wrap: wrap; }
  .check-body { flex: 1 1 150px; }
  .check-item .pill { margin-left: calc(1.9rem + 14px); }
}

/* ------------------------------------------------------------------ подготовка к уроку */
.guide { display: grid; gap: 18px; max-width: 980px; }
.g-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.g-head h2 { margin: 0; }
.g-time { background: var(--accent2); color: #fff; font-weight: 800; border-radius: 999px; padding: 3px 12px; font-size: .85rem; white-space: nowrap; }
.g-block h3 { margin-top: 1.4em; }
.g-say, .g-say-mini { background: var(--bg2); border-left: 5px solid var(--accent); border-radius: 0 12px 12px 0; }
.g-say { padding: 12px 16px; font-size: 1.05rem; font-style: italic; }
.g-ask, .g-ask-mini { background: var(--wait-bg); border-left: 5px solid var(--gold); border-radius: 0 12px 12px 0; }
.g-ask { padding: 10px 16px; }
.g-say-mini, .g-ask-mini { padding: 0 8px; }
.g-tip { color: var(--muted); }
.g-list li { margin-bottom: 8px; }
.g-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.g-fact { display: flex; gap: 10px; background: var(--bg2); border-radius: 12px; padding: 10px 12px; }
.g-fact > span { font-size: 1.8rem; line-height: 1.2; }
.g-fact p { margin: 0; font-size: .95rem; }
.g-figure { margin: 18px 0; }
.g-figure svg { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-family: var(--font); }
.g-figure figcaption { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.g-ops { box-shadow: none; border: 1px solid var(--line); }
.g-ops td, .g-ops th { font-size: .92rem; }
.g-timeline-bar { display: flex; gap: 3px; margin: 10px 0; border-radius: 10px; overflow: hidden; font-size: .78rem; font-weight: 700; }
.g-timeline-bar span { background: var(--accent); color: #fff; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-timeline-bar span:nth-child(even) { background: var(--accent2); }
@media (max-width: 640px) { .g-ops { display: block; overflow-x: auto; } }
@media print {
  .topbar, .sidenav, .no-print, .crumbs, #toasts { display: none !important; }
  main.with-nav { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
  .g-figure, .g-fact, .g-say, .g-ask, tr { break-inside: avoid; }
}

.g-steps h2 { margin: 0; }
.g-steps-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.g-steps-cols h3 { margin: .6em 0 .4em; color: var(--accent); }
.g-step { display: flex; flex-direction: row; font-weight: 500; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); cursor: pointer; font-size: .95rem; }
.g-step input { width: auto; margin: 4px 0 0; flex: none; }
.g-step:has(input:checked) span { text-decoration: line-through; color: var(--muted); }

abbr[title] { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; cursor: help; }
.g-glossary dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.g-glossary dt { font-weight: 800; color: var(--accent); }
.g-glossary dd { margin: 0; }
@media (max-width: 520px) { .g-glossary dl { grid-template-columns: 1fr; } .g-glossary dd { margin-bottom: 6px; } }

/* ------------------------------------------------------------------ несколько учеников */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .table { min-width: 560px; }
.bad-text { color: var(--bad); font-weight: 700; }
.alerts-card { margin-bottom: 18px; border: 2px solid var(--accent2); }
.alerts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.alerts li { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: var(--bg2); }
.alerts li.alert-l3 { background: var(--bad-bg); }
.alerts li.alert-l2 { background: var(--wait-bg); }
.alerts a { color: var(--text); }
.roster-card { margin-bottom: 18px; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.roster-item button { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.roster-item.active button { border-color: var(--accent); background: var(--bg2); }
.roster-name { font-weight: 800; }
.lesson-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.ldot { position: relative; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800;
  background: var(--bg2); color: var(--muted); border: 2px solid var(--line); text-decoration: none; }
.ldot.open { border-color: var(--accent); color: var(--accent); }
.ldot.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.ldot i { position: absolute; right: -6px; top: -8px; font-style: normal; font-size: .8rem; }
.copy-row { display: flex; gap: 8px; margin: 8px 0; }
.copy-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: .8rem; }
.score { font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.score-hi { background: var(--ok-bg); color: var(--ok); }
.score-mid { background: var(--wait-bg); color: var(--wait); }
.score-lo { background: var(--bad-bg); color: var(--bad); }
.board { display: grid; gap: 4px; }
.board-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; }
.board-row.me { background: var(--bg2); outline: 2px solid var(--accent); }
.board-place { width: 2em; text-align: center; font-weight: 800; }
.board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parent-page { max-width: 980px; margin: 0 auto; }


/* ------------------------------------------------------------------ ОГЭ */
.oge-pill { background: #e3f2ff; color: #1565c0; }
.oge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.oge-num { display: flex; gap: 12px; align-items: flex-start; }
.oge-num .n { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 900;
  font-size: 1.2rem; background: var(--bg2); color: var(--accent); }
.oge-num.has-python .n { background: var(--accent); color: #fff; }
.oge-num h3 { margin: 0 0 4px; font-size: 1.02rem; }
.oge-num ul { margin: 6px 0 0; padding-left: 18px; font-size: .92rem; }
.oge-num .meta { font-size: .85rem; color: var(--muted); }
.check-timer { position: sticky; top: 64px; z-index: 5; display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 14px;
  border-radius: 999px; background: var(--bg2); border: 2px solid var(--line); margin-bottom: 12px; font-size: 1.05rem; }
.check-timer b { font-family: var(--mono); }
.check-timer.soon { border-color: var(--gold); background: var(--wait-bg); }
.check-timer.over { border-color: var(--bad); background: var(--bad-bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .oge-pill { background: #12324d; color: #8cc8ff; } }

/* ------------------------------------------------------------------ переключатель ученика в шапке */
.student-switch { position: relative; margin-left: 14px; min-width: 0; }
.student-switch summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff;
  border: 1px solid rgba(255, 255, 255, .28); transition: background .15s; }
.student-switch summary::-webkit-details-marker { display: none; }
.student-switch summary:hover, .student-switch[open] summary { background: rgba(255, 255, 255, .26); }
.switch-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.switch-caret { font-size: .8rem; opacity: .8; transition: transform .15s; }
.student-switch[open] .switch-caret { transform: rotate(180deg); }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: .9rem; color: #fff; text-transform: uppercase; }
.avatar.a0 { background: #7b2ff7; } .avatar.a1 { background: #ff7a1a; } .avatar.a2 { background: #10a36b; }
.avatar.a3 { background: #1e88e5; } .avatar.a4 { background: #e0344f; } .avatar.a5 { background: #b7791f; }
.student-switch summary .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.switch-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; min-width: 250px; max-width: 86vw;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(30, 15, 70, .25); padding: 6px; }
.switch-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800;
  padding: 6px 10px 4px; }
.switch-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.switch-item:hover { background: var(--bg2); }
.switch-item.current { background: var(--bg2); }
.switch-item-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; }
.switch-item-name small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.switch-check { color: var(--accent); font-weight: 900; }
.switch-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.switch-link { display: block; padding: 7px 10px; border-radius: 10px; color: var(--text); font-size: .92rem; }
.switch-link:hover { background: var(--bg2); text-decoration: none; }
@media (max-width: 640px) {
  .student-switch { margin-left: 6px; flex: 1 1 auto; }
  .switch-name { max-width: 34vw; }
  .switch-menu { position: fixed; top: 58px; left: 12px; right: 12px; max-width: none; }
  .student-switch + .hud { display: none; }  /* у преподавателя на телефоне счётчики ученика — в карточках пульта */
}

/* ------------------------------------------------------------------ своё окно подтверждения */
.cq-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 15, 45, .45); animation: cq-fade .15s ease-out; }
.cq-modal-card { background: var(--card); color: var(--text); border-radius: 18px; padding: 20px 20px 14px; max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(20, 10, 60, .35); border: 1px solid var(--line); }
.cq-modal-card p { margin: 0 0 14px; font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
.cq-modal-card .row { justify-content: flex-end; margin: 0; }
@keyframes cq-fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ цифровая клавиатура */
.num-answer { max-width: 220px; font-family: var(--mono); font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; caret-color: transparent; }
.numpad { display: grid; grid-template-columns: repeat(4, 54px); gap: 6px; margin-top: 8px; }
.numpad button { height: 46px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.numpad button:active { background: var(--bg2); transform: translateY(1px); }
.numpad .numpad-back { grid-column: 4; grid-row: 1 / span 3; height: auto; background: var(--bg2); }
.autosave { margin: 0; }

/* ------------------------------------------------------------------ картинки бойцов и миров */
.brawler .b-img { width: 104px; height: 104px; object-fit: contain; display: block; margin: 0 auto 2px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); transition: transform .2s; }
.brawler.got:hover .b-img { transform: scale(1.08) rotate(-3deg); }
.brawler .b-img.silhouette { filter: brightness(0) opacity(.55); }
.world-img { width: 72px; height: 72px; object-fit: contain; display: block; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2)); }
.lvl-img { width: 56px; height: 56px; object-fit: contain; display: block; }

/* ------------------------------------------------------------------ русский язык */
.ru-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.ru-tile { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.ru-tile:hover { text-decoration: none; border-color: var(--accent); }
.ru-tile-emoji { font-size: 2rem; }
.ru-tile small { color: var(--muted); }
.ru-review.has-due { border: 2px solid var(--accent2); }
.ru-big { font-size: 2.2rem; font-weight: 900; margin: 0; }
.ru-big small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.ru-trainer { max-width: 760px; }
.ru-card { margin-top: 10px; }
.ru-sentence { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 10px; font-size: 1.35rem; line-height: 1.6; }
.ru-word { white-space: nowrap; }
.ru-gap { width: 22px; height: 30px; margin: 0 1px; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  font: inherit; font-weight: 900; color: var(--accent); position: relative; touch-action: manipulation; vertical-align: baseline; }
.ru-gap::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--line); }
.ru-gap:hover { background: var(--bg2); }
.ru-gap.on::before, .ru-gap.right::before, .ru-gap.extra::before, .ru-gap.missed::before { content: ","; font-size: 1.6rem; }
.ru-gap.on::after, .ru-gap.right::after, .ru-gap.extra::after, .ru-gap.missed::after { display: none; }
.ru-gap.right { color: var(--ok); background: var(--ok-bg); }
.ru-gap.extra { color: var(--bad); background: var(--bad-bg); text-decoration: line-through; }
.ru-gap.missed { color: var(--bad); background: var(--bad-bg); outline: 2px dashed var(--bad); }
.ru-word-big { font-size: 1.8rem; font-weight: 800; margin: 6px 0 14px; }
.ru-blank { display: inline-block; min-width: 1.4em; padding: 0 4px; margin: 0 1px; border-bottom: 3px solid var(--accent2);
  color: var(--accent2); text-align: center; }
.ru-options { display: flex; flex-wrap: wrap; gap: 10px; }
.ru-opt { min-width: 110px; font-size: 1.15rem; justify-content: center; }
.ru-opt.right { background: var(--ok); box-shadow: 0 3px 0 #0b6b47; }
.ru-opt.wrong { background: var(--bad); box-shadow: 0 3px 0 #8f1f31; }
.ru-result { margin-top: 12px; padding: 12px 14px; border-radius: 12px; }
.ru-result.ok { background: var(--ok-bg); }
.ru-result.bad { background: var(--bad-bg); }
.ru-result p { margin: 6px 0 0; }
.ru-correct { font-weight: 700; font-size: 1.1rem; }
.ru-timer { position: sticky; top: 64px; z-index: 5; display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--bg2); font-size: 1.2rem; margin-top: 8px; }
.ru-mistakes li { margin-bottom: 8px; }
.ru-rules { display: grid; gap: 12px; }
.ru-rule h3 { margin: 0; }
@media (max-width: 640px) { .ru-sentence { font-size: 1.2rem; } .ru-gap { width: 26px; height: 40px; } }

.g-draft { border: 2px dashed var(--gold); background: var(--wait-bg); margin-bottom: 14px; }

/* ---------------------------------------------------------------- Робот (ОГЭ №15) */
.robot-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.robot-task { display: flex; align-items: center; gap: 12px; color: var(--text); }
.robot-task:hover { text-decoration: none; border-color: var(--accent); }
.robot-task .n { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 900; background: var(--bg2); }
.robot-task.done .n { background: var(--ok); color: #fff; }
.robot-task .mark { margin-left: auto; }
.robot-help td, .robot-help th { font-size: .88rem; vertical-align: top; }
.robot-help code { white-space: normal; }
.robot-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin: 16px 0; }
@media (max-width: 900px) { .robot-app { grid-template-columns: minmax(0, 1fr); } }
.robot-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.robot-tab { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: .88rem; cursor: pointer; }
.robot-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.robot-svg { margin: 12px 0 8px; overflow-x: auto; min-height: 120px; }
.robot-grid { display: block; max-width: 100%; height: auto; }
.rg-line { stroke: var(--line); stroke-width: 1; }
.rg-wall { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.rg-goal { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; opacity: .7; }
.rg-paint { fill: var(--ok); opacity: .55; }
.rg-extra { fill: var(--bad); opacity: .6; }
.rg-missing { fill: none; stroke: var(--bad); stroke-width: 2.5; }
.rg-crash { fill: var(--bad); opacity: .75; }
.rg-robot rect { fill: var(--accent2); stroke: #b84c00; stroke-width: 1.5; }
.rg-robot.crashed rect { fill: var(--bad); stroke: #9b1c31; }
.rg-robot .rg-eye { fill: #fff; }
.rg-robot { transition: transform .06s linear; }
.robot-legend { gap: 14px; flex-wrap: wrap; align-items: center; }
.robot-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.lg-robot { background: var(--accent2); }
.lg-goal { border: 2px dashed var(--accent); }
.lg-paint { background: var(--ok); opacity: .6; }
.lg-extra { background: var(--bad); opacity: .6; }
.robot-speed { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.robot-speed input { width: 90px; }
.robot-code textarea { width: 100%; min-height: 220px; font-family: var(--mono); }
.robot-code .CodeMirror-scroll { min-height: 220px; }
.robot-result { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-size: .92rem; }
.robot-result.ok { background: var(--ok-bg); }
.robot-result.bad { background: var(--bad-bg); }
.robot-result ul { margin: 6px 0 0; padding-left: 18px; }
.robot-answer pre { background: var(--code-bg); color: var(--code-text); padding: 10px 12px; border-radius: 10px; overflow-x: auto; }

/* ---------------------------------------------------------------- уровни обучения */
.level-opts { display: grid; gap: 6px; }
.level-opt input { width: auto; flex: none; margin: 0; }
.level-opt { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.level-opt:has(input:checked) { border-color: var(--accent); background: var(--bg2); }
.level-rec { background: var(--bg2); border-radius: 12px; padding: 10px 14px; margin-top: 8px; }
.level-rec ul { margin: 6px 0 8px; padding-left: 18px; }

/* ---------------------------------------------------------------- сводка недели */
.weekly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.weekly-card h3 { margin: 0; }
.weekly-card ul { margin: 8px 0; padding-left: 18px; }
.weekly-card.idle { opacity: .75; }
.weekly-days { display: flex; gap: 4px; align-items: center; margin-top: 8px; }
.weekly-days i { width: 14px; height: 14px; border-radius: 4px; background: var(--bg2); border: 1px solid var(--line); }
.weekly-days i.on { background: var(--ok); border-color: var(--ok); }
.weekly-days small { margin-left: 6px; }
.weekly-text { white-space: pre-wrap; background: var(--bg2); padding: 10px 12px; border-radius: 10px; font-size: .88rem; }

/* ---------------------------------------------------------------- пасс сезона */
.hello-title { margin: -6px 0 14px; color: var(--muted); font-weight: 600; }
.board-title { color: var(--muted); font-weight: 500; }
.pass-mini { display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.pass-mini:hover { text-decoration: none; border-color: var(--accent); }
.pass-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.pass-head .big { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.pass-track { display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 8px; overflow-x: auto;
  padding: 6px 2px 12px; scroll-snap-type: x proximity; }
.pass-col { display: grid; grid-template-rows: auto 1fr 1fr; gap: 6px; scroll-snap-align: start; }
.pass-n { text-align: center; font-weight: 800; font-size: .85rem; color: var(--muted); }
.pass-col.open .pass-n { color: var(--accent); }
.pass-cell { border: 2px solid var(--line); border-radius: 12px; padding: 8px 6px; min-height: 92px; display: flex;
  flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; text-align: center;
  font-size: .82rem; background: var(--card); }
.pass-cell .ico { font-size: 1.5rem; line-height: 1.2; }
.pass-cell.prem { background: linear-gradient(160deg, rgba(255, 197, 49, .18), rgba(123, 47, 247, .12)); }
.pass-cell.locked { opacity: .45; }
.pass-cell.got { border-color: var(--ok); }
.pass-cell.ready { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(255, 122, 26, .25); }
.pass-cell .btn { padding: 4px 10px; font-size: .8rem; }
.pass-rowlabels { display: grid; grid-template-rows: auto 1fr 1fr; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.pass-wrap { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; }
.pass-rowlabels span { display: flex; align-items: center; }
.pass-ch { display: grid; gap: 8px; }
.pass-ch li { list-style: none; display: flex; gap: 10px; align-items: center; }
.pass-ch ul { padding: 0; margin: 0; }
.pass-ch .bar { flex: 1; height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; max-width: 160px; }
.pass-ch .bar i { display: block; height: 100%; background: var(--ok); }
.drop-odds { display: flex; flex-wrap: wrap; gap: 8px; }
.coll-items { display: flex; flex-wrap: wrap; gap: 6px; }
.coll-items button { border: 2px solid var(--line); background: var(--card); border-radius: 10px; padding: 4px 10px; cursor: pointer; font: inherit; color: var(--text); }
.coll-items button.on { border-color: var(--accent); background: var(--bg2); }

/* ---------------------------------------------------------------- битва ботов */
.bots-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin: 16px 0; align-items: start; }
.bots-ladder { grid-column: 1 / -1; }
@media (max-width: 900px) { .bots-app { grid-template-columns: minmax(0, 1fr); } }
.bots-bosses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.bots-boss { display: flex; gap: 10px; align-items: center; text-align: left; border: 2px solid var(--line); background: var(--card);
  color: var(--text); border-radius: 12px; padding: 8px 10px; font: inherit; cursor: pointer; }
.bots-boss .be { font-size: 1.6rem; }
.bots-boss.active { border-color: var(--accent); background: var(--bg2); }
.bots-boss.beaten small { color: var(--ok); }
.bots-boss:disabled { opacity: .5; cursor: not-allowed; }
.bots-score { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .95rem; }
.bots-score .blue b { color: #2f7cf6; }
.bots-score .red b { color: var(--bad); }
.bots-svg { margin: 10px 0 6px; overflow-x: auto; }
.bots-grid { display: block; max-width: 100%; height: auto; }
.bg-field { fill: var(--bg2); }
.bg-wall { fill: var(--muted); opacity: .75; }
.bg-base.blue { fill: rgba(47, 124, 246, .22); }
.bg-base.red { fill: rgba(224, 52, 79, .22); }
.bg-bot circle { stroke-width: 2; }
.bg-bot.blue circle { fill: #2f7cf6; stroke: #1b4fa8; }
.bg-bot.red circle { fill: var(--bad); stroke: #9b1c31; }
.bg-bot.dead { opacity: .35; }
.bg-hp { fill: var(--line); }
.bg-hp.on { fill: var(--ok); }
.bg-count { fill: var(--text); font-weight: 800; }
.bg-shot { stroke-width: 3; stroke-linecap: round; opacity: .8; }
.bg-shot.blue { stroke: #2f7cf6; }
.bg-shot.red { stroke: var(--bad); }
.bg-shot.hit { stroke-width: 5; stroke-dasharray: none; }
.bots-legend { gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- химия: кабинет и задачи */
.clean-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.lesson-day { margin: 14px 0 4px; font-weight: 800; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.lesson-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.lesson-actions form { margin: 0; }
.lesson-row.lesson-done { opacity: .85; }
.lesson-row.lesson-cancelled { opacity: .55; }
.pill.lesson-done { background: var(--ok-bg); }
.pill.lesson-missed { background: var(--bad-bg); }
@media (max-width: 640px) {
  .lesson-row { grid-template-columns: 56px minmax(0, 1fr); }
  .lesson-price { grid-column: 2; }
  .lesson-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.add-lesson-box { margin-top: 10px; }
.add-lesson-box summary { list-style: none; cursor: pointer; display: inline-block; }
.add-lesson-box summary::-webkit-details-marker { display: none; }
.add-lesson { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.add-lesson label { flex: 1 1 140px; }
.schedule-day.today { border-color: var(--accent); }
.invite-code { font-size: 1.3rem; font-family: var(--mono); background: var(--bg2); padding: 2px 10px; border-radius: 8px; }
.big-number { font-size: 2rem; font-weight: 900; }
.hw-text { white-space: pre-wrap; }
.grade-pick { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; display: flex; gap: 16px; flex-wrap: wrap; }
.grade-pick legend { font-weight: 600; font-size: .93rem; padding: 0 4px; }
.join-card { text-align: left; }
.join-card h1, .join-card .login-hero { text-align: center; }
.parent-head { margin-top: 0; }

.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.exam-num { display: flex; gap: 12px; align-items: flex-start; }
.exam-num .n { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 900;
  background: var(--bg2); }
.exam-num.long .n { background: var(--wait-bg); }
.exam-num.good .n { background: var(--ok); color: #fff; }
.exam-num h3 { margin: 0 0 4px; font-size: 1rem; }
.exam-num .meta { font-size: .85rem; color: var(--muted); }
.exam-tasks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.exam-task { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  border: 2px solid var(--line); color: var(--text); }
.exam-task:hover { text-decoration: none; border-color: var(--accent); }
.exam-task.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.exam-task.half { background: var(--wait-bg); border-color: var(--wait); }
.exam-task.bad { background: var(--bad-bg); border-color: var(--bad); }
.chem-text { line-height: 1.6; }
.chem-answer { margin-top: 12px; align-items: flex-end; }
.chem-answer input { max-width: 14em; font-family: var(--mono); font-size: 1.1rem; }
.chem-sample { margin-top: 12px; padding: 12px 14px; background: var(--bg2); border-radius: 12px; line-height: 1.6; }

.pt-scroll { overflow-x: auto; padding-bottom: 8px; }
.pt-grid { display: grid; grid-template-columns: 22px repeat(18, minmax(46px, 1fr)); grid-template-rows: 22px repeat(7, auto) 12px auto auto;
  gap: 3px; min-width: 900px; }
.pt-head { font-size: .72rem; color: var(--muted); display: grid; place-items: center; font-weight: 700; }
.pt-gap { font-size: .7rem; color: var(--muted); display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 6px; }
.pt-el { border: 1px solid rgba(0, 0, 0, .08); border-radius: 6px; padding: 3px 2px; cursor: pointer; font: inherit; color: #1d1838;
  display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-height: 50px; }
.pt-el small { font-size: .62rem; opacity: .75; }
.pt-el b { font-size: 1rem; }
.pt-el span { font-size: .6rem; opacity: .8; }
.pt-el:hover, .pt-el.active { outline: 3px solid var(--accent); outline-offset: 0; }
.pt-detail { display: flex; gap: 18px; align-items: center; color: #1d1838; }
.pt-detail h2 { margin: 0 0 4px; }
.pt-big { width: 84px; height: 84px; border-radius: 14px; background: rgba(255, 255, 255, .6); display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: .85rem; }
.pt-big b { font-size: 2rem; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pt-chip { font-size: .78rem; padding: 3px 10px; border-radius: 999px; color: #1d1838; }
.cat-alkali { background: #ffb4a2; } .cat-alkaline { background: #ffd6a5; } .cat-transition { background: #f6e6a6; }
.cat-lanthanide { background: #ffc6e8; } .cat-actinide { background: #e5c4ff; } .cat-metal { background: #c9d8e8; }
.cat-metalloid { background: #c6f0d8; } .cat-nonmetal { background: #b9f3c0; } .cat-halogen { background: #a6f0ef; }
.cat-noble { background: #bcd4ff; }
.ok-card { border: 2px solid var(--ok); }

/* ---------------------------------------------------------------- формулы веществ */
.f { white-space: nowrap; font-variant-numeric: lining-nums; }
.f sub { font-size: .68em; vertical-align: -.32em; line-height: 0; margin-left: .02em; }
.f[title] { text-decoration: underline dotted rgba(123, 47, 247, .55); text-underline-offset: .22em; cursor: help; }
.f-tip { position: absolute; z-index: 50; background: var(--code-bg); color: var(--code-text); font-size: .85rem;
  padding: 6px 10px; border-radius: 8px; max-width: 260px; box-shadow: var(--shadow); pointer-events: none; }
.chem-text sub, .robot-result sub, .chem-sample sub, .check-text sub { font-size: .68em; vertical-align: -.32em; line-height: 0; }
