:root {
    --theme-bg-0: #030508;
    --theme-bg-1: #050816;
    --theme-bg-2: #0a0f1e;
    --theme-bg-3: #0f172a;
    --theme-panel: rgba(10, 14, 28, 0.88);
    --theme-panel-strong: rgba(8, 12, 24, 0.96);
    --theme-panel-soft: rgba(30, 41, 59, 0.62);
    --theme-text: #f8fafc;
    --theme-muted: #94a3b8;
    --theme-muted-2: #64748b;
    --theme-line: rgba(148, 163, 184, 0.24);
    --theme-line-strong: rgba(34, 211, 238, 0.42);
    --theme-accent: #22d3ee;
    --theme-accent-2: #a855f7;
    --theme-accent-hot: #f472b6;
    --theme-accent-warm: #fb7185;
    --theme-danger: #ef4444;
    --theme-success: #10b981;
    --theme-warning: #f59e0b;
    --theme-radius-lg: 24px;
    --theme-radius-md: 16px;
    --theme-radius-sm: 12px;
    --theme-radius-xs: 10px;
    --theme-shadow-card: 0 18px 60px rgba(2, 6, 23, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --theme-shadow-hover: 0 24px 80px rgba(2, 6, 23, 0.52), 0 0 48px rgba(34, 211, 238, 0.14);
    --theme-shadow-glow: 0 0 32px rgba(168, 85, 247, 0.35);
    --theme-dur-1: 150ms;
    --theme-dur-2: 240ms;
    --theme-dur-3: 380ms;
    --theme-dur-4: 520ms;
    --theme-motion-fast: var(--theme-dur-1);
    --theme-motion: var(--theme-dur-2);
    --theme-motion-slow: var(--theme-dur-4);
    --theme-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --theme-ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
    --theme-z-base: 1;
    --theme-z-nav: 400;
    --theme-z-overlay: 800;
    --theme-z-modal: 900;
    --theme-z-toast: 1000;
    --theme-z-loader: 10000;
    --theme-feed-neon: linear-gradient(135deg, var(--theme-accent), var(--theme-accent-2), var(--theme-accent-hot));
    --theme-gradient-cta: linear-gradient(135deg, #22d3ee 0%, #6366f1 45%, #a855f7 75%, #f472b6 100%);
    --theme-gradient-progress: linear-gradient(90deg, #22d3ee, #a855f7, #f472b6);
    --theme-indigo: #6366f1;
    --theme-indigo-deep: #4f46e5;
    --theme-violet: #a855f7;
    --theme-pink: #f472b6;
    --theme-surface: rgba(3, 5, 8, 0.94);
    --theme-stroke: rgba(34, 211, 238, 0.28);
    --primary: var(--theme-indigo);
    --primary-dark: var(--theme-indigo-deep);
    --primary-light: #818cf8;
    --success: var(--theme-success);
    --danger: var(--theme-danger);
    --dark: var(--theme-bg-1);
    --dark-light: var(--theme-bg-3);
    --gray: var(--theme-muted-2);
    --gray-light: var(--theme-muted);
    --white: var(--theme-text);
    --stroke: var(--theme-line-strong);
    --nav-pink: var(--theme-accent-hot);
    --nav-indigo: var(--theme-indigo);
    --nav-violet: var(--theme-violet);
    --nav-surface: var(--theme-panel);
    --nav-ease: var(--theme-ease-out);
}

html {
    color-scheme: dark;
}

a,
button,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid rgba(165, 180, 252, 0.9);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.18);
}

.theme-card,
.lenta-page .item,
.content-section,
.profile-card,
.upload-section,
.file-card,
.modal-content,
.auth-modal-panel .card {
    border-color: var(--theme-line);
    box-shadow: var(--theme-shadow-card);
}

.lenta-page .item,
.file-card,
.profile-card,
.content-section {
    transition: transform var(--theme-motion) var(--theme-ease-out), border-color var(--theme-motion) var(--theme-ease-out), box-shadow var(--theme-motion) var(--theme-ease-out), background var(--theme-motion) var(--theme-ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .lenta-page .item:hover {
        border-color: var(--theme-line-strong);
        box-shadow: var(--theme-shadow-hover);
    }

    .file-card:hover,
    .profile-card:hover {
        transform: translateY(-2px);
        border-color: var(--theme-line-strong);
        box-shadow: var(--theme-shadow-hover);
    }
}

.theme-btn,
.nav-btn-login,
.nav-btn-secondary,
.btn,
.category-btn,
.filter-toggle-btn,
.public-access-link {
    transition: transform var(--theme-motion-fast) var(--theme-ease-out), box-shadow var(--theme-motion-fast) var(--theme-ease-out), border-color var(--theme-motion-fast) var(--theme-ease-out), background var(--theme-motion-fast) var(--theme-ease-out), opacity var(--theme-motion-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
    .theme-btn:hover,
    .nav-btn-login:hover,
    .nav-btn-secondary:hover,
    .btn:hover,
    .category-btn:hover,
    .filter-toggle-btn:hover,
    .public-access-link:hover {
        transform: translateY(-1px);
    }
}

.theme-media-frame,
.feed-audio-placeholder,
.content-viewer,
.image-preview,
.video-player,
.audio-player {
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.72)),
        radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.18), transparent 32%);
    border: 1px solid var(--theme-line);
}

