/* Gems Game Styles */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    background: #050505;
}

/* .bg-video-layer is the second playlist layer added by scripts/videos.js. */
#background-video,
.bg-video-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.page-scrim {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 38%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.62));
    z-index: -1;
}

/* Station logo, watermarked over the background video. z-index 0 keeps it
   above the scrim at -1, so the scrim does not dim it. */
#channel-logo {
    position: fixed;
    left: clamp(10px, 2vw, 24px);
    top: clamp(10px, 2vw, 24px);
    width: clamp(132px, 18vw, 228px);
    height: auto;
    opacity: 0.5;
    border-radius: 12px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.game-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: min(92vw, 1120px);
    padding: 20px 16px;
    border-radius: 20px;
}

#hud {
    display: flex;
    width: 100%;
    max-width: 720px;
    justify-content: space-between;
    color: #ddd;
    margin-bottom: 10px;
    font-weight: bold;
}

h1 {
    margin: 0 0 12px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
}

canvas#gameCanvas {
    border-radius: 12px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Responsive aspect: desktop landscape 16:9, mobile portrait 9:16 */
canvas#gameCanvas {
    width: 92vw;
    height: auto;
    aspect-ratio: 9/16;
    max-width: 720px;
    max-height: 70vh;
}

@media (min-width: 800px) {
    canvas#gameCanvas {
        width: min(1100px, 80vw);
        height: auto;
        aspect-ratio: 16/9;
        max-width: 1100px;
        max-height: 75vh;
    }
}

.overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.overlay.show {
    display: flex;
    pointer-events: auto;
}

.overlay .box {
    background: rgba(0,0,0,0.82);
    color: #fff;
    padding: 18px 26px;
    border-radius: 14px;
    font-size: 20px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.overlay-title {
    margin-bottom: 14px;
}

.play-again-button {
    border: 0;
    border-radius: 999px;
    padding: 14px 28px;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff4c4c, #ff7b4c);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 76, 76, 0.32);
    user-select: none;
    -webkit-user-select: none;
}

.play-again-button:hover {
    filter: brightness(1.08);
}

.hint {
    font-size: 12px;
    color: #aaa;
    margin-top: 8px;
}

@media (max-width: 799px) {
    body {
        justify-content: flex-start;
        padding: 12px 0;
    }

    .game-shell {
        width: calc(100vw - 20px);
        padding: 14px 10px 18px;
    }

    #hud {
        max-width: none;
        font-size: 14px;
        gap: 12px;
    }
}
