body {
    margin: 0; padding: 0;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 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;
}

.back-link {
    position: absolute; top: 20px; left: 20px;
    color: #888; text-decoration: none; font-family: 'Roboto', sans-serif; font-weight: bold;
    transition: all 0.3s; z-index: 100;
    font-size: 1rem; display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.5); padding: 10px; border-radius: 8px; border: 1px solid #333;
}
.back-link:hover { color: #ff0055; border-color: #ff0055; background: #000; box-shadow: 0 0 15px rgba(255, 0, 85, 0.4); }

.top-controls {
    position: absolute; top: 20px; right: 20px; z-index: 100;
    display: flex; gap: 10px;
}
.icon-btn {
    background: rgba(20, 20, 40, 0.8); border: 1px solid #444; color: #fff;
    width: 45px; height: 45px; border-radius: 8px; cursor: pointer;
    font-size: 1.1rem; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 5px rgba(0, 243, 255, 0.2);
}
.icon-btn:hover { background: #333; color: #00f3ff; border-color: #00f3ff; transform: scale(1.1); box-shadow: 0 0 15px rgba(0, 243, 255, 0.6); }

.ui-layer {
    position: absolute; top: 10%; width: 100%; display: flex; flex-direction: column; align-items: center; pointer-events: none; z-index: 5;
}
.scoreboard {
    display: flex; gap: 120px; font-size: 3.5rem; color: rgba(255,255,255,0.2); margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255,255,255,0.1);
}
/* YENİ: Bilgi Metni Stili */
.game-info {
    font-family: 'Roboto', sans-serif; font-size: 0.8rem; color: #888; letter-spacing: 2px; margin-bottom: 10px;
}

.rally-counter {
    font-size: 1rem; color: #ffff00; text-shadow: 0 0 10px #ffff00; opacity: 0; transition: opacity 0.3s;
    background: rgba(0,0,0,0.5); padding: 5px 10px; border-radius: 5px; border: 1px solid #ffff00;
}
.rally-active { opacity: 1; }
.active-score { color: #fff; text-shadow: 0 0 30px #fff; transform: scale(1.3); transition: all 0.2s; }

canvas {
    border: 2px solid rgba(0, 243, 255, 0.3); 
    background: transparent;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.15);
    display: block; cursor: none;
    border-radius: 4px;
}

.shake { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

#overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 10, 0.95); 
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; 
    z-index: 20;
}
h1 { 
    color: #fff; font-size: 3rem; margin-bottom: 30px; 
    text-shadow: 0 0 10px #00f3ff, 0 0 20px #00f3ff, 0 0 40px #00f3ff;
    text-align: center; letter-spacing: 5px;
}
.btn-group { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; }
button.btn-p1, button.btn-p2 {
    background: rgba(0, 0, 0, 0.6); color: #fff; border: 2px solid #555; padding: 20px 40px;
    font-family: 'Press Start 2P'; font-size: 1rem; cursor: pointer; border-radius: 8px; 
    transition: all 0.3s; position: relative; overflow: hidden;
}
button.btn-p1:hover { transform: scale(1.05); border-color: #00f3ff; box-shadow: 0 0 25px rgba(0, 243, 255, 0.6); color: #00f3ff;}
button.btn-p2:hover { transform: scale(1.05); border-color: #ff0055; box-shadow: 0 0 25px rgba(255, 0, 85, 0.6); color: #ff0055;}

#message-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    text-align: center; display: none; z-index: 15; pointer-events: none; width: 100%;
}
.msg-text {
    font-size: 3.5rem; color: #ffff00;
    text-shadow: 4px 4px 0 #ff0055, 0 0 20px #ffff00;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sub-msg { font-family: 'Press Start 2P'; font-size: 1rem; color: #fff; margin-top: 20px; text-shadow: 0 0 10px #00f3ff; line-height: 1.5;}
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.controls-hint { margin-top: 50px; color: #aaa; text-align: center; font-family: 'Roboto'; font-size: 0.9rem; line-height: 1.8; background: rgba(255,255,255,0.05); padding: 20px; border-radius: 10px;}
.key { border: 1px solid #666; padding: 4px 8px; border-radius: 4px; color: #fff; background: #222; font-size: 0.8rem; display: inline-block; margin: 0 2px; box-shadow: 0 2px 0 #000;}

/* Mobil Kontroller (GÜNCELLENDİ: Daha geniş alan) */
.mobile-controls {
    display: none; 
    width: 100%; 
    height: 100%; /* Tüm ekranı kapsasın ama pointer-events ile yönetelim */
    position: absolute; top: 0; left: 0; 
    pointer-events: none; z-index: 10;
}
.mob-zone {
    position: absolute; bottom: 0;
    width: 40%; height: 50%; /* Altın %50'sini ve genişliğin %40'ını kaplar */
    border: 2px dashed rgba(255,255,255,0.1); border-radius: 20px 20px 0 0;
    display: flex; align-items: center; justify-content: center; 
    color: rgba(255,255,255,0.1); font-size: 0.8rem;
    pointer-events: auto; /* Dokunmayı yakalar */
    text-align: center; font-family: 'Roboto'; 
    background: rgba(255, 255, 255, 0.02);
}
#mobLeft { left: 10px; }
#mobRight { right: 10px; }

@media (max-width: 768px) {
    .mobile-controls { display: flex; } 
    .btn-group { flex-direction: column; width: 80%; gap: 15px;}
    button.btn-p1, button.btn-p2 { width: 100%; padding: 15px; }
    h1 { font-size: 1.8rem; margin-bottom: 15px; }
    .scoreboard { gap: 40px; font-size: 2.5rem; margin-top: 20px;}
    .msg-text { font-size: 2rem; }
    .top-controls { top: 10px; right: 10px; }
    .back-link { top: 10px; left: 10px; padding: 8px; font-size: 0.8rem; }
    /* Mobilde canvas biraz daha yukarı kayabilir */
    canvas { margin-top: 10px; }
}


/* Mevcut CSS kodlarının altına ekleyin veya güncelleyin */

/* --- SERİ İSTATİSTİKLERİ --- */
.series-stats {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
    animation: fadeIn 1s ease;
}

.series-title {
    font-family: 'Roboto', sans-serif;
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.series-score {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.p1-stats { color: #00f3ff; text-shadow: 0 0 10px rgba(0, 243, 255, 0.5); }
.p2-stats { color: #ff0055; text-shadow: 0 0 10px rgba(255, 0, 85, 0.5); }
.vs-divider { color: #fff; margin: 0 10px; opacity: 0.5; }

.reset-stats-btn {
    background: transparent;
    border: 1px solid #444;
    color: #666;
    font-family: 'Roboto', sans-serif;
    font-size: 0.7rem;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}
.reset-stats-btn:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255,255,255,0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Diğer stiller aynı kalıyor... */

/* ... Önceki stiller aynen kalıyor ... */

/* OYUN SONU EKRANI (YENİ) */
#game-end-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92); 
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; 
    z-index: 50; /* Menüden daha üstte */
    animation: fadeIn 0.5s ease;
}

#end-title {
    font-size: 2.5rem; color: #fff; margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    text-align: center;
}

.end-btn-group {
    display: flex; gap: 20px; margin-top: 20px;
}

.btn-restart {
    background: #00f3ff; color: #000; border: none; padding: 15px 30px;
    font-family: 'Press Start 2P'; font-size: 0.9rem; cursor: pointer; border-radius: 5px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-restart:hover {
    transform: scale(1.1); box-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
}

.btn-menu {
    background: transparent; color: #fff; border: 2px solid #555; padding: 15px 30px;
    font-family: 'Press Start 2P'; font-size: 0.9rem; cursor: pointer; border-radius: 5px;
    transition: all 0.2s;
}
.btn-menu:hover {
    border-color: #fff; background: rgba(255,255,255,0.1);
}

/* Seri İstatistikleri Kutusu (Güncellendi) */
.series-stats {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    text-align: center;
    min-width: 300px;
}
.series-title {
    font-family: 'Roboto', sans-serif; color: #aaa; font-size: 0.9rem; margin-bottom: 15px; letter-spacing: 3px;
}
.series-score { font-size: 2rem; margin-bottom: 20px; font-family: 'Press Start 2P'; }
.p1-stats { color: #00f3ff; }
.p2-stats { color: #ff0055; }
.vs-divider { color: #555; font-size: 1rem; vertical-align: middle; margin: 0 15px;}

/* Mobil Uyumluluk */
@media (max-width: 768px) {
    .end-btn-group { flex-direction: column; width: 80%; }
    .btn-restart, .btn-menu { width: 100%; }
    #end-title { font-size: 1.8rem; }
}