/* ═══════════════════════════════════════════════════════════════════
   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);
}
.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: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(.4,0,.2,1), visibility 0.4s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.editor-overlay.active { opacity: 1; visibility: visible; }
.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); }

.editor-close-top {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
}
.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;
}
.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; }

/* 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;
}
.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; }

/* 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: 24px;
    background: transparent;
    min-height: 44px;
}
.editor-overlay.theme-dark .editor-title { color: #e5e5e5; }
.editor-overlay.theme-dark .editor-title::placeholder { color: rgba(255,255,255,0.12); }
.editor-overlay.theme-light .editor-title { color: #111; }
.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: -20px; margin-bottom: 16px; opacity: 0.3;
    transition: opacity 0.2s, color 0.2s;
}
.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; }

.editor-block {
    position: relative;
    margin: 2px 0;
    padding: 3px 0;
    border-radius: 6px;
}
.editor-block:hover .block-controls { opacity: 1; }

/* Block controls — far left */
.block-controls {
    position: absolute;
    left: -100px;
    top: 4px;
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.2s;
}
.block-ctrl-btn {
    width: 26px; height: 26px; border-radius: 7px; border: none;
    background: transparent; font-size: 11px; 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.15); }
.editor-overlay.theme-dark .block-ctrl-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5); }
.editor-overlay.theme-light .block-ctrl-btn { color: rgba(0,0,0,0.15); }
.editor-overlay.theme-light .block-ctrl-btn:hover { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.5); }
.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.08) !important; }

/* Block editable content */
.block-editable {
    width: 100%; min-height: 24px; outline: none;
    line-height: 1.75; font-size: 16px; word-break: break-word;
}
.editor-overlay.theme-dark .block-editable { color: rgba(255,255,255,0.7); caret-color: #e5e5e5; }
.editor-overlay.theme-light .block-editable { color: #374151; caret-color: #111; }
/* Placeholder on focused empty block */
.block-editable:empty:focus::before { content: attr(data-placeholder); pointer-events: none; }
.editor-overlay.theme-dark .block-editable:empty:focus::before { color: rgba(255,255,255,0.12); }
.editor-overlay.theme-light .block-editable:empty:focus::before { color: rgba(0,0,0,0.2); }
/* Empty block indicator (unfocused) — subtle dotted line */
.block-editable:empty:not(:focus) {
    min-height: 28px;
    position: relative;
}
.block-editable:empty:not(:focus)::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    pointer-events: none;
}
.editor-overlay.theme-dark .block-editable:empty:not(:focus)::before { background: rgba(255,255,255,0.04); }
.editor-overlay.theme-light .block-editable:empty:not(:focus)::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: underline; }

/* 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; }
.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: 8px; background: transparent; font-family: var(--font-body); }
.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: absolute; display: none; border-radius: 10px; padding: 4px;
    gap: 2px; z-index: 300; 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: 10002;
    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: 10003;
    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: 10001;
    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: 80vh;
    overflow: hidden; display: flex; flex-direction: column;
    animation: edSlideUp 0.3s ease-out;
}
@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: inline-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;
}
.block-image-container:hover .block-image-actions { opacity: 1; }

.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); }

/* 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; }

/* ── 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 ── */
.focus-picker-overlay {
    position: absolute; inset: 0; z-index: 10;
    background: rgba(0,0,0,0.45); border-radius: 12px;
    cursor: crosshair; display: flex;
    flex-direction: column; align-items: center; justify-content: flex-start;
    animation: focusPickerIn 0.2s ease;
}
@keyframes focusPickerIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.focus-picker-hint {
    margin-top: 12px; padding: 6px 14px;
    background: rgba(0,0,0,0.7); color: #fff;
    font-size: 12px; border-radius: 20px;
    backdrop-filter: blur(10px); pointer-events: none;
    letter-spacing: 0.3px;
}
.focus-picker-crosshair {
    position: absolute; width: 28px; height: 28px;
    margin-left: -14px; margin-top: -14px;
    border: 2px solid #fff; border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.4), inset 0 0 0 2px rgba(0,0,0,0.3);
    pointer-events: none; transition: left 0.15s ease, top 0.15s ease;
}
.focus-picker-crosshair::before {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 6px; height: 6px; margin: -3px 0 0 -3px;
    background: #fff; border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}
.focus-picker-done {
    position: absolute; bottom: 12px; right: 12px;
    padding: 6px 16px; border: none; border-radius: 8px;
    background: rgba(99,102,241,0.9); color: #fff;
    font-size: 13px; font-weight: 600; cursor: pointer;
    backdrop-filter: blur(10px); transition: background 0.2s, transform 0.15s;
}
.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;
}

