/* ============================================================================
   superblocks.css — стили для блочного редактора (robx-superblocks)
   ----------------------------------------------------------------------------
   Подключение:
     <link rel="stylesheet" href="/shared/superblocks/superblocks.css">
     <script src="/shared/superblocks/superblocks.js" defer></script>

   Скоупа НЕТ: селекторы (`.notion-*`, `.ct-*`, `.pdf-viewer*`, `.gpt-modal*`)
   живут глобально, чтобы редактор работал без обязательной обёртки
   `.edu-root` и его можно было подключать в любую страницу — в discussion-
   panel, чат, на сторонний сайт. Все классы префиксованы доменом редактора,
   так что коллизий с обычным host-CSS быть не должно. Если на host-странице
   уже определён хотя бы один из этих классов — оборачивай редактор в свой
   контейнер и переопределяй стили внутри него.
   ============================================================================ */


/* ── Тема редактора ────────────────────────────────────────────────────────
   Все поверхности, границы и текст берутся из переменных, поэтому редактор
   встаёт в тёмную тему хоста и подстраивается под его палитру. Тёмная тема
   включается любым из привычных признаков: класс `dark` на <html> или <body>,
   `data-theme="dark"` или обёртка `.sb-dark`. Свою (кастомную) тему хост
   задаёт, переопределив нужные `--sb-*` у себя — правила ниже трогать не надо.
   ────────────────────────────────────────────────────────────────────────── */
:root{
  --sb-surface:#fff;            /* карточки, меню, ячейки таблицы */
  --sb-surface-2:#f5f6fa;       /* вторичный фон: кнопки меню, наведение */
  --sb-surface-3:#eef0f5;       /* ручки таблицы */
  --sb-text:#3c4043;
  --sb-text-muted:#6b7280;
  --sb-text-faint:#9aa6b2;      /* подсказки и плейсхолдеры */
  --sb-line:#d6dbe6;
  --sb-line-soft:#eef1f6;
  --sb-accent:#1a73e8;
  --sb-accent-strong:#185abc;
  --sb-accent-ink:#fff;
  --sb-accent-soft:rgba(26,115,232,.08);
  --sb-accent-line:rgba(26,115,232,.3);
  --sb-danger:#c5221f;
  --sb-danger-soft:rgba(197,34,31,.1);
  --sb-shadow:0 8px 24px rgba(0,0,0,.12);
}
html.dark,html[data-theme="dark"],body.dark,.sb-dark{
  --sb-surface:#0D131B;
  --sb-surface-2:#131B25;
  --sb-surface-3:#1A2330;
  --sb-text:#E9EEF5;
  --sb-text-muted:#8C97A6;
  --sb-text-faint:#5F6A79;
  --sb-line:rgba(255,255,255,.16);
  --sb-line-soft:rgba(255,255,255,.08);
  --sb-accent:#4D9BFF;
  --sb-accent-strong:#84BDFF;
  --sb-accent-ink:#04162E;
  --sb-accent-soft:rgba(77,155,255,.14);
  --sb-accent-line:rgba(77,155,255,.35);
  --sb-danger:#FF6B6E;
  --sb-danger-soft:rgba(255,107,110,.16);
  --sb-shadow:0 12px 30px rgba(0,0,0,.55);
}

/* Block editor (robx-superblocks) — seamless, no inner scroll */
.notion-editor-wrap{background:transparent;padding:0;margin:0;border:none;min-height:120px}
.notion-editor-wrap.readonly{background:transparent}
.notion-editor__content{display:flex;flex-direction:column;gap:0}
.notion-block{display:flex;align-items:flex-start;gap:3px;padding:0 6px;border-radius:8px;border:none;background:transparent;min-height:38px;position:relative}
.notion-block__handle{cursor:grab;color:var(--sb-text-faint);font-size:24px;line-height:1;user-select:none;opacity:0;transition:opacity .2s}
.notion-block:hover .notion-block__handle{opacity:1}
.notion-block__handle:active{cursor:grabbing}
.notion-block__content{flex:1;min-height:22px;outline:none;padding:6px 8px;border-radius:6px;font-size:15px;color:var(--sb-text);line-height:1.6}
.notion-block__content:empty::before{content:attr(data-placeholder);color:var(--sb-text-faint)}
.notion-block__content p{margin:0;line-height:1.5}
/* Heading scale: the block itself provides vertical rhythm, so headings get
   zero margin. Sizes are a clean descending ladder — never shrink below p. */
