/* ═══════════════════════════════════════════════════════════════════
   ARTICLE EDITOR — Cinematic Block Editor v2
   Centered author top + Apple-style floating toolbar bottom
   ═══════════════════════════════════════════════════════════════════ */

/* ── Header "Написать" button ── */
.write-article-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    margin-right: 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(168, 85, 247, 0.35);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(139, 92, 246, 0.06));
    color: var(--star-purple, #c084fc);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    position: relative;
    overflow: hidden;
}
.write-article-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(168, 85, 247, 0.15) 45%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(168, 85, 247, 0.15) 55%,
        transparent 60%
    );
    animation: writeGlint 6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes writeGlint {
    0%, 80% { left: -75%; }
    100%    { left: 150%; }
}
.write-article-btn:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(139, 92, 246, 0.14));
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.12);
    transform: translateY(-1px);
}
.write-article-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Editor Overlay ── */
.editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000002;
    opacity: 0;
    visibility: hidden;
    transition: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.editor-overlay.active { opacity: 1; visibility: visible; }
.editor-overlay.active ~ *, .editor-overlay.active + * { overflow: hidden !important; }
html:has(.editor-overlay.active), body:has(.editor-overlay.active) { overflow: hidden !important; }
.editor-overlay.theme-dark { background: #0f0f11; }
.editor-overlay.theme-light { background: #fcfcfc; }

/* ── Top Bar: centered author + topic ── */
.editor-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 52px;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}
.editor-overlay.theme-dark .editor-topbar { border-bottom: 1px solid rgba(255,255,255,0.05); }
.editor-overlay.theme-light .editor-topbar { border-bottom: 1px solid rgba(0,0,0,0.06); }

/* ── Dual-lang bar (admin/mod only) ── */
.editor-dual-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 20px;
    border-bottom: 1px solid rgba(124,58,237,0.2);
    background: rgba(124,58,237,0.05);
    min-height: 38px;
}
/* The centered group: tabs + translate button */
.editor-dual-center {
    display: flex;
    align-items: center;
    gap: 8px;
}
.editor-dual-tabs {
    display: flex;
    gap: 4px;
}
.editor-dual-tab {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(124,58,237,0.3);
    background: transparent;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all .15s;
}
.editor-dual-tab.active {
    background: rgba(124,58,237,0.18);
    border-color: #7c3aed;
    color: #a78bfa;
}
.editor-dual-translate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(37,99,235,0.4);
    background: rgba(37,99,235,0.08);
    color: #60a5fa;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all .15s;
    white-space: nowrap;
}
.editor-dual-translate-btn:hover:not(:disabled) { background: rgba(37,99,235,0.18); }
.editor-dual-translate-btn:disabled { opacity: .5; cursor: default; }
/* Hint sits absolutely on the right — doesn't affect centering */
.editor-dual-hint {
    position: absolute;
    right: 16px;
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
}

/* RU+EN publish button */
.toolbar-publish-both {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: opacity .15s;
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
}
.toolbar-publish-both:hover:not(:disabled) { opacity: .85; }
.toolbar-publish-both:disabled { opacity: .5; cursor: default; }

@media (max-width: 768px) {
    .editor-dual-bar { padding: 5px 10px; min-height: 34px; }
    .editor-dual-tab { padding: 3px 10px; font-size: 11px; }
    .editor-dual-translate-btn { padding: 3px 10px; font-size: 11px; }
    .editor-dual-hint { display: none; }

    /* On mobile with dual-lang: hide regular publish btn, RU+EN takes its place */
    .has-dual-lang #editor-publish-btn {
        display: none;
    }
    .has-dual-lang .toolbar-publish-both {
        padding: 8px 22px;
        font-size: 13px;
        border-radius: 10px;
    }
}

.editor-close-top {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) !important;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    z-index: 5;
}
.editor-close-top:active {
    transform: translateY(-50%) !important;
}
.editor-overlay.theme-dark .editor-close-top {
    background: rgba(239,68,68,0.08);
    color: rgba(239,68,68,0.6);
}
.editor-overlay.theme-dark .editor-close-top:hover {
    background: rgba(239,68,68,0.18);
    color: #ef4444;
}
.editor-overlay.theme-light .editor-close-top {
    background: rgba(239,68,68,0.06);
    color: rgba(220,38,38,0.5);
}
.editor-overlay.theme-light .editor-close-top:hover {
    background: rgba(239,68,68,0.14);
    color: #dc2626;
}