/* ── Poll Block ── */
.block-poll-wrapper {
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s ease;
    position: relative;
    z-index: 1;
    list-style: none;
}
.editor-overlay.theme-dark .block-poll-wrapper { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); }
.editor-overlay.theme-light .block-poll-wrapper { background: #f9fafb; border: 1px solid #e5e7eb; }

.block-poll-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.block-poll-header i { font-size: 16px; flex-shrink: 0; }
.editor-overlay.theme-dark .block-poll-header i { color: rgba(255,255,255,0.25); }
.editor-overlay.theme-light .block-poll-header i { color: rgba(0,0,0,0.25); }

.block-poll-question {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body);
    background: transparent;
    padding: 4px 0;
}
.editor-overlay.theme-dark .block-poll-question { color: #e5e5e5; }
.editor-overlay.theme-dark .block-poll-question::placeholder { color: rgba(255,255,255,0.15); }
.editor-overlay.theme-light .block-poll-question { color: #111; }
.editor-overlay.theme-light .block-poll-question::placeholder { color: rgba(0,0,0,0.25); }

.block-poll-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.block-poll-option {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    padding: 8px 12px;
    transition: background 0.15s ease;
}
.editor-overlay.theme-dark .block-poll-option { background: rgba(255,255,255,0.03); }
.editor-overlay.theme-light .block-poll-option { background: #fff; border: 1px solid #e5e7eb; }

.poll-opt-num {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}
.editor-overlay.theme-dark .poll-opt-num { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.3); }
.editor-overlay.theme-light .poll-opt-num { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.3); }

.block-poll-option input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--font-body);
    background: transparent;
    padding: 2px 0;
}
.editor-overlay.theme-dark .block-poll-option input { color: #e5e5e5; }
.editor-overlay.theme-dark .block-poll-option input::placeholder { color: rgba(255,255,255,0.15); }
.editor-overlay.theme-light .block-poll-option input { color: #333; }
.editor-overlay.theme-light .block-poll-option input::placeholder { color: rgba(0,0,0,0.2); }

.poll-opt-remove {
    width: 22px; height: 22px;
    border: none; background: transparent;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px;
    opacity: 0;
    transition: all 0.15s ease;
}
.block-poll-option:hover .poll-opt-remove { opacity: 1; }
.editor-overlay.theme-dark .poll-opt-remove { color: rgba(255,255,255,0.3); }
.editor-overlay.theme-dark .poll-opt-remove:hover { color: #ef4444; background: rgba(239,68,68,0.12); }
.editor-overlay.theme-light .poll-opt-remove { color: rgba(0,0,0,0.25); }
.editor-overlay.theme-light .poll-opt-remove:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

.block-poll-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.block-poll-add-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.15s ease;
}
.editor-overlay.theme-dark .block-poll-add-option { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.5); }
.editor-overlay.theme-dark .block-poll-add-option:hover { background: rgba(255,255,255,0.08); color: #fff; }
.editor-overlay.theme-light .block-poll-add-option { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.5); }
.editor-overlay.theme-light .block-poll-add-option:hover { background: rgba(0,0,0,0.07); color: #111; }

.block-poll-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}
.editor-overlay.theme-dark .block-poll-toggle { color: rgba(255,255,255,0.35); }
.editor-overlay.theme-light .block-poll-toggle { color: rgba(0,0,0,0.4); }
.block-poll-toggle input[type="checkbox"] {
    width: 14px; height: 14px;
    accent-color: #7c3aed;
    cursor: pointer;
    border-radius: 3px;
}

/* ── 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);
}

/* ── 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 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;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.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: 100000;
    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 { display: none !important; max-height: 0 !important; overflow: hidden !important; }
.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);
}