.notion-block__content h1,
.notion-block__content h2,
.notion-block__content h3,
.notion-block__content h4,
.notion-block__content h5,
.notion-block__content h6{margin:0;line-height:1.3;font-family:inherit;color:inherit}
.notion-block__content h1{font-size:26px;font-weight:700}
.notion-block__content h2{font-size:22px;font-weight:700}
.notion-block__content h3{font-size:18px;font-weight:700}
.notion-block__content h4{font-size:16px;font-weight:600}
.notion-block__content h5{font-size:15px;font-weight:600}
.notion-block__content h6{font-size:14px;font-weight:600;color:var(--sb-text-muted)}
.notion-add-block{align-self:flex-start;display:inline-flex;align-items:center;gap:8px;padding:8px 14px;border-radius:999px;border:1px solid var(--sb-accent-line);background:var(--sb-accent-soft);color:var(--sb-accent);font-size:14px;font-weight:600;cursor:pointer}
.notion-add-block:hover,.notion-add-block:focus{background:rgba(26,115,232,.12);border-color:rgba(26,115,232,.5);outline:none}
.notion-add-block-menu{position:relative;align-self:flex-start;margin-top:10px}
.notion-add-block-menu summary{list-style:none;display:inline-block}
.notion-add-block-menu summary::-webkit-details-marker{display:none}
/* Add-block popup — matches the hover-«+» popup in robx-superblocks.js
   (.rsb-add-menu) so both entry points read identically. NOT scoped to
   because positionAddBlockMenu portals the element to <body>
   to escape transformed ancestors. */
.notion-add-block-options{background:var(--sb-surface);border:1px solid var(--sb-line);border-radius:10px;box-shadow:var(--sb-shadow);padding:6px;display:none;flex-direction:column;gap:2px;min-width:220px;z-index:5000;font-family:inherit}
details.notion-add-block-menu[open] > .notion-add-block-options{display:flex}
.notion-add-block-option{border:none;background:none;color:var(--sb-text);padding:8px 12px;border-radius:6px;cursor:pointer;font-size:13.5px;font-weight:500;text-align:left;font-family:inherit;white-space:nowrap}
.notion-add-block-option:hover,.notion-add-block-option:focus{background:var(--sb-accent-soft);color:var(--sb-accent);outline:none}
.editor-loading{padding:24px;text-align:center;color:var(--sb-text-faint);font-size:13px}

