:root {
    /* Color Palette - Premium White Design */
    --accent-primary: #2d4a22;
    /* Deeper Forest Green */
    --accent-primary-rgb: 45, 74, 34;
    --accent-secondary: #3498db;
    --accent-tertiary: #ffffff;

    --bg-main: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.82);

    --text-main: #141612;
    --text-muted: #4a4d45;
    --text-light: #7c8077;

    --border-subtle: rgba(0, 0, 0, 0.04);
    --border-glass: rgba(0, 0, 0, 0.06);

    /* Spacing System */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1.25rem;
    --space-lg: 2rem;
    --space-xl: 3.5rem;

    /* Elevation & Glass */
    --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.08);
    --glass-blur: 20px;

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 9999px;

    /* Animations */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.4s var(--ease-out-expo);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-bottom: 90px;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    z-index: -1;
}

.app-container {
    max-width: 640px;
    margin: 0 auto;
    position: relative;
}

/* Glassmorphism Utility */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-glass);
}

/* Pull to Refresh Visual */
.pull-to-refresh {
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: height 0.3s var(--ease-out-expo);
}

.pull-to-refresh.showing {
    height: 60px;
}

.pull-to-refresh svg {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

/* Header Styles */
.app-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-sm) var(--space-md);
    margin: var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(61, 107, 32, 0.2);
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-xs);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.logo h1 span {
    color: var(--accent-primary);
}

.tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1;
    margin: 0;
}

/* Article Card Action Button */
.card-favorite-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-subtle);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: var(--transition-smooth);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.card-favorite-btn:hover {
    transform: scale(1.1);
    color: var(--accent-primary);
    background: white;
}

.card-favorite-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.05);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Hero Section */
.hero-section {
    padding: var(--space-md) var(--space-md);
    text-align: left;
}

.hero-content {
    animation: fadeInUp 0.8s var(--ease-out-expo);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(61, 107, 32, 0.1);
    color: var(--accent-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.hero-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    gap: var(--space-md);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.05);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    gap: var(--space-md);
    text-align: center;
    color: var(--text-light);
}

.empty-state svg {
    opacity: 0.3;
}

.empty-state h2 {
    color: var(--text-main);
    font-size: 1.25rem;
}

.empty-state p {
    max-width: 300px;
}

/* Articles Feed */
.articles-feed {
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.article-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    position: relative;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
    background: white;
}

.article-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #eef2f5;
    position: relative;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out-expo);
}

.article-card:hover .article-image img {
    transform: scale(1.08);
}

.article-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.article-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.article-date {
    color: var(--text-light);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Reaction Buttons Footer */
.article-card-footer {
    display: flex;
    border-top: 1px solid var(--border-subtle);
    padding: 8px 12px;
    gap: 8px;
    background: rgba(255, 255, 255, 0.3);
}

.reaction-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.reaction-btn:hover {
    background: rgba(0, 0, 0, 0.03);
    transform: translateY(-1px);
}

.reaction-btn:active {
    transform: scale(0.96);
}

/* Helpful Button (Like) */
.reaction-btn.helpful.active {
    background: rgba(33, 150, 243, 0.1);
    border-color: #2196f3;
    color: #2196f3;
}

/* Want to Go Button */
.reaction-btn.want-to-go.active {
    background: rgba(255, 152, 0, 0.1);
    border-color: #ff9800;
    color: #ff9800;
}

.reaction-count {
    font-size: 0.75rem;
    margin-left: 2px;
}

.article-new-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent-primary);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(61, 107, 32, 0.3);
}

/* Skeleton Loading */
.skeleton-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.skeleton-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(90deg, #f0f4f0 25%, #e0e8e0 50%, #f0f4f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.skeleton-text {
    height: 14px;
    background: linear-gradient(90deg, #f0f4f0 25%, #e0e8e0 50%, #f0f4f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-title {
    height: 20px;
    width: 80%;
}

.skeleton-desc {
    width: 95%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-xs);
    margin: var(--space-md);
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-around;
    box-shadow: var(--shadow-elevated);
    z-index: 1000;
}

