/* ══════════════════════════════════════════════════════════
   Crowncade Design System
   Dark arcade theme with neon accents and pixel chrome
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #0a0a12;
    --bg-sidebar: #0f0f1a;
    --bg-card: #141422;
    --bg-card-hover: #1a1a30;
    --bg-input: #1a1a2e;
    --bg-surface: #12121f;
    --border-color: #2a2a40;
    --border-glow: #3a3a55;

    --text-primary: #e8e8f0;
    --text-secondary: #9898b0;
    --text-muted: #686888;
    --text-dim: #484860;

    --neon-cyan: #00f0ff;
    --neon-magenta: #ff00aa;
    --neon-gold: #ffd700;
    --neon-green: #00ff88;
    --neon-purple: #aa44ff;
    --neon-orange: #ff8800;
    --neon-red: #ff3355;

    --tier-1: #8899aa;
    --tier-2: #44aa44;
    --tier-3: #4488ff;
    --tier-4: #aa44ff;
    --tier-5: #ffd700;

    --font-pixel: 'Press Start 2P', monospace;
    --font-body: 'Inter', -apple-system, sans-serif;

    --sidebar-width: 240px;
    --header-height: 56px;
    --radius: 8px;
    --radius-sm: 4px;

    --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--neon-cyan); text-decoration: none; transition: color 0.2s; }
a:hover { color: #66f8ff; }

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

/* ── Layout ── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-logo h1 {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    letter-spacing: 2px;
}

.sidebar-logo .tagline {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Sidebar nav */
.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(0, 240, 255, 0.05);
    border-left-color: var(--neon-cyan);
}

.nav-link.active {
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
    border-left-color: var(--neon-cyan);
}

.nav-link .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

/* Sidebar user widget */
.sidebar-user {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--neon-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--neon-cyan);
}

.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-level { font-size: 11px; color: var(--neon-gold); }

/* ── Main Content ── */
.main-content {
    grid-column: 2;
    padding: 24px 32px;
    min-height: 100vh;
}

/* ── Search bar ── */
.sidebar-search {
    padding: 12px 16px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

.search-input::placeholder { color: var(--text-dim); }

/* ── Page Header ── */
.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-family: var(--font-pixel);
    font-size: 16px;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Game Cards ── */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
}

.game-card:hover {
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.game-card-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-surface);
    object-fit: cover;
    display: block;
}

.game-card-thumb-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-pixel);
    font-size: 24px;
    color: var(--text-dim);
}

.game-card-body {
    padding: 12px;
}

.game-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

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

.game-card-genre {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan);
    border-radius: 10px;
}

.game-card-rating {
    color: var(--neon-gold);
}

.game-card-plays {
    color: var(--text-secondary);
}

/* ── Game Row (horizontal scroll) ── */
.game-row {
    margin-bottom: 32px;
}

.game-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.game-row-header h3 {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--text-primary);
}

.game-row-header a {
    font-size: 13px;
}

.game-row-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.game-row-scroll .game-card {
    min-width: 200px;
    max-width: 200px;
    flex-shrink: 0;
}

/* ── Featured Carousel ── */
.featured-hero {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    overflow: hidden;
}

.featured-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-gold));
}

.featured-hero-content { flex: 1; }

.featured-hero-content h2 {
    font-family: var(--font-pixel);
    font-size: 18px;
    color: var(--neon-cyan);
    margin-bottom: 8px;
}

.featured-hero-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    max-width: 500px;
}

/* ── Daily Challenge ── */
.daily-challenge {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 0, 170, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.daily-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
}

.daily-info h4 {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--neon-gold);
    margin-bottom: 4px;
}

.daily-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.daily-xp {
    margin-left: auto;
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--neon-gold);
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--neon-cyan);
    color: var(--bg-dark);
}
.btn-primary:hover {
    background: #33f5ff;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
    color: var(--bg-dark);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    border-color: var(--neon-cyan);
}