/* ===== robx-superblocks: per-block overlays / menus / media ===== */
/* Block types */
.notion-block__content--media{display:flex;flex-direction:column;gap:10px;padding:10px;border:1px dashed rgba(26,115,232,.3);background:transparent;border-radius:8px;width:100%;max-width:100%;min-width:240px;min-height:140px;overflow:hidden;box-sizing:border-box;align-self:flex-start;flex:none;margin-left:auto;margin-right:auto}
.notion-block__content--media[data-file-id]:not([data-file-id=""]){border:none;padding:0}
.notion-media-resize-handle{position:absolute;background:transparent;z-index:4;pointer-events:auto}
.notion-media-resize-handle.is-left,.notion-media-resize-handle.is-right{top:0;bottom:0;width:10px;cursor:ew-resize}
.notion-media-resize-handle.is-left{left:0}
.notion-media-resize-handle.is-right{right:0}
.notion-media-resize-handle.is-top,.notion-media-resize-handle.is-bottom{left:0;right:0;height:10px;cursor:ns-resize}
.notion-media-resize-handle.is-top{top:0}
.notion-media-resize-handle.is-bottom{bottom:0}
.notion-block__content--code{
  flex:1;background:#111 !important;color:#f8f8f2 !important;
  border-radius:8px;padding:14px 16px 14px 0;margin:0;
  font-family:"SF Mono","Consolas","Monaco","Courier New",monospace;
  font-size:13.5px;line-height:1.55;white-space:pre-wrap;
  counter-reset:code-line;tab-size:4;-moz-tab-size:4;
  overflow:auto;box-sizing:border-box;
}
.notion-block__content--code:focus{background:#111 !important;box-shadow:none;outline:1px solid rgba(26,115,232,.35)}
/* Line numbers: each top-level line (browser wraps contenteditable lines in <div>)
   gets an auto-incremented counter shown in a fixed-width gutter.
   Hanging indent (padding-left + negative text-indent): первая визуальная
   строка с ::before-номером сидит у левого края, а wrapped-continuation
   респектит padding-left и не уезжает под номера. Без этого длинные
   строки с мягким переносом наезжали на gutter. */
.notion-block__content--code > div,
.notion-block__content--code > p{
  margin:0;padding:0 0 0 4.5em;text-indent:-4.5em;display:block
}
.notion-block__content--code > *::before{
  counter-increment:code-line;content:counter(code-line);
  display:inline-block;width:3em;padding-right:1em;margin-right:.5em;
  text-align:right;color:#6b7890;user-select:none;
  border-right:1px solid rgba(255,255,255,.08);
}
/* If the editor renders the content as a single text node (no wrapper lines),
   fall back to a single "1" counter on the plain text. */
.notion-block__content--code:empty::before,
.notion-block__content--code::first-line{/* keep natural */}
.notion-block__content--pdf{border:1px solid var(--sb-line);border-radius:8px;overflow:hidden;background:var(--sb-surface-2);padding:0}
.pdf-viewer{display:flex;flex-direction:column;align-items:center}
.pdf-viewer__canvas-wrap{width:100%;display:flex;justify-content:center;background:#525659;min-height:300px}
.pdf-viewer__canvas-wrap canvas{max-width:100%;height:auto!important}
.pdf-viewer__controls{display:flex;align-items:center;justify-content:center;gap:12px;padding:10px 16px;background:var(--sb-surface);border-top:1px solid var(--sb-line);width:100%}
.pdf-viewer__controls button{padding:6px 14px;border:1px solid var(--sb-line);border-radius:6px;background:var(--sb-surface-2);cursor:pointer;font-size:14px;font-weight:600;color:var(--sb-text)}
.pdf-viewer__controls button:hover:not(:disabled){background:var(--sb-accent-soft)}
.pdf-viewer__controls button:disabled{opacity:.4;cursor:default}
.pdf-viewer__page-info{font-size:14px;color:var(--sb-text-muted);font-weight:500}
.pdf-upload-area{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 24px;color:var(--sb-text-muted);gap:12px}
.pdf-upload-area i{font-size:40px;color:#ccc}
.pdf-upload-btn{padding:8px 20px;background:var(--sb-accent);color:var(--sb-accent-ink);border:none;border-radius:8px;cursor:pointer;font-size:14px;font-weight:600}
.pdf-upload-btn:hover{background:#0046cc}
.notion-block__content--quote{border-left:3px solid var(--sb-accent);padding:8px 12px;background:var(--sb-accent-soft);border-radius:8px;font-style:italic}
/* у блока таблицы своих отступов нет: слева таблица должна начинаться там же,
   где текст соседних блоков (8px из .notion-block__content). Поля под ручки
   задаёт контейнер таблицы ниже. */
/* line-height:0 убирает щель под inline-block контейнером таблицы (место под
   выносные элементы строки), из-за которой блок казался выше и таблица
   «висела» ниже соседних. */
.notion-block__content--table{padding:0;border:none;border-radius:8px;line-height:0}
.notion-block__content--quiz{padding:12px;border:1px dashed var(--sb-accent-line);border-radius:8px;background:var(--sb-accent-soft)}
.notion-quiz-label{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-weight:600;color:var(--sb-accent)}
.notion-quiz-select{width:100%;padding:8px 12px;border:1px solid var(--sb-line);border-radius:8px;font-size:14px;background:var(--sb-surface);color:var(--sb-text);cursor:pointer}
.notion-quiz-select:focus{outline:none;border-color:#1a73e8}

/* Code trainer */
.notion-block__content--code-trainer{padding:0;border:1px solid var(--sb-line);border-radius:8px;overflow:hidden}
.ct-toolbar{display:flex;align-items:center;gap:4px;padding:8px 12px;background:var(--sb-surface-2);border-bottom:1px solid var(--sb-line);flex-wrap:wrap}
.ct-lang-tab{padding:5px 12px;border-radius:14px;font-size:13px;font-weight:500;cursor:pointer;background:transparent;color:#666;transition:all .15s;user-select:none;border:none;font-family:inherit}
.ct-lang-tab:hover{background:#e0e0e0}
.ct-lang-tab--active{background:#1a73e8;color:#fff}
.ct-lang-tab--active:hover{background:#1765cc}
.ct-run-btn{margin-left:auto;padding:5px 14px;border-radius:14px;border:none;background:#00aa55;color:#fff;font-size:13px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:6px;font-family:inherit}
.ct-run-btn:hover{background:#009944}
.ct-run-icon{display:inline-block;width:0;height:0;border-style:solid;border-width:5px 0 5px 9px;border-color:transparent transparent transparent #fff}
.ct-textarea{width:100%;box-sizing:border-box;border:none;resize:vertical;font-family:inherit}
.notion-block__content--code-trainer .CodeMirror{height:250px;font-size:14px;font-family:"Courier New",Consolas,monospace;border:none;background:#212121}
.ct-output{border-top:1px solid var(--sb-line);background:#1e1e1e;color:#d4d4d4}
.ct-output-header{padding:6px 12px;font-size:12px;font-weight:600;color:#888;border-bottom:1px solid #333}
.ct-output-pre{margin:0;padding:10px 12px;font-family:"Courier New",Consolas,monospace;font-size:13px;white-space:pre-wrap;word-break:break-all}

/* Table */
.notion-table{width:100%;border-collapse:separate;border-spacing:0;border:.5px solid var(--sb-line);border-radius:12px;overflow:hidden;background:var(--sb-surface)}
.notion-table td,.notion-table th{border:.5px solid var(--sb-line);padding:6px 8px;min-width:40px;background:var(--sb-surface);color:var(--sb-text);position:relative}
.notion-table td:hover,.notion-table th:hover{background:var(--sb-surface-2);box-shadow:inset 0 0 0 1px var(--sb-line)}
.notion-table td:focus,.notion-table th:focus,.notion-table td:focus-visible,.notion-table th:focus-visible{outline:none;box-shadow:none}
.notion-table-cell-selected,.notion-table-cell-selected:hover{background:var(--sb-accent-soft);box-shadow:inset 0 0 0 2px var(--sb-accent)}
.notion-table-resizer-col{position:absolute;top:0;right:-2px;width:4px;height:100%;cursor:col-resize;z-index:2}
.notion-table-resizer-row{position:absolute;left:0;bottom:-2px;width:100%;height:4px;cursor:row-resize;z-index:2}
/* Таблица по вертикали видна целиком — вертикальной прокрутки у блока нет.
   По горизонтали контейнер прокручиваемый, но полосы скрыты: широкую таблицу
   тянут мышью «поездом» (см. enablePan в superblocks.js). Вертикальные
   отступы — чтобы ручки «+» между строками не срезались overflow. */
.notion-table-wrapper{position:relative;display:inline-block;vertical-align:top;line-height:1.6;max-width:100%;
  overflow-x:auto;overflow-y:hidden;
  /* поля под ручки: они живут СНАРУЖИ таблицы, но внутри контейнера —
     иначе прокрутка обрезала бы их. Слева и сверху ровно столько, сколько
     у текста (8px и 6px): ручки меню лежат на границе и выступают на 4px,
     поэтому помещаются, а таблица начинается вровень с текстом соседних
     блоков. Справа и снизу шире — там полосы «+» (14px) с зазором. Ширину
     таблицы padding не ломает: width:100% считается от внутренней области. */
  padding:6px 24px 24px 8px;
  scrollbar-width:none;-ms-overflow-style:none;overscroll-behavior-x:contain}
.notion-table-wrapper > table{margin:0}
.notion-table-wrapper::-webkit-scrollbar{width:0;height:0;display:none}
.sb-readonly .notion-table-wrapper.is-pannable{cursor:grab}
.notion-table-wrapper.is-panning{cursor:grabbing;user-select:none}
/* Ручки «+»: JS растягивает их вдоль стороны таблицы, поэтому скругление
   фиксированное (не 50%) — иначе полоска раздувается в эллипс. Толщина у
   строки и столбца одинаковая. */
.notion-table-add-col,.notion-table-add-row{position:absolute;box-sizing:border-box;border-radius:8px;border:none;background:var(--sb-surface-3);color:var(--sb-text-muted);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-size:12px;font-weight:600;line-height:1;padding:0;overflow:hidden;opacity:0;pointer-events:none;font-family:inherit;transition:background .12s,color .12s,opacity .12s}
.notion-table-add-col{width:14px}
.notion-table-add-row{height:14px}
.notion-table-add-col:hover,.notion-table-add-row:hover,.notion-table-add-col:focus,.notion-table-add-row:focus{background:var(--sb-accent-soft);color:var(--sb-accent);outline:none}
.notion-block:hover .notion-table-add-col[data-positioned="true"],.notion-block:hover .notion-table-add-row[data-positioned="true"]{opacity:1;pointer-events:auto}
.notion-table-row-btn,.notion-table-col-btn{position:absolute;border-radius:6px;border:none;background:var(--sb-surface-3);color:var(--sb-text-muted);display:inline-flex;align-items:center;justify-content:center;font-size:12px;cursor:pointer;opacity:0;pointer-events:none;font-family:inherit}
.notion-table-row-btn{width:8px;height:18px}
.notion-table-col-btn{width:18px;height:8px}
.notion-table-row-btn:hover,.notion-table-col-btn:hover,.notion-table-row-btn:focus,.notion-table-col-btn:focus{background:var(--sb-accent-soft);outline:none}
/* меню строки и столбца рендерится в <body>: внутри прокручиваемого
   контейнера таблицы его обрезало краем. Отсюда fixed и высокий z-index. */
.notion-table-menu{position:fixed;background:var(--sb-surface);border:1px solid var(--sb-line);border-radius:8px;box-shadow:var(--sb-shadow);padding:6px;display:none;flex-direction:column;gap:6px;z-index:5000;min-width:150px}
.notion-table-menu button{border:none;background:var(--sb-surface-2);color:var(--sb-text);padding:6px 10px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;text-align:left;font-family:inherit}
.notion-table-menu button:hover,.notion-table-menu button:focus{background:var(--sb-accent-soft);color:var(--sb-accent);outline:none}
/* удаление строки или столбца — действие необратимое, поэтому в красном тоне */
.notion-table-menu button.is-danger{background:var(--sb-danger-soft);color:var(--sb-danger)}
.notion-table-menu button.is-danger:hover,.notion-table-menu button.is-danger:focus{background:var(--sb-danger-soft);color:var(--sb-danger);filter:brightness(.95)}

/* Inline per-block action row (image/code/quote icons) */
.notion-block__actions{display:none;gap:2px;position:absolute;right:6px;top:6px}
/* Ghost-кнопки в духе действий в дереве заметок: без рамок и подложки,
   полупрозрачные, проявляются при наведении на блок, мягкий hover-фон. */
.notion-block__action{width:26px;height:26px;padding:0;border:none;border-radius:7px;background:transparent;color:var(--sb-text-faint);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-family:inherit;opacity:0;transition:opacity .12s,background .12s,color .12s}
.notion-block:hover .notion-block__action,.notion-block__action:focus{opacity:1}
.notion-block__action:hover,.notion-block__action:focus{background:var(--sb-accent-soft);color:var(--sb-accent);outline:none}
.notion-block__action svg{width:15px;height:15px;display:block}

/* Media preview + upload */
.notion-block__media-preview{display:flex;flex-direction:column;gap:6px;width:100%;height:100%}
.notion-block__media-preview img,.notion-block__media-preview video{max-width:100%;border-radius:8px;width:100%;height:100%;object-fit:contain}
.notion-media-upload{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;border:1px solid var(--sb-accent-line);background:var(--sb-accent-soft);color:var(--sb-accent);font-weight:600;cursor:pointer;font-size:13px;font-family:inherit}
.notion-media-upload:disabled{opacity:.6;cursor:not-allowed}
.notion-media-progress{display:none;flex-direction:column;gap:6px}
.notion-media-progress.active{display:flex}
.notion-media-progress__bar{position:relative;height:6px;background:#d9e6ff;border-radius:999px;overflow:hidden}
.notion-media-progress__fill{position:absolute;inset:0;width:0;background:#00aa55;transition:width .2s}
.notion-media-progress__info{font-size:12px;color:var(--sb-text-muted)}

/* Per-block hamburger menu (Спросить GPT / Удалить) — HIDDEN by default */
.notion-block__menu{position:absolute;top:0;left:0;transform:translateY(-100%);background:var(--sb-surface);border:1px solid var(--sb-line);border-radius:8px;box-shadow:var(--sb-shadow);padding:6px;display:none;flex-direction:column;gap:6px;z-index:5;min-width:160px}
.notion-block__menu button{border:none;background:rgba(255,68,68,.1);color:#ff4444;padding:6px 10px;border-radius:6px;cursor:pointer;font-weight:600;font-size:12px;text-align:left;font-family:inherit}
.notion-block__menu button:hover,.notion-block__menu button:focus{background:rgba(255,68,68,.2);outline:none}
.notion-block__menu-gpt{background:rgba(59,130,246,.1)!important;color:#3b82f6!important}
.notion-block__menu-gpt:hover,.notion-block__menu-gpt:focus{background:rgba(59,130,246,.2)!important}
.notion-block__menu-copy{background:rgba(16,185,129,.1)!important;color:#10b981!important}
.notion-block__menu-copy:hover,.notion-block__menu-copy:focus{background:rgba(16,185,129,.2)!important}

/* AI-модалки superblocks («Спросить», «Преобразовать в…») — библиотека
   строит их сама, страницам разметка не нужна. Иконка ИИ — искра. */
.sb-ai-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);display:none;align-items:flex-start;justify-content:center;padding:12vh 16px 16px;z-index:9500}
.sb-ai-overlay.active{display:flex}
.sb-ai-box{background:var(--sb-surface);border-radius:16px;box-shadow:0 24px 60px rgba(15,23,42,.35);width:min(560px,100%);overflow:hidden}
.sb-ai-head{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--sb-line-soft)}
.sb-ai-spark{width:28px;height:28px;border-radius:50%;background:var(--sb-accent);color:var(--sb-accent-ink);display:flex;align-items:center;justify-content:center;flex:none}
.sb-ai-spark svg{width:14px;height:14px}
.sb-ai-title{flex:1;font-size:15px;font-weight:700;color:var(--sb-text)}
.sb-ai-close{border:none;background:none;font-size:22px;line-height:1;color:var(--sb-text-faint);cursor:pointer;padding:2px 8px;border-radius:8px;font-family:inherit}
.sb-ai-close:hover{color:var(--sb-text)}
.sb-ai-body{padding:16px 18px 18px;display:flex;flex-direction:column;gap:10px}
.sb-ai-input{width:100%;box-sizing:border-box;border:1px solid var(--sb-line);border-radius:12px;padding:10px 12px;font:inherit;font-size:14px;resize:vertical;min-height:76px;background:var(--sb-surface-2);color:var(--sb-text)}
.sb-ai-input:focus{outline:none;border-color:var(--sb-accent);box-shadow:0 0 0 3px var(--sb-accent-soft)}
.sb-ai-actions{display:flex;justify-content:flex-end}
.sb-ai-go{display:inline-flex;align-items:center;gap:8px;border:none;border-radius:999px;background:var(--sb-accent);color:var(--sb-accent-ink);font-weight:600;font-size:13.5px;padding:9px 18px;cursor:pointer;font-family:inherit;transition:background .12s}
.sb-ai-go:hover{background:var(--sb-accent-strong)}
.sb-ai-go:disabled{opacity:.6;cursor:default}
.sb-ai-go svg{width:13px;height:13px}
.sb-ai-status{font-size:12.5px;color:var(--sb-text-muted);min-height:16px}
.sb-ai-status.is-error{color:var(--sb-danger)}
.sb-ai-list{display:flex;flex-direction:column;gap:8px;max-height:50vh;overflow-y:auto}
.sb-ai-card{display:flex;flex-direction:column;gap:3px;text-align:left;border:1px solid var(--sb-line);background:var(--sb-surface-2);border-radius:12px;padding:10px 14px;cursor:pointer;font-family:inherit;transition:border-color .12s,background .12s}
.sb-ai-card:hover{border-color:var(--sb-accent);background:var(--sb-accent-soft)}
.sb-ai-card:disabled{opacity:.6;cursor:default}
.sb-ai-card__t{font-size:13.5px;font-weight:700;color:var(--sb-text)}
.sb-ai-card__d{font-size:12px;color:var(--sb-text-muted)}

/* Floating selection toolbar (B/I/U/links/colors/headings/alignment) */
/* Панель форматирования не переносится и не обрезается: кнопок больше,
   чем влезает в узкий экран, поэтому сама панель прокручивается вбок —
   её листают пальцем (touch-action:pan-x, чтобы жест доставался панели,
   а не странице). Полосу прокрутки прячем: она бы съедала высоту. */
.notion-toolbar{position:absolute;display:none;align-items:center;gap:4px;padding:6px 8px;background:var(--sb-surface);border:1px solid var(--sb-line);border-radius:10px;box-shadow:var(--sb-shadow);z-index:2000;flex-wrap:nowrap;white-space:nowrap;font-family:"Montserrat",system-ui,-apple-system,sans-serif;max-width:min(94vw,560px);overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;touch-action:pan-x;scrollbar-width:none}
.notion-toolbar::-webkit-scrollbar{height:0;width:0}
.notion-toolbar button{border:1px solid var(--sb-accent-line);background:var(--sb-accent-soft);color:var(--sb-accent);padding:5px 7px;border-radius:6px;cursor:pointer;font-size:13px;font-weight:600;min-width:30px;flex-shrink:0;font-family:inherit}
.notion-toolbar button:hover,.notion-toolbar button:focus{background:var(--sb-accent-soft);outline:none}
.notion-toolbar button.active{background:rgba(26,115,232,.25)}
.notion-toolbar__color{width:28px;height:28px;padding:2px;border:1px solid var(--sb-accent-line);border-radius:6px;background:var(--sb-surface);cursor:pointer;flex-shrink:0}
.notion-toolbar__sep{width:1px;height:20px;background:var(--sb-line);margin:0 2px;flex-shrink:0}

/* «Columns» layout block — 2..3 columns, one nested block each, draggable dividers */
.notion-block__content--columns{display:flex;flex-direction:column;gap:8px;width:100%}
.notion-columns-controls{display:flex;gap:6px;align-items:center}
.notion-columns-count{border:1px solid var(--sb-line);background:var(--sb-surface-2);color:var(--sb-text);padding:3px 10px;border-radius:6px;cursor:pointer;font-size:12px;font-family:inherit}
.notion-columns-count:hover{border-color:var(--sb-accent)}
.notion-columns-count.is-active{background:var(--sb-accent);color:var(--sb-accent-ink);border-color:var(--sb-accent)}
.notion-columns-host{display:flex;align-items:stretch;gap:0;width:100%}
.notion-column{flex:0 0 auto;min-width:80px;display:flex;flex-direction:column;overflow:hidden;position:relative}
.notion-column.is-drop{outline:2px dashed var(--sb-accent);outline-offset:-2px;background:var(--sb-accent-soft);border-radius:8px}
.notion-column > .notion-block{margin:0;width:100%;position:relative}
/* Nested blocks are their own drag handle — hide the side ☰ handle and its menu */
.notion-column > .notion-block .notion-block__handle{display:none}
.notion-column > .notion-block[draggable="true"]{cursor:grab}
.notion-column > .notion-block[draggable="true"]:active{cursor:grabbing}
.notion-column__del{position:absolute;top:2px;right:2px;z-index:4;border:none;background:var(--sb-surface);color:var(--sb-text-muted);cursor:pointer;font-size:16px;line-height:1;width:20px;height:20px;border-radius:4px;display:none;font-family:inherit;padding:0}
.notion-column > .notion-block:hover .notion-column__del{display:block}
.notion-column__del:hover{color:var(--sb-danger);background:var(--sb-surface)}
.notion-column__placeholder{display:block;width:100%;min-height:64px;border:1px dashed var(--sb-line);border-radius:8px;background:var(--sb-surface-2);color:var(--sb-text-muted);cursor:pointer;font-size:13px;font-family:inherit}
.notion-column__placeholder:hover{border-color:var(--sb-accent);color:var(--sb-accent)}
.notion-columns-resizer{flex:0 0 12px;align-self:stretch;cursor:col-resize;position:relative}
.notion-columns-resizer::before{content:'';position:absolute;left:50%;top:0;bottom:0;width:2px;transform:translateX(-50%);background:var(--sb-line);border-radius:1px}
.notion-columns-resizer:hover::before{background:var(--sb-accent)}
@media (max-width:600px){
  .notion-columns-host{flex-direction:column}
  .notion-column{flex-basis:auto!important;width:100%}
  .notion-columns-resizer{display:none}
}

/* «Диктофон» — запись звука, аудио-плеер и распознавание речи */
.notion-block__content--dictaphone{display:flex;flex-direction:column;gap:10px;border:1px solid var(--sb-line);border-radius:12px;padding:14px 16px;background:var(--sb-surface-2)}
.sb-dict-head{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--sb-text-muted)}
.sb-dict-head .sb-dict-ico{color:var(--sb-accent)}
.sb-dict-main{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.sb-dict-rec{border:none;border-radius:999px;padding:9px 18px;background:var(--sb-accent-soft);color:var(--sb-accent);font-size:13.5px;font-weight:600;cursor:pointer;font-family:inherit;transition:background .15s;display:inline-flex;align-items:center;gap:8px}
.sb-dict-rec:hover{background:var(--sb-accent-soft)}
.sb-dict-rec:disabled{opacity:.6;cursor:default}
.sb-dict-rec.is-recording{background:#fdecea;color:#c5221f;animation:sbDictPulse 1.2s ease-in-out infinite}
@keyframes sbDictPulse{0%,100%{box-shadow:0 0 0 0 rgba(197,34,31,.25)}50%{box-shadow:0 0 0 8px rgba(197,34,31,0)}}
/* Прогресс распознавания и загрузки: тонкая полоса в акценте хоста;
   без известной доли (ждём ответ облака) — бегущий блик */
.sb-dict-progress{display:none;width:100%;max-width:480px;flex-direction:column;gap:6px}
.sb-dict-progress.is-on{display:flex}
.sb-dict-progress__bar{position:relative;height:8px;border-radius:999px;background:var(--sb-accent-soft);overflow:hidden}
.sb-dict-progress__fill{display:block;height:100%;width:0;border-radius:999px;background:var(--sb-accent);transition:width .35s ease}
.sb-dict-progress.is-indeterminate .sb-dict-progress__fill{width:38%;transition:none;animation:sbDictSlide 1.15s ease-in-out infinite}
@keyframes sbDictSlide{0%{transform:translateX(-110%)}100%{transform:translateX(290%)}}
.sb-dict-progress__meta{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--sb-text-muted)}
.sb-dict-progress__n{font-variant-numeric:tabular-nums;color:var(--sb-text);font-weight:600;white-space:nowrap}
.sb-dict-status{font-size:12.5px;color:var(--sb-text-muted)}
.sb-dict-status.is-error{color:var(--sb-danger)}
.sb-dict-player{width:100%;max-width:480px;height:40px}
.sb-dict-frame{display:block;width:100%;max-width:640px;height:76px;border:0;border-radius:14px;background:transparent}
.sb-dict-actions{display:flex;gap:8px;flex-wrap:wrap}
.sb-dict-btn{border:1px solid var(--sb-accent-line);background:var(--sb-surface);color:var(--sb-accent);border-radius:8px;padding:7px 14px;font-size:12.5px;font-weight:600;cursor:pointer;font-family:inherit}
.sb-dict-btn:hover{background:var(--sb-accent-soft)}
.sb-dict-btn:disabled{opacity:.6;cursor:default}
.sb-dict-btn--ghost{border-color:var(--sb-line);color:var(--sb-text-muted)}
.sb-dict-btn--ghost:hover{background:var(--sb-surface-2);color:var(--sb-text)}

/* ── Режим просмотра: createBlockEditor(id, {readOnly:true}) ───────────────
   Контейнер получает класс .sb-readonly. Прячем всё, чем правят документ:
   ручки блоков, меню, кнопки действий, добавление блоков, ручки таблиц и
   подсветку выделенных ячеек. Текст и ячейки при этом не contenteditable,
   а панель форматирования (синглтон в <body>) не всплывает вовсе. */
.sb-readonly .notion-block__handle,
.sb-readonly .notion-block__menu,
.sb-readonly .notion-block__actions,
.sb-readonly .notion-block__action,
.sb-readonly .notion-add-block,
.sb-readonly .notion-add-block-menu,
.sb-readonly .notion-add-block-options,
.sb-readonly .rsb-add-menu,
.sb-readonly .rsb-between,
.sb-readonly .notion-table-add-row,
.sb-readonly .notion-table-add-col,
.sb-readonly .notion-table-row-btn,
.sb-readonly .notion-table-col-btn,
.sb-readonly .notion-table-menu,
.sb-readonly .notion-table-resizer-col,
.sb-readonly .notion-table-resizer-row{display:none!important}
.sb-readonly [contenteditable]{cursor:default;caret-color:transparent}
.sb-readonly .notion-table-cell-selected{background:transparent!important;box-shadow:none!important}
