/* GENEL AYARLAR */
body {
    margin: 0; padding: 0; background-color: #0b0014; color: #fff;
    font-family: 'Roboto', sans-serif; display: flex; flex-direction: column;
    align-items: center; justify-content: center; min-height: 100vh; user-select: none;
    
    /* NEBULA ARKA PLANI */
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(67, 0, 212, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(200, 0, 80, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(0, 255, 200, 0.15) 0%, transparent 60%);
    background-size: 100% 100%;
}

/* HAREKETLİ YILDIZLAR */
.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, 80vw 50vh #fff, 90vw 90vh #fff; 
    animation: animStar 50s linear infinite;
}
.stars2 { width: 2px; height: 2px; animation: animStar 100s linear infinite; box-shadow: 15vw 25vh #fff, 25vw 85vh #fff; }
@keyframes animStar { from { transform: translateY(0px); } to { transform: translateY(-2000px); } }

h1 {
    font-family: 'Press Start 2P', cursive; color: #fff;
    text-shadow: 2px 2px 0 #d04ed6, -2px -2px 0 #00f3ff;
    margin-bottom: 20px; font-size: 2rem; text-align: center; letter-spacing: 2px;
}

/* KONTROL PANELİ */
.control-panel {
    position: absolute; top: 20px; right: 20px; z-index: 50; display: flex; gap: 10px;
}
.icon-btn {
    background: rgba(0, 0, 0, 0.6); color: #fff; border: 2px solid #00f3ff;
    width: 40px; height: 40px; border-radius: 5px; cursor: pointer;
    font-size: 1rem; display: flex; align-items: center; justify-content: center;
    transition: 0.2s; pointer-events: auto;
}
.icon-btn:hover { background: #00f3ff; color: #000; box-shadow: 0 0 15px #00f3ff; }

/* Standart Çıkış Butonu */
.back-link {
    position: absolute; top: 20px; left: 20px; color: #777; text-decoration: none; font-weight: bold;
    transition: color 0.3s; z-index: 50; padding: 10px; border: 1px solid rgba(255,255,255,0.1); border-radius: 5px;
    background: rgba(0,0,0,0.5); display: flex; align-items: center; gap: 8px; font-size: 0.8rem;
}
.back-link:hover { color: #00ff88; border-color: #00ff88; }

/* MENÜLER */
.mode-selector { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.mode-btn {
    background: #1a1a1a; color: #aaa; border: 2px solid #333;
    padding: 10px 20px; border-radius: 50px; cursor: pointer; font-weight: bold; transition: all 0.3s;
    font-family: 'Roboto', sans-serif;
}
.mode-btn:hover { color: #fff; border-color: #fff; }
.mode-btn.active {
    background: #fff; color: #000; box-shadow: 0 0 15px rgba(255,255,255,0.5); border-color: #fff;
}
.dif-btn { border-color: #00ff88; color: #00ff88; }
.dif-btn:hover { background: #00ff88; color: #000; box-shadow: 0 0 15px #00ff88; }

/* SKORLAR */
.score-single { display: flex; gap: 30px; margin-bottom: 20px; font-size: 1.2rem; font-weight: bold; }
.info-box { color: #fff; }
.info-box span { color: #00f3ff; font-family: 'Press Start 2P'; font-size: 1rem; margin-left: 5px;}

.score-multi {
    display: none; gap: 40px; margin-bottom: 20px;
    background: rgba(20, 20, 20, 0.8); padding: 10px 30px; border-radius: 50px; border: 2px solid #333;
}
.player-box { text-align: center; opacity: 0.5; padding: 5px 15px; border-radius: 10px; transition: all 0.3s; }
.player-box.active { opacity: 1; transform: scale(1.1); background: rgba(255,255,255,0.1); }
.p1.active { color: #00f3ff; border: 2px solid #00f3ff; box-shadow: 0 0 15px #00f3ff; }
.p2.active { color: #d04ed6; border: 2px solid #d04ed6; box-shadow: 0 0 15px #d04ed6; }
.player-score { font-family: 'Press Start 2P', cursive; font-size: 1.5rem; display: block; margin-top: 5px; }

/* OYUN ALANI */
.grid-container {
    display: grid; gap: 15px; perspective: 1000px; margin: 0 auto;
}
.grid-easy { grid-template-columns: repeat(4, 1fr); max-width: 400px; }
.grid-medium { grid-template-columns: repeat(4, 1fr); max-width: 400px; }
.grid-hard { grid-template-columns: repeat(6, 1fr); max-width: 600px; }

.card {
    width: 80px; height: 80px; position: relative; transform-style: preserve-3d;
    transition: transform 0.5s; cursor: pointer;
}
.card.flip { transform: rotateY(180deg); cursor: default; }

/* KLAVYE ODAK */
.card.keyboard-focus { z-index: 20; transform: scale(1.1); box-shadow: 0 0 20px #fff; border-radius: 10px; }
.card.flip.keyboard-focus { transform: rotateY(180deg) scale(1.1); }

.front, .back {
    width: 100%; height: 100%; position: absolute; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; backface-visibility: hidden;
    border: 2px solid #333; box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.front { background: linear-gradient(135deg, #111, #222); font-size: 1.5rem; color: #333; }
.front::after { content: '\f5fc'; font-family: 'Font Awesome 6 Free'; font-weight: 900; }
.back { background-color: #1a1a1a; transform: rotateY(180deg); font-size: 2.5rem; }

.card.match .back { border-color: #00ff88; color: #00ff88; box-shadow: 0 0 20px #00ff88; animation: pulse 0.5s; }
.card.match.p1-match .back { border-color: #00f3ff; color: #00f3ff; box-shadow: 0 0 20px #00f3ff; }
.card.match.p2-match .back { border-color: #d04ed6; color: #d04ed6; box-shadow: 0 0 20px #d04ed6; }

@keyframes pulse { 0% { transform: rotateY(180deg) scale(1); } 50% { transform: rotateY(180deg) scale(1.2); } 100% { transform: rotateY(180deg) scale(1); } }

#win-overlay, #pause-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); backdrop-filter: blur(5px);
    display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 100;
}
#winnerText, #pause-overlay h2 { font-family: 'Press Start 2P', cursive; font-size: 2rem; margin-bottom: 20px; text-align: center; line-height: 1.5; color: #fff; }

.btn-restart {
    padding: 15px 40px; background: #fff; color: #000; border: none;
    font-family: 'Roboto', sans-serif; font-weight: bold; font-size: 1.2rem;
    cursor: pointer; border-radius: 50px; transition: transform 0.2s; margin-top: 10px;
}
.btn-restart:hover { transform: scale(1.1); box-shadow: 0 0 20px rgba(255,255,255,0.5); }
.btn-restart.secondary { background: transparent; border: 2px solid #555; color: #aaa; }
.btn-restart.secondary:hover { border-color: #fff; color: #fff; }

@media (max-width: 650px) {
    .grid-hard { grid-template-columns: repeat(4, 1fr); }
    .card { width: 60px; height: 60px; }
    h1 { font-size: 1.5rem; }
    .score-single { gap: 10px; font-size: 1rem; }
}