/* ============================================================
   Тема курса Go «Земли Горутин»: дерево, мох, камень, горы, костёр и немного эльфийского света.
   Подключается после стилей движка (generic_styles.css, hud.css) и только переопределяет их.
   Светлая — «утро в Истоках», тёмная — «ночь у костра». Принцип — как в Go: мало украшений, всё по делу.
   ============================================================ */

:root {
    /* палитра */
    --moss: #4f7a4a; --moss-dk: #34563a; --moss-lt: #a9c79a;
    --wood: #8a623e; --wood-dk: #5e4129; --bark: #3b2c20;
    --stone: #8c938d; --stone-lt: #d9dcd3;
    --ember: #c8642a; --ember-lt: #f0a24a;
    --elf: #3f8f86; --elf-lt: #8fd6c8;
    --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;

    /* переменные движка */
    --bg: #eef1e6; --ink: #24302a; --ink-soft: #5d6b61; --gold: #9db48f; --gold-soft: #e3e8da; --card: #fbfaf4;
    --h-bg1: #eef2e6; --h-bg2: #dde5d0;
    --h-glow1: rgba(143, 214, 200, .22); --h-glow2: rgba(240, 162, 74, .14);
    --h-panel: rgba(251, 250, 244, .94); --h-panel-solid: #fbfaf4;
    --h-frame-a: #fbfaf4; --h-frame-b: #f1f2e8;
    --h-pill-a: #fbfaf4; --h-pill-b: #e8ecdc;
    --h-edge: rgba(79, 122, 74, .38);
    --h-gold: var(--moss-dk); --h-gold-fill: var(--moss);
    --h-text: #24302a; --h-soft: #5d6b61;
    --h-field: #ffffff; --h-line: rgba(36, 48, 42, .12);
    --h-shadow: 0 10px 30px rgba(36, 56, 40, .20);
    --h-card: rgba(255, 255, 255, .7);
    --h-inline-code-bg: rgba(79, 122, 74, .12); --h-inline-code: #2f5d3a;
    --h-link: #2f7a72; --h-link-v: #6b5a8e;
    --ridge-far: #b9c6b0; --ridge-near: #93a98a; --ridge-pine: #4f7a4a;
    --hills-far: #cdd8c4; --hills-near: #b2c3a6; --pines: #8aa27f;
}
html[data-theme="dark"] {
    --bg: #0e1612; --ink: #e3e9df; --ink-soft: #9fb0a4; --card: #16221c;
    --h-bg1: #0b1310; --h-bg2: #13211b;
    --h-glow1: rgba(143, 214, 200, .10); --h-glow2: rgba(240, 140, 60, .12);
    --h-panel: rgba(21, 33, 27, .90); --h-panel-solid: #15211b;
    --h-frame-a: rgba(26, 40, 33, .97); --h-frame-b: rgba(17, 27, 22, .97);
    --h-pill-a: rgba(30, 46, 38, .97); --h-pill-b: rgba(18, 29, 24, .97);
    --h-edge: rgba(143, 214, 200, .26);
    --h-gold: #f0b46a; --h-gold-fill: #f0b46a;
    --h-text: #e3e9df; --h-soft: #9fb0a4;
    --h-field: rgba(255, 255, 255, .06); --h-line: rgba(255, 255, 255, .09);
    --h-shadow: 0 14px 40px rgba(0, 0, 0, .55);
    --h-card: rgba(255, 255, 255, .04);
    --h-inline-code-bg: rgba(143, 214, 200, .10); --h-inline-code: #b9e8de;
    --h-link: #8fd6c8; --h-link-v: #c3b3ee;
    --ridge-far: #22352c; --ridge-near: #2c4437; --ridge-pine: #3d5e4a;
    --hills-far: #142019; --hills-near: #101a14; --pines: #0c140f;
}

