* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #fff;
    --fg: #000;
    --muted: #79828B;
    --border: #e0e0e0;
    --panel: #f5f5f5;
    --tooltip-bg: #292927;
    --tooltip-panel: #3a3a38;
    --tooltip-hover: #4f4f4d;
}

body.theme-dark {
    --bg: #0f1115;
    --fg: #f2f3f5;
    --muted: #a2a9b1;
    --border: rgba(255,255,255,0.12);
    --panel: rgba(255,255,255,0.06);
    --tooltip-bg: #1e1f24;
    --tooltip-panel: #2a2c33;
    --tooltip-hover: #3a3d46;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
    min-height: 100vh;
}

.page {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.field-row {
    width: 100%;
}

.field {
    width: 100%;
    border: none;
    outline: none;
    font-family: inherit;
    background: transparent;
    padding: 0;
    margin: 0;
}

.field-title {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    height: 48px;
}

.field-title::placeholder {
    color: #aaa;
    font-weight: 400;
}

.field-author {
    color: var(--muted);
    font-size: 16px;
    height: 24px;
}

.field-author::placeholder {
    color: #ccc;
}

.field-story {
    color: #000;
    font-size: 18px;
    height: 27px;
}

.field-story::placeholder {
    color: #aaa;
}

.editor-content {
    font-size: 18px;
    line-height: 1.7;
    min-height: 300px;
    outline: none;
    margin: 0;
    padding: 0;
}

.editor-content:empty:before {
    content: "";
}

.action-row {
    margin-top: 30px;
    text-align: left;
}

.btn-publish {
    background: white;
    border: 2px solid #000;
    padding: 8px 30px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.btn-publish:hover {
    background: #000;
    color: #fff;
}

body.view-mode .field-row {
    display: none;
}

body.view-mode .article-view {
    display: block;
}

.editor-content b, .editor-content strong {
    font-weight: 700;
}

.editor-content i, .editor-content em {
    font-style: italic;
}

.editor-content a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.3);
}

.theme-dark .editor-content a {
    border-bottom-color: rgba(255,255,255,0.28);
}

.editor-content a:hover {
    border-bottom-color: #000;
}

.theme-dark .editor-content a:hover {
    border-bottom-color: rgba(255,255,255,0.5);
}

.editor-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 18px 0 9px;
}

.editor-content blockquote {
    margin: 18px 0 16px;
    padding-left: 15px;
    border-left: 3px solid #000;
    font-style: italic;
}

.format-tooltip {
    position: fixed;
    background: var(--tooltip-bg);
    border-radius: 8px;
    padding: 8px 12px;
    display: none;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.format-tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

.format-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 30px;
}

.format-btn:hover {
    background: #3f3f3d;
}

.block-tooltip {
    position: fixed;
    background: #292927;
    border-radius: 8px;
    padding: 8px 12px;
    display: none;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
}

.block-tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

.block-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.block-btn:hover {
    background: #3f3f3d;
}

.format-btn.active {
    background: #3f3f3d;
    color: #fff;
}

.editor-content b, .editor-content strong {
    font-weight: 700;
}

.editor-content i, .editor-content em {
    font-style: italic;
}

.editor-content a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.3);
}

.editor-content a:hover {
    border-bottom-color: #000;
}

.editor-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 18px 0 9px;
}

.editor-content blockquote {
    margin: 18px 0 16px;
    padding-left: 15px;
    border-left: 3px solid #000;
    font-style: italic;
}

.format-tooltip {
    position: fixed;
    background: #292927;
    border-radius: 8px;
    padding: 8px 12px;
    display: none;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.format-tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

.format-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 30px;
}

.format-btn:hover {
    background: #3f3f3d;
}

.format-btn.active {
    background: #3f3f3d;
}

.block-tooltip {
    position: fixed;
    background: #292927;
    border-radius: 8px;
    padding: 8px 12px;
    display: none;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
}

.block-tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

.block-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.block-btn:hover {
    background: #3f3f3d;
}

.block-tooltip {
    position: fixed;
    background: #292927;
    border-radius: 8px;
    padding: 8px 12px;
    display: none;
    gap: 8px;
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.block-tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

.block-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 40px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.block-btn:hover {
    background: #3f3f3d;
}

.editor-content figure {
    margin: 20px 0;
    text-align: center;
}

.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.editor-content .video-wrapper {
    position: relative;
    padding-bottom: 56.25%; 
    overflow: hidden;
    max-width: 100%;
    margin: 20px 0;
}

.editor-content .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

body.view-mode .field-row input,
body.view-mode .editor-content[contenteditable="true"] {
    pointer-events: none;
    background: transparent;
}

body.view-mode .current-line-buttons,
body.view-mode #format-tooltip {
    display: none !important;
}

