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

:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #252542;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --success: #22c55e;
    --border: #333355;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

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

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

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container-narrow {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-muted);
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Game Cards */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.game-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.game-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.game-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid var(--border);
    margin-top: 2rem;
}

.form-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.checkbox-group label {
    margin-bottom: 0;
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.hidden {
    display: none;
}

/* Profile */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.avatar {
    width: 80px;
    height: 80px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

.profile-info h1 {
    margin-bottom: 0.25rem;
}

.profile-info p {
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-card .sub {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Leaderboard */
.leaderboard {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-top: 2rem;
}

.leaderboard h2 {
    margin-bottom: 1rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 2rem;
    }

    .games-grid {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        gap: 1rem;
    }
}
