:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1c1e21;
    --text-secondary: #65676b;
    --accent: #f4845f;
    --accent-hover: #f26a3e;
    --corgi-color: #f4a261;
    --cat-color: #e76f51;
    --border: #dadde1;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --max-width: 680px;
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.logo-icon {
    font-size: 28px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--corgi-color), var(--cat-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: 8px;
    padding: 3px;
}

.tab {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.tab.active {
    background: var(--card-bg);
    color: var(--accent);
    box-shadow: var(--shadow);
}

/* Feed Container */
.feed-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
}

.feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Post Card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    animation: fadeInUp 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.card-avatar.corgi {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
}

.card-avatar.cat {
    background: linear-gradient(135deg, #ffecd2, #f4845f);
}

.card-meta {
    flex: 1;
    min-width: 0;
}

.card-subreddit {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.card-subreddit a {
    color: inherit;
    text-decoration: none;
}

.card-subreddit a:hover {
    text-decoration: underline;
}

.card-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title {
    padding: 0 16px 12px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.card-title a {
    color: var(--text);
    text-decoration: none;
}

.card-title a:hover {
    text-decoration: underline;
}

/* Media */
.card-media {
    position: relative;
    width: 100%;
    background: #f8f8f8;
    overflow: hidden;
}

.card-media img {
    width: 100%;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.card-media img:hover {
    transform: scale(1.01);
}

.card-media video {
    width: 100%;
    display: block;
    max-height: 600px;
    object-fit: contain;
    background: #000;
}

.card-media iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

/* Gallery */
.gallery {
    position: relative;
}

.gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-track img {
    min-width: 100%;
    scroll-snap-align: center;
    object-fit: contain;
    max-height: 600px;
}

.gallery-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Text Post */
.card-text {
    padding: 0 16px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.card-text.expanded {
    max-height: none;
}

.card-text-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--card-bg));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 4px;
}

.read-more {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

/* Card Footer */
.card-footer {
    padding: 8px 16px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-link {
    margin-left: auto;
}

.card-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.card-link a:hover {
    text-decoration: underline;
}

/* Loader */
.loader {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}

/* Responsive */
@media (max-width: 720px) {
    .feed-container {
        padding: 8px;
    }

    .feed {
        gap: 8px;
    }

    .header-inner {
        justify-content: center;
    }

    .card {
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 20px;
    }

    .tab {
        padding: 6px 12px;
        font-size: 13px;
    }

    .card-title {
        font-size: 14px;
    }
}
