/* ============ Тема ============ */
:root {
  --bg: #f5f6fb;
  --bg-2: #eceef6;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #1c2033;
  --text-2: #4b5168;
  --muted: #8389a3;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --accent-text: #4f46e5;
  --ok: #16a34a;
  --ok-soft: #e8f8ee;
  --warn: #d97706;
  --warn-soft: #fff6e5;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --info: #0284c7;
  --info-soft: #e6f4fb;
  --code-bg: #f3f4f9;
  --term-bg: #12141f;
  --term-text: #d7dbe8;
  --shadow: 0 1px 2px rgba(20, 24, 50, .05), 0 4px 16px rgba(20, 24, 50, .06);
  --shadow-lg: 0 10px 40px rgba(20, 24, 50, .16);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f111a;
  --bg-2: #161926;
  --surface: #171a27;
  --surface-2: #1d2130;
  --border: #282d40;
  --border-strong: #363c54;
  --text: #e6e8f2;
  --text-2: #b4b9cc;
  --muted: #7d839c;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --accent-soft: #23264a;
  --accent-text: #a5b4fc;
  --ok: #4ade80;
  --ok-soft: #13291d;
  --warn: #fbbf24;
  --warn-soft: #2d2410;
  --bad: #f87171;
  --bad-soft: #2f1517;
  --info: #38bdf8;
  --info-soft: #0f2633;
  --code-bg: #1d2130;
  --term-bg: #0b0c13;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
.boot { display: grid; place-items: center; height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.stack > * + * { margin-top: 12px; }

/* ============ Кнопки и поля ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.success:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }

.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 13px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* ============ Карточки, бейджи ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 22px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--bg-2); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.info { background: var(--info-soft); color: var(--info); }
.progress { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .5s; }
.progress.ok > i { background: var(--ok); }

/* ============ Каркас ============ */
.topbar {
  position: sticky; top: 0; z-index: 50; height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.3px; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 11px; font-weight: 800; letter-spacing: .3px;
}
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { white-space: nowrap; padding: 7px 12px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--bg-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-text); flex: none;
}
.user-chip .who { line-height: 1.2; text-align: right; }
.user-chip .who b { display: block; font-size: 14px; }
.user-chip .who span { font-size: 12px; color: var(--muted); }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 22px 60px; }
.page.wide { max-width: 1500px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; margin: 0; letter-spacing: -.5px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ============ Вход ============ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; padding: 56px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 20%, #8b5cf6 0, transparent 50%), radial-gradient(circle at 80% 80%, #06b6d4 0, transparent 45%), linear-gradient(135deg, #312e81, #4338ca);
}
.login-art h1 { font-size: 40px; letter-spacing: -1px; margin-top: 40px; max-width: 520px; }
.login-art p { opacity: .85; max-width: 460px; font-size: 17px; }
.login-code {
  font-family: var(--mono); font-size: 14px; background: rgba(10, 10, 30, .45); border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 14px; padding: 18px 20px; max-width: 470px; line-height: 1.7; backdrop-filter: blur(4px); white-space: pre; overflow-x: auto;
}
.login-code .k { color: #c4b5fd; } .login-code .s { color: #86efac; } .login-code .c { color: #94a3b8; } .login-code .n { color: #fcd34d; }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 26px; margin-bottom: 4px; }
.alert { padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* ============ Курсы ============ */
.hello { display: flex; gap: 20px; align-items: center; padding: 26px 28px; margin-bottom: 26px; border-radius: 18px; color: #fff;
  background: linear-gradient(120deg, #4f46e5, #7c3aed 60%, #db2777); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hello h1 { margin: 0 0 4px; font-size: 26px; }
.hello p { margin: 0; opacity: .9; }
.hello .big { font-size: 46px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.course-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s; color: var(--text); }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.course-cover { height: 120px; position: relative; display: flex; align-items: flex-end; padding: 16px 20px; color: #fff; }
.course-cover .ico { font-size: 44px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25)); }
.course-cover .lang { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .22); padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.course-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-body h3 { margin: 0; font-size: 18px; }
.course-body p { margin: 0; color: var(--text-2); font-size: 14px; flex: 1; }
.course-meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 48px; margin-bottom: 8px; }

/* ============ Страница курса ============ */
.course-hero { border-radius: 18px; padding: 30px; color: #fff; margin-bottom: 24px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow); }
.course-hero h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.5px; }
.course-hero p { margin: 0; opacity: .92; max-width: 720px; }
.course-hero .stats { display: flex; gap: 26px; margin-top: 16px; }
.course-hero .stats b { display: block; font-size: 22px; }
.course-hero .stats span { font-size: 13px; opacity: .85; }
.ring { width: 110px; height: 110px; flex: none; margin-left: auto; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.module { margin-bottom: 16px; overflow: hidden; }
.module-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; cursor: pointer; user-select: none; }
.module-head:hover { background: var(--surface-2); }
.module-num { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.module-head h3 { margin: 0; font-size: 17px; }
.module-head .chev { transition: transform .2s; color: var(--muted); }
.module.open .chev { transform: rotate(90deg); }
.module-body { display: none; border-top: 1px solid var(--border); padding: 8px; }
.module.open .module-body { display: block; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; color: var(--text); }
.lesson-row:hover { background: var(--bg-2); text-decoration: none; }
.lesson-row .st { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none; border: 2px solid var(--border-strong); color: var(--muted); }
.lesson-row .st.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.lesson-row .st.started { border-color: var(--warn); color: var(--warn); }
.lesson-row .t { flex: 1; min-width: 0; }

/* ============ Урок ============ */
.lesson-layout { display: grid; grid-template-columns: 290px 1fr; min-height: calc(100vh - 60px); }
.lesson-layout.collapsed { grid-template-columns: 0 1fr; }
.side { border-right: 1px solid var(--border); background: var(--surface); position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; }
.lesson-layout.collapsed .side { visibility: hidden; }
.side-head { padding: 16px 16px 10px; position: sticky; top: 0; background: var(--surface); z-index: 1; border-bottom: 1px solid var(--border); }
.side-head a { font-weight: 700; color: var(--text); font-size: 15px; }
.side-mod { padding: 12px 16px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.side a.item { display: flex; gap: 9px; align-items: flex-start; padding: 7px 16px; font-size: 13.5px; color: var(--text-2); line-height: 1.35; border-left: 3px solid transparent; }
.side a.item:hover { background: var(--bg-2); text-decoration: none; }
.side a.item.active { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); font-weight: 600; }
.side a.item .dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); margin-top: 1px; font-size: 10px; display: grid; place-items: center; }
.side a.item .dot.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.side a.item .dot.started { border-color: var(--warn); }
.lesson-main { min-width: 0; }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 14px 26px; border-bottom: 1px solid var(--border); background: var(--surface); }
.lesson-top h1 { font-size: 20px; margin: 0; }
.article { max-width: 860px; margin: 0 auto; padding: 30px 26px 40px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; max-width: 860px; margin: 0 auto; padding: 0 26px 50px; }
.lesson-nav a { max-width: 48%; }

