/* --- GENEL AYARLAR --- */
body {
    margin: 0; padding: 0;
    /* İSTEDİĞİN ARKA PLAN AYNI KORUNDU */
    background: radial-gradient(circle at center, #111 0%, #000 100%);
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100vh; overflow: hidden;
    user-select: none; touch-action: none;
}

/* YILDIZ EFEKTLERİ (KORUNDU) */
.stars, .stars2 {
    position: fixed; top: 0; left: 0; width: 1px; height: 1px;
    background: transparent; z-index: -1;
    box-shadow: 50vw 10vh #fff, 10vw 80vh #fff, 90vw 50vh #fff; 
    animation: animStar 50s linear infinite;
}
.stars2 { width: 2px; height: 2px; animation: animStar 100s linear infinite; }
@keyframes animStar { from { transform: translateY(0px); } to { transform: translateY(-2000px); } }

/* STANDART UI ELEMANLARI */
/* Z-Index 201: Menü (overlay) 200 olduğu için bu butonlar en üstte kalsın */
.back-link {
    position: absolute; top: 20px; left: 20px; z-index: 201;
    color: #777; text-decoration: none; font-family: 'Roboto', sans-serif; font-weight: bold;
    display: flex; align-items: center; gap: 8px; font-size: 0.8rem;
    transition: color 0.3s;
}
.back-link:hover { color: #00ff88; }

.top-controls {
    position: absolute; top: 20px; right: 20px;
    display: flex; gap: 10px; z-index: 201;
}

.control-btn {
    background: rgba(20, 20, 40, 0.8); 
    color: #aaa; border: 1px solid #334;
    width: 40px; height: 40px; border-radius: 8px; 
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1rem; transition: all 0.2s; backdrop-filter: blur(2px);
}
.control-btn:hover { background: #223; border-color: #00ff88; color: #00ff88; box-shadow: 0 0 15px rgba(0, 255, 136, 0.4); }
.control-btn.muted { color: #555; border-color: #555; }

/* OYUN ALANI */
.game-container {
    position: relative; display: flex; flex-direction: column; align-items: center;
    width: 100%; z-index: 10;
}

.scoreboard {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; max-width: 800px; margin-bottom: 10px;
    text-transform: uppercase; font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px; border-radius: 10px;
    border: 1px solid #333; box-sizing: border-box; backdrop-filter: blur(5px);
}

.p1-color { color: #00f3ff; text-shadow: 0 0 10px #00f3ff; }
.p2-color { color: #ff0055; text-shadow: 0 0 10px #ff0055; }

.rally-box { color: #00ff88; font-size: 1rem; text-shadow: 0 0 10px #00ff88; letter-spacing: 2px; }
.timer { color: #ffcc00; font-size: 1.2rem; text-shadow: 0 0 10px orange; animation: pulse 1s infinite; }
.digit { font-size: 1.2rem; margin-left: 10px; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

.canvas-wrapper {
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    overflow: hidden; border-radius: 4px;
}

canvas {
    background: rgba(10, 10, 10, 0.85);
    border-left: 2px solid #333;
    border-right: 2px solid #333;
    border-bottom: 4px solid #00f3ff;
    border-top: 4px solid #ff0055;
    max-width: 95vw; max-height: 80vh;
}

.canvas-message {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Press Start 2P'; color: rgba(255,255,255,0.7);
    font-size: 1rem; text-align: center;
    pointer-events: none; animation: blink 1s infinite; width: 100%;
}
@keyframes blink { 50% { opacity: 0; } }

/* MENÜ & OVERLAY */
.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; z-index: 200;
    backdrop-filter: blur(5px);
}
.hidden { display: none !important; }

h1.glitch-title {
    font-size: 2.2rem; color: #fff;
    text-shadow: 3px 3px 0 #00f3ff, -3px -3px 0 #ff0055;
    margin-bottom: 10px; letter-spacing: 3px; text-align: center; line-height: 1.4;
}
.subtitle { font-family: 'Roboto'; color: #888; margin-bottom: 40px; letter-spacing: 2px; font-size: 0.9rem; }

.btn-group { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; justify-content: center; }

.btn {
    background: transparent; color: #fff; border: 2px solid #fff;
    padding: 15px 30px; font-family: 'Press Start 2P'; font-size: 0.8rem;
    cursor: pointer; transition: 0.2s; border-radius: 5px;
    display: flex; align-items: center; gap: 10px; min-width: 200px; justify-content: center;
}
.btn:hover { transform: scale(1.05); background: #fff; color: #000; box-shadow: 0 0 20px #fff; }
.p1-btn { border-color: #00f3ff; color: #00f3ff; }
.p1-btn:hover { background: #00f3ff; color: #000; box-shadow: 0 0 20px #00f3ff; }
.p2-btn { border-color: #ff0055; color: #ff0055; }
.p2-btn:hover { background: #ff0055; color: #000; box-shadow: 0 0 20px #ff0055; }

.instructions {
    text-align: center; color: #666; font-size: 0.75rem; line-height: 2;
    font-family: 'Roboto', sans-serif;
}

/* MOBİL KONTROLLER */
.mobile-controls {
    display: none; width: 100%; max-width: 800px;
    justify-content: space-between; margin-top: 10px;
}
.touch-area {
    width: 45%; height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #333; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #00f3ff;
}
.touch-area:active { background: rgba(0, 243, 255, 0.3); }

@media (max-width: 768px) {
    .mobile-controls { display: flex; }
    h1.glitch-title { font-size: 1.5rem; }
    .btn-group { flex-direction: column; gap: 15px; }
    canvas { width: 95vw; height: 60vh; }
}