/* ==========================================================================
   Oyun Dünyası — shared game-screen shell
   --------------------------------------------------------------------------
   Common structure used by the in-room game screens. Load it after
   ``theme.css`` and before the per-game stylesheet:

       theme.css  ->  game.css  ->  <game>/css/game.css

   The per-game file only needs to add its own look (board, table, cards,
   colours). Anything shared between two or more games belongs here.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.hidden,
[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Shared page backdrop
   -------------------------------------------------------------------------- */

body.game-shell-page {
    background-image:
        linear-gradient(rgba(11, 15, 25, 0.9), rgba(11, 15, 25, 0.96)),
        url('../img/background.webp');
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-attachment: fixed;
}

/* --------------------------------------------------------------------------
   Screen shell
   -------------------------------------------------------------------------- */

.game-container {
    position: relative;
    width: 100%;
    margin-inline: auto;
}

.game-header {
    text-align: center;
}

.room-code {
    display: inline-block;
    margin-top: 14px;
    padding: 6px 16px;
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent, var(--color-accent-2, #22d3ee));
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 2px;
}

/* --------------------------------------------------------------------------
   Player status
   -------------------------------------------------------------------------- */

.player-info {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.player-section {
    flex: 1;
    padding: 18px;
    border-radius: var(--radius-md, 14px);
    text-align: center;
}

.player-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.turn-indicator,
.opponent-status {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.turn-indicator.waiting,
.opponent-status {
    border: 1px solid var(--border-subtle, var(--color-border, rgba(148, 163, 184, 0.14)));
    background: rgba(148, 163, 184, 0.06);
    color: var(--text-muted, var(--color-text-muted, #64748b));
}

.turn-indicator.your-turn {
    border: 1px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.12);
    color: var(--green, #10b981);
}

.turn-indicator.opponent-turn {
    border: 1px solid rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.12);
    color: var(--red, #f43f5e);
}

.opponent-status.connected {
    border: 1px solid rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.1);
    color: var(--cyan, var(--accent, #06b6d4));
}

.opponent-status.disconnected {
    border: 1px solid rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.12);
    color: var(--red, #f43f5e);
}

.opponent-activity {
    min-height: 20px;
    margin-top: 8px;
    color: var(--text-muted, var(--color-text-muted, #64748b));
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Game area reveal / game over
   -------------------------------------------------------------------------- */

.game-area {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.game-area.visible {
    opacity: 1;
    transform: translateY(0);
}

.game-over {
    margin-top: 24px;
    padding: 34px 20px;
    border: 1px solid var(--border-subtle, var(--color-border, rgba(148, 163, 184, 0.14)));
    border-radius: var(--radius-lg, 18px);
    background: rgba(17, 24, 39, 0.72);
    text-align: center;
}

.game-over h2 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.footer {
    margin-top: 32px;
    color: var(--text-muted, var(--color-text-muted, #64748b));
    font-size: 0.85rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Shared controls
   -------------------------------------------------------------------------- */

/* Base look for games that do not define their own ghost button.
   Wrapped in :where() so any app-level ``button`` / ``.ghost-btn`` rule
   always wins, even though the app stylesheet loads after this file. */
:where(.ghost-btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--color-border, rgba(148, 163, 184, 0.14));
    border-radius: var(--radius-xs, 8px);
    background: transparent;
    color: var(--color-text-secondary, #94a3b8);
    font-family: var(--font-ui, sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

:where(.ghost-btn):hover {
    border-color: var(--color-border-strong, rgba(148, 163, 184, 0.26));
    background: rgba(148, 163, 184, 0.06);
    color: var(--color-text, #f8fafc);
}

:where(.ghost-btn):active {
    background: rgba(148, 163, 184, 0.12);
}

:where(.ghost-btn).small {
    padding: 4px 10px;
    font-size: 0.72rem;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    z-index: 1000;
    max-width: min(92vw, 520px);
    padding: 12px 22px;
    transform: translateX(-50%);
    border: 1px solid var(--border-subtle, var(--color-border, rgba(148, 163, 184, 0.14)));
    border-radius: 999px;
    background: rgba(21, 29, 48, 0.98);
    color: var(--text-main, var(--color-text, #f8fafc));
    box-shadow: 0 24px 50px -24px rgba(2, 6, 23, 0.95);
    font-size: 0.9rem;
    text-align: center;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.42);
    color: #fca5a5;
}

/* --------------------------------------------------------------------------
   Responsive shell
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .game-container {
        padding: 24px 16px;
    }

    .player-info {
        flex-direction: column;
        gap: 12px;
    }

    .game-over h2 {
        font-size: 1.8rem;
    }
}
