:root {
    --site-bg: #010409;
    --site-text: #ffffff;
    --site-accent: #2f8cff;
    --site-accent-soft: rgba(47, 140, 255, 0.25);
    --site-accent-faint: rgba(47, 140, 255, 0.15);
    --site-accent-glow: rgba(47, 140, 255, 0.05);
    --site-bottom-glow: rgba(47, 140, 255, 0.2);
}

body[data-site-theme="black"] {
    --site-bg: #000000;
}

body[data-site-theme="white"] {
    --site-bg: #F5F7FA;
    --site-text: #111827;
    --site-accent: #2563EB;
    --site-accent-soft: rgba(37, 99, 235, 0.14);
    --site-accent-faint: rgba(37, 99, 235, 0.08);
    --site-accent-glow: rgba(37, 99, 235, 0.04);
    --site-bottom-glow: rgba(37, 99, 235, 0.10);

    --card-analytics-bg: #FFFFFF;
}

body[data-site-theme="white"] .analytics-title,
body[data-site-theme="white"] .analytics-toolbar h2,
body[data-site-theme="white"] .analytics-card__title,
body[data-site-theme="white"] .analytics-card__title a,
body[data-site-theme="white"] .analytics-create-form__section-head h4,
body[data-site-theme="white"] .analytics-compose-box__header label,
body[data-site-theme="white"] .analytics-section-card__header h4 {
    color: #111827;
}

body[data-site-theme="white"] .analytics-subtitle,
body[data-site-theme="white"] .analytics-toolbar p,
body[data-site-theme="white"] .category-group-title,
body[data-site-theme="white"] .analytics-card__excerpt,
body[data-site-theme="white"] .analytics-create-form__section-head p,
body[data-site-theme="white"] .analytics-compose-box__header p,
body[data-site-theme="white"] .analytics-section-card__header p,
body[data-site-theme="white"] .analytics-cover-upload__filename,
body[data-site-theme="white"] .analytics-color-field__hint {
    color: #6B7280;
}

body[data-site-theme="white"] .analytics-search input {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #111827;
}

body[data-site-theme="white"] .analytics-search input::placeholder {
    color: #9CA3AF;
}

body[data-site-theme="white"] .analytics-search input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

body[data-site-theme="white"] .category-btn {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #374151;
}

body[data-site-theme="white"] .category-btn:hover {
    border-color: rgba(37, 99, 235, 0.35);
    color: #2563EB;
    background: #F8FAFC;
}

body[data-site-theme="white"] .category-btn.active {
    background: #2563EB;
    border-color: #2563EB;
    color: #FFFFFF !important;
}

body[data-site-theme="white"] .analytics-card {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

body[data-site-theme="white"] .analytics-card:hover {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.10);
}

body[data-site-theme="white"] .analytics-meta-chip {
    background: #F3F4F6;
    color: #6B7280;
}

body[data-site-theme="white"] .analytics-stat__label {
    color: #9CA3AF;
}

body[data-site-theme="white"] .analytics-stat__value {
    color: #111827;
}

body[data-site-theme="white"] .analytics-card__button {
    background: rgba(37, 99, 235, 0.10);
    color: #2563EB;
}

body[data-site-theme="white"] .analytics-card__button:hover {
    background: #2563EB;
    color: #FFFFFF;
}

body[data-site-theme="white"] .analytics-card__manage {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #374151;
}

