/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1b2838;
    color: #c6d4df;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

a {
    color: #66c0f4;
    text-decoration: none;
}

a:hover {
    color: #fff;
}

/* ===== NAV ===== */
nav {
    background-color: #171a21;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid #2a475e;
}

nav a:first-child {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
}

/* ===== MAIN CONTENT ===== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== PROFILE ===== */
.profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #2a475e;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.profile img {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    border: 2px solid #66c0f4;
}

.profile h1 {
    font-size: 2rem;
    color: #fff;
}

.profile p {
    color: #8f98a0;
    margin-top: 0.25rem;
}

/* ===== LIBRARY ===== */
.library-header {
    margin-bottom: 1.5rem;
}

.library-header h1 {
    color: #fff;
    font-size: 1.8rem;
}

.library-header p {
    color: #8f98a0;
    margin-top: 0.25rem;
}

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

.game-card {
    background: #2a475e;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.game-card img {
    width: 100%;
    aspect-ratio: 460 / 215;
    object-fit: cover;
    background: #1b2838;
}

.game-info {
    padding: 0.75rem;
}

.game-info h3 {
    font-size: 0.85rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-info p {
    font-size: 0.8rem;
    color: #8f98a0;
    margin-top: 0.25rem;
}

/* ===== RECENTLY PLAYED ===== */
a.recent-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.section-title {
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.recent-card {
    background: #2a475e;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.recent-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.recent-card img {
    width: 100%;
    aspect-ratio: 460 / 215;
    object-fit: cover;
}

/* ===== GAME / ACHIEVEMENTS ===== */
.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #66c0f4;
}

.achievement-header {
    margin-bottom: 2rem;
}

.achievement-header h1 {
    color: #fff;
    font-size: 1.8rem;
}

.achievement-header p {
    color: #8f98a0;
    margin: 0.25rem 0 0.75rem;
}

.progress-bar {
    background: #1b2838;
    border-radius: 4px;
    height: 8px;
    width: 300px;
    overflow: hidden;
}

.progress-fill {
    background: #66c0f4;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.achievement-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #2a475e;
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.achievement.locked {
    opacity: 0.5;
}

.achievement img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
}

.achievement-info h3 {
    color: #fff;
    font-size: 0.95rem;
}

.achievement-info p {
    color: #8f98a0;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.badge {
    margin-left: auto;
    color: #66c0f4;
    font-weight: bold;
    font-size: 1.1rem;
}

.no-achievements {
    color: #8f98a0;
}

/* Make game cards work as links */
a.game-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* ===== LIBRARY CONTROLS ===== */
.library-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
}

.library-controls input,
.library-controls select {
    background: #2a475e;
    border: 1px solid #4a7a9b;
    color: #c6d4df;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    outline: none;
}

.library-controls input {
    width: 250px;
}

.library-controls input::placeholder {
    color: #8f98a0;
}

.library-controls select option {
    background: #1b2838;
}

.library-controls input:focus,
.library-controls select:focus {
    border-color: #66c0f4;
}

/* ===== STATS ===== */
.stats-header {
    margin-bottom: 1.5rem;
}

.stats-header h1 {
    color: #fff;
    font-size: 1.8rem;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: #2a475e;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #66c0f4;
}

.stat-label {
    font-size: 0.85rem;
    color: #8f98a0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chart-section {
    background: #2a475e;
    border-radius: 8px;
    padding: 1.5rem;
}

.chart-container {
    position: relative;
    height: 350px;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }

    nav {
        padding: 1rem;
        gap: 1rem;
        flex-wrap: wrap;
    }

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

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

    .recent-grid {
        grid-template-columns: 1fr;
    }

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

    .library-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .library-controls input {
        width: 100%;
    }

    .progress-bar {
        width: 100%;
    }

    .chart-container {
        height: 250px;
    }
}

/* ===== LOADING SPINNER ===== */
.loader-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
    color: #8f98a0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #2a475e;
    border-top-color: #66c0f4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== ERROR PAGE ===== */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-page h1 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-page p {
    color: #8f98a0;
    margin-bottom: 2rem;
}