: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);

    --app-safe-top: env(safe-area-inset-top, 0px);
    --app-safe-right: env(safe-area-inset-right, 0px);
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-safe-left: env(safe-area-inset-left, 0px);

    --app-mobile-header-content-height: 56px;
    --app-mobile-header-total-height: calc(
        var(--app-mobile-header-content-height) + var(--app-safe-top)
    );
    --app-bottom-nav-content-height: 64px;
    --app-bottom-nav-border-height: 1px;
    --app-bottom-nav-total-height: calc(
        var(--app-bottom-nav-content-height) +
        var(--app-safe-bottom) +
        var(--app-bottom-nav-border-height)
    );
}

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="midnight"] {
    color-scheme: dark;
}

body[data-site-theme="white"] {
    color-scheme: light;
}

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;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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) {
    main {
        padding-top: var(--app-safe-top);
    }

    body {
        padding-bottom: var(--app-bottom-nav-total-height);
    }

    html.feed-page-root main {
        padding-top: 0;
    }

    html.feed-page-root body {
        padding-bottom: 0;
    }

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

.cookie-consent__banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2900;
    padding: 10px 18px calc(10px + var(--app-safe-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 + var(--app-safe-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;
}

.push-notification-prompt[hidden] {
    display: none !important;
}

.push-notification-prompt {
    position: fixed;
    z-index: 11000;
    right: 20px;
    bottom: 20px;

    width: min(390px, calc(100vw - 32px));
    padding: 16px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;

    background: rgba(11, 18, 32, 0.97);
    color: #f8fafc;

    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
}

.push-notification-prompt__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.push-notification-prompt__text {
    margin: 5px 0 0;
    color: #b7c1d1;
    font-size: 13px;
    line-height: 1.45;
}

.push-notification-prompt__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.push-notification-prompt__button {
    min-height: 40px;
    padding: 8px 14px;

    border: 0;
    border-radius: 10px;

    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.push-notification-prompt__button--primary {
    background: #2f80ed;
    color: #ffffff;
}

.push-notification-prompt__button--secondary {
    background: rgba(255, 255, 255, 0.09);
    color: inherit;
}

body[data-site-theme="white"] .push-notification-prompt {
    border-color: rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.98);
    color: #0f172a;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

body[data-site-theme="white"] .push-notification-prompt__text {
    color: #64748b;
}

body[data-site-theme="white"] .push-notification-prompt__button--secondary {
    background: #edf2f7;
}

@media (max-width: 700px) {
    .push-notification-prompt {
        right: 12px;
        bottom: calc(88px + env(safe-area-inset-bottom));
        left: 12px;

        width: auto;
        max-width: none;
    }

    .push-notification-prompt__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .push-notification-prompt__button {
        width: 100%;
    }
}