/* Circle Pong - Mobile-first styles */

:root {
    --bg-dark: #1a1a2e;
    --circle-border: #16213e;
    --ball-color: #e94560;
    --ball-glow: #ff6b6b;
    --paddle-color: #00fff5;
    --paddle-glow: #00d4aa;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #f39c12;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* Menu Screen */
#menu-screen h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px var(--paddle-color);
}

.menu-preview {
    margin-bottom: 30px;
}

.preview-circle {
    width: 150px;
    height: 150px;
    border: 4px solid var(--circle-border);
    border-radius: 50%;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

.preview-ball {
    width: 16px;
    height: 16px;
    background: var(--ball-color);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px var(--ball-glow);
    animation: ball-move 3s ease-in-out infinite;
}

@keyframes ball-move {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(20px, -30px); }
    50% { transform: translate(-20px, 30px); }
    75% { transform: translate(30px, 20px); }
}

.preview-paddle {
    position: absolute;
    width: 40px;
    height: 8px;
    background: var(--paddle-color);
    border-radius: 4px;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--paddle-glow);
}

.best-score-display {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.best-score-display span {
    color: var(--accent);
    font-weight: 700;
}

.tap-hint {
    font-size: 1rem;
    color: var(--text-secondary);
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Game Screen */
#game-screen {
    padding: 0;
}

.game-ui {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

#current-score {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#game-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.touch-zones {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    pointer-events: auto;
}

.touch-zone {
    flex: 1;
    height: 100%;
    cursor: pointer;
}

#touch-left:active {
    background: rgba(0, 255, 245, 0.05);
}

#touch-right:active {
    background: rgba(0, 255, 245, 0.05);
}

/* Game Over Screen */
#gameover-screen h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 20px;
    color: var(--ball-color);
}

.gameover-circle {
    width: 100px;
    height: 100px;
    border: 4px solid var(--circle-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

.gameover-x {
    font-size: 3rem;
    color: var(--ball-color);
}

.final-score {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.final-score span {
    font-weight: 700;
    color: var(--paddle-color);
}

.new-record {
    font-size: 1.2rem;
    color: var(--accent);
    font-weight: 700;
    text-shadow: 0 0 15px var(--accent);
    animation: glow-pulse 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 15px var(--accent); }
    50% { opacity: 0.8; text-shadow: 0 0 25px var(--accent); }
}

.new-record.hidden {
    display: none;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 250px;
    margin-top: 20px;
}

.btn {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 2px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--paddle-color);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--paddle-glow);
}

.btn-primary:active {
    box-shadow: 0 0 30px var(--paddle-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--text-secondary);
}

.btn-secondary:active {
    border-color: var(--paddle-color);
    color: var(--paddle-color);
}

/* Error Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.overlay.visible {
    display: flex;
}

.error-content {
    text-align: center;
    padding: 30px;
    background: var(--circle-border);
    border-radius: 12px;
    max-width: 300px;
}

.error-content p {
    color: var(--ball-color);
    font-size: 1.1rem;
}

/* Desktop adjustments */
@media (min-width: 768px) {
    #menu-screen h1 {
        font-size: 3.5rem;
    }

    .preview-circle {
        width: 200px;
        height: 200px;
    }

    .preview-ball {
        width: 20px;
        height: 20px;
    }

    .preview-paddle {
        width: 50px;
        height: 10px;
    }

    #current-score {
        font-size: 2.5rem;
    }

    .gameover-circle {
        width: 120px;
        height: 120px;
    }

    .gameover-x {
        font-size: 4rem;
    }

    .gameover-buttons {
        flex-direction: row;
        max-width: 400px;
    }

    .btn {
        flex: 1;
    }
}
