/* --- Game Cards & Components --- */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.game-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease, box-shadow 0.28s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}

/* Flat, catalogue-style hover: lift and lighten rather than glow */
.game-card:hover {
    transform: translateY(-4px);
    background-color: var(--card-hover-bg-color);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.game-visuals {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: var(--skeleton-color);
}

/* Default aspect ratio for standard grid items to prevent collapse */
.games-grid .game-visuals {
    aspect-ratio: 3 / 2;
}

.game-visuals img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s cubic-bezier(0.2, 0, 0.2, 1);
}

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

/* The name plate is always visible: a scrim gradient anchored to the bottom of
   the thumbnail, so the grid reads as a labelled catalogue rather than an
   unlabelled wall of artwork. Meta and actions slide in on hover. */
.card-overlay {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 3;
    padding: 26px 12px 10px;
    background: linear-gradient(0deg, rgba(8, 9, 15, 0.92) 0%, rgba(8, 9, 15, 0.55) 55%, transparent 100%);
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.game-card.image-error .game-visuals::after {
    content: 'Image unavailable';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-color-muted);
    font-size: .85em;
}

.game-title {
    font-size: 14.5px;
    font-weight: 900;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tag chips — revealed with the actions on hover/focus */
.game-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}

.game-card:hover .game-meta,
.game-card:focus-within .game-meta {
    max-height: 24px;
    opacity: 1;
    margin-top: 6px;
}

.game-chip {
    height: 20px;
    padding: 0 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    text-transform: capitalize;
    white-space: nowrap;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}

.game-card:hover .card-actions,
.game-card:focus-within .card-actions {
    max-height: 40px;
    opacity: 1;
    margin-top: 10px;
    pointer-events: auto;
}

.play-button-overlay {
    background: var(--accent-color);
    color: var(--on-accent-color);
    height: 34px;
    padding: 0 16px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background-color 0.15s ease;
}

.play-button-overlay:hover {
    background: var(--accent-hover-color);
}

.favorite-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(8, 9, 15, 0.82);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-size: 13px;
    transition: transform 0.25s ease, background-color 0.15s ease, color 0.15s ease;
}

.favorite-button:hover {
    transform: scale(1.1);
    background: rgba(8, 9, 15, 0.95);
}

.report-game-button {
    width: 34px !important;
    height: 34px;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 0 !important;
    border-radius: 50%;
    color: #ffd166;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.report-game-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2) !important;
    transform: none !important;
}

.favorite-button.favorited {
    color: #ff4d6a;
    background: rgba(8, 9, 15, 0.9);
}

/* Corner badges — Verified and New share one row so they never overlap */
.card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.new-tag {
    height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 8px;
    background: var(--accent-color);
    color: var(--on-accent-color);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

/* Trust mark for games and tools added by the Funbyte team. Reads on any
   palette, so it keeps its own colour instead of the accent. */
.verified-tag {
    height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 9px;
    border-radius: 8px;
    background: rgba(8, 9, 15, 0.82);
    color: #34d399;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

/* Category Slider */
.category-container {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 5px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-container::-webkit-scrollbar {
    display: none;
}

.category-button {
    padding: 0 20px;
    height: 38px;
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color-muted);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9em;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.25s ease;
}

.category-button:hover {
    background: var(--card-hover-bg-color);
    color: var(--text-color);
    transform: translateY(-2px);
}

.category-button.active {
    background: var(--accent-color);
    color: var(--on-accent-color);
    border-color: var(--accent-color);
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-color) 25%, var(--skeleton-shine) 50%, var(--skeleton-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

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

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    aspect-ratio: 3 / 2;
    width: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal {
    position: relative;
    background: var(--modal-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal h2 {
    font-size: 1.8em;
    margin-bottom: 24px;
    text-align: center;
}

.modal input {
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 16px;
    background: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1em;
    transition: all 0.3s ease;
}

.modal input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.modal button {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: var(--on-accent-color);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1em;
    transition: all 0.3s ease;
}

.modal button:hover {
    background: var(--accent-hover-color);
    transform: translateY(-2px);
}

.modal .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color-muted);
    font-size: 1.25em;
    line-height: 1;
    cursor: pointer;
    transition: all 0.25s ease;
}

.modal .modal-close:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--on-accent-color);
    transform: none;
    box-shadow: none;
}

/* --- Report a game modal --- */
#report-modal .modal {
    width: min(100%, 480px);
    max-height: min(680px, calc(100vh - 40px));
    overflow-y: auto;
    padding: 36px;
}

#report-modal .modal h2 {
    text-align: left;
    font-size: 1.5em;
    margin: 0 0 6px;
    padding-right: 44px;
}

.report-modal-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    margin-bottom: 18px;
    font-size: 1.3em;
    color: var(--accent-color);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent-color) 25%, transparent);
}

.report-modal-game {
    color: var(--text-color-muted);
    font-size: 0.92em;
    margin: 0 0 24px;
}

.report-modal-game strong {
    display: inline-block;
    max-width: 100%;
    padding: 3px 10px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-color);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.modal-field-label {
    display: block;
    font-weight: 700;
    font-size: 0.9em;
    margin: 0 0 8px;
    color: var(--text-color);
}

#report-modal .settings-input-refined {
    width: 100%;
    margin: 0 0 18px;
}

.report-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.report-modal-actions button {
    flex: 1;
    width: auto;
    padding: 14px 16px;
    margin: 0;
}

.report-modal-actions .secondary-action-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-weight: 700;
}

.report-modal-actions .secondary-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: none;
}

/* Section Titles */
.section-title {
    font-size: 2.2em;
    font-weight: 800;
    margin: 60px 0 30px 0;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::before {
    content: '';
    width: 8px;
    height: 32px;
    background: var(--accent-color);
    border-radius: 4px;
}

.page-subtitle {
    color: var(--text-color-muted);
    font-size: 1em;
    margin: -18px 0 30px;
    padding-left: 23px;
}