.fcc-game-player {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top, #1f2338 0%, #0b0d1b 65%, #05060f 100%);
    color: #f5f7ff;
    padding: 2rem 1rem 3rem;
}

/* Force light text in all modes (protect from theme light-mode bleed) */
.fcc-game-player *,
.fcc-game-player *::before,
.fcc-game-player *::after {
    color: inherit;
}

.fcc-game-player--missing {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.fcc-game-player__inner {
    background: rgba(15, 19, 35, 0.75);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 560px;
}

.fcc-game-player__back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    color: #f5f7ff;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 1px solid rgba(245, 185, 66, 0.35);
    background: rgba(245, 185, 66, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fcc-game-player__back:hover {
    background: rgba(245, 185, 66, 0.25);
    box-shadow: 0 8px 18px rgba(245, 185, 66, 0.25);
}

.fcc-game-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fcc-game-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #f5f7ff;
    font-weight: 600;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(245, 185, 66, 0.35);
    background: rgba(245, 185, 66, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fcc-game-back:hover {
    background: rgba(245, 185, 66, 0.25);
    box-shadow: 0 8px 18px rgba(245, 185, 66, 0.25);
}

.fcc-game-meta {
    display: flex;
    gap: 0.5rem;
}

.fcc-game-pill {
    background: rgba(245, 185, 66, 0.15);
    color: #f5b942;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.fcc-game-header {
    background: rgba(10, 12, 22, 0.8);
    border: 1px solid rgba(245, 185, 66, 0.18);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(10, 12, 22, 0.35);
}

.fcc-game-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    margin: 0;
    letter-spacing: 0.03em;
}

.fcc-game-subtitle {
    margin: 0.75rem 0 1.5rem;
    color: rgba(255, 255, 255, 0.75);
}

.fcc-game-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.fcc-game-status__item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    min-width: 140px;
}

.fcc-game-status__item .label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.65;
}

.fcc-game-status__item .value {
    font-size: 1.1rem;
    font-weight: 700;
}

.fcc-game-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.fcc-game-button {
    padding: 0.75rem 1.75rem;
    border-radius: 999px;
    border: 1px solid rgba(245, 185, 66, 0.4);
    background: rgba(245, 185, 66, 0.15);
    color: #f5f7ff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fcc-game-button:focus,
.fcc-game-button:hover {
    background: rgba(245, 185, 66, 0.25);
    box-shadow: 0 6px 16px rgba(245, 185, 66, 0.25);
    outline: none;
}

/* Shared button styles (used inside game UIs) */
.fcc-button {
    border-radius: 10px;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fcc-button--primary {
    background: linear-gradient(135deg, #f5b942, #f78423);
    color: #06070f !important;
    border-color: transparent;
}

.fcc-button--ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(245, 185, 66, 0.25);
    color: #f7f8ff;
}

.fcc-button:focus,
.fcc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(245, 185, 66, 0.25);
}

.fcc-game-canvas {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 1rem 0;
}

.fcc-game-surface {
    width: 100%;
    max-width: 1100px;
    display: flex;
    gap: 2rem;
    background: rgba(10, 12, 22, 0.65);
    border: 1px solid rgba(245, 185, 66, 0.12);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: inset 0 0 0 1px rgba(245, 185, 66, 0.05);
}

/* ========================================================================
   Game Over Overlay
   ======================================================================== */

.fcc-gameover {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 16, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 1.5rem;
}

.fcc-gameover[hidden] {
    display: none;
}

.fcc-gameover__panel {
    width: min(92vw, 520px);
    background: rgba(12, 15, 28, 0.95);
    border: 1px solid rgba(245, 185, 66, 0.2);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 30px 80px rgba(8, 10, 20, 0.45);
}

.fcc-gameover__eyebrow {
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    color: rgba(245, 185, 66, 0.85) !important;
}

.fcc-gameover__title {
    margin: 0 0 0.75rem;
    font-size: 1.6rem;
}

.fcc-gameover__score {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #f5b942 !important;
}

.fcc-gameover__message {
    margin: 0 0 1.5rem;
    color: rgba(255, 255, 255, 0.75);
}

.fcc-gameover__actions {
    display: grid;
    gap: 0.75rem;
}

.fcc-gameover__actions .fcc-game-button {
    width: 100%;
}


.fcc-tetris__board canvas {
    border: 4px solid rgba(245, 185, 66, 0.35);
    border-radius: 10px;
    background: #04050a;
    box-shadow: 0 12px 30px rgba(10, 12, 22, 0.45);
    touch-action: none;
}

.fcc-tetris__sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fcc-tetris__score {
    font-size: 1.2rem;
    font-weight: 700;
    background: rgba(245, 185, 66, 0.18);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    text-align: center;
}

.fcc-tetris__status {
    min-height: 1.5rem;
    font-size: 0.95rem;
}

.fcc-tetris__status[data-tone="success"] {
    color: #4ade80 !important;
}

.fcc-tetris__status[data-tone="error"] {
    color: #f87171 !important;
}

.fcc-tetris__status[data-tone="info"] {
    color: #60a5fa !important;
}

.fcc-tetris__panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(245, 185, 66, 0.14);
}