.editor-topbar-center {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Author chip */
.editor-author {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.editor-author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.editor-overlay.theme-dark .editor-author-avatar { border: 1.5px solid rgba(255,255,255,0.1); }
.editor-overlay.theme-light .editor-author-avatar { border: 1.5px solid rgba(0,0,0,0.08); }

.editor-author-name { font-weight: 600; font-size: 13px; }
.editor-overlay.theme-dark .editor-author-name { color: rgba(255,255,255,0.8); }
.editor-overlay.theme-light .editor-author-name { color: #333; }

.editor-impersonate-btn {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid rgba(139,92,246,0.4);
    background: rgba(139,92,246,0.15);
    color: #a78bfa; font-size: 11px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.editor-impersonate-btn:hover { background: rgba(139,92,246,0.35); }

.author-picker-dropdown {
    position: absolute; top: 100%; left: 0; z-index: 100;
    min-width: 260px; max-height: 320px;
    background: var(--card-bg, #1a1a2e); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow: hidden;
    margin-top: 6px;
}
.author-picker-search {
    padding: 8px 12px; border: none; border-bottom: 1px solid rgba(255,255,255,0.06);
    background: transparent; color: var(--text-main, #fff); font-size: 13px;
    outline: none;
}
.author-picker-list {
    overflow-y: auto; max-height: 260px; padding: 4px;
}
.author-picker-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 6px; cursor: pointer;
    font-size: 13px; color: var(--text-main, #ddd);
    transition: background .15s;
}
.author-picker-item:hover { background: rgba(139,92,246,0.15); }
.author-picker-item img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* Topic selector */
.editor-topic-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-body);
    border: none;
    background: transparent;
}
.editor-overlay.theme-dark .editor-topic-trigger { color: rgba(255,255,255,0.4); }
.editor-overlay.theme-dark .editor-topic-trigger:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.04); }
.editor-overlay.theme-light .editor-topic-trigger { color: rgba(0,0,0,0.4); }
.editor-overlay.theme-light .editor-topic-trigger:hover { color: rgba(0,0,0,0.7); background: rgba(0,0,0,0.04); }

.editor-topic-trigger .topic-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.editor-topic-trigger i { font-size: 9px; opacity: 0.4; }

/* Save status — top right */
.editor-save-float {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.editor-save-status { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.editor-save-status i { font-size: 10px; }
.editor-overlay.theme-dark .editor-save-status { color: rgba(255,255,255,0.2); }
.editor-overlay.theme-light .editor-save-status { color: rgba(0,0,0,0.25); }
.editor-save-status.saving { color: #f59e0b !important; }
.editor-save-status.saved { color: #10b981 !important; }
.editor-save-status.error { color: #ef4444 !important; }

/* ── Topic dropdown ── */
.editor-topic-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35);
    z-index: 100;
    display: none;
    overflow: hidden;
}
.editor-topic-dropdown.open { display: block; animation: edDropIn 0.2s ease-out; }
.editor-overlay.theme-dark .editor-topic-dropdown { background: #1c1c20; border: 1px solid rgba(255,255,255,0.07); }
.editor-overlay.theme-light .editor-topic-dropdown { background: #fff; border: 1px solid rgba(0,0,0,0.08); }

@keyframes edDropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.editor-topic-search {
    width: 100%;
    border: none;
    padding: 10px 12px;
    font-size: 12px;
    outline: none;
    font-family: var(--font-body);
}
.editor-overlay.theme-dark .editor-topic-search { background: rgba(255,255,255,0.03); color: #e5e5e5; border-bottom: 1px solid rgba(255,255,255,0.04); }
.editor-overlay.theme-dark .editor-topic-search::placeholder { color: rgba(255,255,255,0.2); }
.editor-overlay.theme-light .editor-topic-search { background: #f9f9f9; color: #111; border-bottom: 1px solid rgba(0,0,0,0.05); }
.editor-overlay.theme-light .editor-topic-search::placeholder { color: rgba(0,0,0,0.3); }

.editor-topic-list { max-height: 240px; overflow-y: auto; padding: 4px; }
.editor-topic-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 8px;
    transition: background 0.1s;
}
.editor-overlay.theme-dark .editor-topic-item { color: rgba(255,255,255,0.6); }
.editor-overlay.theme-dark .editor-topic-item:hover { background: rgba(255,255,255,0.05); }
.editor-overlay.theme-dark .editor-topic-item.active { background: rgba(168,85,247,0.12); color: #c084fc; font-weight: 600; }
.editor-overlay.theme-light .editor-topic-item { color: #555; }
.editor-overlay.theme-light .editor-topic-item:hover { background: rgba(0,0,0,0.03); }
.editor-overlay.theme-light .editor-topic-item.active { background: rgba(168,85,247,0.08); color: #7c3aed; font-weight: 600; }

.editor-topic-item .topic-icon {
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: #fff; flex-shrink: 0;
}

/* ── Main Editor Area ── */
.editor-main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 48px 24px 0;
    /* Reserve space at bottom so toolbar never covers content */
    margin-bottom: 80px;
}
/* Large clickable/scrollable empty zone after all blocks */
.editor-canvas::after {
    content: '';
    display: block;
    min-height: 70vh;
    cursor: text;
    order: 99;
}
.editor-overlay.theme-dark .editor-canvas::after {
    cursor: var(--cursor-text, text);
}
.editor-overlay.theme-light .editor-canvas::after {
    cursor: var(--cursor-text-light, text);
}
.editor-main::-webkit-scrollbar { width: 3px; }
.editor-main::-webkit-scrollbar-track { background: transparent; }
.editor-overlay.theme-dark .editor-main::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
.editor-overlay.theme-light .editor-main::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }

.editor-canvas { width: 100%; max-width: 660px; display: flex; flex-direction: column; }

/* Title */
.editor-title {
    width: 100%;
    border: none;
    outline: none;
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-body);
    line-height: 1.25;
    resize: none;
    padding: 0;
    margin-bottom: 4px;
    background: transparent;
    min-height: 44px;
    order: 0;
    flex-shrink: 0;
}
.editor-overlay.theme-dark .editor-title { color: #e5e5e5; cursor: var(--cursor-text, text); }
.editor-overlay.theme-dark .editor-title::placeholder { color: rgba(255,255,255,0.12); }
.editor-overlay.theme-light .editor-title { color: #111; cursor: var(--cursor-text-light, text); }
.editor-overlay.theme-light .editor-title::placeholder { color: #b0b0b0; }

/* Title character counter */
.editor-title-counter {
    font-size: 11px; font-weight: 500; text-align: right;
    margin-top: 0; margin-bottom: 20px; opacity: 0.3;
    transition: opacity 0.2s, color 0.2s;
    order: 1;
    flex-shrink: 0;
}
.editor-title:focus ~ .editor-title-counter,
.editor-title-counter.warn, .editor-title-counter.over { opacity: 0.7; }
.editor-title-counter.warn { color: #f59e0b; }
.editor-title-counter.over { color: #ef4444; opacity: 1; }

/* ── Blocks ── */
.editor-blocks {
    min-height: 300px;
    outline: none;
    user-select: text;
    -webkit-user-select: text;
    order: 2;
    flex: 1;
}

.editor-block {
    position: relative;
    margin: 2px 0;
    padding: 3px 0;
    border-radius: 6px;
}
/* hover show/pointer-events handled in .block-controls rule below */

/* Block controls — far left.
   pointer-events always auto so the controls themselves participate in
   :hover detection on the parent — otherwise the mouse "falls through"
   the invisible buttons and the block loses :hover before cursor reaches them. */
.block-controls {
    position: absolute;
    left: -100px;
    top: 4px;
    display: flex;
    gap: 1px;
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.15s;
    user-select: none;
    -webkit-user-select: none;
}
.editor-block:hover .block-controls,
.editor-block.is-active .block-controls {
    opacity: 1;
}
.block-ctrl-btn {
    width: 28px; height: 28px; border-radius: 7px; border: none;
    background: transparent; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s ease;
}
.editor-overlay.theme-dark .block-ctrl-btn { color: rgba(255,255,255,0.35); }
.editor-overlay.theme-dark .block-ctrl-btn:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.75); }
/* Light theme: give controls a visible card so they stand out on white */
.editor-overlay.theme-light .block-controls {
    background: #f0f0f3;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 9px;
    padding: 1px 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.editor-overlay.theme-light .block-ctrl-btn { color: rgba(0,0,0,0.45); }
.editor-overlay.theme-light .block-ctrl-btn:hover { background: rgba(0,0,0,0.07); color: rgba(0,0,0,0.75); }
.block-delete-btn:hover { color: #ef4444 !important; }
.editor-overlay.theme-dark .block-delete-btn:hover { background: rgba(239,68,68,0.12) !important; }
.editor-overlay.theme-light .block-delete-btn:hover { background: rgba(239,68,68,0.1) !important; }

/* Block editable content */
.block-editable {
    width: 100%; min-height: 24px; outline: none;
    line-height: 1.75; font-size: 16px; word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
}
.editor-overlay.theme-dark .block-editable { color: rgba(255,255,255,0.7); caret-color: #e5e5e5; cursor: var(--cursor-text, text); }
.editor-overlay.theme-light .block-editable { color: #374151; caret-color: #111; cursor: var(--cursor-text-light, text); }
/* Placeholder — only on the focused/active block */
.editor-block .block-editable:empty::before { content: none; pointer-events: none; }
.editor-block:first-child .block-editable[data-type="paragraph"]:empty::before,
.editor-block.is-active .block-editable:empty::before { content: attr(data-placeholder); pointer-events: none; }
.editor-overlay.theme-dark .editor-block:first-child .block-editable:empty::before,
.editor-overlay.theme-dark .editor-block.is-active .block-editable:empty::before { color: rgba(255,255,255,0.15); }
.editor-overlay.theme-light .editor-block:first-child .block-editable:empty::before,
.editor-overlay.theme-light .editor-block.is-active .block-editable:empty::before { color: rgba(0,0,0,0.2); }
/* Empty block minimum height */
.block-editable:empty {
    min-height: 28px;
    position: relative;
}
.block-editable:empty.no-placeholder::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    pointer-events: none;
}
.editor-overlay.theme-dark .block-editable:empty.no-placeholder::before { background: rgba(255,255,255,0.04); }
.editor-overlay.theme-light .block-editable:empty.no-placeholder::before { background: rgba(0,0,0,0.04); }

.block-editable[data-type="heading-2"] { font-size: 24px; font-weight: 700; line-height: 1.3; margin: 8px 0 4px; }
.editor-overlay.theme-dark .block-editable[data-type="heading-2"] { color: #e5e5e5; }
.editor-overlay.theme-light .block-editable[data-type="heading-2"] { color: #111; }

.block-editable[data-type="heading-3"] { font-size: 19px; font-weight: 600; line-height: 1.4; margin: 6px 0 2px; }
.editor-overlay.theme-dark .block-editable[data-type="heading-3"] { color: rgba(255,255,255,0.85); }
.editor-overlay.theme-light .block-editable[data-type="heading-3"] { color: #1f2937; }

.block-editable[data-type="quote"] { padding-left: 18px; font-style: italic; }
.editor-overlay.theme-dark .block-editable[data-type="quote"] { border-left: 3px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.4); }
.editor-overlay.theme-light .block-editable[data-type="quote"] { border-left: 3px solid rgba(0,0,0,0.12); color: #9ca3af; }

.block-editable[data-type="code"] {
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 13px; border-radius: 10px; padding: 16px 18px;
    white-space: pre-wrap; line-height: 1.7;
}
.editor-overlay.theme-dark .block-editable[data-type="code"] { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); color: rgba(255,255,255,0.65); }
.editor-overlay.theme-light .block-editable[data-type="code"] { background: #f3f4f6; border: 1px solid #e5e7eb; color: #1e293b; }

.block-editable[data-type="list"] { padding-left: 20px; }
.block-editable[data-type="bullet-list"],
.block-editable[data-type="numbered-list"] {
    padding-left: 8px;
}
.block-editable[data-type="bullet-list"] li,
.block-editable[data-type="numbered-list"] li {
    margin-left: 18px;
    padding: 2px 0;
    line-height: 1.7;
}
.block-editable[data-type="bullet-list"] { list-style-type: disc; }
.block-editable[data-type="numbered-list"] { list-style-type: decimal; }
.block-editable a { color: #818cf8; text-decoration: none; }

/* Divider */
.block-divider { height: 1px; margin: 28px 0; border: none; cursor: pointer; transition: background 0.2s; }
.editor-overlay.theme-dark .block-divider { background: rgba(255,255,255,0.06); }
.editor-overlay.theme-dark .block-divider:hover { background: rgba(255,255,255,0.15); }
.editor-overlay.theme-light .block-divider { background: rgba(0,0,0,0.08); }
.editor-overlay.theme-light .block-divider:hover { background: rgba(0,0,0,0.18); }

/* Image block */
.block-image-wrapper { position: relative; border-radius: 12px; overflow: hidden; border: 2px dashed transparent; transition: border-color 0.2s; cursor: pointer; }
.editor-overlay.theme-dark .block-image-wrapper { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.06); }
.editor-overlay.theme-light .block-image-wrapper { background: #f9fafb; border-color: #e5e7eb; }
.block-image-wrapper:hover { border-color: rgba(0,0,0,0.15) !important; }
.editor-overlay.theme-dark .block-image-wrapper:hover { border-color: rgba(255,255,255,0.15) !important; }
.block-image-wrapper.has-image { border: none !important; background: transparent !important; overflow: visible; }
.block-image-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px; }
.editor-overlay.theme-dark .block-image-upload { color: rgba(255,255,255,0.15); }
.editor-overlay.theme-light .block-image-upload { color: rgba(0,0,0,0.2); }
.block-image-upload i { font-size: 28px; }
.block-image-upload span { font-size: 13px; }
.block-image-preview { width: 100%; max-height: 500px; object-fit: cover; display: block; border-radius: 12px; }
.block-image-caption { width: 100%; border: none; outline: none; text-align: center; font-size: 12px; padding: 6px 8px; margin-top: 2px; background: transparent; font-family: var(--font-body); display: block; box-sizing: border-box; }
.editor-overlay.theme-dark .block-image-caption { color: rgba(255,255,255,0.25); }
.editor-overlay.theme-light .block-image-caption { color: rgba(0,0,0,0.35); }

/* Link embed */
.block-link-input { width: 100%; padding: 12px 16px; border-radius: 10px; font-size: 14px; outline: none; font-family: var(--font-body); transition: border-color 0.2s; }
.editor-overlay.theme-dark .block-link-input { border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.03); color: #e5e5e5; }
.editor-overlay.theme-light .block-link-input { border: 1px solid #e5e7eb; background: #fff; color: #111; }
.editor-overlay.theme-dark .block-link-input:focus { border-color: rgba(255,255,255,0.2) !important; }
.editor-overlay.theme-light .block-link-input:focus { border-color: rgba(0,0,0,0.2) !important; }

/* ── Block Insert Menu ── */
.block-insert-menu {
    position: fixed; width: 240px; border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25); z-index: 10000;
    display: none; overflow: hidden; max-height: 420px; overflow-y: auto; padding: 0 0 4px;
}
.block-insert-menu.open { display: block; animation: edMenuPop 0.25s cubic-bezier(.16,1,.3,1); }
.editor-overlay.theme-dark .block-insert-menu { background: #1c1c20; border: 1px solid rgba(255,255,255,0.07); }
.editor-overlay.theme-light .block-insert-menu { background: #fff; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 12px 40px rgba(0,0,0,0.1); }

/* Insert menu search */
.block-insert-search {
    width: 100%;
    border: none;
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
    font-family: var(--font-body);
    box-sizing: border-box;
}
.editor-overlay.theme-dark .block-insert-search { background: rgba(255,255,255,0.03); color: #e5e5e5; border-bottom: 1px solid rgba(255,255,255,0.04); }
.editor-overlay.theme-dark .block-insert-search::placeholder { color: rgba(255,255,255,0.2); }
.editor-overlay.theme-light .block-insert-search { background: #f9fafb; color: #111; border-bottom: 1px solid rgba(0,0,0,0.05); }
.editor-overlay.theme-light .block-insert-search::placeholder { color: rgba(0,0,0,0.3); }

.block-insert-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    cursor: pointer; font-size: 13px; width: 100%; border: none;
    background: transparent; font-family: var(--font-body); text-align: left; border-radius: 8px; transition: background 0.12s ease;
    margin: 0 4px; width: calc(100% - 8px);
}
.editor-overlay.theme-dark .block-insert-item { color: rgba(255,255,255,0.6); }
.editor-overlay.theme-dark .block-insert-item:hover { background: rgba(255,255,255,0.05); }
.editor-overlay.theme-light .block-insert-item { color: #555; }
.editor-overlay.theme-light .block-insert-item:hover { background: rgba(0,0,0,0.04); }

.block-insert-item .insert-icon {
    width: 26px; height: 26px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; flex-shrink: 0;
}
.editor-overlay.theme-dark .block-insert-item .insert-icon { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.35); }
.editor-overlay.theme-light .block-insert-item .insert-icon { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.35); }

/* ═══ BOTTOM FLOATING TOOLBAR — Apple Style ═══ */
.editor-toolbar-float {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 6px 8px;
    border-radius: 16px;
    z-index: 50;
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.editor-overlay.theme-dark .editor-toolbar-float {
    background: rgba(30, 30, 34, 0.85);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), inset 0 0.5px 0 rgba(255,255,255,0.06);
}
.editor-overlay.theme-light .editor-toolbar-float {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
}

.toolbar-divider {
    width: 1px; height: 22px; margin: 0 4px; flex-shrink: 0;
}
.editor-overlay.theme-dark .toolbar-divider { background: rgba(255,255,255,0.08); }
.editor-overlay.theme-light .toolbar-divider { background: rgba(0,0,0,0.08); }

/* Toolbar icon buttons */
.toolbar-btn {
    width: 38px; height: 38px; border-radius: 10px; border: none;
    background: transparent; font-size: 15px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease; position: relative;
}
.editor-overlay.theme-dark .toolbar-btn { color: rgba(255,255,255,0.45); }
.editor-overlay.theme-dark .toolbar-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.editor-overlay.theme-light .toolbar-btn { color: rgba(0,0,0,0.4); }
.editor-overlay.theme-light .toolbar-btn:hover { background: rgba(0,0,0,0.06); color: #111; }

.toolbar-btn.close-btn:hover { color: #ef4444 !important; }
.editor-overlay.theme-dark .toolbar-btn.close-btn:hover { background: rgba(239,68,68,0.12); }
.editor-overlay.theme-light .toolbar-btn.close-btn:hover { background: rgba(239,68,68,0.08); }

/* Publish button in toolbar */
.toolbar-publish {
    padding: 8px 22px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.25s ease;
    font-family: var(--font-body); letter-spacing: 0.3px;
    white-space: nowrap;
}
.toolbar-publish:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 20px rgba(124,58,237,0.4);
    transform: translateY(-1px);
}
.toolbar-publish:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

/* Day/Night toggle */
.toolbar-theme-toggle { position: relative; }
.toolbar-theme-toggle .theme-icon-sun,
.toolbar-theme-toggle .theme-icon-moon { position: absolute; transition: opacity 0.2s, transform 0.2s; }
.editor-overlay.theme-dark .toolbar-theme-toggle .theme-icon-sun { opacity: 1; transform: scale(1); }
.editor-overlay.theme-dark .toolbar-theme-toggle .theme-icon-moon { opacity: 0; transform: scale(0.7); }
.editor-overlay.theme-light .toolbar-theme-toggle .theme-icon-sun { opacity: 0; transform: scale(0.7); }
.editor-overlay.theme-light .toolbar-theme-toggle .theme-icon-moon { opacity: 1; transform: scale(1); }

/* More dropdown (from toolbar) */
.editor-more-dropdown {
    position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
    width: 200px; border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35); z-index: 100;
    display: none; overflow: hidden; padding: 4px;
}
.editor-more-dropdown.open { display: block; animation: edDrop2 0.2s ease-out; }
.editor-overlay.theme-dark .editor-more-dropdown { background: #1c1c20; border: 1px solid rgba(255,255,255,0.07); }
.editor-overlay.theme-light .editor-more-dropdown { background: #fff; border: 1px solid rgba(0,0,0,0.08); }

.editor-more-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; width: 100%; border: none; background: transparent;
    cursor: pointer; font-size: 13px; font-family: var(--font-body);
    border-radius: 8px; text-align: left; transition: background 0.1s;
}
.editor-overlay.theme-dark .editor-more-item { color: rgba(255,255,255,0.6); }
.editor-overlay.theme-dark .editor-more-item:hover { background: rgba(255,255,255,0.05); }
.editor-overlay.theme-light .editor-more-item { color: #555; }
.editor-overlay.theme-light .editor-more-item:hover { background: rgba(0,0,0,0.04); }
.editor-more-item.danger { color: #ef4444 !important; }
.editor-more-item.official-toggle { color: #60a5fa !important; }
.editor-more-item.official-toggle i { color: #818cf8; opacity: 0.8; }
.editor-more-item i { width: 16px; text-align: center; opacity: 0.5; }

/* ── Text Format Toolbar ── */
.editor-format-toolbar {
    position: fixed; display: none; border-radius: 10px; padding: 4px;
    gap: 2px; z-index: 10001; transform: translateX(-50%);
}
.editor-format-toolbar.visible { display: flex; }
.editor-overlay.theme-dark .editor-format-toolbar { background: #1c1c20; border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.editor-overlay.theme-light .editor-format-toolbar { background: #fff; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 8px 30px rgba(0,0,0,0.12); }

.format-btn {
    width: 30px; height: 30px; border-radius: 6px; border: none;
    background: transparent; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.1s;
}
.editor-overlay.theme-dark .format-btn { color: rgba(255,255,255,0.4); }
.editor-overlay.theme-dark .format-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.editor-overlay.theme-light .format-btn { color: rgba(0,0,0,0.4); }
.editor-overlay.theme-light .format-btn:hover { background: rgba(0,0,0,0.06); color: #111; }
.format-btn.active { color: #a855f7 !important; }
.format-divider { width: 1px; height: 18px; margin: 6px 2px; }
.editor-overlay.theme-dark .format-divider { background: rgba(255,255,255,0.06); }
.editor-overlay.theme-light .format-divider { background: rgba(0,0,0,0.08); }

/* ── Preview Overlay ── */
.editor-preview-overlay {
    position: fixed; inset: 0; z-index: 2000003;
    background: var(--void-black, #0a0a0f);
    overflow-y: auto;
    animation: edFadeIn 0.3s ease;
}
@keyframes edFadeIn { from { opacity: 0; } to { opacity: 1; } }
.editor-preview-close {
    position: fixed; top: 16px; right: 16px; z-index: 2000004;
    width: 40px; height: 40px; border-radius: 12px; border: none;
    background: rgba(255,255,255,0.1); color: #fff; font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
}
.editor-preview-close:hover { background: rgba(255,255,255,0.2); }

/* ── Drafts/Articles Modal ── */
.editor-list-overlay {
    position: fixed; inset: 0; z-index: 2000003;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    animation: edFadeIn 0.25s ease;
}
.editor-list-modal {
    background: #1a1a1e; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px; width: 90%; max-width: 560px; max-height: 85vh; max-height: 85dvh;
    overflow: hidden; display: flex; flex-direction: column;
    animation: edSlideUp 0.3s ease-out;
}
@media (max-width: 768px) {
    .editor-list-modal {
        width: 100%; max-width: 100%; max-height: 100vh; max-height: 100dvh;
        border-radius: 0; border: none;
        height: 100vh; height: 100dvh;
    }
    .editor-list-overlay {
        align-items: stretch;
    }
}
@keyframes edSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.editor-list-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.editor-list-header h3 { font-size: 16px; font-weight: 600; color: #e5e5e5; margin: 0; }
.editor-list-close { width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: rgba(255,255,255,0.4); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.editor-list-close:hover { background: rgba(255,255,255,0.06); color: #fff; }
.editor-list-body { overflow-y: auto; padding: 8px; flex: 1; }
.editor-list-empty { text-align: center; padding: 48px 20px; color: rgba(255,255,255,0.25); font-size: 14px; }
.editor-list-item-img { width: 56px; height: 40px; border-radius: 6px; object-fit: cover; background: rgba(255,255,255,0.04); flex-shrink: 0; }
.editor-list-item-info { flex: 1; min-width: 0; }
.editor-list-item-title { font-size: 14px; font-weight: 500; color: #e5e5e5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-list-item-meta { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 2px; }
.editor-list-item-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; color: rgba(255,255,255,0.3); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.editor-list-item-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }
.editor-list-item-btn.delete:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ── Drag to reorder ── */
.editor-block.dragging {
    position: fixed !important;
    z-index: 10010;
    opacity: 0.85;
    pointer-events: none;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    border-radius: 10px;
    transform: scale(1.02);
}
.editor-overlay.theme-dark .editor-block.dragging { background: #1a1a1e; }
.editor-overlay.theme-light .editor-block.dragging { background: #fff; }

.editor-block-placeholder {
    border: 2px dashed rgba(0,0,0,0.12);
    border-radius: 8px;
    margin: 2px 0;
    transition: height 0.15s ease;
}
.block-drag-btn { cursor: grab; }
.block-drag-btn:active { cursor: grabbing; }

/* ── Image block: action buttons + tight spacing ── */
.block-image-container { position: relative; display: block; width: 100%; }
.block-image-container .block-image-preview { width: 100%; max-height: 500px; object-fit: cover; display: block; border-radius: 12px; }

.block-image-actions {
    position: absolute; top: 8px; right: 8px;
    display: flex; gap: 6px;
    opacity: 0; transition: opacity 0.25s ease;
    z-index: 5;
}
.block-image-container:hover .block-image-actions { opacity: 1; }
@media (hover: none) {
    .block-image-actions, .block-gallery-actions { opacity: 1; }
    .block-image-action-btn { width: 38px; height: 38px; font-size: 15px; }
    .block-image-action-btn.block-image-delete { background: rgba(239,68,68,0.75); }
    .block-music-wrapper .block-music-remove { width: 36px; height: 36px; font-size: 16px; }
}

/* ── Video in image block ── */
.block-video-container {
    display: flex; align-items: center; justify-content: center;
    background: #0a0a0c; border-radius: 12px; overflow: hidden;
    max-height: 500px; min-height: 120px;
}
.block-video-preview {
    width: 100%; max-height: 500px;
    object-fit: contain; display: block; border-radius: 0;
}
.block-video-badge {
    position: absolute; bottom: 50px; left: 10px; z-index: 5;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; pointer-events: none;
    backdrop-filter: blur(6px);
}

.block-image-action-btn {
    width: 34px; height: 34px; border-radius: 8px; border: none;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 13px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(10px); transition: background 0.2s, transform 0.15s;
}
.block-image-action-btn:hover { background: rgba(0,0,0,0.75); transform: scale(1.08); }
.block-image-action-btn.block-image-delete:hover { background: rgba(239,68,68,0.85); }

/* ── Star (featured cover) button ── */
.block-image-star { position: relative; }
.block-image-star i { transition: color 0.2s, transform 0.2s; }
.block-image-star.active { background: rgba(234,179,8,0.85); }
.block-image-star.active i { color: #fff; }
.block-image-star:not(.active):hover i { color: #facc15; transform: scale(1.15); }
.block-gallery-actions {
    position: absolute; top: 8px; right: 44px; z-index: 5;
    opacity: 0; transition: opacity 0.25s ease;
}
.block-gallery-wrapper:hover .block-gallery-actions { opacity: 1; }

/* Image block collapses empty margin */
.editor-block[data-type="image"] { margin-top: 0; margin-bottom: 0; padding: 2px 0; }
.block-image-wrapper.has-image { border: none !important; background: transparent !important; margin: 0; overflow: visible; }

/* Gallery block */
.editor-block[data-type="gallery"] { margin-top: 0; margin-bottom: 0; padding: 2px 0; }
.block-gallery-wrapper { position: relative; border-radius: 12px; overflow: hidden; border: 2px dashed transparent; transition: border-color 0.2s; }
.editor-overlay.theme-dark .block-gallery-wrapper { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.06); }
.editor-overlay.theme-light .block-gallery-wrapper { background: #f9fafb; border-color: #e5e7eb; }
.block-gallery-wrapper:hover { border-color: rgba(0,0,0,0.15) !important; }
.editor-overlay.theme-dark .block-gallery-wrapper:hover { border-color: rgba(255,255,255,0.15) !important; }
.block-gallery-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px; cursor: pointer; }
.editor-overlay.theme-dark .block-gallery-upload { color: rgba(255,255,255,0.15); }
.editor-overlay.theme-light .block-gallery-upload { color: rgba(0,0,0,0.2); }
.block-gallery-upload i { font-size: 28px; }
.block-gallery-upload span { font-size: 13px; }
.block-gallery-upload:hover { transform: scale(1.01); }
.block-gallery-upload:hover i { transform: scale(1.12); }
.block-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
    padding: 8px;
}
.block-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}
.block-gallery-item.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 18px;
}
.block-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.block-gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    border: none;
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}
.block-gallery-item:hover .block-gallery-remove { opacity: 1; }
.block-gallery-remove:hover { background: rgba(239,68,68,0.9); }
.block-gallery-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    margin: 0 8px 8px;
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.35);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    font-family: var(--font-body);
}
.block-gallery-add:hover { border-color: rgba(99,102,241,0.4); color: rgba(99,102,241,0.8); }
.editor-overlay.theme-light .block-gallery-item { background: #f0f0f0; }
.editor-overlay.theme-light .block-gallery-item.loading { color: rgba(0,0,0,0.2); }
.editor-overlay.theme-light .block-gallery-add { border-color: rgba(0,0,0,0.12); color: rgba(0,0,0,0.35); }
.block-gallery-wrapper .block-overlay-close { z-index: 5; }
.block-gallery-wrapper.drag-highlight .block-gallery-upload { border-color: rgba(99,102,241,0.5) !important; background: rgba(99,102,241,0.05) !important; }
/* Gallery drag-to-reorder */
.block-gallery-item[draggable="true"] { cursor: grab; }
.block-gallery-item[draggable="true"]:active { cursor: grabbing; }
.block-gallery-item.gallery-dragging { opacity: 0.35; transform: scale(0.92); transition: opacity 0.15s, transform 0.15s; }
.block-gallery-item.gallery-drag-over { outline: 2px solid #818cf8; outline-offset: -2px; border-radius: 8px; }

/* ── Drag & Drop overlay ── */
.editor-dragover {
    position: relative;
}
.editor-dragover::before {
    content: '';
    position: absolute; inset: 0;
    border: 2px dashed rgba(99,102,241,0.5);
    border-radius: 16px;
    background: rgba(99,102,241,0.04);
    pointer-events: none; z-index: 50;
    animation: editorDragPulse 1.2s ease-in-out infinite;
}
@keyframes editorDragPulse {
    0%, 100% { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.02); }
    50% { border-color: rgba(99,102,241,0.7); background: rgba(99,102,241,0.06); }
}

/* ── Image Focus Point Picker (dot) ── */
.focus-picker-overlay {
    position: absolute; inset: 0; z-index: 10;
    background: rgba(15,15,20,0.92); border-radius: 12px;
    display: flex; flex-direction: column;
    animation: focusPickerIn 0.2s ease;
    overflow: hidden;
}
@keyframes focusPickerIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fp-canvas {
    flex: 1; min-height: 0;
    position: relative; overflow: hidden;
    cursor: crosshair; user-select: none;
    display: flex; align-items: center; justify-content: center;
    background: #111118;
    border-radius: 12px 12px 0 0;
}
.fp-image {
    max-width: 100%; max-height: 100%;
    display: block; user-select: none; pointer-events: none;
}
.fp-video {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}
.fp-marker {
    position: absolute;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(139,92,246,0.9);
    border: 2.5px solid #fff;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.4), 0 2px 8px rgba(0,0,0,0.3);
    transform: translate(-50%,-50%);
    pointer-events: none;
    transition: left 0.12s ease, top 0.12s ease;
    z-index: 3;
}
.fp-crosshair {
    position: absolute; pointer-events: none; opacity: 0.25; z-index: 2;
}
.fp-crosshair-v {
    width: 1px; top: 0; bottom: 0;
    background: rgba(255,255,255,0.5);
    transition: left 0.12s ease;
}
.fp-crosshair-h {
    height: 1px; left: 0; right: 0;
    background: rgba(255,255,255,0.5);
    transition: top 0.12s ease;
}
.fp-controls {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    background: rgba(15,15,20,0.95);
    backdrop-filter: blur(12px);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}
.fp-hint {
    font-size: 11px; color: rgba(255,255,255,0.4);
    white-space: nowrap; margin-right: auto;
}
.focus-picker-done {
    padding: 5px 14px; border: none; border-radius: 8px;
    background: rgba(99,102,241,0.9); color: #fff;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}
.focus-picker-done:hover { background: rgba(99,102,241,1); transform: scale(1.05); }

/* ── Image upload drop hint on empty image blocks ── */
.block-image-upload {
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}
.editor-dragover .block-image-upload,
.block-image-wrapper.drag-highlight .block-image-upload {
    border-color: rgba(99,102,241,0.5) !important;
    background: rgba(99,102,241,0.05) !important;
}

/* ── Block Overlay Close (image/music/poll remove) ── */
.block-overlay-close {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 32px; height: 32px; border-radius: 50%;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: all 0.15s ease;
    background: rgba(239,68,68,0.12); color: #ef4444;
}
.block-overlay-close:hover { background: rgba(239,68,68,0.25); color: #dc2626; transform: scale(1.1); }
.block-image-wrapper, .block-music-wrapper { position: relative; }
@media (hover: none) {
    .block-overlay-close { width: 36px; height: 36px; font-size: 16px; }
}

/* ── Poll Block (iframe-based) ── */
.block-poll-iframe {
    width: 100%;
    border: none;
    overflow: hidden;
    min-height: 220px;
    display: block;
    border-radius: 12px;
    background: transparent;
}
.editor-overlay.theme-dark [data-type="poll"] { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; }
.editor-overlay.theme-light [data-type="poll"] { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 14px; }
[data-type="poll"] { position: relative; }
[data-type="poll"] .block-overlay-close { top: 8px; right: 8px; }

/* ── NSFW 18+ overlay on images ── */
.nsfw-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.15);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-radius: 12px;
    cursor: pointer;
    transition: backdrop-filter 0.3s ease;
}
.nsfw-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(239,68,68,0.85);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(239,68,68,0.3);
    user-select: none;
}

/* ── Spoiler/Hidden Text Block ── */
.block-spoiler-wrapper {
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.2s;
}
.editor-overlay.theme-light .block-spoiler-wrapper {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}
.editor-overlay.theme-dark .block-spoiler-wrapper {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}
.block-spoiler-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}
.editor-overlay.theme-light .block-spoiler-header i { color: #9ca3af; }
.editor-overlay.theme-dark .block-spoiler-header i { color: rgba(255,255,255,0.3); }
.block-spoiler-title {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    padding: 4px 0;
}
.editor-overlay.theme-light .block-spoiler-title { color: #111; }
.editor-overlay.theme-light .block-spoiler-title::placeholder { color: #9ca3af; }
.editor-overlay.theme-dark .block-spoiler-title { color: #e5e5e5; }
.editor-overlay.theme-dark .block-spoiler-title::placeholder { color: rgba(255,255,255,0.25); }
.block-spoiler-content {
    min-height: 40px;
    font-size: 14px;
    line-height: 1.6;
    border-radius: 6px;
    padding: 8px 10px;
}
.editor-overlay.theme-light .block-spoiler-content {
    background: #fff;
    border: 1px dashed #d1d5db;
    color: #374151;
}
.editor-overlay.theme-dark .block-spoiler-content {
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

/* ── Music/Audio Block ── */
.block-music-wrapper {
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
}
.editor-overlay.theme-dark .block-music-wrapper { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); }
.editor-overlay.theme-light .block-music-wrapper { background: #f9fafb; border: 1px solid #e5e7eb; }

.block-music-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 16px;
    border-radius: 10px;
    border: 2px dashed rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.editor-overlay.theme-light .block-music-upload { border-color: #d1d5db; }
.block-music-upload:hover { border-color: #6366f1; background: rgba(99,102,241,0.04); }
.block-music-upload i { font-size: 24px; }
.editor-overlay.theme-dark .block-music-upload i { color: rgba(255,255,255,0.3); }
.editor-overlay.theme-light .block-music-upload i { color: rgba(0,0,0,0.3); }
.block-music-upload span { font-size: 13px; }
.editor-overlay.theme-dark .block-music-upload span { color: rgba(255,255,255,0.5); }
.editor-overlay.theme-light .block-music-upload span { color: rgba(0,0,0,0.5); }
.block-music-hint { font-size: 11px !important; }
.editor-overlay.theme-dark .block-music-hint { color: rgba(255,255,255,0.25) !important; }
.editor-overlay.theme-light .block-music-hint { color: rgba(0,0,0,0.25) !important; }

.block-music-player {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.block-music-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.block-music-info > i { font-size: 18px; color: #6366f1; flex-shrink: 0; }
.block-music-title {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 0;
    outline: none;
}
.editor-overlay.theme-light .block-music-title { border-bottom-color: #d1d5db; color: #1f2937; }
.block-music-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.block-music-remove:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

.block-music-audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    outline: none;
}

/* ── Article Music Player (frontend) ── */
.article-music-player {
    border-radius: 14px;
    padding: 16px 20px;
    margin: 16px 0;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.article-music-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.article-music-info i {
    font-size: 18px;
    color: #6366f1;
}
.article-music-title {
    font-size: 14px;
    font-weight: 600;
    color: #e5e5e5;
}
.article-music-player audio {
    width: 100%;
    height: 36px;
    border-radius: 8px;
}

/* ── Portrait Image: Cinematic Blur Letterbox ── */
.block-image-container.portrait-blur {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 440px;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
}
.block-image-container.portrait-blur::before {
    content: '';
    position: absolute;
    inset: -20px;
    background-image: var(--bg-url);
    background-size: cover;
    background-position: center;
    filter: blur(28px) brightness(0.55) saturate(1.4);
    z-index: 0;
    transform: scale(1.15);
}
.block-image-container.portrait-blur .block-image-preview {
    position: relative;
    z-index: 1;
    width: auto;
    max-width: 55%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.block-image-container.portrait-blur .block-image-actions {
    z-index: 2;
}

/* ── Batch delete UI in list modal ── */
.editor-list-checkbox { display: flex; align-items: center; flex-shrink: 0; }
.editor-list-checkbox input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: #7c3aed; cursor: pointer;
    border-radius: 4px;
}
.editor-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: default; transition: background 0.15s; }
.editor-list-item:hover { background: rgba(255,255,255,0.04); }
.editor-list-item-clickable { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }

.editor-list-batch-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 8px; border: none;
    background: rgba(239,68,68,0.15); color: #ef4444;
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: var(--font-body); transition: all 0.15s;
}
.editor-list-batch-btn:hover { background: rgba(239,68,68,0.25); }

.editor-list-select-all {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: rgba(255,255,255,0.4); cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
}
.editor-list-select-all:hover { color: rgba(255,255,255,0.7); }
.editor-list-select-all input { accent-color: #7c3aed; cursor: pointer; }

/* ── Topic item highlight (keyboard navigation) ── */
.editor-topic-item.highlight {
    outline: none;
}
.editor-overlay.theme-dark .editor-topic-item.highlight { background: rgba(255,255,255,0.08); color: #fff; }
.editor-overlay.theme-light .editor-topic-item.highlight { background: rgba(0,0,0,0.06); color: #111; }

/* ── Image upload hint ── */
.block-image-hint {
    font-size: 11px;
    margin-top: 2px;
    opacity: 0.35;
}

/* ── Custom Link Dialog ── */
.editor-link-dialog-overlay {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.editor-link-dialog-overlay.active {
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
}
.editor-link-dialog-box {
    width: 380px;
    max-width: 90%;
    border-radius: 16px;
    padding: 28px 24px 20px;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(.4,0,.2,1);
}
.editor-link-dialog-overlay.active .editor-link-dialog-box {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.editor-overlay.theme-dark .editor-link-dialog-box {
    background: #1c1c20;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.editor-overlay.theme-light .editor-link-dialog-box {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.editor-link-dialog-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}
.editor-overlay.theme-dark .editor-link-dialog-title { color: #e5e5e5; }
.editor-overlay.theme-light .editor-link-dialog-title { color: #111; }

.editor-link-dialog-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    font-family: var(--font-body);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}
.editor-overlay.theme-dark .editor-link-dialog-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e5e5e5;
}
.editor-overlay.theme-dark .editor-link-dialog-input:focus {
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}
.editor-overlay.theme-light .editor-link-dialog-input {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #111;
}
.editor-overlay.theme-light .editor-link-dialog-input:focus {
    border-color: rgba(0,0,0,0.2);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.editor-link-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}
.editor-link-dialog-cancel,
.editor-link-dialog-ok {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.15s ease;
}
.editor-link-dialog-cancel {
    background: transparent;
}
.editor-overlay.theme-dark .editor-link-dialog-cancel { color: rgba(255,255,255,0.4); }
.editor-overlay.theme-dark .editor-link-dialog-cancel:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
.editor-overlay.theme-light .editor-link-dialog-cancel { color: rgba(0,0,0,0.4); }
.editor-overlay.theme-light .editor-link-dialog-cancel:hover { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.7); }

.editor-link-dialog-ok {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
}
.editor-link-dialog-ok:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 2px 12px rgba(124,58,237,0.35);
}

/* ── Toolbar always visible ── */
.editor-toolbar-float {
    transition: opacity 0.35s cubic-bezier(.4,0,.2,1), transform 0.35s cubic-bezier(.4,0,.2,1);
}

/* ══════════ SMOOTH / JUICY ANIMATIONS ══════════ */

/* Overlay entrance — slide up + fade */
.editor-overlay {
    transition: opacity 0.45s cubic-bezier(.4,0,.2,1), visibility 0.45s;
}
.editor-overlay.active {
    animation: edOverlayIn 0.5s cubic-bezier(.16,1,.3,1) both;
}
@keyframes edOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Editor canvas entrance */
.editor-overlay.active .editor-canvas {
    animation: edCanvasIn 0.55s cubic-bezier(.16,1,.3,1) 0.1s both;
}
@keyframes edCanvasIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Topbar entrance */
.editor-overlay.active .editor-topbar {
    animation: edTopbarIn 0.45s cubic-bezier(.16,1,.3,1) 0.05s both;
}
@keyframes edTopbarIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toolbar float entrance */
.editor-overlay.active .editor-toolbar-float {
    animation: edToolbarIn 0.5s cubic-bezier(.16,1,.3,1) 0.2s both;
}
@keyframes edToolbarIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Block enter animation */
.editor-block {
    animation: edBlockIn 0.35s cubic-bezier(.16,1,.3,1) both;
}
@keyframes edBlockIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Image upload hover scale */
.block-image-upload {
    transition: background 0.2s ease, transform 0.15s ease;
}
.block-image-upload:hover {
    transform: scale(1.01);
}
.block-image-upload i {
    transition: transform 0.25s cubic-bezier(.16,1,.3,1);
}
.block-image-upload:hover i {
    transform: scale(1.12);
}

/* Image upload overlay */
.block-upload-overlay {
    position: absolute; inset: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    border-radius: 12px;
    animation: uploadOverlayIn 0.25s ease both;
}
@keyframes uploadOverlayIn { from { opacity: 0; } to { opacity: 1; } }
.block-upload-spinner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.block-upload-ring {
    width: 48px; height: 48px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: #818cf8;
    animation: uploadRingSpin 0.8s linear infinite;
}
@keyframes uploadRingSpin { to { transform: rotate(360deg); } }
.block-upload-pct { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums; }

/* Image preview load animation */
.block-image-preview {
    animation: edImgIn 0.4s cubic-bezier(.16,1,.3,1) both;
}
@keyframes edImgIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* Title — no underline on focus */

/* Block hover subtle highlight */
.editor-overlay.theme-light .editor-block:hover {
    background: rgba(0,0,0,0.01);
    border-radius: 8px;
}
.editor-overlay.theme-dark .editor-block:hover {
    background: rgba(255,255,255,0.01);
    border-radius: 8px;
}
.editor-block {
    transition: background 0.2s ease;
}

/* Topic dropdown open animation */
.editor-topic-dropdown.open {
    animation: edTopicDropIn 0.25s cubic-bezier(.16,1,.3,1);
}
@keyframes edTopicDropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Topic item hover transition */
.editor-topic-item {
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.editor-topic-item:active {
    transform: scale(0.98);
}

/* Format toolbar pop animation */
.editor-format-toolbar.visible {
    animation: edFormatIn 0.2s cubic-bezier(.16,1,.3,1);
}
@keyframes edFormatIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px) scale(0.95); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Format button press */
.format-btn {
    transition: all 0.12s ease, transform 0.1s ease;
}
.format-btn:active {
    transform: scale(0.9);
}

/* Toolbar button press */
.toolbar-btn {
    transition: all 0.15s ease, transform 0.1s ease;
}
.toolbar-btn:active {
    transform: scale(0.92);
}

/* Publish button press */
.toolbar-publish {
    transition: all 0.2s cubic-bezier(.16,1,.3,1), transform 0.12s ease;
}
.toolbar-publish:active {
    transform: translateY(0) scale(0.97);
}

/* Block controls fade in smoother */
.block-controls {
    transition: opacity 0.25s cubic-bezier(.4,0,.2,1);
}

/* Smooth scrollbar */
.editor-main {
    scroll-behavior: smooth;
}

/* Block editable focus — no visible glow */

/* Divider hover */
.block-divider {
    transition: background 0.25s ease;
}

/* Insert menu pop */
.block-insert-menu.open {
    animation: edMenuPop 0.25s cubic-bezier(.16,1,.3,1);
}
@keyframes edMenuPop {
    from { opacity: 0; transform: translateY(-6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Insert item press */
.block-insert-item {
    transition: background 0.12s ease, transform 0.1s ease;
}
.block-insert-item:active {
    transform: scale(0.98);
}

/* Drag placeholder pulse */
.editor-block-placeholder {
    animation: edPlaceholderPulse 1.5s ease-in-out infinite;
}
@keyframes edPlaceholderPulse {
    0%, 100% { border-color: rgba(0,0,0,0.1); }
    50% { border-color: rgba(0,0,0,0.25); }
}

/* Save status fade */
.editor-save-status {
    transition: color 0.3s ease, opacity 0.3s ease;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .write-article-btn span { display: none; }
    .write-article-btn { padding: 7px 10px; margin-right: 6px; }
    .editor-topbar { height: 44px; padding: 0 12px; }
    .editor-main { padding: 24px 16px 0; margin-bottom: 72px; }
    .editor-title { font-size: 24px; }
    .block-controls { left: -48px; flex-direction: column; }
    .editor-author-name { display: none; }
    .editor-toolbar-float { bottom: 16px; padding: 5px 6px; border-radius: 14px; }
    .toolbar-btn { width: 34px; height: 34px; font-size: 13px; }
    .toolbar-publish { padding: 7px 16px; font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.editor-toast-container {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 2000005;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 340px;
}
.editor-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-body, system-ui);
    pointer-events: auto;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    transform: translateX(40px) scale(0.95);
    transition: opacity 0.35s cubic-bezier(.16,1,.3,1), transform 0.35s cubic-bezier(.16,1,.3,1);
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    cursor: default;
}
.editor-toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}
.editor-toast.hide {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
}
.editor-toast i {
    font-size: 16px;
    flex-shrink: 0;
}
.editor-toast span {
    line-height: 1.35;
}
.editor-toast-success {
    background: rgba(16, 185, 129, 0.92);
    color: #fff;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.editor-toast-error {
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.editor-toast-warning {
    background: rgba(245, 158, 11, 0.92);
    color: #fff;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.editor-toast-info {
    background: rgba(59, 130, 246, 0.92);
    color: #fff;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   CONFIRM DIALOG
   ══════════════════════════════════════════════════════════════ */
.editor-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000005;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.editor-confirm-overlay.active {
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
}
.editor-confirm-box {
    width: 360px;
    max-width: 88vw;
    border-radius: 18px;
    padding: 32px 28px 24px;
    text-align: center;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(.16,1,.3,1), transform 0.3s cubic-bezier(.16,1,.3,1);
}
.editor-confirm-overlay.active .editor-confirm-box {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.editor-confirm-icon {
    font-size: 28px;
    margin-bottom: 14px;
    display: block;
    opacity: 0.7;
}
.editor-confirm-message {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 22px;
}
.editor-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.editor-confirm-cancel,
.editor-confirm-ok {
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body, system-ui);
    transition: all 0.15s ease;
    min-width: 90px;
}
.editor-confirm-cancel {
    background: transparent;
}
.editor-confirm-cancel:hover {
    opacity: 0.85;
}
.editor-confirm-ok {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}
.editor-confirm-ok:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.editor-confirm-ok.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}
.editor-confirm-ok.danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 16px rgba(239,68,68,0.3);
}
/* Light theme */
.editor-overlay.theme-light .editor-confirm-box,
body .editor-confirm-box {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 20px 60px rgba(0,0,0,0.14);
    color: #111;
}
body .editor-confirm-cancel { color: #6b7280; }
body .editor-confirm-cancel:hover { background: #f3f4f6; }
body .editor-confirm-icon { color: #6b7280; }
/* Dark theme */
.editor-overlay.theme-dark .editor-confirm-box {
    background: #1c1c20;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    color: #e5e5e5;
}
.editor-overlay.theme-dark .editor-confirm-cancel { color: rgba(255,255,255,0.45); }
.editor-overlay.theme-dark .editor-confirm-cancel:hover { background: rgba(255,255,255,0.06); }
.editor-overlay.theme-dark .editor-confirm-icon { color: rgba(255,255,255,0.5); }

/* ══════════════════════════════════════════════════════════════
   LINK PREVIEW CARD (in editor)
   ══════════════════════════════════════════════════════════════ */
.block-link-preview {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    margin: 4px 0;
}
.block-link-preview:hover {
    transform: translateY(-1px);
}
.editor-overlay.theme-light .block-link-preview {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    color: #111;
}
.editor-overlay.theme-light .block-link-preview:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-color: #d1d5db;
}
.editor-overlay.theme-dark .block-link-preview {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: #e5e5e5;
}
.editor-overlay.theme-dark .block-link-preview:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.15);
}
.link-preview-image {
    width: 100%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(0,0,0,0.3);
}
.link-preview-image img {
    width: 100%;
    display: block;
    max-height: 260px;
    object-fit: contain;
}
.link-preview-body {
    flex: 1;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}
.link-preview-body.link-preview-minimal {
    padding: 18px 20px;
}
.link-preview-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.editor-overlay.theme-light .link-preview-title { color: #111; }
.editor-overlay.theme-dark .link-preview-title { color: #f5f5f5; }
.link-preview-desc {
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.editor-overlay.theme-light .link-preview-desc { color: #6b7280; }
.editor-overlay.theme-dark .link-preview-desc { color: rgba(255,255,255,0.45); }
.link-preview-url {
    word-break: break-all;
    -webkit-line-clamp: 1;
}
.link-preview-domain {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-top: 2px;
}
.editor-overlay.theme-light .link-preview-domain { color: #9ca3af; }
.editor-overlay.theme-dark .link-preview-domain { color: rgba(255,255,255,0.3); }
.link-preview-domain i {
    font-size: 10px;
}
.link-preview-favicon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    object-fit: contain;
}

/* Internal article badge */
.link-preview-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
    margin-bottom: 2px;
}
.editor-overlay.theme-light .link-preview-badge {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}
.editor-overlay.theme-dark .link-preview-badge {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}
/* Internal article card accent */
.editor-overlay.theme-light .link-preview-internal {
    border-left: 3px solid rgba(124, 58, 237, 0.3);
}
.editor-overlay.theme-dark .link-preview-internal {
    border-left: 3px solid rgba(139, 92, 246, 0.3);
}

/* ── YouTube preview in editor ── */
.block-yt-preview {
    cursor: default !important;
    background: #0d0d0d !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 10px !important;
    overflow: hidden;
}
.block-yt-preview:hover { transform: none !important; }
.yt-editor-thumb {
    position: relative;
    line-height: 0;
}
.yt-editor-play-badge {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(220, 30, 30, 0.88);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px; padding-left: 3px;
    pointer-events: none;
    box-shadow: 0 3px 16px rgba(0,0,0,0.5);
}
.yt-editor-title {
    padding: 9px 14px 10px;
    font-size: 13px; font-weight: 600;
    color: rgba(255,255,255,0.75);
    line-height: 1.4;
    background: #0d0d0d;
}

/* ── Chapter editing mode ─────────────────────────────────────────────── */
.editor-chapter-mode .editor-dual-bar,
.editor-chapter-mode #editor-topic-trigger,
.editor-chapter-mode .editor-impersonate-btn,
.editor-chapter-mode .editor-menu-schedule,
.editor-chapter-mode .editor-menu-nsfw,
.editor-chapter-mode .editor-menu-official,
.editor-chapter-mode .editor-menu-delete,
.editor-chapter-mode .toolbar-publish-both {
    display: none !important;
}

/* ── Block indent (красная строка) ──────────────────────────────────── */
.editor-block[data-indent="1"] .block-editable {
    text-indent: 1.5em;
}

/* ── Hyperlinks in editor ──────────────────────────────────────────── */
.editor-overlay .block-editable a[href] {
    color: #818cf8;
    text-decoration: none;
    border-bottom: 1px solid rgba(129,140,248,0.4);
    padding: 0 1px;
    border-radius: 2px;
    transition: background 0.15s, border-color 0.15s;
    cursor: text;
}
.editor-overlay .block-editable a[href]:hover {
    background: rgba(129,140,248,0.08);
    border-bottom-color: rgba(129,140,248,0.7);
}
.editor-overlay.theme-light .block-editable a[href] {
    color: #4f46e5;
    border-bottom-color: rgba(79,70,229,0.3);
}
.editor-overlay.theme-light .block-editable a[href]:hover {
    background: rgba(79,70,229,0.06);
    border-bottom-color: rgba(79,70,229,0.6);
}

/* ── Wiki superlinks in editor ──────────────────────────────────────── */
.editor-overlay .wiki-superlink {
    color: #22d3ee;
    border-bottom: 1px dashed rgba(34,211,238,0.4);
    padding: 0 1px;
    border-radius: 2px;
    cursor: text;
    position: relative;
    transition: background 0.15s, border-color 0.15s;
}
.editor-overlay .wiki-superlink:hover {
    background: rgba(34,211,238,0.06);
    border-bottom-color: rgba(34,211,238,0.7);
}
.editor-overlay .wiki-superlink::before {
    content: '\f02d';
    font-family: 'Font Awesome 5 Free', 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 8px;
    vertical-align: super;
    margin-right: 1px;
    opacity: 0.5;
}
.editor-overlay.theme-light .wiki-superlink {
    color: #0891b2;
    border-bottom-color: rgba(8,145,178,0.35);
}
.editor-overlay.theme-light .wiki-superlink:hover {
    background: rgba(8,145,178,0.06);
    border-bottom-color: rgba(8,145,178,0.6);
}

/* ── Link badge popup ─────────────────────────────────────────────── */
.editor-link-badge {
    position: fixed;
    z-index: 10000010;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    max-width: 400px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
    background: rgba(22,16,42,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    color: rgba(255,255,255,0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.editor-link-badge.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.editor-link-badge-info {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.editor-link-badge-info i {
    font-size: 10px;
    opacity: 0.6;
    flex-shrink: 0;
}
.editor-link-badge-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}
.editor-link-badge-open {
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    padding: 3px 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}
.editor-link-badge-open:hover {
    color: #818cf8;
    background: rgba(129,140,248,0.12);
}
.editor-link-badge-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    padding: 3px 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.editor-link-badge-remove:hover {
    color: #f87171;
    background: rgba(248,113,113,0.12);
}
/* Light theme */
.editor-overlay.theme-light .editor-link-badge {
    background: rgba(255,255,255,0.97);
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    color: #374151;
}
.editor-overlay.theme-light .editor-link-badge-open { color: rgba(0,0,0,0.4); }
.editor-overlay.theme-light .editor-link-badge-open:hover { color: #4f46e5; background: rgba(79,70,229,0.08); }
.editor-overlay.theme-light .editor-link-badge-remove { color: rgba(0,0,0,0.35); }
.editor-overlay.theme-light .editor-link-badge-remove:hover { color: #dc2626; background: rgba(220,38,38,0.08); }

/* ── Wiki items in dialog ──────────────────────────────────────────── */
.editor-wiki-item {
    transition: background 0.15s;
}
.editor-overlay.theme-dark .editor-wiki-item {
    color: #e5e5e5;
}
.editor-overlay.theme-light .editor-wiki-item {
    color: #1f2937;
}
.editor-wiki-item:hover {
    background: rgba(255,255,255,0.06);
}
.editor-overlay.theme-light .editor-wiki-item:hover {
    background: rgba(0,0,0,0.04);
}
/* "Nothing found" text in wiki dialog */
.editor-overlay.theme-light #editor-wiki-list {
    color: #374151;
}

/* ═══════════════════════════════════════════════════════════════════════
   EDITOR TOPIC MODAL (mobile — centered overlay)
   ═══════════════════════════════════════════════════════════════════════ */
.etm-wrap {
    position: fixed;
    inset: 0;
    z-index: 2000010;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.etm-wrap.etm-visible {
    opacity: 1;
    pointer-events: auto;
}
.etm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}
.etm-card {
    position: relative;
    width: min(340px, 88vw);
    max-height: 72vh;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.93) translateY(14px);
    transition: transform 0.28s cubic-bezier(.16, 1, .3, 1);
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.55);
    background: #1c1c22;
}
[data-theme="light"] .etm-card {
    background: #ffffff;
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.2);
}
.etm-wrap.etm-visible .etm-card {
    transform: scale(1) translateY(0);
}
.etm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
[data-theme="light"] .etm-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}
.etm-title {
    font-size: 15px;
    font-weight: 700;
    color: #e8e8e8;
    letter-spacing: 0.01em;
}
[data-theme="light"] .etm-title {
    color: #111;
}
.etm-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 6px;
    line-height: 1;
    font-size: 14px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}
.etm-close:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.07);
}
[data-theme="light"] .etm-close {
    color: rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .etm-close:hover {
    color: rgba(0, 0, 0, 0.7);
    background: rgba(0, 0, 0, 0.06);
}
.etm-search-wrap {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}
[data-theme="light"] .etm-search-wrap {
    border-bottom-color: rgba(0, 0, 0, 0.07);
}
.etm-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.28);
    pointer-events: none;
}
[data-theme="light"] .etm-search-icon {
    color: rgba(0, 0, 0, 0.28);
}
.etm-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 9px;
    padding: 8px 10px 8px 30px;
    font-size: 13px;
    color: #e5e5e5;
    outline: none;
    font-family: var(--font-body, inherit);
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.etm-search:focus {
    border-color: rgba(168, 85, 247, 0.45);
}
[data-theme="light"] .etm-search {
    background: #f3f4f6;
    border-color: rgba(0, 0, 0, 0.09);
    color: #111;
}
[data-theme="light"] .etm-search:focus {
    border-color: rgba(109, 40, 217, 0.4);
}
.etm-list {
    overflow-y: auto;
    padding: 6px;
    flex: 1;
    overscroll-behavior: contain;
}
.etm-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    transition: background 0.13s, color 0.13s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.etm-item:active {
    background: rgba(255, 255, 255, 0.05);
}
[data-theme="light"] .etm-item {
    color: #444;
}
[data-theme="light"] .etm-item:active {
    background: rgba(0, 0, 0, 0.04);
}
.etm-item.etm-active {
    background: rgba(168, 85, 247, 0.13);
    color: #c084fc;
    font-weight: 600;
}
[data-theme="light"] .etm-item.etm-active {
    background: rgba(109, 40, 217, 0.08);
    color: #6d28d9;
}
.etm-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.etm-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.etm-check {
    font-size: 12px;
    color: #a78bfa;
    flex-shrink: 0;
}
[data-theme="light"] .etm-check {
    color: #6d28d9;
}