.theme-media-error {
    width: 100%;
    height: 100%;
    min-height: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    color: #cbd5e1;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.theme-media-error small {
    color: var(--theme-muted-2);
    font-size: 11px;
    font-weight: 700;
}

.theme-media-loading {
    position: relative;
    overflow: hidden;
}

.theme-media-loading::before,
.theme-skeleton {
    background: linear-gradient(100deg, rgba(30, 41, 59, 0.45) 0%, rgba(99, 102, 241, 0.12) 40%, rgba(30, 41, 59, 0.45) 80%);
    background-size: 220% 100%;
    animation: themeSkeleton 1.2s ease-in-out infinite;
}

.theme-media-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
}

.theme-media-loading > * {
    position: relative;
    z-index: 1;
}

@keyframes themeSkeleton {
    0% { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

.theme-empty-state {
    padding: 36px 20px;
    border-radius: var(--theme-radius-lg);
    border: 1px solid var(--theme-line);
    background: var(--theme-panel);
    color: var(--theme-muted);
    text-align: center;
    font-weight: 700;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    nav.app-header,
    .card,
    .lenta-page .item,
    .filter-group,
    .modal-overlay,
    .auth-modal-backdrop,
    .admin-modal-overlay,
    .content-section,
    .profile-card,
    .upload-section {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        background-color: rgba(15, 23, 42, 0.96) !important;
    }
}

@media (prefers-reduced-transparency: reduce), (forced-colors: active), (update: slow) {
    .gradient-blob,
    .noise {
        display: none !important;
    }

    nav.app-header,
    .card,
    .lenta-page .item,
    .filter-group,
    .modal-overlay,
    .auth-modal-backdrop,
    .admin-modal-overlay,
    .content-section,
    .profile-card,
    .upload-section {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        background-color: rgba(15, 23, 42, 0.98) !important;
    }
}

@media (max-width: 640px) {
    .lenta-page .wrap {
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
    }

    .lenta-page .item {
        border-radius: 18px;
    }

    .lenta-page .list--list .preview {
        min-height: 180px;
    }
}

.feed-container {
    background:
        radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.14), transparent 34%),
        #000;
}

.feed-item::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 34%;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45));
}

.feed-media {
    background: #000;
}

.play-pause-overlay::before {
    border: 2px solid rgba(255, 255, 255, 0.88);
}

.navigation .action-btn,
.navigation .nav-btn,
.sound-control,
.progress-container,
.video-timer,
.category-filter,
.filter-group {
    border-color: rgba(255, 255, 255, 0.18);
    background-color: rgba(15, 23, 42, 0.56);
}

.navigation .action-btn,
.navigation .nav-btn,
.sound-control {
    min-width: 44px;
    min-height: 44px;
}

.feed-audio-placeholder {
    width: min(520px, 78vw);
    min-height: 220px;
    border-radius: 28px;
    box-shadow: var(--theme-shadow-card);
}

.feed-audio-placeholder svg {
    filter: drop-shadow(0 12px 28px rgba(99, 102, 241, 0.42));
}

.category-filter {
    max-width: min(520px, calc(100vw - 32px));
}

.category-btn.active {
    color: #f8fafc;
    border-color: rgba(129, 140, 248, 0.55);
    background: rgba(99, 102, 241, 0.22);
}

.toast {
    border: 1px solid rgba(255, 255, 255, 0.16);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

@media (max-width: 768px) {
    .navigation {
        right: max(12px, env(safe-area-inset-right, 0px));
        gap: 16px;
    }

    .navigation .action-btn,
    .navigation .nav-btn {
        width: 48px;
        height: 48px;
    }

    .filter-toggle-wrap {
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        max-width: calc(100vw - 24px);
    }

    .filter-group-buttons {
        gap: 6px;
    }

    .category-btn {
        min-height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .feed-item::after {
        transition: none !important;
    }
}

.admin-modal-overlay,
.modal-overlay,
.theme-modal__backdrop,
.auth-modal-backdrop,
.paste-overlay {
    z-index: 10050;
}

#theme-page-loader {
    z-index: 10100;
}