body.view-mode .btn-publish {
    display: inline-block;
}

.editor-content {
    font-size: 18px;
    line-height: 1.7;
    min-height: 300px;
    outline: none;
    margin: 0;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
}

.editor-content p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    margin: 0 0 1em 0;
    max-width: 100%;
    position: relative;
}

.article-content {
    font-size: 18px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.article-content p {
    margin: 0 0 1em 0;
}

.view-area .content blockquote {
    margin: 18px 0 16px;
    padding-left: 15px;
    border-left: 3px solid #000;
    font-style: italic;
}

.view-area .content blockquote.quote-alt {
    border-left: none;
    padding-left: 0;
    padding: 12px 14px;
    background: rgba(0,0,0,0.04);
    border-radius: 10px;
    color: inherit;
    font-style: normal;
}

.theme-dark .view-area .content blockquote.quote-alt {
    background: rgba(255,255,255,0.06);
}

.editor blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 3px solid #ddd;
    color: #666;
    font-style: italic;
}

.theme-dark .editor blockquote {
    border-left-color: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.75);
}

/* Якоря для заголовков */
.anchor-link {
    opacity: 0;
    margin-left: 8px;
    text-decoration: none;
    color: inherit;
    border-bottom: none !important;
    font-weight: 600;
}

h1:hover .anchor-link,
h2:hover .anchor-link,
h3:hover .anchor-link {
    opacity: 0.55;
}

.anchor-link:hover {
    opacity: 0.9 !important;
}


.editor ul, .editor ol {
    margin: 0.5em 0 1em 1.5em;
    padding-left: 0;
}

.editor li {
    margin-bottom: 0.25em;
}

.editor hr {
    border: none;
    border-top: 2px solid #ddd;
    margin: 30px 0;
    clear: both;
}

.editor u {
    text-decoration: underline;
}

.view-area .content ul,
.view-area .content ol {
    margin: 1em 0 1em 1.5em;
}

.view-area .content hr {
    border: none;
    border-top: 2px solid #ddd;
    margin: 30px 0;
}

.custom-notification {
    cursor: pointer;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
}

.custom-notification:hover {
    filter: brightness(1.1);
    transform: translateX(0) scale(1.02) !important;
}

#report-popup {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#report-popup > div {
    animation: slideUp 0.3s ease;
}

/* Тёмная тема: попап жалобы */
body.theme-dark #report-popup > div {
    background: var(--bg) !important;
    color: var(--fg) !important;
    border: 1px solid var(--border);
}

body.theme-dark #report-popup select,
body.theme-dark #report-popup textarea {
    background: rgba(255,255,255,0.04);
    color: var(--fg);
    border-color: var(--border) !important;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.report-footer button {
    transition: all 0.2s ease;
}

.report-footer button:hover {
    background: #f0f0f0 !important;
    border-color: #999 !important;
    color: #333 !important;
}

#report-popup select,
#report-popup textarea {
    font-family: inherit;
    transition: border-color 0.2s ease;
}

#report-popup select:focus,
#report-popup textarea:focus {
    outline: none;
    border-color: #292927 !important;
    box-shadow: 0 0 0 2px rgba(41,41,39,0.1);
}

#report-popup button {
    transition: all 0.2s ease;
}

#report-popup button:hover {
    filter: brightness(1.1);
}

#report-popup button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#sticky-buttons {
    transition: all 0.3s ease;
    will-change: transform, box-shadow;
}

/* Sticky-панель: используем native position: sticky (без мерцания и прыжков) */
body.edit-mode #sticky-buttons {
    position: sticky !important;
    top: 0;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    background-color: var(--panel) !important;
    border-color: var(--border) !important;
    backdrop-filter: blur(10px);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Кнопка темы */
.theme-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 9000;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--fg);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.theme-toggle:active {
    transform: translateY(1px);
}

.edit-area.sticky-active .field-title,
.edit-area.sticky-active .field-author {
    transition: margin-top 0.3s ease;
}

@media (max-width: 768px) {
    #sticky-buttons {
        padding: 10px !important;
    }
    
    #sticky-buttons .buttons-row {
        gap: 5px;
    }
    
    #sticky-buttons a {
        padding: 6px 12px !important;
        font-size: 14px !important;
    }
}

.site-footer {
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.site-footer button:hover,
.site-footer a:hover {
    background: #e0e0e0 !important;
    border-color: #999 !important;
    color: #333 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.site-footer button:active,
.site-footer a:active {
    transform: translateY(0);
    box-shadow: none;
}

@media (max-width: 600px) {
    .site-footer > div {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .site-footer .report-buttons {
        width: 100%;
        justify-content: center;
    }
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
}

