/* Markdown */
.md { font-size: 16px; line-height: 1.75; }
.md h1 { font-size: 30px; margin-top: 0; letter-spacing: -.5px; }
.md h2 { font-size: 23px; margin: 1.8em 0 .6em; padding-top: .2em; letter-spacing: -.3px; }
.md h3 { font-size: 18px; margin: 1.5em 0 .5em; }
.md p { margin: .7em 0; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: .25em 0; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); }
.md pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; overflow: auto; font-size: 14px; line-height: 1.55; }
.md pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.md table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 14.5px; overflow: hidden; border-radius: 10px; border: 1px solid var(--border); display: table; }
.md th, .md td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 700; }
.md tr:last-child td { border-bottom: 0; }
.md blockquote { margin: 1em 0; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; color: var(--text); }
.md blockquote p { margin: .3em 0; }
.md img { max-width: 100%; border-radius: 12px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.callout { display: flex; gap: 12px; padding: 14px 18px; border-radius: 12px; margin: 1.1em 0; border: 1px solid; }
.callout .ci { font-size: 20px; line-height: 1.4; }
.callout > div > :first-child { margin-top: 0; } .callout > div > :last-child { margin-bottom: 0; }
.callout.tip { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.callout.def { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* Запускаемый пример кода */
.runnable { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin: 1.2em 0; background: var(--surface); box-shadow: var(--shadow); }
.runnable-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.runnable-bar .lbl { font-weight: 700; color: var(--text-2); }
.runnable .editor-host { height: 200px; }
.runnable .term { height: auto; min-height: 0; max-height: 260px; border-radius: 0; }

/* ============ Тест ============ */
.quiz { margin-top: 36px; padding: 26px; }
.quiz h2 { display: flex; align-items: center; gap: 10px; font-size: 21px; }
.q { padding: 18px 0; border-top: 1px solid var(--border); }
.q:first-of-type { border-top: 0; }
.q-text { font-weight: 600; margin-bottom: 10px; white-space: pre-wrap; }
.q-text code { font-family: var(--mono); background: var(--code-bg); padding: 1px 5px; border-radius: 5px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; margin: 7px 0; cursor: pointer; transition: .12s; }
.opt:hover { border-color: var(--accent); }
.opt input { margin-top: 4px; accent-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt code { font-family: var(--mono); font-size: .9em; }
.q-explain { margin-top: 8px; font-size: 14px; color: var(--text-2); padding: 8px 12px; background: var(--surface-2); border-radius: 8px; }
.complete-box { margin-top: 26px; padding: 22px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* ============ Практика / IDE ============ */
.task-layout { display: grid; grid-template-columns: minmax(340px, 42%) 1fr; height: calc(100vh - 60px - 57px); }
.task-desc { overflow: auto; border-right: 1px solid var(--border); background: var(--surface); }
.task-desc .inner { padding: 24px 26px 40px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 14px; background: var(--surface); position: sticky; top: 0; z-index: 2; }
.tab { padding: 11px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.ide { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.ide-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ide-bar .file { font-family: var(--mono); font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ide-split { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ide .editor-host { flex: 1; min-height: 120px; }
.splitter { height: 7px; cursor: row-resize; background: var(--border); position: relative; flex: none; }
.splitter::after { content: ""; position: absolute; left: 50%; top: 2px; width: 40px; height: 3px; margin-left: -20px; border-radius: 3px; background: var(--border-strong); }
.bottom-panel { height: 38%; min-height: 90px; display: flex; flex-direction: column; background: var(--term-bg); }
.bottom-tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; background: color-mix(in srgb, var(--term-bg) 85%, #333); border-bottom: 1px solid #2a2e3f; }
.bottom-tabs button { background: none; border: 0; color: #8e94ad; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.bottom-tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.bottom-tabs .status { margin-left: auto; font-size: 12px; color: #8e94ad; padding-right: 6px; }
.bottom-body { flex: 1; min-height: 0; overflow: auto; }

/* Терминал */
.term {
  background: var(--term-bg); color: var(--term-text); font-family: var(--mono); font-size: 14px; line-height: 1.5;
  padding: 12px 16px; overflow: auto; height: 100%; white-space: pre-wrap; word-break: break-word; cursor: text;
}
.term .sys { color: #7c83a3; }
.term .err { color: #ff8b8b; }
.term .ok { color: #6ee7a0; }
.term .inp { color: #fde68a; }
.term .hint { color: #fbbf77; }
.term input.term-in {
  background: transparent; border: 0; outline: none; color: #fde68a; font: inherit; padding: 0; margin: 0;
  width: 60%; min-width: 120px; caret-color: #fde68a;
}
.term .keywait { color: #93c5fd; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.cm-line { cursor: pointer; }
.cm-line:hover { text-decoration: underline; }

/* Результаты проверки */
.results { padding: 14px 16px; color: var(--term-text); font-size: 14px; }
.results .sum { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 700; }
.results .sum.ok { background: rgba(34, 197, 94, .15); color: #6ee7a0; }
.results .sum.bad { background: rgba(239, 68, 68, .15); color: #ff9b9b; }
.test { border: 1px solid #2a2e3f; border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.test summary { padding: 9px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; }
.test summary::-webkit-details-marker { display: none; }
.test .body { padding: 4px 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.test pre { margin: 4px 0 0; background: #1a1d2b; padding: 8px 10px; border-radius: 8px; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; max-height: 200px; overflow: auto; }
.test .lbl { font-size: 12px; color: #8e94ad; font-weight: 600; }
.test .probs { grid-column: 1 / -1; color: #ffb4b4; font-size: 13.5px; }

.req-list { display: flex; gap: 6px; flex-wrap: wrap; }
.example { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.example pre { margin: 4px 0 0; background: var(--code-bg); border: 1px solid var(--border); padding: 10px 12px; border-radius: 10px; font-family: var(--mono); font-size: 13.5px; white-space: pre-wrap; min-height: 42px; }
.sub-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.sub-item pre { max-height: 220px; overflow: auto; background: var(--code-bg); padding: 10px; border-radius: 8px; font-size: 13px; font-family: var(--mono); margin: 8px 0 0; }

/* Файлы */
.files { padding: 12px 14px; color: var(--term-text); font-size: 14px; }
.files .f { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.files .f:hover { background: #1c2030; }
.files .f .n { flex: 1; font-family: var(--mono); cursor: pointer; }
.files .btn { background: transparent; color: #c6cbe0; border-color: #33384d; }

/* ============ Модальные окна, уведомления ============ */
.modal-back { position: fixed; inset: 0; background: rgba(10, 12, 25, .55); z-index: 200; display: grid; place-items: center; padding: 20px; animation: fade .15s; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal.lg { max-width: 820px; }
.modal.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: pop .2s; max-width: 380px; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; }

/* ============ Таблицы ============ */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:hover td { background: var(--surface-2); }
table.tbl tr.off td { opacity: .5; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 200px; }

/* Матрица прогресса */
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0; text-align: center; background: var(--surface); }
.matrix th.name, .matrix td.name { position: sticky; left: 0; z-index: 2; text-align: left; padding: 8px 12px; min-width: 220px; background: var(--surface); }
.matrix thead th { position: sticky; top: 0; z-index: 3; height: 150px; vertical-align: bottom; padding: 8px 2px; }
.matrix thead th.name { z-index: 4; vertical-align: bottom; }
.matrix thead th .vt { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 140px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--text-2); }
.matrix td.c { width: 30px; height: 32px; cursor: default; }
.cell { width: 22px; height: 22px; border-radius: 6px; margin: auto; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.cell.done { background: var(--ok); color: #fff; }
.cell.try { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.cell.none { background: var(--bg-2); }
.matrix td.total { padding: 0 10px; font-weight: 700; white-space: nowrap; }

/* Админ-редактор курса */
.admin-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.tree { padding: 10px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.tree .mod { margin-bottom: 8px; }
.tree .mod-h { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-weight: 700; font-size: 14px; border-radius: 8px; background: var(--surface-2); }
.tree .les { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 18px; font-size: 13.5px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.tree .les:hover { background: var(--bg-2); }
.tree .les.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.tree .les[draggable="true"] { cursor: grab; }
.tree .les.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.editor-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview-box { border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; max-height: 70vh; overflow: auto; background: var(--surface); }
.kind-pill { font-size: 11px; padding: 1px 7px; border-radius: 99px; font-weight: 700; }
.kind-theory { background: var(--info-soft); color: var(--info); }
.kind-code { background: var(--accent-soft); color: var(--accent-text); }
.kind-text { background: var(--warn-soft); color: var(--warn); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { padding: 18px 20px; }
.stat b { display: block; font-size: 30px; letter-spacing: -.5px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.creds { font-family: var(--mono); }
.print-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.print-card { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; }

/* Билеты */
.ticket { padding: 26px; }
.ticket-num { font-size: 13px; font-weight: 800; color: var(--accent-text); text-transform: uppercase; letter-spacing: .5px; }
.ticket-item { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--border); }
.ticket-item .n { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 800; flex: none; }
.ticket-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ticket-list button { height: 48px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; cursor: pointer; }
.ticket-list button:hover, .ticket-list button.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.timer { font-family: var(--mono); font-size: 22px; font-weight: 700; }

/* ============ Виджеты ============ */
.widget { margin: 1.4em 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.widget-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.widget-head .wi { font-size: 17px; }
.widget-body { padding: 18px; }
.widget-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.widget svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.widget svg text { font-family: var(--font); }
.fc-node { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.fc-term { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.fc-io { fill: var(--info-soft); stroke: var(--info); stroke-width: 2; }
.fc-dec { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 2; }
.fc-proc { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 2; }
.fc-text { fill: var(--text); font-size: 13px; }
.fc-label { fill: var(--muted); font-size: 12px; font-weight: 700; }
.fc-line { stroke: var(--text-2); stroke-width: 1.6; fill: none; }
.fc-active { filter: drop-shadow(0 0 8px var(--accent)); stroke-width: 3.5 !important; }
.arr-cells { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.arr-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.arr-cell .box { width: 52px; height: 52px; border-radius: 10px; border: 2px solid var(--border-strong); display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 17px; background: var(--surface); transition: .25s; position: relative; }
.arr-cell .idx { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.arr-cell .box.cur { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-4px); }
.arr-cell .box.best { border-color: var(--ok); background: var(--ok-soft); }
.arr-cell .box.cmp { border-color: var(--warn); background: var(--warn-soft); }
.arr-cell .box.done { border-color: var(--ok); background: var(--ok); color: #fff; }
.arr-cell .box.dim { opacity: .4; }
.vars { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.var { border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; font-family: var(--mono); font-size: 14px; background: var(--surface-2); }
.var b { color: var(--accent-text); }
.var.changed { animation: flash .6s; }
@keyframes flash { 0% { background: var(--warn-soft); border-color: var(--warn); } }
.trace-line { font-family: var(--mono); font-size: 14px; padding: 2px 10px; border-radius: 6px; white-space: pre; }
.trace-line.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.code-trace { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 0; overflow: auto; }
.trace-out { font-family: var(--mono); background: var(--term-bg); color: var(--term-text); border-radius: 10px; padding: 10px 14px; min-height: 44px; white-space: pre-wrap; font-size: 14px; }
.trace-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.matrix-w { display: inline-grid; gap: 5px; margin: 0 auto; }
.matrix-w .box { width: 46px; height: 46px; border-radius: 9px; border: 2px solid var(--border-strong); display: grid; place-items: center; font-family: var(--mono); font-weight: 700; transition: .2s; background: var(--surface); }
.matrix-w .box.cur { border-color: var(--accent); background: var(--accent-soft); }
.matrix-w .box.best { border-color: var(--ok); background: var(--ok-soft); }
.matrix-w .box.row { background: color-mix(in srgb, var(--info-soft) 60%, var(--surface)); }
.matrix-w .hdr { font-family: var(--mono); font-size: 12px; color: var(--muted); display: grid; place-items: center; }
.order-list { list-style: none; padding: 0; margin: 0; }
.order-list li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; margin: 6px 0; background: var(--surface); cursor: grab; user-select: none; }
.order-list li .grip { color: var(--muted); }
.order-list li.dragging { opacity: .5; }
.order-list li.right { border-color: var(--ok); background: var(--ok-soft); }
.order-list li.wrong { border-color: var(--bad); background: var(--bad-soft); }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.flip { perspective: 800px; height: 130px; cursor: pointer; }
.flip-in { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flip.on .flip-in { transform: rotateY(180deg); }
.flip-f, .flip-b { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 12px; border: 1px solid var(--border); }
.flip-f { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); font-weight: 700; font-size: 15px; }
.flip-f .e { display: block; font-size: 28px; margin-bottom: 4px; }
.flip-b { background: var(--surface-2); transform: rotateY(180deg); font-size: 13.5px; line-height: 1.45; }
.chart-box { position: relative; }
.chart-box canvas { width: 100%; height: 280px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 13px; margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.range-row { display: flex; gap: 12px; align-items: center; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.mem-box { display: inline-flex; flex-direction: column; align-items: center; margin: 6px; }
.mem-box .cell2 { min-width: 70px; height: 50px; padding: 0 10px; border: 2px solid var(--accent); border-radius: 10px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; background: var(--accent-soft); }
.mem-box .nm { font-family: var(--mono); font-size: 13px; margin-top: 4px; }
.mem-box .tp { font-size: 11px; color: var(--muted); }
.truth td.t { color: var(--ok); font-weight: 700; } .truth td.f { color: var(--bad); font-weight: 700; }
.toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.toggle button { border: 0; background: var(--surface); padding: 6px 14px; cursor: pointer; font-weight: 700; font-family: var(--mono); }
.toggle button.on { background: var(--accent); color: #fff; }
.uml { display: inline-block; border: 2px solid var(--accent); border-radius: 10px; overflow: hidden; min-width: 200px; font-family: var(--mono); font-size: 13px; background: var(--surface); vertical-align: top; margin: 6px; }
.uml .h { background: var(--accent); color: #fff; padding: 6px 12px; font-weight: 700; text-align: center; }
.uml .s { padding: 6px 12px; border-top: 1px solid var(--border); }
.uml .s div { white-space: nowrap; }
.pipeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pipeline .st { padding: 12px 16px; border-radius: 12px; border: 2px solid var(--border-strong); text-align: center; min-width: 120px; background: var(--surface); transition: .3s; }
.pipeline .st b { display: block; }
.pipeline .st span { font-size: 12px; color: var(--muted); }
.pipeline .st.on { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.05); }
.pipeline .ar { color: var(--muted); font-size: 20px; }
.expr-steps { font-family: var(--mono); font-size: 18px; text-align: center; padding: 14px; }
.expr-steps .hl { background: var(--warn-soft); outline: 2px solid var(--warn); border-radius: 6px; padding: 0 3px; }
.scope-box { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 10px 14px; margin: 8px 0; position: relative; }
.scope-box .tag { position: absolute; top: -11px; left: 12px; background: var(--surface); padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ============ Адаптивность ============ */
@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .task-layout { grid-template-columns: 1fr; height: auto; }
  .task-desc { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; }
  .ide { height: 85vh; }
  .admin-grid, .split2, .trace-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .nav { display: none; }
  .user-chip .who { display: none; }
}
@media (max-width: 600px) {
  .page { padding: 18px 16px 40px; }
  .article { padding: 22px 16px; }
  .example, .test .body { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .no-print, #toasts { display: none !important; }
  body { background: #fff; }
  .modal-back { position: static; background: none; }
  .modal { box-shadow: none; max-height: none; }
}

/* Преимущества платформы на странице входа */
.login-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; margin-top: 8px; }
.login-feature {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px;
  background: rgba(10, 10, 30, .3); border: 1px solid rgba(255, 255, 255, .15); backdrop-filter: blur(4px);
}
.login-feature .fi { font-size: 24px; line-height: 1; }
.login-feature b { display: block; font-size: 15px; margin-bottom: 2px; }
.login-feature span:not(.fi) { font-size: 13px; opacity: .85; line-height: 1.4; display: block; }

/* Название портала рядом с логотипом */
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text b { font-size: 16px; }
.logo-text small { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

/* Подвал с информацией о разработчике */
.site-footer {
  display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding: 18px 22px 26px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.site-footer b { color: var(--text-2); font-weight: 600; }
.task-desc .site-footer { padding: 18px 0 0; margin-top: 30px; }

.mobile-only { display: none; }
@media (max-width: 980px) { .mobile-only { display: block; } }

/* ============ Мобильная версия ============ */
.menu-btn { display: none; }
.logo-mark { flex: none; }
.logo-text b, .logo-text small { white-space: nowrap; }
.side-shade { display: none; }
.logo.mobile-only { align-items: center; gap: 10px; }

/* Выезжающее меню */
.drawer-back { position: fixed; inset: 0; z-index: 250; background: rgba(10, 12, 25, 0); transition: background .2s; }
.drawer-back.open { background: rgba(10, 12, 25, .5); }
.drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(300px, 84vw); background: var(--surface);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(-102%); transition: transform .2s ease-out;
}
.drawer-back.open .drawer { transform: none; }
.drawer-user { display: flex; gap: 12px; align-items: center; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.drawer-user b { display: block; line-height: 1.3; }
.drawer nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; overflow: auto; flex: 1; }
.drawer nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: 15px; }
.drawer nav a:hover { background: var(--bg-2); text-decoration: none; }
.drawer nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.drawer nav a span { width: 24px; text-align: center; font-size: 18px; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.drawer-foot .btn { flex: 1; }

@media (max-width: 980px) {
  .menu-btn { display: inline-flex; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 12px; gap: 10px; }
  .user-chip .avatar { cursor: pointer; }
  .logo.mobile-only { display: flex; }

  /* Урок: содержание курса выезжает слева */
  .lesson-layout .side, .lesson-layout.collapsed .side {
    display: block; visibility: visible; position: fixed; top: 60px; left: 0; bottom: 0; height: auto;
    width: min(320px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .2s ease-out; box-shadow: var(--shadow-lg);
  }
  .lesson-layout.side-open .side { transform: none; }
  .lesson-layout.side-open .side-shade { display: block; position: fixed; inset: 60px 0 0 0; z-index: 55; background: rgba(10, 12, 25, .45); }
  .lesson-top { padding: 10px 12px; flex-wrap: wrap; gap: 8px 10px; }
  .lesson-top h1 { font-size: 17px; }
  .lesson-top .crumbs { font-size: 12px; }
  .lesson-nav { flex-direction: column; padding: 0 16px 30px; }
  .lesson-nav a { max-width: none; white-space: normal; height: auto; min-height: 40px; padding: 8px 14px; }

  /* Практика: условие сверху, редактор и консоль ниже */
  .task-desc .inner { padding: 18px 16px 24px; }
  .ide { height: calc(100vh - 60px); min-height: 520px; }
  .ide-bar { padding: 8px; gap: 6px; }
  .ide-bar .btn { height: 34px; padding: 0 10px; font-size: 13px; }
  .ide-bar .file { display: none; }
  .bottom-panel { height: 42%; }

  /* Курсы и страницы */
  .hello { padding: 20px; gap: 14px; }
  .hello h1 { font-size: 21px; }
  .hello .big { font-size: 34px; }
  .course-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .course-hero { padding: 22px 20px; flex-direction: column; align-items: flex-start; gap: 16px; }
  .course-hero h1 { font-size: 23px; }
  .course-hero .stats { flex-wrap: wrap; gap: 12px 22px; }
  .course-hero .ring { margin: 0; width: 90px; height: 90px; }
  .course-hero .ring svg { width: 90px; height: 90px; }
  .module-head { padding: 14px; gap: 12px; }
  .module-head .progress { display: none; }
  .lesson-row { flex-wrap: wrap; padding: 10px; }
  .lesson-row .t { min-width: 60%; }
  .page-head h1 { font-size: 23px; }
  .tree { position: static; max-height: none; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .toolbar .input { min-width: 0; width: 100%; }
  .ticket { padding: 18px; }

  /* Окна */
  .modal-back { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); border-radius: 14px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot { flex-wrap: wrap; }

  /* Виджеты */
  .widget-body { padding: 14px; overflow-x: auto; }
  .expr-steps { font-size: 15px; word-break: break-word; }
  .matrix th.name, .matrix td.name { min-width: 150px; }

  /* iOS увеличивает страницу при вводе в поля со шрифтом меньше 16px */
  .input, select.input, textarea.input, .term input.term-in { font-size: 16px; }
}

@media (max-width: 600px) {
  .logo-text small { display: none; }
  .hello .big { display: none; }
  .print-cards { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; padding: 16px; }
  .quiz { padding: 18px; }
  .complete-box { padding: 16px; }
  .card.pad { padding: 16px; }
}

/* Переключатель «Задание / Код» в практике на телефоне */
.mobile-tabs { display: none; }
@media (max-width: 980px) {
  .mobile-tabs {
    display: flex; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 60px; z-index: 20;
  }
  .mobile-tabs button {
    flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
    font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text-2);
  }
  .mobile-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .task-layout .ide { display: none; }
  .task-layout.show-code .ide { display: flex; height: calc(100vh - 60px - 55px); min-height: 460px; }
  .task-layout.show-code .task-desc { display: none; }
}

@media (max-width: 980px) {
  .lesson-top .crumbs { display: none; }
  .lesson-top h1 .badge { margin-left: 6px !important; }
}
