/* Шрифты лежат на своём домене (scripts/fetch_vendor.sh): страница изолирована COOP/COEP */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/static/vendor/fonts/nunito-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: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/static/vendor/fonts/nunito-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: "Nunito", 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] { 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; 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; 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; }
}