body[data-site-theme="white"] .analytics-empty__box {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #111827;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

body[data-site-theme="white"] .analytics-modal__backdrop {
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body[data-site-theme="white"] .analytics-modal__dialog {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(229, 231, 235, 0.95);
    box-shadow: 0 35px 80px rgba(15, 23, 42, 0.22);
    color: #111827;
}

body[data-site-theme="white"] .analytics-modal__header h3 {
    color: #111827;
}

body[data-site-theme="white"] .analytics-modal__close {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #374151;
}

body[data-site-theme="white"] .analytics-create-form__section {
    border-top-color: #E5E7EB;
}

body[data-site-theme="white"] .analytics-create-form__field label {
    color: #374151;
}

body[data-site-theme="white"] .analytics-create-form__field input[type="text"],
body[data-site-theme="white"] .analytics-create-form__field input[type="file"],
body[data-site-theme="white"] .analytics-create-form__field select,
body[data-site-theme="white"] .analytics-create-form__field textarea {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #111827;
}

body[data-site-theme="white"] .analytics-create-form__field input:focus,
body[data-site-theme="white"] .analytics-create-form__field select:focus,
body[data-site-theme="white"] .analytics-create-form__field textarea:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

body[data-site-theme="white"] .analytics-cover-upload {
    border-color: #D1D5DB;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 45%),
    #FFFFFF;
}

body[data-site-theme="white"] .analytics-cover-upload:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: #F8FAFC;
}

body[data-site-theme="white"] .analytics-cover-upload__empty {
    color: #374151;
}

body[data-site-theme="white"] .analytics-cover-upload__empty span {
    color: #6B7280;
}

body[data-site-theme="white"] .markdown-editor-surface,
body[data-site-theme="white"] .analytics-editor-surface {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    color: #111827;
}

body[data-site-theme="white"] .markdown-editor-surface:empty::before,
body[data-site-theme="white"] .analytics-editor-surface:empty::before {
    color: #9CA3AF;
}

body[data-site-theme="white"] .markdown-editor-surface:focus,
body[data-site-theme="white"] .analytics-editor-surface:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

body[data-site-theme="white"] .analytics-create-form__actions {
    background: rgba(255, 255, 255, 0.86);
    border-top: 1px solid #E5E7EB;
}

body[data-site-theme="white"] .analytics-create-form__secondary {
    border: 1px solid #D1D5DB;
    background: #FFFFFF;
    color: #374151;
}

body[data-site-theme="white"] .analytics-create-form__secondary:hover {
    background: #F3F4F6;
}

body[data-site-theme="white"] .analytics-create-form__submit,
body[data-site-theme="white"] .analytics-create-btn {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #FFFFFF;
}

body[data-site-theme="white"] .analytics-create-form__submit:hover,
body[data-site-theme="white"] .analytics-create-btn:hover {
    background: linear-gradient(135deg, #1D4ED8, #1E40AF);
}

body[data-site-theme="white"] .analytics-create-form input[type="checkbox"] {
    accent-color: #2563EB;
}

body[data-site-theme="white"] .analytics-context-menu {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

body[data-site-theme="white"] .analytics-context-menu__item {
    color: #374151;
}

body[data-site-theme="white"] .analytics-context-menu__item:hover {
    background: rgba(37, 99, 235, 0.10);
    color: #2563EB;
}

body[data-site-theme="white"] .analytics-context-menu__shortcut {
    color: #9CA3AF;
}

body[data-site-theme="white"] ::-webkit-scrollbar-thumb {
    background: rgba(17, 24, 39, 0.20);
}

body[data-site-theme="white"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 24, 39, 0.34);
}


html {
    scrollbar-gutter: stable;
}

html.chat-page-root {
    scrollbar-gutter: auto;
}

html.feed-page-root {
    scrollbar-gutter: auto;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

main {
    flex: 1;
    width: 100%;
}

body {
    font-family: 'Tahoma', sans-serif;
    background: var(--site-bg);
    color: var(--site-text);
    line-height: 1.5;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);

    width: 1200px;
    height: 800px;

    background: radial-gradient(
            circle,
            var(--site-accent-soft) 0%,
            var(--site-accent-faint) 30%,
            var(--site-accent-glow) 50%,
            transparent 70%
    );

    filter: blur(120px);
    z-index: -1;
}

body::after {
    content: "";
    position: fixed;
    bottom: -200px;
    right: -200px;

    width: 600px;
    height: 600px;

    background: radial-gradient(
            circle,
            var(--site-bottom-glow),
            transparent 70%
    );

    filter: blur(100px);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

img {
    max-width: 100%;
    display: block;
}

@media (max-width: 768px) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    body.chat-page.chat-mobile-open {
        padding-bottom: 0;
    }
}

.pwa-update-banner {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 3000;
    width: min(420px, calc(100vw - 24px));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(13, 19, 30, 0.98), rgba(9, 14, 22, 0.94)),
    rgba(11, 16, 24, 0.96);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(20px);
}

.pwa-update-banner__content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 18px 16px;
}