.fcc-tetris__panel h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    color: #f5b942 !important;
}

.fcc-tetris__panel ul {
    margin: 0;
    padding-left: 1.1rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

.fcc-tetris__mobile-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.fcc-tetris-control {
    background: rgba(59, 73, 123, 0.5);
    border: 1px solid rgba(245, 185, 66, 0.2);
    border-radius: 10px;
    color: #f5f7ff;
    padding: 0.9rem;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.fcc-tetris-control span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.fcc-tetris-control:active {
    transform: scale(0.96);
    background: rgba(245, 185, 66, 0.25);
}

/* ==========================================================================
   Mobile Controls Dock (keep controls close to the game surface on phones)
   ========================================================================== */

.fcc-controls-dock {
    display: none;
    /* enabled on mobile breakpoints */
    width: 100%;
    justify-content: center;
}

.fcc-controls-dock .fcc-tetris__mobile-controls,
.fcc-controls-dock .fca-snake__mobile-controls {
    width: 100%;
    max-width: 360px;
}

.fcc-controls-panel--sidebar {
    /* Hidden on mobile to avoid duplicated controls (dock replaces it). */
}

/* ==========================================================================
   Snake (styles moved from inline CSS to shared stylesheet)
   ========================================================================== */

.fca-snake {
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.fca-snake__board {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.fca-snake__board canvas {
    display: block;
    border-radius: 8px;
    background: #0a0a15;
    touch-action: none;
}

.fca-snake__sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    max-width: 280px;
}

.fca-snake__score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4ade80 !important;
    text-align: center;
    padding: 0.75rem;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.fca-snake__highscore {
    font-size: 1rem;
    color: #fbbf24 !important;
    text-align: center;
    padding: 0.5rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.fca-snake__status {
    min-height: 2rem;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: #a0a0b0;
}

.fca-snake__panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
}

.fca-snake__panel h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: #e0e0e0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.fca-snake__panel ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.fca-snake__panel li {
    font-size: 0.85rem;
    color: #a0a0b0;
    padding: 0.25rem 0;
}

.fca-snake__mobile-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 220px;
    margin: 0 auto;
}

.fca-snake-control {
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #2a2a4e, #1a1a3e);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
}

.fca-snake-control:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.fca-snake-control span {
    display: none;
}

.fca-snake-control[data-control="up"] {
    grid-column: 2;
    grid-row: 1;
}

.fca-snake-control[data-control="left"] {
    grid-column: 1;
    grid-row: 2;
}

.fca-snake-control[data-control="right"] {
    grid-column: 3;
    grid-row: 2;
}

.fca-snake-control[data-control="down"] {
    grid-column: 2;
    grid-row: 3;
}

/* Leaderboard Modal (shared) */
.fcc-leaderboard-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 6, 12, 0.65);
    backdrop-filter: blur(6px);
    z-index: 9999;
}

.fcc-leaderboard-modal[hidden] {
    display: none;
}

.fcc-leaderboard-modal__dialog {
    background: #0b0d1b;
    border-radius: 18px;
    border: 1px solid rgba(245, 185, 66, 0.15);
    width: min(90vw, 520px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(5, 6, 15, 0.45);
}

.fcc-leaderboard-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid rgba(245, 185, 66, 0.12);
}

.fcc-leaderboard-modal__close {
    background: none;
    border: none;
    color: #f5f7ff;
    font-size: 1.5rem;
    cursor: pointer;
}

.fcc-leaderboard-modal__body {
    padding: 1.5rem 1.75rem 1.75rem;
    overflow-y: auto;
    display: grid;
    gap: 0.75rem;
}

.fcc-leaderboard-modal__loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 960px) {
    .fcc-game-surface {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .fcc-controls-dock {
        display: flex;
        margin-top: 0.5rem;
    }

    .fcc-controls-panel--sidebar {
        display: none;
    }

    .fcc-tetris__sidebar {
        width: 100%;
        max-width: 460px;
    }

    .fca-snake__sidebar {
        width: 100%;
        max-width: 460px;
    }
}

@media (max-width: 640px) {
    .fcc-game-player {
        padding: 1.5rem 0.75rem 2rem;
    }

    .fcc-game-header {
        padding: 1.5rem 1.25rem;
    }

    .fcc-game-controls {
        gap: 0.65rem;
    }

    .fcc-game-button {
        flex: 1;
        min-width: 140px;
    }

    .fcc-game-surface {
        padding: 1.5rem;
    }

    .fcc-tetris__board canvas {
        width: 240px;
        height: 384px;
    }

    .fca-snake__board canvas {
        width: 300px;
        height: 300px;
    }

    .fcc-gameover__panel {
        padding: 1.5rem;
    }
}