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

:root {
    /* Monochrome Palette */
    --bg-main: #141414;
    --bg-surface: #1e1e1e;
    --bg-card: #242424;
    --bg-card-hover: #2c2c2c;
    --bg-navbar: #222222;
    --bg-modal: #1e1e1e;
    --bg-modal-header: #191919;
    --modal-overlay: rgba(0, 0, 0, 0.85);

    /* Borders & Lines */
    --border-subtle: 1px solid #333333;
    --border-card: 1px solid #303030;
    --border-hover: 1px solid #666666;
    --border-active: 1px solid #ffffff;

    /* Monochrome Badges */
    --badge-bg: #333333;
    --badge-text: #e0e0e0;
    --badge-border: 1px solid #444444;

    /* Typography Colors */
    --text-white: #ffffff;
    --text-body: #b3b3b3;
    --text-muted: #7e7e7e;
    --text-subtle: #5a5a5a;

    /* Fonts */
    --font-heading: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Shadows & Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 9999px;
    --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.8);

    --transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body {
    background-color: var(--bg-main);
    color: var(--text-body);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 30px 20px 70px;
    flex-grow: 1;
}

/* navbar */
.navbar {
    background: var(--bg-navbar);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-white);
    user-select: none;
    cursor: pointer;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: #2e2e2e;
    border: 1px solid #444444;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--text-white);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-white);
}

/* Filter Links */
.nav-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
    flex-wrap: wrap;
}

.filter-btn {
    background: none;
    border: 1px solid transparent;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    color: var(--text-white);
    background: #333333;
    border-color: #555555;
}

.filter-count {
    font-size: 0.72rem;
    background: #181818;
    color: inherit;
    padding: 1px 6px;
    border-radius: 10px;
    font-family: var(--font-body);
}

/* toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.catalog-count-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
}

.catalog-count-label strong {
    color: var(--text-white);
}


/* game grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

.game-card {
    background: var(--bg-card);
    border: var(--border-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    outline: none;
}

.game-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: #555555;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}

.game-card:focus-visible {
    border-color: var(--text-white);
}

/* Thumbnail Area */
.card-thumb-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 ratio */
    background: #181818;
    overflow: hidden;
}

.card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

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

/* Card Details Body */
.card-content {
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.card-game-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
}

/* Small "Played" Badge */
.played-badge {
    background: var(--badge-bg);
    color: var(--badge-text);
    border: var(--badge-border);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.card-desc-truncated {
    font-size: 0.82rem;
    color: var(--text-body);
    line-height: 1.4;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

/* Card Footer Tags */
.card-footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #333333;
    font-size: 0.76rem;
}

.genre-label {
    font-weight: 800;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.platform-label {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 135px;
}

/* Empty Grid State */
.empty-state {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed #383838;
    border-radius: var(--radius-md);
}

.empty-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    opacity: 0.8;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-white);
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-body);
    margin-bottom: 16px;
    font-size: 0.9rem;
}


/* modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--bg-modal);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 920px;
    box-shadow: var(--shadow-modal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: scale(0.95);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-backdrop.active .modal-box {
    transform: scale(1);
}

/* Modal Top Header */
.modal-header {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2e2e2e;
    background: var(--bg-modal-header);
}

.modal-headline {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-white);
}

.modal-close-btn {
    background: transparent;
    border: 1px solid transparent;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    outline: none;
}

.modal-close-btn:hover {
    background: #333333;
    color: var(--text-white);
    border-color: #444444;
}

.modal-close-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Two-Column Modal Body */
.modal-body {
    padding: 26px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 28px;
    align-items: start;
}

/* Left Column: Image & Stats */
.modal-left-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-cover-frame {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #333333;
    background: #141414;
}

.modal-cover-image {
    width: 100%;
    height: 230px;
    object-fit: cover;
    display: block;
}

.modal-specs-box {
    background: #252525;
    border: 1px solid #333333;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.spec-val {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-white);
}

/* Right Column: Title, Metadata, Description & Button */
.modal-right-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-title-text {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.25;
}

/* Metadata Badges Rows */
.modal-meta-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.meta-title-label {
    color: var(--text-white);
    font-weight: 700;
    min-width: 78px;
}

.mono-pill-badge {
    display: inline-flex;
    align-items: center;
    background: #2e2e2e;
    color: #e0e0e0;
    border: 1px solid #444444;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.2px;
}

/* Long Description Paragraphs */
.modal-description-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-body);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 4px;
}

.modal-description-box p {
    text-align: justify;
}



/* Minimalist Toast */
.mono-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #222222;
    color: var(--text-white);
    border: 1px solid #444444;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 2000;
    transform: translateY(80px);
    opacity: 0;
    transition: var(--transition);
}

.mono-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 24px 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid #222222;
    background: #111111;
}

/* Responsive */
@media (max-width: 1100px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 820px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal-cover-image {
        height: 200px;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
        gap: 14px;
    }

    .brand-link {
        justify-content: center;
    }

    .nav-filters {
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .container {
        padding: 16px 12px 40px;
    }

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

    .nav-filters {
        gap: 8px;
    }

    .filter-btn {
        font-size: 0.78rem;
        padding: 5px 10px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-title-text {
        font-size: 1.3rem;
    }
}