/* ---------- фон: небо, горы и ельник внизу ---------- */
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--h-text);
}
body::after {                                   /* вместо «звезды» движка — силуэт гор и леса по низу окна */
    content: ""; position: fixed; z-index: 0; pointer-events: none; opacity: 1; animation: none;
    left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 34vh; min-height: 180px; transform: none;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'><path fill='black' d='M0 200V150l12-9 10 7 9-16 10 11 11-20 10 15 9-9 12 13 11-22 10 14 10-8 11 12 10-17 11 13 9-6 12 14 10-19 11 16 10-10 11 9 10-15 12 14 9-8 10 12 11-21 10 15 12-6 10 10 9-14 12 13 10-9 11 11 10-18 11 16 10-7 9 10 12-20 10 15 11-8 10 12 11-16 10 13 12-10 9 9 11-22 10 17 10-6 12 11 10-15 10 12 11-9 11 13 10-19 11 15 9-7 12 10 11-17 10 14 10-8 12 12 10-21 9 16 11-6 10 9 11-14 12 13 10-10 11 12 9-18 12 15 10-7 10 10 11-20 11 16 10-9 10 11 12-15 9 13 11-8 11 12 10-22 10 17 12-6 9 9 11-16 10 14 12-10 10 11 11-19 10 15 10-7 11 12 11-17 10 13 10-9 12 12 9-20 11 16 10-6 11 10 10-15 12 14 10-9 9 11 11-18 11 15 10-8 12 12 10-21 10 16 11-7 9 9 12-14 10 13 11-10 10 12V200z'/></svg>") bottom / 100% 42% no-repeat,
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'><path fill='black' d='M0 300V170l90-60 70 40 110-100 90 80 60-40 120 90 100-70 80 50 130-110 110 95 70-35 90 60 90-50V300z'/></svg>") bottom / 100% 100% no-repeat;
    -webkit-mask: none; mask: none;
    filter: none;
}
/* цвет силуэтов задаём через маску: так одни и те же рисунки работают в обеих темах */
body::after {
    background: var(--pines);
    -webkit-mask:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'><path d='M0 200V150l12-9 10 7 9-16 10 11 11-20 10 15 9-9 12 13 11-22 10 14 10-8 11 12 10-17 11 13 9-6 12 14 10-19 11 16 10-10 11 9 10-15 12 14 9-8 10 12 11-21 10 15 12-6 10 10 9-14 12 13 10-9 11 11 10-18 11 16 10-7 9 10 12-20 10 15 11-8 10 12 11-16 10 13 12-10 9 9 11-22 10 17 10-6 12 11 10-15 10 12 11-9 11 13 10-19 11 15 9-7 12 10 11-17 10 14 10-8 12 12 10-21 9 16 11-6 10 9 11-14 12 13 10-10 11 12 9-18 12 15 10-7 10 10 11-20 11 16 10-9 10 11 12-15 9 13 11-8 11 12 10-22 10 17 12-6 9 9 11-16 10 14 12-10 10 11 11-19 10 15 10-7 11 12 11-17 10 13 10-9 12 12 9-20 11 16 10-6 11 10 10-15 12 14 10-9 9 11 11-18 11 15 10-8 12 12 10-21 10 16 11-7 9 9 12-14 10 13 11-10 10 12V200z'/></svg>") bottom / 100% 42% no-repeat;
            mask:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'><path d='M0 200V150l12-9 10 7 9-16 10 11 11-20 10 15 9-9 12 13 11-22 10 14 10-8 11 12 10-17 11 13 9-6 12 14 10-19 11 16 10-10 11 9 10-15 12 14 9-8 10 12 11-21 10 15 12-6 10 10 9-14 12 13 10-9 11 11 10-18 11 16 10-7 9 10 12-20 10 15 11-8 10 12 11-16 10 13 12-10 9 9 11-22 10 17 10-6 12 11 10-15 10 12 11-9 11 13 10-19 11 15 9-7 12 10 11-17 10 14 10-8 12 12 10-21 9 16 11-6 10 9 11-14 12 13 10-10 11 12 9-18 12 15 10-7 10 10 11-20 11 16 10-9 10 11 12-15 9 13 11-8 11 12 10-22 10 17 12-6 9 9 11-16 10 14 12-10 10 11 11-19 10 15 10-7 11 12 11-17 10 13 10-9 12 12 9-20 11 16 10-6 11 10 10-15 12 14 10-9 9 11 11-18 11 15 10-8 12 12 10-21 10 16 11-7 9 9 12-14 10 13 11-10 10 12V200z'/></svg>") bottom / 100% 42% no-repeat;
}
body::before {                                  /* дальние горы; ночью над ними светлячки */
    content: ""; position: fixed; z-index: 0; pointer-events: none; inset: auto 0 0 0; height: 46vh; min-height: 240px;
    background: var(--hills-far); animation: none;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'><path d='M0 300V190l90-60 70 40 110-100 90 80 60-40 120 90 100-70 80 50 130-110 110 95 70-35 90 60 90-50V300z'/></svg>") bottom / 100% 100% no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'><path d='M0 300V190l90-60 70 40 110-100 90 80 60-40 120 90 100-70 80 50 130-110 110 95 70-35 90 60 90-50V300z'/></svg>") bottom / 100% 100% no-repeat;
}
html[data-theme="dark"] body::before {
    background-image: none; background-color: var(--hills-far); animation: none;
}
/* светлячки ночью: отдельный слой поверх неба (на элементе .ridge нельзя — он внутри страницы) */
html[data-theme="dark"] body {
    background:
        radial-gradient(2px 2px at 12% 28%, rgba(240, 180, 106, .75), transparent 60%),
        radial-gradient(1.5px 1.5px at 27% 62%, rgba(143, 214, 200, .6), transparent 60%),
        radial-gradient(2px 2px at 44% 18%, rgba(240, 180, 106, .55), transparent 60%),
        radial-gradient(1.5px 1.5px at 63% 44%, rgba(143, 214, 200, .55), transparent 60%),
        radial-gradient(2px 2px at 78% 24%, rgba(240, 180, 106, .6), transparent 60%),
        radial-gradient(1.5px 1.5px at 90% 52%, rgba(143, 214, 200, .5), transparent 60%),
        radial-gradient(1000px 520px at 15% -10%, var(--h-glow1), transparent 62%),
        radial-gradient(800px 600px at 95% 105%, var(--h-glow2), transparent 60%),
        linear-gradient(180deg, var(--h-bg1) 0%, var(--h-bg2) 100%);
    background-attachment: fixed;
}
html:not([data-theme="dark"]) body {
    background:
        radial-gradient(1000px 520px at 15% -10%, var(--h-glow1), transparent 62%),
        radial-gradient(800px 600px at 95% 0%, rgba(255, 236, 190, .5), transparent 60%),
        linear-gradient(180deg, #f4f6ee 0%, var(--h-bg2) 100%);
    background-attachment: fixed;
}

/* ---------- гребень над страницей (templates/decor.html) ---------- */
.ridge { position: relative; z-index: 2; max-width: 1080px; margin: 8px auto -1px; height: 58px; line-height: 0; }
:root { --strip-h: 58px; }                              /* высота полоски гребня: по её средней линии стоит кнопка входа на телефоне */
.ridge svg { margin-left: 26px; overflow: visible; }
.ridge .r-far { fill: var(--ridge-far); }
.ridge .r-near { fill: var(--ridge-near); }
.ridge .r-pine { fill: var(--ridge-pine); }
.ridge .r-log { stroke: var(--wood); stroke-width: 4; stroke-linecap: round; fill: none; }
.ridge .r-flame { fill: var(--ember); }
.ridge .r-core { fill: #ffd27a; }
.ridge .r-spark, .ridge .r-spark-dot { fill: var(--elf); }
html[data-theme="dark"] .ridge .r-flame { fill: var(--ember-lt); filter: drop-shadow(0 0 6px rgba(240, 162, 74, .8)); }
html[data-theme="dark"] .ridge .r-spark, html[data-theme="dark"] .ridge .r-spark-dot { fill: var(--elf-lt); filter: drop-shadow(0 0 4px rgba(143, 214, 200, .9)); }
@media (prefers-reduced-motion: no-preference) {
    .ridge .r-flame { transform-origin: 240px 50px; animation: flame 2.4s ease-in-out infinite; }
    .ridge .r-spark { transform-origin: 282px 18px; animation: spark 5s ease-in-out infinite; }
}
@keyframes flame { 50% { transform: scale(1.06, .94); } }
@keyframes spark { 50% { opacity: .45; transform: rotate(45deg) scale(.85); } }

/* ---------- страница ---------- */
.slide, html[data-theme="dark"] .slide {
    position: relative; z-index: 1;
    background: var(--h-panel); border: 1px solid var(--h-edge);
    border-radius: 16px; box-shadow: var(--h-shadow);
    padding: 34px 44px 30px;
}
.slide::before {                                /* тонкая полоса сверху: мох переходит в эльфийский свет */
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, var(--moss), var(--elf) 60%, transparent);
}
:is(h1, h2, h3, .main-title, .section-title) { font-family: var(--serif); letter-spacing: .2px; text-shadow: none !important; }
h2, html[data-theme="dark"] h2 { color: var(--h-gold); font-size: 1.9em; font-weight: 600; margin: 0 0 18px; text-align: left; }
.slide > h2:first-child::after {                /* под заголовком урока — побег с листком */
    content: ""; display: block; width: 120px; height: 12px; margin-top: 8px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'><path d='M0 6h96' stroke='%234f7a4a' stroke-width='1.5' stroke-linecap='round'/><path d='M100 6c4-6 12-6 18-3-4 6-12 7-18 3z' fill='%234f7a4a'/><path d='M96 6c-3-4-8-5-12-3 3 4 8 5 12 3z' fill='%23a9c79a'/></svg>") left center / contain no-repeat;
}
h3, html[data-theme="dark"] h3 { color: var(--h-gold); font-size: 1.35em; font-weight: 600; }
h4, html[data-theme="dark"] h4 { color: var(--h-soft); font-family: system-ui, sans-serif; font-size: 1em; letter-spacing: .2px; }
p, li, html[data-theme="dark"] :is(p, li) { color: var(--h-text); line-height: 1.65; }
a, html[data-theme="dark"] a { color: var(--h-link); }
code, html[data-theme="dark"] code { background: var(--h-inline-code-bg); color: var(--h-inline-code); border-radius: 5px; padding: 1px 5px; }

/* ---------- блоки урока ---------- */
:is(.theory-block, .task, .hint, .example), html[data-theme="dark"] :is(.theory-block, .task, .hint, .example) {
    background: var(--h-card); border: 1px solid var(--h-line); border-left: 4px solid var(--moss);
    border-radius: 6px 14px 14px 6px; box-shadow: none; padding: 18px 24px; margin: 22px 0; color: var(--h-text);
}
.theory-block > h3:first-child, .task > h3:first-child, .hint > h3:first-child, .example > h3:first-child {
    display: flex; align-items: center; gap: 10px; margin-top: 0;
}
.theory-block > h3:first-child::before, .task > h3:first-child::before, .hint > h3:first-child::before, .example > h3:first-child::before {
    content: ""; width: 22px; height: 22px; flex: 0 0 auto; background: currentColor;
    -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat;
}
/* Теория — лист, Квест — костёр, Ловушки — камень, Боковые квесты — эльфийская искра */
.theory-block { --mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 20C4 10 10 4 20 4c0 10-6 16-16 16z M4 20l9-9' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }
.task, html[data-theme="dark"] .task { border-left-color: var(--ember); --mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3c3 4 6 6 6 10a6 6 0 0 1-12 0c0-3 2-4 3-6 0 2 1 3 2 3 0-3-1-5 1-7z M5 21h14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }
.task > h3:first-child { color: var(--ember); }
html[data-theme="dark"] .task > h3:first-child { color: var(--ember-lt); }
.hint, html[data-theme="dark"] .hint { border-left-color: var(--stone); --mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 17l3-8 6-4 6 3 1 8-5 4H8z M9 12l4 2' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'/></svg>"); }
.hint > h3:first-child { color: var(--h-soft); }
.example, html[data-theme="dark"] .example { border-left-color: var(--elf); border-left-style: solid; --mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3c1 5 3 7 8 8-5 1-7 3-8 8-1-5-3-7-8-8 5-1 7-3 8-8z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/></svg>"); }
.example > h3:first-child { color: var(--elf); }
html[data-theme="dark"] .example > h3:first-child { color: var(--elf-lt); }
.theory-block > h3:first-child { color: var(--moss); }
html[data-theme="dark"] .theory-block > h3:first-child { color: var(--moss-lt); }

/* ---------- реплики персонажей ---------- */
blockquote { margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--wood); background: rgba(138, 98, 62, .06); border-radius: 0 12px 12px 0; }
blockquote p { margin: 0; }
blockquote.voice strong:first-child { font-family: var(--serif); color: var(--wood-dk); }
blockquote.v-yanareel { border-left-color: var(--elf); background: rgba(63, 143, 134, .07); }
blockquote.v-yanareel strong:first-child { color: var(--elf); }
blockquote.v-goffi { border-left-color: #4f97cf; background: rgba(79, 151, 207, .07); }
blockquote.v-goffi strong:first-child { color: #2f6fa6; }
blockquote.v-frol { border-left-color: var(--ember); background: rgba(200, 100, 42, .06); }
blockquote.v-frol strong:first-child { color: var(--ember); }
blockquote.v-ghost { border-left-color: #8a86b8; background: rgba(138, 134, 184, .08); font-style: italic; }
blockquote.v-ghost strong:first-child { color: #6b66a3; font-style: normal; }
html[data-theme="dark"] blockquote { background: rgba(255, 255, 255, .035); }
html[data-theme="dark"] blockquote.voice strong:first-child { color: #d7b98e; }
html[data-theme="dark"] blockquote.v-yanareel strong:first-child { color: var(--elf-lt); }
html[data-theme="dark"] blockquote.v-goffi strong:first-child { color: #8cc4ee; }
html[data-theme="dark"] blockquote.v-frol strong:first-child { color: var(--ember-lt); }
html[data-theme="dark"] blockquote.v-ghost strong:first-child { color: #b9b4ea; }

/* ---------- код ---------- */
pre[class*="language-"], html[data-theme="dark"] pre[class*="language-"], pre:has(> code[class*="language-"]), pre.output, pre.language-none {
    background: #18221d; border: 1px solid rgba(143, 214, 200, .12); border-radius: 10px; box-shadow: none;
    padding: 14px 16px; overflow-x: auto; tab-size: 4; font: 14px/1.5 "JetBrains Mono", "Cascadia Code", Consolas, Monaco, monospace;
}
:is(pre code, code[class*="language-"]), html[data-theme="dark"] :is(pre code, code[class*="language-"]) { background: none; color: #d3ddd5; padding: 0; }
code[class*="language-"] .token.comment { color: #7d917f; font-style: italic; }
code[class*="language-"] .token.keyword { color: #8fd6c8; }
code[class*="language-"] .token.string { color: #b8d68a; }
code[class*="language-"] .token.number, code[class*="language-"] .token.boolean { color: #f0a24a; }
code[class*="language-"] .token.function { color: #e8cf8a; }
code[class*="language-"] :is(.token.operator, .token.punctuation) { color: #a9b8ae; }
pre.output { background: #121a16; color: #c9d4cc; }
pre.output::before { content: "вывод"; display: block; font: 600 10.5px system-ui; color: #7d917f; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 4px; }
.code-section h4 { margin: 12px 0 4px; font-size: .9em; color: var(--h-soft); text-transform: uppercase; letter-spacing: .08em; }
details.solution { margin: 12px 0; }
details.solution > summary { cursor: pointer; color: var(--moss); font-weight: 600; }
html[data-theme="dark"] details.solution > summary { color: var(--moss-lt); }
details { margin: 4px 0 10px; }
.hint ol, .hint ul { padding-left: 1.3em; }

/* ---------- таблицы ---------- */
table { border-collapse: collapse; margin: 14px 0; width: 100%; font-size: .95em; }
th, td { border-bottom: 1px solid var(--h-line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { color: var(--h-gold); font-family: var(--serif); font-weight: 600; border-bottom: 2px solid var(--h-edge); }

/* ---------- навигация: дощечки ---------- */
a.back, a.forward, html[data-theme="dark"] :is(a.back, a.forward) {
    background: linear-gradient(180deg, var(--wood), var(--wood-dk)); color: #fff7e8 !important;
    border: 1px solid var(--bark); border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 2px 6px rgba(0, 0, 0, .18);
    font-weight: 600; text-decoration: none;
}
a.back:hover, a.forward:hover, html[data-theme="dark"] :is(a.back, a.forward):hover { background: linear-gradient(180deg, #9c7148, var(--wood)); color: #fff !important; }
.gl-link, html[data-theme="dark"] .gl-link { background: transparent; border: 1px solid var(--h-edge); color: var(--h-gold); border-radius: 999px; }

/* ---------- титульная ---------- */
.main-title, html[data-theme="dark"] .main-title { color: var(--h-gold); font-size: 2.6em; font-weight: 600; text-align: left; }
.hero { justify-content: flex-start; }
.hero img { filter: drop-shadow(0 8px 12px rgba(36, 56, 40, .25)); }
.lead-intro, html[data-theme="dark"] .lead-intro { color: var(--h-text); text-align: left; }
.section-card, html[data-theme="dark"] .section-card {
    background: var(--h-card); border: 1px solid var(--h-line); border-left: 4px solid var(--moss); border-radius: 6px 14px 14px 6px; box-shadow: none;
}
.section-title, html[data-theme="dark"] .section-title { color: var(--h-gold); font-size: 1.3em; }
.section-title .ic, html[data-theme="dark"] .section-title .ic { color: var(--moss); border-color: var(--h-edge); background: rgba(79, 122, 74, .08); border-radius: 50%; }
html[data-theme="dark"] .section-title .ic { color: var(--elf-lt); }
.note-card, html[data-theme="dark"] .note-card { background: rgba(63, 143, 134, .07); border: 1px solid var(--h-edge); border-radius: 14px; }
.goffi-note { width: 90px; height: auto; flex: 0 0 auto; }

/* ---------- HUD: окна, кнопки, Гоффи ---------- */
.hud-head { background: linear-gradient(180deg, rgba(79, 122, 74, .14), rgba(79, 122, 74, .02)); }
html[data-theme="dark"] .hud-head { background: linear-gradient(180deg, rgba(143, 214, 200, .10), transparent); }
.hud-frame { border-radius: 16px; }
.pai-av, .pai-head-av {
    background: radial-gradient(circle at 50% 35%, #f4f8ee 0%, #cfe2c4 55%, #6f9a62 100%);
    border-color: #f4f8ee; box-shadow: 0 0 0 2px var(--moss), 0 10px 24px rgba(0, 0, 0, .32), 0 0 22px rgba(143, 214, 200, .45);
}
html[data-theme="dark"] .pai-av { background: radial-gradient(circle at 50% 35%, #2e4a3d 0%, #1c3028 60%, #0f1a15 100%); border-color: #3d5e4a;
    box-shadow: 0 0 0 2px rgba(143, 214, 200, .5), 0 10px 26px rgba(0, 0, 0, .5), 0 0 26px rgba(143, 214, 200, .35); }
.pai-av img { filter: drop-shadow(0 4px 6px rgba(20, 40, 30, .35)); }
.pai-head-av img { top: -8%; width: 120%; }
:is(.code-run, .rep-btns .rep-send) { background: linear-gradient(180deg, var(--ember-lt), var(--ember)); color: #2a1406; }
:is(.ctx-progress .bar > i, .toc-bar > i) { background: linear-gradient(90deg, var(--moss), var(--elf)); }
.ctx-item.cur { background: linear-gradient(90deg, rgba(79, 122, 74, .28), rgba(79, 122, 74, .06)); }
.ctx-item mark { background: rgba(143, 214, 200, .45); }
.pai-bubble { background: #fbfaf4; color: #24302a; border: 1px solid var(--h-edge); }
.code-ed { background: #18221d; color: #d3ddd5; }
html[data-theme="dark"] #toc-sidebar { background: linear-gradient(180deg, #17251e, #0f1814); }
html[data-theme="dark"] .toc-current { background: rgba(143, 214, 200, .16) !important; }
html[data-theme="dark"] .gl-pop { background: linear-gradient(180deg, #1c2c24, #121c17); }

/* ---------- узкий экран ---------- */
@media (max-width: 640px) {
    .slide, html[data-theme="dark"] .slide { padding: 24px 18px; border-radius: 12px; }
    .ridge { margin-top: 2px; height: 46px; }
    .ridge svg { width: 250px; height: 46px; margin-left: 10px; }
    h2, html[data-theme="dark"] h2 { font-size: 1.55em; }
    .main-title, html[data-theme="dark"] .main-title { font-size: 2em; text-align: center; }
    .hero { justify-content: center; }
    :is(.theory-block, .task, .hint, .example) { padding: 14px 16px; }
}

/* ---------- код в чате Гоффи и в песочнице: та же палитра и фон, что у блоков кода на страницах ---------- */
html .pai-m.bot .pai-code { background: #18221d; border: 1px solid rgba(143, 214, 200, .12); border-radius: 10px; color: #d3ddd5; tab-size: 4; font: 12.5px/1.5 "JetBrains Mono", "Cascadia Code", Consolas, Monaco, monospace; }
html .pai-m.bot .pai-code code { color: #d3ddd5; }
.pai-code code .token.comment { color: #7d917f; font-style: italic; }
.pai-code code .token.keyword { color: #8fd6c8; }
.pai-code code .token.string, .pai-code code .token.char { color: #b8d68a; }
.pai-code code .token.number, .pai-code code .token.boolean { color: #f0a24a; }
.pai-code code .token.function { color: #e8cf8a; }
.pai-code code :is(.token.operator, .token.punctuation) { color: #a9b8ae; }
html .cm-s-course.CodeMirror { background: #18221d; color: #d3ddd5; }
html .cm-s-course .CodeMirror-gutters { background: #141c18; border-right: 1px solid rgba(143, 214, 200, .12); }
html .cm-s-course .CodeMirror-linenumber { color: #5f7466; }
html .cm-s-course .CodeMirror-activeline-background { background: rgba(143, 214, 200, .06); }
html .cm-s-course .cm-keyword { color: #8fd6c8; }
html .cm-s-course .cm-string, html .cm-s-course .cm-string-2 { color: #b8d68a; }
html .cm-s-course .cm-number, html .cm-s-course .cm-atom { color: #f0a24a; }
html .cm-s-course .cm-comment { color: #7d917f; font-style: italic; }
html .cm-s-course :is(.cm-function, .cm-def) { color: #e8cf8a; }
html .cm-s-course :is(.cm-builtin, .cm-type) { color: #cc99cd; }
html .cm-s-course .cm-variable { color: #c3d9ea; }
html .cm-s-course .cm-property { color: #a8cdbd; }
html .cm-s-course :is(.cm-operator, .cm-punctuation, .cm-bracket) { color: #a9b8ae; }
html .cm-s-course .cm-meta { color: #f8c555; }
