/* everything related to the game feature is here. */

/* =========================================
   Game selector modal
========================================= */
/* #game-modal */
/* .game-selector */
/* #close-game-selector */
/* #game-list */
/* .game-option */

:root {
    --color-bg: #111218;
    --color-surface: #1c1e29;
    --color-surface-hover: #272a38;
    --color-border: #333646;
    --color-text: #f5f5fa;
    --color-muted: #a5a8b8;
    --color-accent: #a78bfa;
    --radius-card: 18px;
}

/* Modal backdrop */

#game-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
    background: rgb(0 0 0 / 65%);
    backdrop-filter: blur(6px);
}
/* Modal container */

.game-selector {
    position: relative;

    width: min(100%, 480px);
    max-height: min(80vh, 700px);
    overflow-y: auto;

    padding: 28px;
    border: 1px solid var(--color-border);
    border-radius: 24px;

    background: var(--color-bg);
    color: var(--color-text);

    box-shadow: 0 24px 80px rgb(0 0 0 / 35%);

    animation: modal-enter 180ms ease-out;
}

/* Modal heading */
.game-selector h2 {
    margin: 0 36px 8px 0;
    font-size: 1.65rem;
    letter-spacing: -0.04em;
}

.game-selector > p {
    margin-bottom: 24px;
    color: var(--color-muted);
}

/* Close button */
#close-game-selector {
    position: absolute;
    top: 18px;
    right: 18px;

    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    border: 1px solid var(--color-border);
    border-radius: 50%;

    background: var(--color-surface);
    color: var(--color-text);

    font-size: 1.2rem;
    cursor: pointer;
}

#close-game-selector:hover {
    background: var(--color-surface-hover);
}

#back-to-all-games {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 10px 14px;
    margin-bottom: 24px;

    border: 1px solid var(--color-border);
    border-radius: 12px;

    background: transparent;
    color: var(--color-muted);

    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;

    transition:
        background 160ms ease,
        color 160ms ease,
        border-color 160ms ease;
}

#back-to-all-games:hover {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-accent);
}

#back-to-all-games:active {
    transform: translateY(1px);
}

#back-to-all-games:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

/* Game list */
#game-list {
    display: grid;
    gap: 12px;
}

/* Individual game cards */
.game-option {
    display: flex;
    align-items: center;
    gap: 16px;

    width: 100%;
    padding: 20px;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);

    background: var(--color-surface);
    color: var(--color-text);

    text-align: left;
    cursor: pointer;

    transition:
        background 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

.game-option:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.game-option:focus-visible,
#close-game-selector:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

.game-option span:first-child {
    font-size: 2rem;
}

.game-option span:last-child {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Game screen */

.game-card {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 32px 24px;

    border: 1px solid var(--color-border);
    border-radius: 24px;

    background: var(--color-surface);
    color: var(--color-text);

    text-align: center;
}

#argument-prompt {
    margin: 32px 0;
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    font-weight: 600;
    line-height: 1.4;
}

#next-argument {
    width: 100%;
    min-height: 48px;

    border: 0;              
    border-radius: 12px;

    background: var(--color-accent);
    color: #171322;

    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

#next-argument:hover {
    filter: brightness(1.08);
}

.game-card button + button {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    cursor: pointer;
}

.game-card button + button:hover {
    color: var(--color-text);
    border-color: var(--color-accent);
}

.game-card .answer-button {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    cursor: pointer;
}

.game-card .answer-button:hover {
    color: var(--color-text);
    border-color: var(--color-accent);
}

.game-card .answer-button:disabled {
    cursor: default;
    opacity: 0.7;
}

.game-card .trivia-exit-button {
    display: block;
    width: auto;
    margin: 24px auto 0;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    cursor: pointer;
}

.game-card .trivia-exit-button:hover {
    color: var(--color-text);
    text-decoration: underline;
}
/* Entrance animation */

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile adjustments */

@media (max-width: 480px) {
    .game-selector {
        padding: 22px;
        border-radius: 20px;
    }

    .game-option {
        padding: 16px;
    }

    .game-card {
        margin: 20px auto;
        padding: 24px 18px;
    }
}
