/* ══════════════════════════════════════
   Games Page
   ══════════════════════════════════════ */
.games-page {
    padding: 40px 0 60px;
    min-height: 60vh;
}

.games-page h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.games-subtitle {
    color: var(--text-secondary, #999);
    margin-bottom: 30px;
}

.games-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.games-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.games-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.games-back:hover {
    color: var(--primary-color);
    text-shadow: var(--glow-primary);
}

.games-page--game {
    padding-bottom: 40px;
}

.games-game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 16px;
    align-items: start;
}

.games-game-main {
    min-width: 0;
}

.games-embed {
    width: 100%;
    min-height: min(78vh, 820px);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(167, 139, 255, 0.22);
    background: rgba(15, 13, 22, 0.55);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

.games-note {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* -----------------------------------
   Games - Basketball Launch (Three.js)
   ----------------------------------- */

.basketball-launch-stage {
    --ink: #dce8ff;
    --panel: rgba(11, 17, 36, 0.84);
    --accent: #ff5f8b;
    --accent-2: #49ff9f;
    --edge: rgba(123, 172, 255, 0.36);

    position: relative;
    width: 100%;
    height: min(78vh, 820px);
    overflow: hidden;
    user-select: none;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% 14%, rgba(56, 126, 255, 0.35) 0%, transparent 42%),
        radial-gradient(circle at 86% 10%, rgba(255, 70, 126, 0.28) 0%, transparent 44%),
        linear-gradient(170deg, #070a15 0%, #080d1e 56%, #0a1025 100%);
}

/* Fullscreen mode (CSS-based): covers the viewport when fs=1 */
.basketball-launch-stage.is-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    z-index: 50000;
}

.games-page--game.is-fullscreen {
    padding: 0;
}

.games-page--game.is-fullscreen .container {
    max-width: none;
    width: 100%;
    padding: 0;
}

.games-page--game.is-fullscreen .games-embed {
    border-radius: 0;
    border: 0;
    box-shadow: none;
    min-height: 100vh;
    background: transparent;
}

.games-page--game.is-fullscreen .games-game-layout {
    display: block;
}

.games-page--game.is-fullscreen .basketball-leaderboard {
    display: none;
}

.basketball-launch-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 30;
    display: none;
    gap: 10px;
}

.basketball-launch-stage.is-fullscreen .basketball-launch-toolbar {
    display: flex;
}

.basketball-launch-stage * {
    box-sizing: border-box;
}

#basketball-launch-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.basketball-launch-stage canvas {
    display: block;
    cursor: grab;
}

.basketball-launch-stage #hud {
    position: absolute;
    left: 14px;
    top: 14px;
    z-index: 10;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 14px;
    padding: 12px 14px;
    min-width: 220px;
    box-shadow: 0 14px 36px rgba(2, 6, 18, 0.62);
    backdrop-filter: blur(4px);
}

.basketball-leaderboard {
    position: sticky;
    top: 14px;
    width: 100%;
    max-height: min(78vh, 820px);
    color: #dce8ff;
    background: rgba(8, 14, 30, 0.9);
    border: 1px solid var(--edge);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(2, 6, 18, 0.62);
    backdrop-filter: blur(4px);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.basketball-leaderboard h2 {
    margin: 0;
    font-size: 15px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.basketball-leaderboard-status {
    font-size: 11px;
    color: #c7d9ff;
}

.basketball-leaderboard-status.is-error {
    color: #ffcfdd;
}

.basketball-leaderboard-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    min-height: 40px;
}

.basketball-leaderboard-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 5px 7px;
    border-radius: 9px;
    border: 1px solid rgba(140, 183, 255, 0.2);
    background: rgba(10, 18, 37, 0.7);
    font-size: 12px;
}

.basketball-leaderboard-item.is-current {
    border-color: rgba(99, 255, 176, 0.62);
    background: rgba(10, 42, 31, 0.78);
}

.basketball-leaderboard-rank {
    color: #9ec3ff;
    font-weight: 700;
    min-width: 34px;
}

