:root {
    --header-height: 58px;
    --category-nav-height: 52px;
    --app-content-gutter: 16px;
}

.app-page,
.app-header {
    background: linear-gradient(90deg, #f7f1de, #fbe5e2);
}

.app-header {
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.header-content {
    padding: 0 14px;
}

.logo-section {
    gap: 9px;
    min-width: 0;
}

.logo-img {
    width: 32px;
    height: 32px;
    box-shadow: none;
}

.logo-text {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: .02em;
    white-space: nowrap;
}

.header-actions {
    gap: 6px;
    padding: 0;
    flex-shrink: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.menu-icon {
    width: auto;
    min-width: 62px;
    height: 44px;
    gap: 6px;
    padding: 0 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--primary-dark);
    font: inherit;
}

.cps-test-link {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    padding: 0;
    text-decoration: none;
}

.cps-test-link img {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    object-fit: contain;
}

.menu-icon-glyph {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    background-color: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    transition: color .18s ease;
}

.icon-moon-star {
    mask-image: url("/images/lucide-moon-star.svg");
    -webkit-mask-image: url("/images/lucide-moon-star.svg");
}

.icon-sun {
    mask-image: url("/images/lucide-sun.svg");
    -webkit-mask-image: url("/images/lucide-sun.svg");
}

.icon-list-filter {
    mask-image: url("/images/lucide-list-filter.svg");
    -webkit-mask-image: url("/images/lucide-list-filter.svg");
}

.menu-icon-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    line-height: 1;
}

.menu-icon.is-active {
    color: inherit;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.menu-icon:focus-visible {
    outline: 2px solid rgba(141, 110, 99, .45);
    outline-offset: 2px;
}

.category-nav {
    left: 50%;
    right: auto;
    width: calc(100% - var(--app-content-gutter) - var(--app-content-gutter));
    max-width: 688px;
    transform: translateX(-50%);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    border: 0;
    background: linear-gradient(90deg, #f7f1de, #fbe5e2);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-list {
    width: max-content;
    min-width: 100%;
    height: 100%;
    margin: 0 auto;
    padding-top: 0;
    padding-bottom: 0;
}

.category-item {
    scroll-snap-align: center;
}

.category-item.active {
    color: var(--text-secondary);
    font-weight: 500;
    transform: none;
}

.category-item.active::after {
    display: none;
}

.main-content {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding-right: var(--app-content-gutter);
    padding-left: var(--app-content-gutter);
}

@media (max-width: 480px) {
    :root {
        --app-content-gutter: 12px;
    }
}

.story-card {
    border: 0;
    box-shadow: none;
}

.story-card:hover {
    transform: none;
    border: 0;
    box-shadow: none;
}

.category-toggle {
    appearance: none;
    padding: 0;
    border: 0;
    background: #ddd7d2;
}

.category-toggle.active {
    background: var(--primary-light);
}

.category-toggle::after,
.category-toggle.active::after {
    background: #fff;
    box-shadow: none;
}

.settings-description,
.category-setting-item {
    background: var(--background-color);
    border: 0;
}

.category-setting-item::before {
    display: none;
}

.category-toggle:focus-visible,
.modal-close:focus-visible {
    outline: 2px solid rgba(141, 110, 99, .45);
    outline-offset: 3px;
}

body.app-page:not(.dark-theme) .category-settings-modal {
    color-scheme: light;
}

body.app-page:not(.dark-theme) .category-settings-modal .modal-content {
    background: #fff;
    color: #212121;
}

body.app-page:not(.dark-theme) .category-settings-modal .modal-header h3,
body.app-page:not(.dark-theme) .category-settings-modal .category-setting-name {
    color: #212121;
}

body.app-page:not(.dark-theme) .category-settings-modal .settings-description,
body.app-page:not(.dark-theme) .category-settings-modal .category-setting-item {
    background: #f8f9fa;
    color: #212121;
}

body.app-page:not(.dark-theme) .category-settings-modal .modal-close {
    background: #fff;
    color: #616161;
}

body.app-page:not(.dark-theme) .category-settings-modal .modal-header::before {
    background: #e0e0e0;
}

body.dark-theme {
    background: linear-gradient(145deg, #050608 0%, #11141a 42%, #08090c 72%, #15171c 100%);
    background-attachment: fixed;
}

body.dark-theme .app-header,
body.dark-theme .category-nav {
    background: linear-gradient(100deg, #0a0b0e 0%, #171a20 52%, #08090c 100%);
}

body.dark-theme .app-header,
body.dark-theme .category-nav {
    border-color: #2b2522;
}

.dark-theme .menu-icon {
    color: #d8b5a0;
}

.dark-theme .menu-icon:hover {
    background: transparent;
    color: #f0d4c1;
}

.dark-theme .story-card,
.dark-theme .story-card:hover {
    background: linear-gradient(145deg, #1b1e24 0%, #111318 100%);
    border: 0;
    box-shadow: none;
}

.dark-theme .detail-header,
.dark-theme .detail-meta,
.dark-theme .detail-text {
    background: linear-gradient(145deg, #1b1e24 0%, #111318 100%);
}

.dark-theme .modal-content {
    color-scheme: dark;
    background: linear-gradient(160deg, #171a20 0%, #0c0e12 100%);
}

.dark-theme .settings-description,
.dark-theme .category-setting-item {
    background: linear-gradient(100deg, #1a1d22 0%, #121419 100%);
}

.dark-theme .category-toggle {
    background: #3a3430;
}

.dark-theme .category-toggle.active {
    background: var(--primary-light);
}

.modal-content,
.app-page .site-links-footer,
.dark-theme.app-page .site-links-footer {
    background: linear-gradient(110deg, #171a20 0%, #0d0f13 100%);
    box-shadow: none;
}

.modal-content {
    border: 0;
}

@media (hover: hover) {
    .menu-icon:hover {
        transform: none;
        background: transparent;
        box-shadow: none;
    }
}

.menu-icon:hover,
.menu-icon:active,
.menu-icon:focus,
.menu-icon:focus-visible,
.menu-icon.is-active,
.menu-icon[aria-pressed="true"] {
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

@media (max-width: 380px) {
    .header-content {
        padding: 0 8px;
    }

    .logo-section {
        gap: 6px;
    }

    .logo-text {
        font-size: 15px;
    }

    .header-actions {
        gap: 2px;
        padding: 0;
    }

    .menu-icon {
        min-width: 58px;
        height: 44px;
        gap: 5px;
        padding: 0 5px;
    }

    .cps-test-link {
        width: 40px;
        min-width: 40px;
        padding: 0;
    }

    .menu-icon-label {
        font-size: 12px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .menu-icon,
    .menu-icon-glyph {
        transition: none;
    }
}