.btn-gold {
    background: var(--neon-gold);
    color: var(--bg-dark);
}
.btn-gold:hover {
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
    color: var(--bg-dark);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-danger {
    background: var(--neon-red);
    color: white;
}

/* ── Game Player ── */
.game-player-container {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.game-player-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.toolbar-btn:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.toolbar-btn.active {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.game-iframe {
    width: 100%;
    border: none;
    display: block;
    background: #1a1a2e;
}

/* ── Game Info Panel ── */
.game-info-panels {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.info-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
}

.info-panel h3 {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--neon-cyan);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* ── Star Rating ── */
.star-rating {
    display: inline-flex;
    gap: 4px;
    direction: rtl;
}

.star-rating input { display: none; }

.star-rating label {
    cursor: pointer;
    font-size: 24px;
    color: var(--text-dim);
    transition: color 0.15s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.rating-display {
    color: var(--neon-gold);
    font-size: 14px;
}

/* ── Achievements ── */
.achievement-list { display: flex; flex-direction: column; gap: 8px; }

.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.achievement-item:hover { border-color: var(--border-glow); }

.achievement-item.earned {
    border-color: var(--neon-gold);
    background: rgba(255, 215, 0, 0.05);
}

.achievement-item.locked { opacity: 0.5; }

.ach-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ach-tier-1 .ach-icon { background: rgba(136, 153, 170, 0.15); }
.ach-tier-2 .ach-icon { background: rgba(68, 170, 68, 0.15); }
.ach-tier-3 .ach-icon { background: rgba(68, 136, 255, 0.15); }
.ach-tier-4 .ach-icon { background: rgba(170, 68, 255, 0.15); }
.ach-tier-5 .ach-icon { background: rgba(255, 215, 0, 0.15); }

.ach-info { flex: 1; }
.ach-name { font-weight: 600; font-size: 13px; }
.ach-desc { font-size: 12px; color: var(--text-secondary); }
.ach-xp { font-family: var(--font-pixel); font-size: 10px; color: var(--neon-gold); }

/* ── Leaderboard / Scores ── */
.score-list { list-style: none; }

.score-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.score-rank {
    width: 28px;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 11px;
}

.score-rank.gold { color: var(--neon-gold); }
.score-rank.silver { color: #c0c0c0; }
.score-rank.bronze { color: #cd7f32; }

.score-name { flex: 1; }
.score-value { font-family: var(--font-pixel); font-size: 12px; color: var(--neon-cyan); }

/* ── XP Bar ── */
.xp-bar-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
}

.xp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 60%);
}

.xp-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-pixel);
    font-size: 8px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}

/* ── Level Badge ── */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-family: var(--font-pixel);
    font-size: 10px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(170, 68, 255, 0.15));
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--neon-cyan);
}

/* ── Profile Page ── */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 3px solid var(--neon-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-pixel);
    font-size: 24px;
    color: var(--neon-cyan);
    flex-shrink: 0;
}

.profile-info { flex: 1; }
.profile-info h2 { font-size: 20px; margin-bottom: 4px; }
.profile-stats {
    display: flex;
    gap: 24px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-stats .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.profile-xp {
    margin-top: 12px;
    max-width: 300px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

.form-error {
    background: rgba(255, 51, 85, 0.1);
    border: 1px solid var(--neon-red);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--neon-red);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Auth Page — Two-Box Split Layout ── */
.auth-container-wide {
    max-width: 820px;
    margin: 40px auto;
    padding: 0 20px;
}

.auth-card-wide {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    position: relative;
}

.auth-card-wide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-magenta), transparent);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h1 {
    font-family: var(--font-pixel);
    font-size: 16px;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Two-column grid */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Vertical divider between columns */
.auth-card-wide .auth-split::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 120px;
    bottom: 80px;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
}

.auth-split-left,
.auth-split-right {
    display: flex;
    flex-direction: column;
}

.auth-column-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-secondary);
}

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

/* OAuth buttons (stacked) */
.oauth-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.oauth-btn svg {
    flex-shrink: 0;
}

.oauth-btn.google {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}
.oauth-btn.google:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #333;
}

