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

:root {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --accent: #ffffff;
    --accent-hover: #e0e0e0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.6rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(0,0,0,0.9) 0%, rgba(20,20,30,0.95) 100%);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.header-right {
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.header #userGreeting {
    color: var(--text-color) !important;
}

.header .settings-btn {
    color: var(--text-color) !important;
    padding: 0;
    border: 2px solid white;
    background: none;
    cursor: pointer;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.header .settings-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--primary-color, #00c9a7);
    border-color: var(--primary-color, #00c9a7);
}

.header .settings-btn img,
#headerAvatar {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: cover;
    display: block;
    opacity: 0.8;
    border-radius: 50%;
    margin: 0;
    padding: 0;
}

.header .settings-btn:hover img {
    opacity: 0.8;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.settings-wrapper { position: relative; display:inline-block; }
.settings-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #0f0f0f;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    min-width: 180px;
    z-index: 1200;
}
.settings-dropdown { display: none; }
.settings-dropdown.show { display: block; }
.settings-dropdown .dropdown-item {
    display:block;
    width:100%;
    background:transparent;
    border:none;
    color:var(--text-primary);
    text-align:left;
    padding:0.5rem 0.6rem;
    cursor:pointer;
    font-size:0.95rem;
}
.settings-dropdown .dropdown-item:hover { background:#1a1a1a; }

.header-right { gap: 0.8rem; }
.header-left .logo { margin-right: 1rem; }

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.logo {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header .notification-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg,#ffd97a,#ffb347);
    color: #1a1a1a;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    font-size: 1.05rem;
}

.header .notification-badge { position: absolute; top: -6px; right: -6px; }

.header .btn-primary {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
}

.header .settings-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#userGreeting {
    text-transform: uppercase;
    font-family: 'Creepster', 'Press Start 2P', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    margin-right: 0.6rem;
}

.btn-primary {
    background-color: #00a88a;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background-color: #0055e0;
}

.btn-secondary {
    background-color: #3a3b3c;
    color: #e4e6eb;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background-color: #4e4f50;
}

.main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 5rem);
    padding: 2rem;
    text-align: center;
}

.hero {
    max-width: 600px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-text {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.cta-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: var(--accent);
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 1.125rem;
    border-radius: 9999px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.cta-btn:hover {
    opacity: 0.9;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-form {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background-color: var(--bg-primary);
}

.login-form h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.submit-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 1rem;
}

.submit-btn:hover {
    opacity: 0.9;
}

.hint {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.error {
    color: #ef4444;
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 1rem;
}

/* Tablet breakpoint (768px and below) */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-text {
        font-size: 1rem;
    }
    
    .header {
        padding: 0.5rem 1rem;
    }
    
    /* Mobile: logo-only header (handled in shared.css & desktop-nav.css) */
    
    .search-wrapper {
        max-width: 150px;
    }
    
    .search-input {
        width: 100%;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .notification-btn,
    .settings-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .settings-dropdown {
        right: 0;
        min-width: 160px;
    }
}

/* Mobile breakpoint (480px and below) */
@media (max-width: 480px) {
    * {
        scroll-behavior: smooth;
    }

    .header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    /* Mobile header: logo only (handled in shared.css) */

    .search-wrapper,
    .search-container {
        display: none;
    }

    .logo {
        font-size: 1.1rem;
    }

    .logo-img {
        height: 60px !important;
        width: auto !important;
        margin-top: 0 !important;
    }
    
    .settings-dropdown {
        right: 0;
        left: auto;
        min-width: 160px;
        max-width: calc(100vw - 20px);
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Extra small devices (360px and below) */
@media (max-width: 360px) {
    .logo {
        font-size: 1rem;
        letter-spacing: -0.05em;
    }

    .header {
        padding: 0.4rem 0.5rem;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-text {
        font-size: 0.9rem;
    }

    .btn-primary, .btn-secondary {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }

    .login-form {
        padding: 1rem;
        margin: 0.25rem;
    }

    .settings-dropdown {
        min-width: 140px;
        font-size: 0.85rem;
    }

    .dropdown-item {
        padding: 0.65rem 0.9rem;
        font-size: 0.85rem;
    }
}

/* Ultra small devices (320px and below) */
@media (max-width: 320px) {
    .header {
        padding: 0.35rem 0.4rem;
    }

    .logo {
        font-size: 0.9rem;
    }

    .logo-img {
        height: 50px !important;
    }

    .hero-title {
        font-size: 1.15rem;
    }

    .hero-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .btn-primary, .btn-secondary {
        padding: 0.45rem 0.5rem;
        font-size: 0.7rem;
    }

    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 1rem; }
}

/* Touch-friendly targets - Priority for mobile devices */
@media (pointer: coarse) {
    .btn-primary, .btn-secondary, .menu-btn, .settings-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.6rem 1rem;
    }
    
    .menu-item {
        padding: 0.9rem 1rem;
        min-height: 44px;
    }
    
    input, textarea, select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.75rem;
        min-height: 44px;
    }

    button {
        min-height: 44px;
    }
}

/* Performance optimizations */
.header {
    will-change: transform;
    contain: layout style;
}

img {
    content-visibility: auto;
    max-width: 100%;
    height: auto;
}

/* Lazy-loaded images fade in — only hide if JS explicitly adds the class */
img.lazy-fade {
    opacity: 0;
    transition: opacity 0.3s ease;
}
img.lazy-fade.loaded {
    opacity: 1;
}

.post-card {
    contain: layout style paint;
}

/* Smooth transitions for all interactive elements — use specific properties to avoid layout thrashing */
button, a, input, select, textarea {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Reduce motion for users who prefer it — huge perf win on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* GPU-accelerated animations */
.blob, .hero-logo, .post-card {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Improve readability on small screens */
@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
}

/* ========================================
   Desktop UI Enhancements (≥769px)
   ======================================== */

/* Desktop hover effects — only for pointer devices */
@media (hover: hover) and (min-width: 769px) {
    /* Post card hover lift */
    .post-card {
        transition: box-shadow 0.2s ease, transform 0.2s ease;
    }

    .post-card:hover {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        transform: translateY(-1px);
    }

    /* Action buttons subtle feedback */
    .action-btn:hover {
        background: rgba(255, 255, 255, 0.08);
        border-radius: 8px;
    }

    /* Buttons — consistent hover glow */
    .btn-primary:hover {
        box-shadow: 0 4px 16px rgba(0, 201, 167, 0.3);
        transform: translateY(-1px);
    }

    .btn-secondary:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Settings dropdown items */
    .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    /* Friend cards */
    .friend-card:hover {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        transform: translateY(-1px);
    }

    /* Notification items */
    .notification-item:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    /* Smooth cursor change for clickable elements */
    .post-card .post-author-handle,
    .friend-card,
    .notification-item {
        cursor: pointer;
    }
}

/* Desktop layout spacing */
@media (min-width: 769px) {
    /* Reserve space for left nav via body padding — content auto-centers in remaining area */
    body.has-desktop-nav {
        padding-left: 60px;
        padding-bottom: 0;
    }
}

/* Widescreen with right sidebar — reserve space on right too */
@media (min-width: 1280px) {
    body.has-desktop-nav.has-right-sidebar {
        padding-right: 240px;
    }
}
