@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Roboto:wght@700&display=swap');

/* --- TEMEL AYARLAR --- */
body { margin: 0; overflow: hidden; background-color: #1a1a1a; font-family: 'Roboto', sans-serif; user-select: none; }

#loading {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 5000;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: white; font-family: 'Lilita One', cursive; font-size: 24px; text-shadow: 2px 2px 4px black;
}

/* --- BAŞLANGIÇ EKRANI --- */
#start-screen { 
    display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); z-index: 4000; justify-content: center; align-items: center; backdrop-filter: blur(5px); 
}
.start-box {
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0); padding: 40px; border-radius: 20px;
    text-align: center; border: 4px solid #4CAF50; box-shadow: 0 0 50px rgba(0,0,0,0.8); max-width: 500px;
}
.start-box h1 { font-family: 'Lilita One', cursive; font-size: 48px; color: #4CAF50; margin: 0; text-shadow: 2px 2px 0 #333; }
.start-box .disclaimer-text { font-size: 13px; color: #666; margin: 15px 0; line-height: 1.4; }
.start-box .camera-info { font-size: 14px; color: #2E7D32; font-weight: bold; background: rgba(76, 175, 80, 0.1); padding: 8px; border-radius: 6px; margin-bottom: 20px; }
#start-game-btn { background: linear-gradient(to bottom, #4CAF50, #388E3C); color: white; border: none; padding: 12px 40px; border-radius: 10px; font-size: 20px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 0 #1B5E20; }
#start-game-btn:active { transform: translateY(4px); box-shadow: none; }

/* --- ÜST BAR (TOP UI) --- */
#top-ui {
    position: absolute; top: 10px; width: 100%; height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 15px; box-sizing: border-box; pointer-events: none; z-index: 1000;
}

/* ORTA BİLGİ KUTUSU */
.central-info {
    position: absolute; left: 50%; top: 0; transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7); border: 2px solid #aaa; border-top: none;
    border-radius: 0 0 15px 15px; padding: 5px 20px 10px 20px;
    display: flex; flex-direction: column; align-items: center;
    pointer-events: auto; min-width: 140px;
}
.game-timer { color: white; font-family: 'Lilita One', cursive; font-size: 24px; margin-bottom: 2px; text-shadow: 1px 1px 2px black; }

/* YENİ SKOR TABLOSU */
#score-board {
    display: flex; align-items: center; justify-content: center; gap: 15px;
    background: rgba(255, 255, 255, 0.1); padding: 2px 10px; border-radius: 10px; width: 100%;
}
.score-item { display: flex; align-items: center; gap: 5px; }
.score-text { font-family: 'Lilita One', cursive; font-size: 20px; text-shadow: 1px 1px 0 #000; }
.score-text.blue { color: #3388ff; }
.score-text.red { color: #ff4d4d; }
.crown-icon-tiny { height: 16px; width: auto; filter: drop-shadow(0 0 2px black); }

/* SAĞ/SOL BİLGİLER */
.player-stats { display: flex; flex-direction: column; color: white; text-shadow: 1px 1px 2px black; pointer-events: auto; }
.player-stats.opponent { align-items: flex-start; }
.player-stats.local { position: absolute; bottom: 320px; left: 10px; z-index: 1000; }

.name-badge { display: flex; align-items: center; background: rgba(0,0,0,0.6); padding: 4px 8px; border-radius: 15px; border: 1px solid rgba(255,255,255,0.3); }
.level { background: #3388ff; padding: 1px 5px; border-radius: 4px; font-family: 'Lilita One', cursive; margin-right: 6px; border: 1px solid white; font-size: 12px; }
#red-level { background: #ff4d4d; }
.name-group { display: flex; flex-direction: column; font-size: 12px; font-weight: bold; }
.trophies { display: flex; align-items: center; color: #ffd700; font-weight: bold; font-size: 14px; margin-top: 5px; text-shadow: 1px 1px 1px black; }
.trophies i { margin-right: 5px; }

.top-right-buttons { display: flex; gap: 10px; pointer-events: auto; }
#pause-btn { background: rgba(0,0,0,0.6); border: 2px solid #aaa; color: white; font-size: 18px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }

/* --- TAÇ KAZANILDI POPUP (GİZLEME VE GÖSTERME) --- */
#crown-popup {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.5);
    display: none; /* KESİN GİZLEME */
    flex-direction: column; align-items: center;
    z-index: 3000; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* JS ile style.display = 'flex' yapılınca görünür */
#crown-popup img { width: 100px; height: auto; filter: drop-shadow(0 0 10px gold); }
#crown-popup p { font-family: 'Lilita One', cursive; font-size: 28px; color: #ffd700; text-shadow: 2px 2px 0 #000; margin-top: 5px; white-space: nowrap; }
#crown-popup p.red-win { color: #ff3b3b; }

/* --- ALT ARAYÜZ --- */
#bottom-ui { position: absolute; bottom: 0; width: 100%; pointer-events: none; z-index: 900; display: flex; justify-content: center; }
#battle-deck-area { display: flex; align-items: flex-end; justify-content: center; padding-bottom: 20px; padding-top: 40px; pointer-events: auto; background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%); width: 100%; }
.cards-container { margin: 0 10px; }
#card-deck { display: flex; gap: 10px; }
.next-card-container { display: flex; flex-direction: column; align-items: center; color: white; font-size: 10px; background: rgba(0,0,0,0.6); padding: 4px; border-radius: 6px; border: 1px solid #444; margin-bottom: 2px; }
#next-card-slot .card { width: 40px; height: 55px; margin: 0; cursor: default; opacity: 0.9; }
#next-card-slot .card .card-cost { width: 16px; height: 16px; font-size: 10px; top: -3px; left: -3px; }
.card { width: 70px; height: 100px; background-color: #333; border: 2px solid #222; border-radius: 6px; position: relative; cursor: pointer; background-size: cover; background-position: center; box-shadow: 0 4px 6px rgba(0,0,0,0.6); transition: transform 0.1s; }
.card:hover { transform: translateY(-5px); }
.card.active { transform: translateY(-15px) scale(1.05); border-color: #ffd700; }
.card.locked { filter: grayscale(100%) brightness(50%); cursor: not-allowed; }
.card-cost { position: absolute; top: -5px; left: -5px; background: #d000ff; width: 20px; height: 20px; border-radius: 50%; border: 2px solid white; color: white; display: flex; justify-content: center; align-items: center; font-weight: bold; font-family: 'Lilita One', cursive; font-size: 12px; }
.elixir-container { position: absolute; bottom: 5px; width: 100%; display: flex; justify-content: center; }
.elixir-bar-bg { width: 300px; height: 20px; background: #111; border: 2px solid #444; border-radius: 10px; position: relative; overflow: hidden; }
#elixir-fill { height: 100%; background: linear-gradient(to bottom, #ff55ff, #aa00aa); width: 0%; transition: width 0.2s linear; }
#elixir-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-weight: bold; font-family: 'Lilita One', cursive; font-size: 12px; z-index: 2; }

/* --- CHAT & EMOJI --- */
#chat-btn-container { position: absolute; bottom: 160px; left: 20px; z-index: 1002; display: flex; flex-direction: column; gap: 15px; }
#chat-btn-container button { 
    background: rgba(255, 255, 255, 0.95); border: none; border-radius: 50%; width: 45px; height: 45px; 
    font-size: 20px; cursor: pointer; box-shadow: 0 4px 8px rgba(0,0,0,0.4); transition: transform 0.1s; 
    display: flex; justify-content: center; align-items: center; color: #333;
}
#chat-btn-container button:active { transform: scale(0.9); }
#music-toggle-btn.playing i { color: #007bff; }

/* Emoji Paneli SAĞA KAYDIRILDI */
#emoji-panel { 
    position: absolute; bottom: 160px; left: 75px; 
    background: rgba(255,255,255,0.95); padding: 8px; border-radius: 15px; 
    display: none; gap: 5px; box-shadow: 0 4px 15px rgba(0,0,0,0.4); 
    width: 160px; flex-wrap: wrap; z-index: 1003;
}
#emoji-panel button { background: none; border: none; padding: 2px; cursor: pointer; }
#emoji-panel img { width: 35px; height: 35px; }

#local-emoji-container { position: absolute; bottom: 360px; left: 30px; z-index: 2000; pointer-events: none; }
.chat-bubble { width: 80px; position: absolute; animation: popUp 3s forwards; }
.chat-bubble img { width: 100%; height: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
@keyframes popUp { 0% { opacity: 0; transform: scale(0); } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40px); } }

/* --- SAĞLIK BARLARI --- */
.health-bar-container { width: 40px; height: 5px; background: #333; border: 1px solid black; pointer-events: none; border-radius: 2px; overflow: hidden; position: absolute; transform: translateX(-50%); }
.health-bar-fill { height: 100%; background: #ff3b3b; transition: width 0.1s; }
.health-bar-fill.friendly { background: #3388ff; }

/* --- OYUN SONU VE DURAKLATMA EKRANLARI --- */
#game-over-screen, #pause-screen { 
    display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); z-index: 4000; justify-content: center; align-items: center; backdrop-filter: blur(5px); 
}

.result-box, .pause-box { 
    background: linear-gradient(135deg, #ffffff, #f0f0f0); padding: 40px; border-radius: 20px; 
    text-align: center; border: 6px solid #ffd700; box-shadow: 0 0 50px rgba(0,0,0,0.8); 
    min-width: 320px; animation: fadeIn 0.3s ease-out;
}

#game-over-result, .pause-box h1 { font-family: 'Lilita One', cursive; font-size: 48px; color: #333; margin: 0 0 20px 0; text-transform: uppercase; }
.trophy-reward { color: #ffd700; font-size: 32px; font-weight: bold; margin-bottom: 20px; text-shadow: 1px 1px 0px black; }

/* BUTONLAR */
.pause-box button, .result-box button {
    display: block; width: 100%; padding: 15px; margin-top: 15px; border-radius: 12px;
    font-size: 20px; font-weight: bold; cursor: pointer; border: none;
    box-shadow: 0 5px 0 rgba(0,0,0,0.2); transition: transform 0.1s;
    font-family: 'Lilita One', cursive; text-transform: uppercase; color: white;
}
.pause-box button:active, .result-box button:active { transform: translateY(3px); box-shadow: none; }
.pause-box button:first-of-type { background: linear-gradient(to bottom, #4CAF50, #388E3C); box-shadow: 0 5px 0 #2E7D32; }
.pause-box .home-button { background: linear-gradient(to bottom, #7d7d7d, #4a4a4a); box-shadow: 0 5px 0 #333; }
.result-box .home-button { background: linear-gradient(to bottom, #007bff, #0056b3); box-shadow: 0 5px 0 #004494; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }