/* ============================================
   Play Party Online - Core Design System
   Clean, minimal, mobile-first
   ============================================ */

/* CSS Variables */
:root {
    --color-bg: #0f0f0f;
    --color-surface: #1a1a1a;
    --color-surface-elevated: #252525;
    --color-accent: #4ade80;
    --color-accent-hover: #22c55e;
    --color-text: #ffffff;
    --color-text-muted: #a1a1aa;
    --color-border: rgba(255, 255, 255, 0.1);
    --nav-height: 56px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

/* ============================================
   Navigation Bar
   ============================================ */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
}

nav .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-text);
}

nav .logo img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

nav .logo span {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

nav .nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav .nav-links a {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

nav .nav-links a:hover,
nav .nav-links a.active {
    color: var(--color-text);
    background: var(--color-surface-elevated);
}

nav .nav-links a.play-btn {
    background: var(--color-accent);
    color: var(--color-bg);
}

nav .nav-links a.play-btn:hover {
    background: var(--color-accent-hover);
}

/* Mobile nav adjustments */
@media (max-width: 600px) {
    nav {
        padding: 0 0.75rem;
    }
    
    nav .logo span {
        display: none;
    }
    
    nav .nav-links a {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* ============================================
   Main Container - Game Window
   ============================================ */
main {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    padding: 1rem;
}

/* Game window - fixed 600px on desktop, fills on mobile */
.game-window {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 600px;
    background: var(--color-bg);
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Mobile: fill entire main area */
@media (max-height: 599px), (max-width: 600px) {
    main {
        padding: 0;
    }
    
    .game-window {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: auto;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Iframe container for embedded games */
.game-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: var(--color-bg);
}

/* ============================================
   Landing Page - Game Cards Grid
   ============================================ */
.landing-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.hero {
    text-align: center;
    padding: 2rem 1rem;
}

.hero-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero p {
    color: var(--color-text-muted);
    max-width: 400px;
    margin: 0 auto;
    font-size: 0.95rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    padding: 0 1rem 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.game-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    cursor: pointer;
    display: block;
}

.game-card:hover {
    background: var(--color-surface-elevated);
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.game-card .emoji-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.game-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.game-card p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.game-card .play-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: var(--color-accent);
    color: var(--color-bg);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.game-card.coming-soon {
    opacity: 0.5;
    pointer-events: none;
}

.game-card.coming-soon .play-badge {
    background: var(--color-surface-elevated);
    color: var(--color-text-muted);
}

/* ============================================
   Ad Containers
   ============================================ */
.ad-container {
    padding: 1rem;
    text-align: center;
}

.ad-slot {
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    max-width: 728px;
    margin: 0 auto;
}

/* ============================================
   Footer
   ============================================ */
footer {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--color-border);
}

footer a {
    color: var(--color-accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================
   Mobile Viewport Adjustments
   ============================================ */
@media (max-width: 600px) {
    :root {
        --nav-height: 48px;
    }
    
    .hero {
        padding: 1.5rem 1rem;
    }
    
    .hero-logo {
        width: 64px;
        height: 64px;
    }
    
    .hero h1 {
        font-size: 1.4rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        padding: 0 0.75rem 1.5rem;
    }
    
    .game-card {
        padding: 1rem;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    nav {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    main {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
