/* ============================================
   Bad Games - Base CSS
   Variables, Reset, Layout, Typography
   ============================================ */

/* ===========================================
   1. CSS Variables & Reset
   =========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-input: #0a0a1a;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #ef4444;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* ===========================================
   2. Layout
   =========================================== */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

#main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 56px; /* Space for fixed header */
}

#footer {
    padding: 16px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.view {
    padding: 24px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===========================================
   3. Typography
   =========================================== */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2rem; margin-bottom: 16px; }
h2 { font-size: 1.5rem; margin-bottom: 12px; }
h3 { font-size: 1.25rem; margin-bottom: 8px; }
h4 { font-size: 1rem; margin-bottom: 4px; }

p { margin-bottom: 12px; }

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

a:hover {
    color: var(--accent-hover);
}

small {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===========================================
   Responsive Header
   =========================================== */
@media (max-width: 768px) {
    .header-nav {
        gap: 4px;
    }

    .nav-link {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
}