.oauth-btn.discord {
    background: #5865F2;
    color: #fff;
    border: 1px solid #4752c4;
}
.oauth-btn.discord:hover {
    background: #4752c4;
    color: #fff;
}

.oauth-btn.twitch {
    background: #9146FF;
    color: #fff;
    border: 1px solid #7c3aed;
}
.oauth-btn.twitch:hover {
    background: #7c3aed;
    color: #fff;
}

.oauth-tos {
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
    margin-top: 12px;
    line-height: 1.4;
}

/* Mobile divider (hidden on desktop) */
.auth-split-divider-mobile {
    display: none;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-footer a {
    color: var(--neon-cyan);
    font-weight: 500;
}

/* Auth responsive — collapse to single column */
@media (max-width: 700px) {
    .auth-container-wide {
        max-width: 420px;
    }

    .auth-split {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-card-wide .auth-split::before {
        display: none;
    }

    .auth-split-divider-mobile {
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 16px 0;
    }

    .auth-split-divider-mobile::before,
    .auth-split-divider-mobile::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-color);
    }

    .auth-split-divider-mobile span {
        color: var(--text-dim);
        font-size: 12px;
    }
}

/* Legacy single-column auth (kept for any other pages) */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
}

.auth-card h2 {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--neon-cyan);
    text-align: center;
    margin-bottom: 24px;
}

/* ── Browse Filters ── */
.browse-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.browse-controls select,
.browse-controls input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.browse-controls select:focus,
.browse-controls input:focus {
    border-color: var(--neon-cyan);
}

.browse-controls select option {
    background: var(--bg-card);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.pagination a:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.pagination .current {
    background: var(--neon-cyan);
    color: var(--bg-dark);
    border-color: var(--neon-cyan);
    font-weight: 600;
}

/* ── Achievement Toast ── */
.achievement-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 2px solid var(--neon-gold);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: toastSlideIn 0.4s ease, toastFadeOut 0.4s ease 4.6s forwards;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    max-width: 360px;
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-20px); }
}

.toast-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

.toast-content h4 {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--neon-gold);
    margin-bottom: 2px;
}

.toast-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-xp {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--neon-green);
}

/* ── Admin ── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.admin-table tr:hover td {
    background: rgba(0, 240, 255, 0.03);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-active { background: rgba(0, 255, 136, 0.15); color: var(--neon-green); }
.badge-inactive { background: rgba(255, 51, 85, 0.15); color: var(--neon-red); }
.badge-featured { background: rgba(255, 215, 0, 0.15); color: var(--neon-gold); }

/* ── Mobile Hamburger ── */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--neon-cyan);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
    }

    .main-content {
        grid-column: 1;
        padding: 60px 16px 24px;
    }

    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .game-info-panels {
        grid-template-columns: 1fr;
    }

    .featured-hero {
        flex-direction: column;
        padding: 20px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .browse-controls {
        flex-direction: column;
    }

    .browse-controls select,
    .browse-controls input {
        width: 100%;
    }

    .achievement-toast {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* ── Fullscreen mode ── */
.fullscreen-mode .sidebar,
.fullscreen-mode .mobile-toggle,
.fullscreen-mode .game-player-toolbar {
    display: none;
}

.fullscreen-mode .main-content {
    grid-column: 1;
    padding: 0;
}

.fullscreen-mode .game-player-container {
    border-radius: 0;
    border: none;
}

.fullscreen-mode .game-iframe {
    height: 100vh !important;
}

.fullscreen-mode .game-info-panels { display: none; }

/* ── Leaderboard page ── */
.leaderboard-list {
    max-width: 600px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.leaderboard-rank {
    font-family: var(--font-pixel);
    font-size: 14px;
    width: 40px;
    text-align: center;
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-pixel);
    font-size: 12px;
}

.leaderboard-info { flex: 1; }
.leaderboard-name { font-weight: 600; }
.leaderboard-stats { font-size: 12px; color: var(--text-secondary); }
.leaderboard-xp {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--neon-cyan);
}

/* ── Legal Pages ── */
.legal-container {
    max-width: 760px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.legal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px 40px;
}

.legal-card h1 {
    font-family: var(--font-pixel);
    font-size: 16px;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
    margin-bottom: 4px;
}

.legal-updated {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.legal-body h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 28px;
    margin-bottom: 10px;
}

.legal-body h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 8px;
}