.pwa-update-banner__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pwa-update-banner__eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(47, 140, 255, 0.12);
    color: #8dc4ff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pwa-update-banner__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pwa-update-banner__copy strong {
    font-size: 19px;
    font-weight: 700;
    color: #f8fbff;
    line-height: 1.15;
}

.pwa-update-banner__copy span {
    color: #adc0d7;
    font-size: 14px;
}

.pwa-update-banner__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.pwa-update-banner__badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #f4f8fe;
    font-size: 12px;
    font-weight: 700;
}

.pwa-update-banner__date {
    color: #8697ac;
    font-size: 12px;
}

.pwa-update-banner__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pwa-update-banner__buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-update-banner__link {
    color: #8dc4ff;
    font-size: 13px;
    font-weight: 700;
}

.pwa-update-banner__ghost {
    min-width: 82px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #d8e3f1;
    font-size: 13px;
    font-weight: 700;
}

.pwa-update-banner__button {
    min-width: 98px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2f8cff, #5a7cff);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.pwa-update-banner__button:disabled {
    opacity: 0.72;
    cursor: wait;
}

.pwa-update-banner__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #b3c0d2;
    background: rgba(255, 255, 255, 0.06);
    font-size: 20px;
    line-height: 1;
}

@media (max-width: 768px) {
    .pwa-update-banner {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: calc(74px + env(safe-area-inset-bottom));
    }

    body.chat-page.chat-mobile-open .pwa-update-banner {
        bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .pwa-update-banner__content {
        padding: 16px 16px 14px;
    }

    .pwa-update-banner__actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .pwa-update-banner__buttons {
        width: 100%;
    }

    .pwa-update-banner__button,
    .pwa-update-banner__ghost {
        flex: 1;
    }
}

.cookie-consent__banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2900;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 16, 22, 0.88);
}

.cookie-consent__line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(100%, 1280px);
    margin: 0 auto;
}

.cookie-consent__text {
    color: #d3deeb;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

.cookie-consent__policy-link {
    color: #8dc4ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-consent__close {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #dbe8f6;
    font-size: 20px;
    line-height: 1;
}

@media (max-width: 768px) {
    .cookie-consent__banner {
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    }

    .cookie-consent__line {
        align-items: flex-start;
        justify-content: space-between;
    }

    .cookie-consent__text {
        text-align: left;
        font-size: 13px;
    }
}

body[data-site-theme="black"] {
    color-scheme: dark;

    --site-bg: #000000;
    --site-text: #f5f5f5;

    --site-accent: #2f8cff;
    --site-accent-soft: rgba(47, 140, 255, 0.18);
    --site-accent-faint: rgba(47, 140, 255, 0.10);
    --site-accent-glow: transparent;
    --site-bottom-glow: transparent;

    --black-bg: #000000;
    --black-surface: #070707;
    --black-surface-raised: #0d0d0d;
    --black-surface-hover: #141414;

    --black-border: #202020;
    --black-border-soft: #171717;

    --black-text: #f5f5f5;
    --black-text-secondary: #b0b0b0;
    --black-text-muted: #737373;
}

body[data-site-theme="black"] {
    background: #000000;
    color: var(--black-text);
}

body[data-site-theme="black"]::before,
body[data-site-theme="black"]::after {
    display: none;
}

body[data-site-theme="black"] ::selection {
    background: rgba(47, 140, 255, 0.35);
    color: #ffffff;
}

body[data-site-theme="black"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body[data-site-theme="black"] ::-webkit-scrollbar-track {
    background: #000000;
}

body[data-site-theme="black"] ::-webkit-scrollbar-thumb {
    background: #262626;
    border-radius: 999px;
}

body[data-site-theme="black"] ::-webkit-scrollbar-thumb:hover {
    background: #383838;
}