.basketball-leaderboard-name {
    color: #e8f2ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

a.basketball-leaderboard-name:hover {
    color: #ffffff;
    text-decoration: underline;
}

.basketball-leaderboard-score {
    color: #9fffd0;
    font-weight: 700;
    text-align: right;
}

.basketball-leaderboard-empty {
    color: #c7d9ff;
    font-size: 12px;
    padding: 4px 0;
}

.basketball-leaderboard-login {
    margin: 0;
    font-size: 11px;
    color: #ffcfdd;
}

.basketball-launch-stage #hud h1 {
    margin: 0 0 6px;
    font-size: 18px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.basketball-launch-stage #scoreline {
    font-size: 20px;
    font-weight: 700;
    margin: 2px 0 8px;
}

.basketball-launch-stage #scoreline strong {
    color: var(--accent-2);
    text-shadow: 0 0 10px rgba(73, 255, 159, 0.45);
}

.basketball-launch-stage #statsline {
    margin: 0 0 8px;
    font-size: 13px;
    color: #c8dcff;
    letter-spacing: 0.02em;
}

.basketball-launch-stage #statsline strong {
    color: #fff2ad;
    font-weight: 700;
}

.basketball-launch-stage #guide {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

.basketball-launch-stage #status {
    margin-top: 8px;
    font-size: 12px;
    color: #ffb6cc;
    min-height: 16px;
}

.basketball-launch-stage #gameOver {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    background: rgba(4, 7, 16, 0.62);
    backdrop-filter: blur(4px);
}

.basketball-launch-stage #gameOver.show {
    display: flex;
}

.basketball-launch-stage #gameOverCard {
    min-width: 280px;
    text-align: center;
    padding: 20px 22px;
    border-radius: 16px;
    background: rgba(11, 17, 36, 0.94);
    border: 1px solid rgba(130, 183, 255, 0.38);
    box-shadow: 0 20px 44px rgba(2, 6, 18, 0.7);
    color: #e9f2ff;
}

.basketball-launch-stage #gameOverCard h2 {
    margin: 0 0 12px;
    font-size: 26px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.basketball-launch-stage #gameOverCard p {
    margin: 6px 0;
    font-size: 16px;
}

.basketball-launch-stage #gameOverCard button {
    margin-top: 14px;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    color: #0e1b3f;
    background: linear-gradient(135deg, #8ec9ff 0%, #66f0bf 100%);
}

.basketball-launch-stage #crowdTips {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
    overflow: hidden;
}

.basketball-launch-stage .crowd-tip {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -100%);
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    color: #eaf3ff;
    background: rgba(8, 14, 30, 0.9);
    border: 1px solid rgba(166, 201, 255, 0.44);
    box-shadow: 0 8px 20px rgba(3, 8, 20, 0.56);
    backdrop-filter: blur(2px);
    opacity: 0;
}

.basketball-launch-stage .crowd-tip.good {
    color: #d7ffe9;
    border-color: rgba(104, 255, 185, 0.6);
    background: rgba(7, 39, 27, 0.92);
}

.basketball-launch-stage .crowd-tip.bad {
    color: #ffd9e3;
    border-color: rgba(255, 117, 155, 0.62);
    background: rgba(48, 11, 24, 0.92);
}

.basketball-launch-stage .crowd-tip.state {
    color: #e4edff;
    border-color: rgba(161, 193, 255, 0.5);
    background: rgba(13, 22, 44, 0.9);
}

@media (max-width: 1200px) {
    .games-game-layout {
        grid-template-columns: 1fr;
    }

    .basketball-leaderboard {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .basketball-launch-stage {
        height: min(72vh, 720px);
    }

    .basketball-launch-stage #hud {
        left: 10px;
        top: 10px;
        min-width: 200px;
    }
}

/* Games grid (listing) */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 20px;
    border-radius: 12px;
    background: var(--card-bg, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent, #7c3aed);
}

.game-card-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.game-card-title {
    font-size: 1.25rem;
    margin-bottom: 6px;
}

.game-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary, #999);
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .games-page {
        padding: 20px 0 40px;
    }

    .games-page h1 {
        font-size: 1.5rem;
    }
}