.nav-tab {
    background: none;
    color: var(--text-light);
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    flex: 1;
    max-width: 100px;
}

.nav-tab svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.nav-tab:hover {
    color: var(--accent-primary);
    background: rgba(61, 107, 32, 0.05);
}

.nav-tab.active {
    color: var(--accent-primary);
}

.nav-tab.active svg {
    transform: translateY(-2px);
    filter: drop-shadow(0 2px 4px rgba(61, 107, 32, 0.2));
}

.nav-tab:active {
    transform: scale(0.9);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.3s var(--ease-out-expo);
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-elevated);
    animation: modalSlideUp 0.4s var(--ease-out-expo);
    overflow: hidden;
}

/* Ranking Section */
.ranking-section {
    margin-bottom: var(--space-md);
}

.ranking-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-item {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.ranking-item.active {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-soft);
}

.ranking-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-main);
}

.ranking-item:hover .ranking-item-header {
    background: rgba(0, 0, 0, 0.02);
}

.ranking-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
}

.ranking-badge.rank-1 {
    background: #ffd700;
    color: #8a6d00;
}

.ranking-badge.rank-2 {
    background: #c0c0c0;
    color: #5a5a5a;
}

.ranking-badge.rank-3 {
    background: #cd7f32;
    color: #6d4117;
}

.ranking-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.ranking-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ranking-count {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
}

.chevron-icon {
    width: 16px;
    height: 16px;
    color: var(--text-light);
    transition: transform 0.3s ease;
}

.ranking-item.active .chevron-icon {
    transform: rotate(180deg);
}

/* Accordion Content */
.ranking-accordion {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.02);
}

.ranking-item.active .ranking-accordion {
    max-height: 300px;
    /* Approximate max height */
}

.ranking-articles-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-articles-list li {
    border-top: 1px solid var(--border-subtle);
}

.ranking-articles-list a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 0.2s;
}

.ranking-articles-list a:hover {
    background: rgba(0, 0, 0, 0.04);
}

.ranking-article-title {
    display: block;
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-article-date {
    display: block;
    font-size: 0.7rem;
    color: var(--text-light);
}

.modal-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-md) 0;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-btn {
    background: var(--bg-main);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.close-btn:hover {
    background: #eef2f5;
    color: var(--text-main);
}

.sites-list {
    padding: var(--space-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.site-item {
    padding: var(--space-md);
    background: var(--bg-main);
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.site-item:hover {
    background: white;
    border-color: var(--accent-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-soft);
}

.site-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

.site-info {
    flex: 1;
    min-width: 0;
}

.site-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 2px;
}

.site-url {
    font-size: 0.75rem;
    color: var(--text-light);
    word-break: break-all;
}

.site-count {
    display: inline-block;
    background: rgba(61, 107, 32, 0.1);
    color: var(--accent-primary);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 6px;
}

.favorite-btn {
    background: white;
    border: 1px solid var(--border-subtle);
    color: var(--text-light);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
}

.favorite-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.1);
}

.favorite-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary));
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(45, 80, 22, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 80, 22, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
    }

    .articles-feed {
        padding: var(--space-lg);
    }

    .logo h1 {
        font-size: 1.75rem;
    }
}

/* Responsive Design */
@media (min-width: 640px) {
    .app-container {
        padding: 0 var(--space-md);
    }

    .app-header {
        margin: var(--space-md) auto;
    }
}

/* Dark Mode Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode - Premium Dark Green */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #121411;
        --bg-card: rgba(30, 34, 28, 0.85);
        --bg-glass: rgba(18, 20, 17, 0.7);
        --text-main: #f0f4f0;
        --text-muted: #aeb4aa;
        --text-light: #767d71;
        --border-subtle: rgba(255, 255, 255, 0.05);
        --border-glass: rgba(255, 255, 255, 0.1);
        --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .article-card:hover {
        background: #1e221c;
    }

    .modal-content {
        background: #1e221c;
    }

    .site-item {
        background: #121411;
    }

    .site-item:hover {
        background: #1e221c;
    }

    .bottom-nav {
        background: #2d2d2d;
    }
}