/* CLASSIC ICONCULT PING PONG 2D Overlay Styles */

.pong-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #111122 0%, #000000 100%); /* Deep space gradient */
    z-index: 99999; /* Above everything */
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    touch-action: none; /* Prevent browser scrolling/bouncing during play */
    overflow: hidden;
}

/* Retro CRT Scanline Effect (Optimized for mobile GPU) */
.pong-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 2;
    pointer-events: none;
}

/* Stars Container */
.pong-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.pong-star {
    position: absolute;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 4px #ffffff;
    animation: driftSpace 15s infinite linear;
}

@keyframes driftSpace {
    0% {
        transform: translateY(-10px) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(120vh) translateX(-50px);
        opacity: 0;
    }
}

.pong-overlay.visible {
    opacity: 1;
}

.pong-overlay-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    z-index: 10;
    pointer-events: none;
}

.pong-close-btn {
    pointer-events: auto;
    background: none;
    border: none;
    color: #5a5a5a;
    font-size: 24px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: color 0.2s ease;
}

.pong-close-btn:hover {
    color: #fff;
}

.pong-score-board {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    opacity: 0.8;
    z-index: 5;
}

.pong-score-board .label {
    display: none;
}

.pong-score-board .score {
    font-size: 24px;
    font-weight: 500;
    color: #fff;
    line-height: 1;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.pong-score-board .best {
    font-size: 10px;
    letter-spacing: 2px;
    color: #888;
    font-family: 'Courier Prime', monospace;
    text-transform: uppercase;
    margin-top: 6px;
}

/* Start / Game Over Overlay */
.pong-start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.8);
    display: none; /* toggled by JS */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.pong-start-overlay h3 {
    font-family: 'Courier Prime', monospace;
    font-size: 24px;
    letter-spacing: 4px;
    color: #fff;
    margin-bottom: 30px;
}

.pong-btn {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 12px 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

#pong-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Slightly transparent so stars show behind it */
    border: 2px solid #333;
    box-shadow: 0 0 20px rgba(255,255,255,0.05);
    max-width: 100%;
    max-height: 70vh;
    z-index: 5;
    position: relative;
}

/* --- Dynamic Retro Message Effects --- */
.pong-message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.pong-message-text {
    font-family: 'Courier Prime', monospace;
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0;
    text-align: center;
    padding: 20px;
}

.pong-msg-win {
    color: #00e5ff;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.8), 0 0 30px rgba(0, 229, 255, 0.4);
    animation: arcadeFlashIn 1.5s forwards cubic-bezier(0.1, 0.9, 0.2, 1);
}

.pong-msg-lose {
    color: #ff003c;
    text-shadow: 0 0 15px rgba(255, 0, 60, 0.8), 0 0 30px rgba(255, 0, 60, 0.4);
    animation: arcadeFlashIn 1.2s forwards cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes arcadeFlashIn {
    0% { transform: scale(0.5); opacity: 0; }
    10% { transform: scale(1.1); opacity: 1; }
    20% { transform: scale(1.0); opacity: 0.3; }
    30% { transform: scale(1.0); opacity: 1; }
    80% { transform: scale(1.0); opacity: 1; filter: blur(0px); }
    100% { transform: scale(1.2); opacity: 0; filter: blur(5px); }
}

.pong-bg-flash-cyan {
    animation: bgFlashCyan 0.4s ease-out;
}

@keyframes bgFlashCyan {
    0% { background: radial-gradient(circle at center, #00e5ff 0%, #000000 100%); }
    100% { background: radial-gradient(circle at center, #111122 0%, #000000 100%); }
}