.legal-body p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.legal-body ul, .legal-body ol {
    margin: 8px 0 16px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.legal-body li {
    margin-bottom: 6px;
}

.legal-body code {
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--neon-cyan);
}

.legal-body strong {
    color: var(--text-primary);
}

.legal-contact-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 12px 0 16px;
}

.legal-contact-box p {
    margin-bottom: 4px;
}

.legal-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 16px;
    font-size: 14px;
}

.legal-data-table th,
.legal-data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.legal-data-table th {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg-surface);
    font-size: 13px;
}

.legal-data-table td {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .legal-card {
        padding: 20px;
    }
}

/* ── Site Footer ── */
.site-footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-dim);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

.footer-copy {
    font-size: 11px;
    color: var(--text-dim);
}

/* ── Terms Checkbox ── */
.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.terms-check input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--neon-cyan);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.terms-check label {
    cursor: pointer;
}

.terms-check a {
    color: var(--neon-cyan);
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-glow); }

/* ══════════════════════════════════════════════════════════
   Visual Polish — Animations, Glows, Depth
   ══════════════════════════════════════════════════════════ */

/* ── Neon Glow Animations ── */
@keyframes neonPulse {
    0%, 100% { text-shadow: 0 0 10px rgba(0, 240, 255, 0.5); }
    50% { text-shadow: 0 0 20px rgba(0, 240, 255, 0.8), 0 0 40px rgba(0, 240, 255, 0.3); }
}

@keyframes borderGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(0, 240, 255, 0.2); }
    50% { box-shadow: 0 0 16px rgba(0, 240, 255, 0.4), 0 0 32px rgba(0, 240, 255, 0.1); }
}

@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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

/* ── Sidebar Logo Glow ── */
.sidebar-logo h1 {
    animation: neonPulse 3s ease-in-out infinite;
}

.sidebar-logo a {
    display: block;
}

.sidebar-logo img {
    max-width: 180px;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* ── Pixel Border on Sidebar ── */
.sidebar {
    border-right: 2px solid var(--neon-cyan);
    border-image: repeating-linear-gradient(
        to bottom,
        var(--neon-cyan) 0px,
        var(--neon-cyan) 4px,
        transparent 4px,
        transparent 8px
    ) 2;
}

/* ── Background Image Support ── */
body.has-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.12;
    z-index: -1;
    pointer-events: none;
}

body.bg-arcade::before { background-image: url('/static/img/arcade-bg.png'); }
body.bg-profile::before { background-image: url('/static/img/profile-bg.png'); }
body.bg-auth::before { background-image: url('/static/img/auth-bg.png'); }

/* ── CRT Scanline Overlay (very subtle) ── */
.main-content {
    position: relative;
}

.main-content::after {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 999;
}

/* ── Enhanced Game Card Hover ── */
.game-card {
    transition: all 0.25s ease;
}

.game-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.game-card-thumb-placeholder {
    position: relative;
    overflow: hidden;
}

.game-card-thumb-placeholder::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.4));
    pointer-events: none;
}

/* Thumbnail image styling */
.game-card-thumb {
    transition: transform 0.3s ease;
}

.game-card:hover .game-card-thumb {
    transform: scale(1.05);
}

/* ── Featured Hero Enhancement ── */
.featured-hero {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 50%, rgba(0, 240, 255, 0.05) 100%);
    border: 1px solid var(--border-color);
}

.featured-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-gold), var(--neon-cyan), var(--neon-magenta));
}

.featured-hero-content h2 {
    animation: neonPulse 4s ease-in-out infinite;
}

/* ── Daily Challenge Enhancement ── */
.daily-challenge {
    position: relative;
    overflow: hidden;
}

.daily-challenge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-gold), transparent);
}

/* ── Enhanced Achievement Items ── */
.achievement-item {
    transition: all 0.2s ease;
}

.achievement-item.earned {
    position: relative;
}

