/* ExcelReps — стилове */
:root {
  --bg: #f7f8f6; --surface: #ffffff; --surface-2: #eef2ef; --text: #17201c; --muted: #5d6b64;
  --line: #dde3df; --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #d9f0ec; --accent: #f59e0b;
  --ok: #15803d; --ok-soft: #dcfce7; --err: #b91c1c; --err-soft: #fee2e2; --warn-soft: #fef3c7;
  --grid-head: #f0f3f1; --grid-line: #d9dfdb; --sel: #0f766e; --range: rgba(15,118,110,.10); --ref: rgba(37,99,235,.13);
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 24px rgba(0,0,0,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412; --surface: #161d1a; --surface-2: #1d2622; --text: #e7ece9; --muted: #95a39c;
    --line: #2a3530; --brand: #2dd4bf; --brand-ink: #062a26; --brand-soft: #123a35; --accent: #fbbf24;
    --ok: #4ade80; --ok-soft: #12301f; --err: #f87171; --err-soft: #3a1616; --warn-soft: #3a2f10;
    --grid-head: #1b2420; --grid-line: #2c3833; --sel: #2dd4bf; --range: rgba(45,212,191,.12); --ref: rgba(96,165,250,.18);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; font-size: 16px; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.05rem; }
code, kbd { font-family: var(--mono); font-size: .92em; }
/* Cascadia Code слепва >= в ≥ и <> в ≠ — формулите трябва да се виждат точно както се пишат */
code, kbd, pre, input, .grid { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
kbd { display: inline-block; min-width: 2em; text-align: center; padding: .25em .55em; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 7px; background: var(--surface); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.page { padding-top: 28px; padding-bottom: 56px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; } .tiny { font-size: .8rem; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; background: var(--brand); color: var(--brand-ink);
  border: 1px solid transparent; border-radius: 10px; padding: .6em 1.1em; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .06s, filter .15s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .choice:focus-visible, a:focus-visible, .grid-wrap:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: .35em .8em; font-size: .9rem; }
.btn-lg { padding: .8em 1.4em; font-size: 1.05rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

/* шапка */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .5em; font-weight: 800; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-family: Georgia, serif; font-style: italic; font-size: .95rem; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--brand); }
.nav .btn { color: var(--brand-ink); }
.nav-sep { width: 1px; height: 22px; background: var(--line); }
.lang-switch { font-size: .85rem; border: 1px solid var(--line); border-radius: 6px; padding: .1em .45em; }
.user-chip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.2rem; color: var(--text); padding: .2em .55em; cursor: pointer; }
@media (max-width: 1000px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav > a, .nav > form { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .nav-sep { display: none; }
  .nav .btn { margin-top: 10px; }
}

/* съобщения */
.flashes { padding-top: 14px; }
.flash { padding: .7em 1em; border-radius: 10px; margin-bottom: 8px; background: var(--ok-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.flash-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); word-break: break-all; }

/* начало */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
.hero h1 em { font-style: normal; color: var(--brand); }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--brand); margin: 0 0 .8em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.cta-row.center { justify-content: center; }
.hero-demo { position: relative; padding-bottom: 52px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.demo-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .9rem; }
.demo-name { min-width: 40px; color: var(--muted); }
.demo-fx { color: var(--muted); font-style: italic; }
.demo-formula { color: var(--brand); font-weight: 600; }
.demo-grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
.demo-grid th { background: var(--grid-head); color: var(--muted); font-weight: 500; width: 36px; border: 1px solid var(--grid-line); }
.demo-grid td { border: 1px solid var(--grid-line); padding: 4px 10px; }
.demo-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.demo-result { outline: 2px solid var(--sel); outline-offset: -2px; background: var(--ok-soft); font-weight: 700; }
.demo-toast { position: absolute; right: 14px; bottom: 14px; background: var(--ok); color: #fff; padding: .35em .8em; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.section { padding: 56px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature p { color: var(--muted); margin: 0; }
.how { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.how li { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; }
.how span { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.curriculum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.curr-module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.curr-module ul { margin: 0; padding-left: 1.1em; }
.curr-module a { color: var(--text); text-decoration: none; }
.curr-module a:hover { color: var(--brand); }
.mod-icon { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .85rem; margin-right: 4px; }
.cta-band { background: var(--brand-soft); }
@media (max-width: 900px) {
  .hero-grid, .features, .how, .curriculum { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
}

/* каталог */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; min-width: 96px; }
.stat b { font-size: 1.35rem; }
.stat span { display: block; font-size: .8rem; color: var(--muted); }
.stats-big .stat { min-width: 150px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.progressbar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 28px; }
.progressbar > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.module { margin-bottom: 30px; }
.lesson-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.lesson-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .1s; }
.lesson-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.lesson-card.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.lesson-card h3 { margin: .5em 0 .3em; }
.lesson-card p { color: var(--muted); font-size: .92rem; margin: 0 0 .8em; flex: 1; }
.lc-top { display: flex; justify-content: space-between; align-items: center; }
.lc-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); font-weight: 700; font-size: .85rem; }
.lesson-card.done .lc-num { background: var(--ok); color: #fff; }
.lc-stars i, .big-stars span { font-style: normal; color: var(--line); }
.lc-stars i.on, .big-stars span.on { color: var(--accent); }
.lc-meta { font-size: .8rem; color: var(--muted); }

/* плейър */
.player { padding-top: 16px; padding-bottom: 40px; }
.player-head { display: flex; justify-content: space-between; gap: 12px; }
.player-head a { text-decoration: none; }
.player-title { font-size: 1.5rem; margin: 8px 0 10px; }
.step-progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.step-progress > div { height: 100%; width: 0; background: var(--brand); transition: width .35s; }
.player-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; }
.task-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 76px; }
.task-text { font-size: 1.04rem; }
.task-text p:first-child { margin-top: 0; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.feedback { margin-top: 12px; padding: .65em .9em; border-radius: 10px; font-weight: 600; }
.fb-ok { background: var(--ok-soft); color: var(--ok); }
.fb-err { background: var(--err-soft); color: var(--err); font-weight: 500; }
.fb-info { background: var(--warn-soft); color: var(--text); font-weight: 500; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 12px;
  max-width: min(560px, calc(100vw - 32px)); padding: .75em 1em; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600;
  border: 1px solid var(--line); }
.toast.fb-ok { background: var(--ok-soft); } .toast.fb-err { background: var(--err-soft); } .toast.fb-info { background: var(--warn-soft); }
.explain { margin-top: 10px; padding: .7em .9em; border-radius: 10px; background: var(--surface-2); font-size: .95rem; }
.explain p { margin: .3em 0 0; }
.choices { display: grid; gap: 8px; margin-top: 8px; }
.choice { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: .7em .9em; font: inherit; cursor: pointer; }
.choice:hover { border-color: var(--brand); }
.choice.correct { background: var(--ok-soft); border-color: var(--ok); }
.choice.wrong { background: var(--err-soft); border-color: var(--err); opacity: .8; }
.keys-hint { margin-top: 8px; }
.kbd-row { margin-top: 6px; font-size: 1.05rem; }
.sheet-panel { min-width: 0; }
.complete { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.45); padding: 16px; }
.complete[hidden] { display: none; }
.complete-card { background: var(--surface); border-radius: 16px; padding: 32px 28px; max-width: 460px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.big-stars { font-size: 2.8rem; letter-spacing: .1em; margin-bottom: 6px; }
@media (max-width: 900px) {
  .player-grid { grid-template-columns: 1fr; }
  .task-panel { position: static; }
}

/* изскачащ прозорец за грешка + талисман */
.err-pop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 20, 16, 0); transition: background .2s; }
.err-pop.open { background: rgba(10, 20, 16, .42); }
.err-card { position: relative; display: grid; grid-template-columns: 132px 1fr; gap: 6px 18px; align-items: start;
  width: min(600px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px 24px 20px 14px; box-shadow: 0 24px 60px rgba(0,0,0,.25); transform: translateY(14px) scale(.94); opacity: 0;
  transition: transform .28s cubic-bezier(.2,1.4,.4,1), opacity .18s; }
.err-pop.open .err-card { transform: none; opacity: 1; }
.err-close { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.err-close:hover { background: var(--surface-2); color: var(--text); }
.err-mascot { padding-top: 6px; }
.err-body h3 { font-size: 1.25rem; margin: .35em 0 .6em; padding-right: 26px; }
.err-code { display: inline-block; font-family: var(--mono); font-weight: 700; font-size: .85rem; padding: .2em .6em; border-radius: 999px;
  background: var(--err-soft); color: var(--err); }
.err-code.code-thinking, .err-code.code-confused { background: var(--warn-soft); color: #92400e; }
@media (prefers-color-scheme: dark) { .err-code.code-thinking, .err-code.code-confused { color: var(--accent); } }
.err-row { margin-bottom: 10px; }
.err-row p { margin: .15em 0 0; }
.err-label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--err); }
.err-label-fix { color: var(--ok); }
.err-note { background: var(--warn-soft); border-radius: 10px; padding: .55em .8em; margin-bottom: 10px; font-size: .92rem; }
.err-hint { background: var(--surface-2); border-radius: 10px; padding: .6em .8em; margin-bottom: 10px; font-size: .95rem; }
.err-hint p { display: inline; margin: 0; }
.err-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.mascot { width: 100%; height: auto; overflow: visible; }
.mascot .m-body { fill: #34d399; stroke: #059669; stroke-width: 3; }
.mascot.mood-shocked .m-body { fill: #fb923c; stroke: #ea580c; }
.mascot.mood-sad .m-body { fill: #7dd3fc; stroke: #0284c7; }
.mascot.mood-confused .m-body { fill: #c4b5fd; stroke: #7c3aed; }
.mascot .m-grid { stroke: rgba(0,0,0,.18); stroke-width: 2; fill: none; }
.mascot .m-fx { font: italic 700 15px Georgia, serif; fill: rgba(0,0,0,.35); }
.mascot .m-eye { fill: #fff; stroke: rgba(0,0,0,.15); stroke-width: 1.5; }
.mascot .m-pupil, .mascot .m-fill-dark { fill: #1f2937; }
.mascot .m-stroke { stroke: #1f2937; stroke-width: 3.2; stroke-linecap: round; fill: none; }
.mascot .m-cheek { fill: #f472b6; opacity: .45; }
.mascot .m-shadow { fill: rgba(0,0,0,.12); }
.mascot .m-drop { fill: #38bdf8; animation: drip 1.8s ease-in infinite; }
.mascot .m-mark { fill: #ea580c; } .mascot.mood-confused .m-mark { fill: #7c3aed; }
.mascot .m-dots { fill: var(--muted); }
.mascot .m-bob { transform-origin: 60px 108px; animation: bob 2.4s ease-in-out infinite; }
.mascot.mood-shocked .m-bob { animation: shake .5s ease-in-out 2, bob 2.4s ease-in-out 1s infinite; }
.mascot.mood-confused .m-bob { animation: tilt 2.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px) rotate(-3deg); } 40%, 80% { transform: translateX(4px) rotate(3deg); } }
@keyframes tilt { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes drip { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mascot *, .err-card { animation: none !important; transition: none !important; } }
@media (max-width: 560px) {
  .err-pop { place-items: end center; padding: 0; }
  .err-card { grid-template-columns: 84px 1fr; border-radius: 20px 20px 0 0; padding: 18px 16px 22px 10px; }
  .err-pop.open .err-card { transform: none; }
  .err-body h3 { font-size: 1.1rem; }
}

/* таблица */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.fbar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.namebox { min-width: 64px; padding: .3em .5em; border: 1px solid var(--line); border-radius: 6px; font-family: var(--mono); font-size: .9rem; text-align: center; color: var(--muted); }
.fx { font-family: Georgia, serif; font-style: italic; color: var(--muted); }
.fbar-input { flex: 1; min-width: 0; font-family: var(--mono); font-size: .95rem; padding: .35em .5em; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
.fbar-input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.fbar-ok { border: 1px solid var(--line); background: var(--surface-2); color: var(--ok); border-radius: 6px; padding: .3em .6em; cursor: pointer; font-weight: 700; }
.grid-wrap { overflow: auto; max-height: 70vh; outline: none; }
.grid { width: max-content; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .93rem; user-select: none; -webkit-user-select: none; }
.grid th { position: sticky; background: var(--grid-head); color: var(--muted); font-weight: 500; font-size: .8rem; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); height: 26px; z-index: 2; }
.grid thead th { top: 0; }
.grid tbody th { left: 0; text-align: center; }
.grid thead th:first-child { left: 0; z-index: 3; }
.grid th.hl { background: color-mix(in srgb, var(--brand) 18%, var(--grid-head)); color: var(--text); }
.grid td { height: 30px; padding: 0 7px; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: cell; position: relative; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.bool { text-align: center; }
.grid td.err { color: var(--err); text-align: center; font-weight: 600; }
.grid td.b { font-weight: 700; } .grid td.i { font-style: italic; } .grid td.u { text-decoration: underline; }
.grid td.given { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.grid td.in-range { background: var(--range); }
.grid td.ref-hl { background: var(--ref); }
.grid td.sel { outline: 2px solid var(--sel); outline-offset: -2px; z-index: 1; }
.grid td.target:not(.sel) { box-shadow: inset 0 0 0 2px var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.grid td.editing { padding: 0; overflow: visible; }
.cell-editor { width: 100%; min-width: 160px; height: 30px; border: 2px solid var(--sel); padding: 0 6px; font: inherit; font-family: var(--mono); background: var(--surface); color: var(--text); outline: none; position: relative; z-index: 4; box-shadow: var(--shadow); }
.grid td.flash-ok { animation: okflash 1.1s ease-out; }
.grid td.flash-err { animation: errflash 1.1s ease-out; }
.grid td.copied { outline: 2px dashed var(--brand); outline-offset: -3px; }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 2px transparent; } }
@keyframes errflash { 0% { background: var(--err); color: #fff; } 100% { background: transparent; } }
@keyframes okflash { 0% { background: var(--ok); color: #fff; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .grid td.target, .grid td.flash-ok { animation: none; } }

/* форми */
.auth { padding: 40px 16px 64px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card h2 { font-size: 1.15rem; }
.card-danger { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.auth-card { max-width: 420px; margin: 0 auto; box-shadow: var(--shadow); }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], select {
  display: block; width: 100%; margin-top: 5px; padding: .65em .8em; font: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.big-icon { font-size: 2.6rem; color: var(--brand); font-family: var(--mono); margin-bottom: 8px; }

/* справочник, текст */
.ref-table { width: 100%; border-collapse: collapse; margin: 18px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ref-table td, .ref-table th { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ref-table td:first-child { white-space: nowrap; }
@media (max-width: 600px) { .ref-table td:first-child { white-space: normal; } }
.prose h2 { margin-top: 1.4em; }

/* footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0 24px; margin-top: 40px; background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--brand); }
.player-page .footer { margin-top: 0; }

/* ── каталог с функции, лимит, PRO ── */
.pro-badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .06em; padding: .2em .55em; border-radius: 6px;
  color: #fff; background: linear-gradient(135deg, #f59e0b, #ea580c); vertical-align: middle; }
.pro-badge-sm { font-size: .62rem; padding: .1em .4em; }
.btn-pro { background: linear-gradient(135deg, #f59e0b, #ea580c); color: #fff; }
.plan-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.plan-bar.plan-out { border-color: color-mix(in srgb, #ea580c 45%, var(--line)); background: color-mix(in srgb, #f59e0b 9%, var(--surface)); }
.plan-bar.plan-pro { font-weight: 600; }
.plan-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.plan-meter { display: flex; gap: 5px; }
.plan-meter span { width: 26px; height: 10px; border-radius: 99px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.plan-meter span.used { background: var(--brand); }
.catalog-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; position: sticky; top: 60px; z-index: 5;
  background: var(--bg); padding: 10px 0; }
.search { width: 100%; padding: .75em 1em; font: inherit; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.search:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: .35em .9em;
  font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.fn-group { margin-bottom: 28px; }
.fn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fn-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .1s; }
.fn-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.fn-card.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.fn-card.locked { opacity: .62; }
.fn-card.locked:hover { opacity: 1; border-color: #ea580c; }
.fn-card p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.fn-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fn-name { font-family: var(--mono); font-weight: 800; font-size: 1.05rem; background: none; padding: 0; color: var(--brand); }
.fn-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fn-syntax { font-family: var(--mono); font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: .72rem; font-weight: 700; padding: .15em .55em; border-radius: 999px; white-space: nowrap; }
.tag-level { background: var(--surface-2); color: var(--muted); }
.tag-trial { background: var(--ok-soft); color: var(--ok); }
.tag-lock { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #c2410c; }
.player-title .fn-name { font-size: 1.5rem; }
.player-title .muted { font-size: 1rem; font-weight: 400; }
.fn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.fn-chips a { text-decoration: none; }
.paywall { display: grid; grid-template-columns: 170px 1fr; gap: 24px; align-items: center; padding: 28px; }
.paywall h1 { margin: .4em 0 .3em; font-size: 1.7rem; }
.checks { list-style: none; padding: 0; margin: 14px 0; }
.checks li { padding-left: 1.6em; position: relative; margin: 6px 0; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.small-h { font-size: 1.05rem; margin-top: 28px; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 20px; justify-content: center; margin-top: 24px; }
.plan { position: relative; display: flex; flex-direction: column; }
.plan .checks { flex: 1; }
.plan-featured { border: 2px solid #f59e0b; box-shadow: var(--shadow); }
.plan-featured .pro-badge { position: absolute; top: -11px; right: 18px; }
.price { font-size: 2rem; font-weight: 800; margin: 4px 0 6px; }
.center-block { margin-left: auto; margin-right: auto; }
.mascot.mood-happy .m-body { fill: #34d399; stroke: #059669; }
.mascot .m-spark { fill: #f59e0b; animation: twinkle 1.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes twinkle { 50% { transform: scale(.5); opacity: .4; } }
@media (max-width: 640px) {
  .paywall { grid-template-columns: 1fr; text-align: center; padding: 20px; }
  .paywall-mascot { max-width: 130px; margin: 0 auto; }
  .paywall .checks { text-align: left; display: inline-block; }
  .paywall .cta-row { justify-content: center; }
  .plans { grid-template-columns: 1fr; }
}

/* ── варианти на плащане ── */
.pay-options { display: grid; gap: 10px; margin: 6px 0 14px; }
.pay-option { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; background: var(--surface); }
.pay-option:hover { border-color: #f59e0b; }
.pay-option.on { border-color: #ea580c; background: color-mix(in srgb, #f59e0b 8%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, #f59e0b 20%, transparent); }
.pay-option input { accent-color: #ea580c; width: 18px; height: 18px; margin: 0; flex: none; }
.po-main { flex: 1; display: flex; flex-direction: column; }
.po-name { font-weight: 700; }
.po-billed { font-size: .82rem; color: var(--muted); }
.po-price { text-align: right; white-space: nowrap; }
.po-price b { font-size: 1.25rem; }
.po-price small { color: var(--muted); }
.po-badge { position: absolute; top: -10px; left: 12px; font-size: .7rem; font-weight: 800; color: #fff; padding: .15em .6em;
  border-radius: 999px; background: linear-gradient(135deg, #f59e0b, #ea580c); }
.pay-option.featured { margin-top: 6px; }
.btn.disabled { opacity: .55; cursor: not-allowed; }
.plans { grid-template-columns: minmax(0, 320px) minmax(0, 420px); }

/* ── лента за форматиране ── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--grid-head); }
.tb-btn { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text);
  font: inherit; font-size: .95rem; cursor: pointer; }
.tb-btn:hover { background: var(--surface); border-color: var(--line); }
.tb-btn.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: var(--brand); }
.tb-btn.hint-pulse { animation: pulse-btn 1.4s ease-in-out infinite; }
@keyframes pulse-btn { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); } }
.tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.grid td.al-left { text-align: left; } .grid td.al-center { text-align: center; } .grid td.al-right { text-align: right; }
.grid td.filled { color: #1f2937; }

/* ── справочници ── */
h2.mt { margin-top: 36px; }
.table-scroll { overflow-x: auto; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cheat-card h3 { margin-bottom: .6em; }
table.cheat { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.cheat th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 6px; }
table.cheat td { padding: 6px; border-top: 1px solid var(--line); vertical-align: middle; }
table.cheat kbd { font-size: .8rem; white-space: nowrap; }
.nav { gap: 14px; }

/* ── поддръжка ── */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
textarea { display: block; width: 100%; margin-top: 5px; padding: .65em .8em; font: inherit; font-weight: 400; resize: vertical;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); }
textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: .6em 0 0; color: var(--muted); }
.support-done .paywall-mascot { width: 140px; }
.support-item { padding: 12px 16px; margin-bottom: 8px; }
.support-item summary { cursor: pointer; }
.support-text { white-space: pre-wrap; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }

/* ── повтори паролата ── */
.field-err { color: var(--err); margin: -6px 0 10px; }
input.invalid { border-color: var(--err); outline-color: var(--err); }

/* ── fill handle и влачене ── */
.grid td.fh::after { content: ""; position: absolute; right: 0; bottom: 0; width: 7px; height: 7px; background: var(--sel);
  border: 1px solid var(--surface); cursor: crosshair; z-index: 3; }
.grid td.fill-preview { outline: 1.5px dashed var(--sel); outline-offset: -2px; background: var(--range); }

/* ── наръчник под упражнението ── */
.guide { max-width: 860px; margin: 48px auto 0; padding: 28px 28px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.guide h2 { font-size: 1.5rem; }
.guide h3 { font-size: 1.1rem; margin: 1.6em 0 .6em; }
.guide-intro { font-size: 1.05rem; }
.guide-syntax { font-size: 1rem; padding: .35em .6em; }
.guide-args { width: 100%; border-collapse: collapse; }
.guide-args td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.guide-args td:first-child { white-space: nowrap; width: 1%; }
.guide-examples { display: grid; gap: 8px; }
.guide-ex { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 12px;
  background: var(--surface-2); border-radius: 10px; }
.guide-ex code { background: none; padding: 0; word-break: break-word; color: var(--brand); font-weight: 600; }
.guide-mistakes dt { font-weight: 700; margin-top: 12px; }
.guide-mistakes dt::before { content: "⚠ "; color: var(--accent); }
.guide-mistakes dd { margin: 4px 0 0 1.4em; color: var(--muted); }
.guide-tips { padding-left: 1.2em; }
@media (max-width: 640px) {
  .guide { padding: 20px 16px; }
  .guide-ex { grid-template-columns: 1fr; gap: 4px; }
  .guide-args td:first-child { white-space: normal; }
}

/* ── покажи паролата ── */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: 2.5px; border: 0; background: transparent;
  color: var(--brand); font: inherit; font-size: .82rem; font-weight: 700; padding: .3em .5em; border-radius: 6px; cursor: pointer; }
.pw-toggle:hover { background: var(--surface-2); }
.pw-warn { display: block; color: #b45309; font-weight: 500; margin-top: 4px; }

/* ── покупка ── */
.buy-card { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: center; padding: 28px; }
.buy-card h1 { margin: .4em 0 .3em; font-size: 1.6rem; }
.buy-steps { padding-left: 1.2em; } .buy-steps li { margin: 6px 0; }
.btn-pro:disabled { opacity: .55; cursor: not-allowed; }
.purchases .st-pending { background: color-mix(in srgb, #f59e0b 8%, transparent); }
.purchases .st-cancelled { opacity: .55; }
@media (max-width: 640px) { .buy-card { grid-template-columns: 1fr; text-align: center; } .buy-card .paywall-mascot { max-width: 120px; margin: 0 auto; } }

/* ── блог ── */
.post-list { display: grid; gap: 14px; margin-top: 18px; }
.post-card { display: block; color: var(--text); text-decoration: none; transition: border-color .15s, transform .1s; margin: 0; }
.post-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.post-card h2, .post-card h3 { margin: .3em 0; }
.read-more { color: var(--brand); font-weight: 700; }
.post { max-width: 820px; }
.post h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.post-meta { margin-bottom: 18px; }
.post-toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; }
.post-toc ol { margin: .4em 0 0; padding-left: 1.2em; }
.post-toc ol.plain { list-style: none; padding-left: 0; }
.post-body { font-size: 1.06rem; line-height: 1.7; }
.post-body h2 { margin-top: 1.8em; scroll-margin-top: 80px; }
.post-body pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.post-body pre code { background: none; padding: 0; font-size: .95rem; color: var(--brand); font-weight: 600; white-space: pre; }
.post-body blockquote { margin: 1em 0; padding: .6em 1em; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 10px 10px 0; }
.post-body blockquote p { margin: .2em 0; }
.post-body table { width: 100%; border-collapse: collapse; font-size: .92rem; display: block; overflow-x: auto; }
.post-body th, .post-body td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.post-body td code { white-space: nowrap; }
.live-sheet { margin: 1.2em 0 1.6em; }
.live-sheet .grid-wrap { max-height: 360px; }
.live-sheet figcaption { font-size: .9rem; margin-top: 8px; }
.post-cta { margin-top: 36px; text-align: center; background: var(--brand-soft); }

/* ── редактор на статии ── */
.nowrap { white-space: nowrap; }
.editor h1 .tag { font-size: .8rem; vertical-align: middle; }
.editor-meta { margin-bottom: 12px; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; position: sticky; top: 60px; z-index: 6; background: var(--bg); padding: 6px 0; }
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.editor-text textarea { min-height: 70vh; font-family: var(--mono); font-size: .92rem; line-height: 1.55; tab-size: 2; }
.editor-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; max-height: 78vh; overflow: auto; position: sticky; top: 112px; }
.editor-preview h1 { font-size: 1.6rem; }
.editor-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--line); z-index: 6; }
.editor-delete { margin: 8px 0 24px; }
.editor-help { margin-top: 18px; }
.editor-help summary { cursor: pointer; }
.post-body img { max-width: 100%; height: auto; border-radius: 10px; }
@media (max-width: 900px) { .editor-split { grid-template-columns: 1fr; } .editor-preview { position: static; max-height: none; } }

/* ── Excel тест за интервю (/excel-test) ── */
.exam-start { padding: 32px 28px; }
.exam-start h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .2em 0 .3em; }
.exam-meta { list-style: none; padding: 0; margin: 18px 0 8px; display: flex; flex-wrap: wrap; gap: 10px; }
.exam-meta li { background: var(--surface-2); border-radius: 999px; padding: .35em .9em; font-size: .92rem; color: var(--muted); }
.exam-meta b { color: var(--text); }
.exam-run { padding-top: 8px; }
.exam-timer { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); padding: .2em .7em; border-radius: 999px; }
.exam-timer.urgent { background: var(--err-soft); color: var(--err); }
.exam-score { font-size: 4rem; font-weight: 800; line-height: 1; color: var(--brand); margin: 6px 0; }
.exam-score span { font-size: 1.6rem; color: var(--muted); font-weight: 600; }
.exam-level { margin: .2em 0 .3em; }
.exam-result .lead { margin-left: auto; margin-right: auto; }
.exam-review { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.exam-review li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.exam-review li.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.exam-review li.miss { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.rv-head { display: flex; align-items: center; gap: 10px; }
.rv-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; flex: none; background: var(--ok-soft); color: var(--ok); }
.miss .rv-mark { background: var(--err-soft); color: var(--err); }
.rv-link { margin-left: auto; white-space: nowrap; text-decoration: none; font-weight: 600; }
.rv-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; margin-top: 8px; font-size: .95rem; align-items: baseline; }
.rv-row span { color: var(--muted); font-size: .85rem; }
.rv-row code { overflow-wrap: anywhere; }
.rv-why { margin-top: 8px; padding: .6em .8em; border-radius: 10px; background: var(--surface-2); font-size: .92rem; }
.exam-about { margin-top: 48px; }
.exam-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.exam-skill { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.exam-skill a { text-decoration: none; font-weight: 600; }
.exam-band { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.exam-band p { margin: .2em 0 0; color: var(--muted); }
@media (max-width: 560px) { .rv-row { grid-template-columns: 1fr; gap: 2px; } .exam-start { padding: 22px 18px; } }
.player-grid.quiz { grid-template-columns: minmax(280px, 640px); }
.player-grid.quiz .task-panel { position: static; }

/* ── Admin: посещения ── */
.visit-chart { margin: 14px 0; }
.visit-bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-bottom: 20px; }
.visit-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 0; }
.visit-bar { background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.visit-col:hover .visit-bar { opacity: .7; }
.visit-col span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--muted); white-space: nowrap; }
.visit-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 24px; margin-bottom: 28px; }
.visit-tables td:first-child { word-break: break-all; }

/* ── Начална страница: живо предизвикателство ── */
.try-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.try-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.try-dots { display: inline-flex; gap: 6px; }
.try-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.try-dots span.now { background: var(--accent); }
.try-dots span.ok { background: var(--ok); }
.try-text { font-size: 1.05rem; margin: 0 0 4px; }
.try-help { color: var(--muted); margin: 0 0 8px; }
.try-hint { background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; margin: 0 0 8px; }
.try-toast { border-radius: 8px; padding: 6px 10px; margin: 0 0 8px; font-size: .92rem; }
.try-toast.ok { background: var(--ok-soft); color: var(--ok); }
.try-toast.info { background: var(--surface-2); color: var(--text); }
.try-toast.err { background: var(--err-soft); color: var(--err); }
.try-card .grid-wrap { max-height: none; }
.try-done { margin-top: 12px; padding: 14px; border-radius: 10px; background: var(--brand-soft); }
.try-done-title { font-weight: 700; font-size: 1.08rem; margin: 0 0 6px; }
.try-done p { margin: 0 0 10px; }
.funnel { max-width: 560px; margin-bottom: 6px; }
@media (max-width: 700px) {
  /* на телефон живата задача да се вижда още на първия екран */
  .hero { padding: 20px 0 24px; }
  .hero-grid { gap: 20px; }
  .hero .kicker { display: none; }
  .hero .lead { font-size: 1rem; margin-bottom: 14px; }
  .hero .cta-row .btn-ghost { display: none; }
  .hero .cta-row { margin-bottom: 6px; }
}

/* ── Начална задача: бутони за телефон ── */
.try-build { margin: 0 0 10px; }
.try-formula { min-height: 2.6em; display: flex; align-items: center; padding: 6px 10px; border: 1px dashed var(--line);
  border-radius: 8px; background: var(--surface-2); margin-bottom: 8px; font-size: .95rem; overflow-x: auto; }
.try-formula code { font-size: 1.05rem; color: var(--brand); white-space: nowrap; }
.try-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.try-chip { font-family: var(--mono); font-size: 1rem; min-height: 44px; min-width: 44px; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--line); border-bottom-width: 3px; background: var(--surface); color: var(--text); cursor: pointer; }
.try-chip:active { transform: translateY(1px); border-bottom-width: 2px; }
.try-build-actions { display: flex; gap: 8px; justify-content: flex-end; }
.try-build-actions .btn { min-height: 44px; }

/* ── Блог: кутия / бутон за сваляне ── */
.download-box { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 24px; background: var(--brand-soft); border-color: transparent; }
.download-box > div { flex: 1 1 260px; }
.post-body .download-cta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px; border-radius: var(--radius); background: var(--brand-soft); margin: 18px 0; }
.post-body .download-cta .btn { text-decoration: none; color: var(--brand-ink); }
.post-body .download-cta p { margin: 0; flex: 1 1 240px; }

/* ── Вградено YouTube видео (зарежда се при натискане) ── */
.yt-lite { margin: 0 0 24px; }
.yt-lite .yt-play, .yt-lite iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: #000; }
.yt-lite .yt-play { position: relative; padding: 0; cursor: pointer; overflow: hidden; }
.yt-lite .yt-play img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.yt-lite .yt-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 50px; border-radius: 14px;
  background: #e00; color: #fff; font-size: 1.5rem; display: grid; place-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.yt-lite .yt-play:hover .yt-btn, .yt-lite .yt-play:focus-visible .yt-btn { background: #c00; }
.yt-lite figcaption { margin-top: 6px; }
.footer-yt { color: #c00 !important; }

/* ── Начална страница: нови раздели ── */
.section-lead { max-width: 760px; margin: 6px 0 0; }
.who-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 18px; }
.who-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; }
.who-card h3 { margin: 6px 0 6px; font-size: 1.05rem; }
.who-card p { color: var(--muted); margin: 0 0 10px; flex: 1; font-size: .95rem; }
.who-card a { font-weight: 600; text-decoration: none; }
.who-icon { font-size: 1.8rem; }
.curr-desc { color: var(--muted); font-size: .92rem; margin: 0 0 8px; }
.why-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: center; }
.why-grid .prose p { color: var(--text); }
.how-vertical { grid-template-columns: 1fr; gap: 14px; margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.disaster-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.disaster { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; }
.disaster h3 { margin: 6px 0; }
.disaster p { margin: 0 0 8px; color: var(--muted); }
.disaster .disaster-lesson { color: var(--text); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 0; font-size: .93rem; }
.disaster-icon { font-size: 1.8rem; }
.quiz-wrap { display: grid; grid-template-columns: 1fr 1.3fr; gap: 32px; align-items: center; }
.quiz-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-height: 210px; }
.quiz-q { font-size: 1.12rem; font-weight: 600; margin: 4px 0 14px; }
.quiz-actions { display: flex; gap: 10px; margin-bottom: 10px; }
.quiz-actions .btn { min-width: 110px; min-height: 44px; }
.quiz-why { border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.quiz-why.ok { background: var(--ok-soft); color: var(--ok); }
.quiz-why.err { background: var(--err-soft); color: var(--err); }
.faq-list { margin-top: 14px; }
.faq-item { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 10px; padding: 0 16px; }
.faq-item summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style-position: inside; }
.faq-item p { margin: 0 0 14px; color: var(--muted); }
.try-head-right { display: inline-flex; align-items: center; gap: 10px; }
.try-timer { font-family: var(--mono); font-weight: 700; color: var(--brand); }
.try-score { font-size: 1.05rem; margin: 0 0 8px; }
@media (max-width: 1000px) { .who-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .who-grid, .disaster-grid, .why-grid, .quiz-wrap { grid-template-columns: 1fr; }
  .why-grid, .quiz-wrap { gap: 18px; }
}
.home-posts { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .home-posts { grid-template-columns: 1fr; } }
p.mt { margin-top: 18px; }

/* ── игри в блога: "Friday, 4:52 PM" (game.js) ── */
.post-toc details summary { cursor: pointer; }
.bg-game { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 1.4em 0 2.2em; scroll-margin-top: 72px; font-size: 1rem; line-height: 1.5; }
.bg-loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.bg-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #17201c; color: #f4f7f5; }
.bg-clockbox { position: relative; }
.bg-clock { display: inline-block; font-family: var(--mono); font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.bg-clock::before { content: "🕓 "; font-family: var(--font); }
.bg-clock.warn { color: #fbbf24; } .bg-clock.late { color: #f87171; }
.bg-clock.hit { animation: bgHit .45s; }
.bg-pen { position: absolute; left: 100%; top: 0; margin-left: 8px; font-weight: 800; color: #f87171; font-size: .9rem; white-space: nowrap; pointer-events: none; animation: bgPen 1.25s ease-out forwards; }
.bg-count { font-size: .9rem; opacity: .85; margin-left: auto; }
.bg-streak { font-weight: 800; min-width: 2.6em; text-align: right; }
.bg-pips { display: flex; gap: 4px; padding: 10px 14px 0; }
.bg-pips span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); transition: background .3s; }
.bg-pips span.now { background: var(--accent); } .bg-pips span.g { background: var(--ok); }
.bg-pips span.y { background: #eab308; } .bg-pips span.r { background: var(--err); }
.bg-body { padding: 14px; }
.bg-body h3 { margin: 0 0 6px; }
.bg-body p { margin: 0 0 10px; }
.bg-intro { text-align: center; padding: 8px 2px 2px; }
.bg-art { font-size: 2.1rem; letter-spacing: .2em; margin-bottom: 4px; }
.bg-body .bg-kicker { text-transform: uppercase; letter-spacing: .09em; font-size: .78rem; font-weight: 800; color: var(--brand); margin-bottom: 2px; }
.bg-intro h3 { font-size: 1.6rem; margin-bottom: 10px; }
.bg-intro p { max-width: 34em; margin-left: auto; margin-right: auto; }
.bg-start { min-width: 230px; margin: 6px 0 12px; animation: pulse-btn 1.8s ease-in-out infinite; }
.bg-best-line { font-weight: 600; }
.bg-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.bg-tag, .bg-lvl { font-size: .78rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.bg-tag.err { background: var(--err-soft); color: var(--err); font-family: var(--mono); }
.bg-tag.silent { background: #ede9fe; color: #6d28d9; }
.bg-lvl { background: var(--surface-2); color: var(--muted); }
.bg-lvl.lvl-easy { color: var(--ok); } .bg-lvl.lvl-medium { color: #b45309; } .bg-lvl.lvl-hard { color: var(--err); }
.bg-lvl.lvl-boss { background: #17201c; color: #fbbf24; }
.bg-ltitle { font-size: 1.2rem; }
.bg-sheet .sheet { box-shadow: none; }
.bg-sheet .grid-wrap { max-height: none; }
.bg-sheet .grid td, .bg-sheet .grid th { padding: 0 7px; line-height: 30px; }
.bg-sheet .grid { display: table; width: max-content; font-size: .9rem; }   /* не като таблиците в текста на статията */
.bg-body .bg-ask { margin: 12px 0 8px; font-weight: 700; }
.bg-ask .muted { font-weight: 400; }
.bg-opts { display: grid; gap: 8px; }
.bg-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 9px 12px; text-align: left; cursor: pointer;
  border: 2px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .15s, background .15s, transform .06s; }
.bg-opt:hover:not(:disabled) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.bg-opt:active:not(:disabled) { transform: translateY(1px); }
.bg-opt:disabled { cursor: default; }
.bg-opt code { background: none; padding: 0; font-size: .93rem; color: var(--text); overflow-wrap: anywhere; }
.bg-key { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); font-weight: 800; font-size: .82rem; }
.bg-opt.wrong { border-color: color-mix(in srgb, var(--err) 55%, transparent); background: var(--err-soft); }
.bg-opt.wrong code { text-decoration: line-through; opacity: .75; }
.bg-opt.wrong .bg-key { background: var(--err); color: #fff; }
.bg-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.bg-opt.right .bg-key { background: var(--ok); color: #fff; }
.bg-msg { margin-top: 10px; padding: 9px 12px; border-radius: 9px; font-size: .95rem; }
.bg-msg.err { background: var(--err-soft); border-left: 4px solid var(--err); }
.bg-msg.info { background: var(--surface-2); }
.bg-msg.win { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); padding: 12px 14px; }
.bg-body .bg-win-title { font-weight: 800; color: var(--ok); font-size: 1.08rem; margin-bottom: 4px; }
.bg-win-mark { color: var(--text); font-weight: 600; font-size: .95rem; margin-left: 4px; }
.bg-body .bg-foot { margin: 10px 0 0; color: var(--muted); }
.bg-foot .linklike:disabled { opacity: .5; cursor: default; }
.bg-body .bg-hint { background: var(--warn-soft); border-radius: 8px; padding: 7px 11px; margin: 8px 0 0; }
.bg-done { text-align: center; padding-top: 4px; }
.bg-body .bg-sent { color: var(--muted); margin: 0; }
.bg-body .bg-time { font-family: var(--mono); font-size: clamp(2.1rem, 8vw, 3rem); font-weight: 800; line-height: 1.15; color: var(--brand); font-variant-numeric: tabular-nums; margin: 0 0 4px; }
.bg-body .bg-time.late { color: var(--err); }
.bg-body .bg-rank { font-size: 1.3rem; font-weight: 800; margin-bottom: 2px; }
.bg-body .bg-grid { font-size: clamp(1.05rem, 5.4vw, 1.5rem); letter-spacing: .04em; white-space: nowrap; margin: 12px 0 2px; }
.bg-badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0; }
.bg-badge { position: relative; padding: 9px 6px 8px; border: 1px dashed var(--line); border-radius: 11px; opacity: .55; }
.bg-badge .i { display: block; font-size: 1.55rem; line-height: 1.2; filter: grayscale(1); }
.bg-badge b { display: block; font-size: .86rem; }
.bg-badge small { display: block; font-size: .74rem; color: var(--muted); line-height: 1.3; }
.bg-badge.got { opacity: 1; border-style: solid; border-color: transparent; background: var(--brand-soft); }
.bg-badge.got .i { filter: none; }
.bg-badge.new::after { content: "NEW"; position: absolute; top: -8px; right: -4px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #1f2937; font-size: .62rem; font-weight: 800; }
.bg-done .cta-row { margin: 14px 0 8px; }
.bg-next { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); text-align: left; }
.bg-body .bg-next p { margin-bottom: 6px; }
.bg-toast { position: fixed; left: 50%; bottom: 18px; z-index: 60; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px);
  padding: 10px 18px; border-radius: 999px; background: #17201c; color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: .95rem; text-align: center;
  animation: bgToast 2.9s ease forwards; }
.bg-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.bg-confetti i { position: absolute; top: -14px; width: 8px; height: 13px; border-radius: 2px; animation: bgFall 2s ease-in forwards; }
@keyframes bgFall { to { top: 105%; transform: rotate(620deg); opacity: .2; } }
@keyframes bgPen { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
@keyframes bgToast { 0% { opacity: 0; transform: translate(-50%, 14px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 6px); } }
@keyframes bgToastFade { 0%, 100% { opacity: 0; } 10%, 85% { opacity: 1; } }
@keyframes bgHit { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@media (prefers-color-scheme: dark) {
  .bg-bar { background: #0b100e; }
  .bg-tag.silent { background: #2e1f4d; color: #c4b5fd; }
  .bg-lvl.lvl-medium { color: #fbbf24; }
  .bg-lvl.lvl-boss { background: #0b100e; }
  .bg-toast { background: #e7ece9; color: #0f1412; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-start, .bg-clock.hit { animation: none; }
  .bg-toast { animation-name: bgToastFade; }
}
@media (max-width: 560px) {
  .bg-body { padding: 12px; }
  .bg-bar { padding: 9px 12px; }
  .bg-clock { font-size: 1.08rem; }
  .bg-badges { grid-template-columns: repeat(2, 1fr); }
  .bg-opt code { font-size: .86rem; }
  .bg-intro h3 { font-size: 1.35rem; }
  .bg-art { display: none; }   /* на телефон бутонът Start да е в първия екран */
}
.bg-rules { color: var(--muted); }
.home-game { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: var(--brand-soft); font-size: .95rem; }

/* ── бърза викторина (```quiz) ── */
.qz { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin: 1.2em 0 1.8em; font-size: 1rem; line-height: 1.5; }
.qz p { margin: 0 0 10px; }
.qz-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.qz-meta { font-size: .9rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.qz .qz-f { display: block; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--brand); font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.qz .qz-note { margin: 6px 0 0; }
.qz-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin: 12px 0 10px; }
.qz-choice { min-height: 46px; padding: 6px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
  font-family: var(--mono); font-weight: 700; font-size: .92rem; cursor: pointer; transition: border-color .15s, background .15s; }
.qz-choice:hover:not(:disabled) { border-color: var(--brand); }
.qz-choice:disabled { cursor: default; }
.qz-choice.right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.qz-choice.wrong { border-color: var(--err); background: var(--err-soft); color: var(--err); }
.qz-why { padding: 8px 12px; border-radius: 8px; }
.qz-why.ok { background: var(--ok-soft); } .qz-why.err { background: var(--err-soft); }
.qz-end { text-align: center; }
.qz .qz-score { font-size: 2rem; font-weight: 800; color: var(--brand); margin: 0 0 4px; }