.achievement-item.earned::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 2px 0 0 2px;
}

.ach-tier-1.earned::before { background: var(--tier-1); }
.ach-tier-2.earned::before { background: var(--tier-2); }
.ach-tier-3.earned::before { background: var(--tier-3); }
.ach-tier-4.earned::before { background: var(--tier-4); }
.ach-tier-5.earned::before { background: var(--tier-5); }

.achievement-item.locked {
    opacity: 0.45;
    filter: grayscale(0.5);
}

.achievement-item:hover {
    transform: translateX(4px);
}

/* Tier glow on hover */
.ach-tier-1:hover { box-shadow: 0 0 8px rgba(136, 153, 170, 0.2); }
.ach-tier-2:hover { box-shadow: 0 0 8px rgba(68, 170, 68, 0.2); }
.ach-tier-3:hover { box-shadow: 0 0 8px rgba(68, 136, 255, 0.2); }
.ach-tier-4:hover { box-shadow: 0 0 8px rgba(170, 68, 255, 0.2); }
.ach-tier-5:hover { box-shadow: 0 0 12px rgba(255, 215, 0, 0.3); }

/* ── Profile Avatar Glow ── */
.profile-avatar {
    position: relative;
    animation: borderGlow 3s ease-in-out infinite;
}

/* ── XP Bar Shimmer ── */
.xp-bar-fill {
    background: linear-gradient(
        90deg,
        var(--neon-cyan),
        var(--neon-purple),
        var(--neon-cyan)
    );
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

/* ── Profile Stats Cards ── */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.profile-stats > span {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-align: center;
}

.profile-stats .stat-value {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--neon-cyan);
    margin-bottom: 2px;
}

/* ── Level Badge Enhancement ── */
.level-badge {
    animation: borderGlow 4s ease-in-out infinite;
}

/* ── Info Panel Enhancement ── */
.info-panel {
    transition: border-color 0.2s;
}

.info-panel:hover {
    border-color: var(--border-glow);
}

.info-panel h3 {
    position: relative;
}

.info-panel h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--neon-cyan);
}

/* ── Leaderboard Enhancement ── */
.leaderboard-item:first-child {
    border-color: rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, var(--bg-card), rgba(255, 215, 0, 0.05));
}

.leaderboard-item:first-child .leaderboard-rank {
    color: var(--neon-gold);
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.leaderboard-item:nth-child(2) .leaderboard-rank { color: #c0c0c0; }
.leaderboard-item:nth-child(3) .leaderboard-rank { color: #cd7f32; }

/* ── Mobile Overlay Backdrop ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .main-content::after {
        left: 0;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Page Entrance Animation ── */
.main-content > *:first-child {
    animation: fadeInUp 0.3s ease;
}

/* ── Nav Link Active Glow ── */
.nav-link.active .nav-icon {
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.6));
}

/* ── Button Press Effect ── */
.btn:active {
    transform: translateY(1px);
}

.btn-primary:active {
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

/* ── Game Player Toolbar Enhancement ── */
.game-player-toolbar {
    background: linear-gradient(180deg, var(--bg-card), var(--bg-surface));
}

/* ── Score List Enhancement ── */
.score-item:first-child .score-rank {
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

/* ── Browse Controls Enhancement ── */
.browse-controls select,
.browse-controls input {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.browse-controls select:focus,
.browse-controls input:focus {
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

/* ── Icon helper (using unicode/emoji) ── */
.icon-gamepad::before { content: '🎮'; }
.icon-fire::before { content: '🔥'; }
.icon-compass::before { content: '🧭'; }
.icon-medal::before { content: '🏅'; }
.icon-crown::before { content: '👑'; }
.icon-star::before { content: '⭐'; }
.icon-clock::before { content: '⏰'; }
.icon-trending-up::before { content: '📈'; }
.icon-heart::before { content: '❤️'; }
.icon-trophy::before { content: '🏆'; }
.icon-grid::before { content: '🎯'; }
.icon-award::before { content: '🥇'; }
.icon-calendar::before { content: '📅'; }
