/* İFRAME İÇİ KUSURSUZ YERLEŞİM (100% Kullanımı) */
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%; 
    background-color: #0b2e0f; 
    font-family: 'Montserrat', sans-serif;
    overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; 
}

#game-board {
    position: relative; 
    width: 100%; height: 100%; 
    max-width: 900px; margin: 0 auto;
    background: radial-gradient(circle, #226f25 0%, #0e4513 100%);
    box-shadow: 0 0 20px rgba(0,0,0,0.8); overflow: hidden;
}

#table-watermark {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 64px;
    color: rgba(255, 255, 255, 0.06); letter-spacing: 12px;
    pointer-events: none; z-index: 1; user-select: none; text-align: center;
}

#intro-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #0e4513; z-index: 3000;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.8s ease;
}

.logo-text {
    font-family: 'Montserrat', sans-serif; font-size: 72px; letter-spacing: -1px;
    margin: 0; text-shadow: 0 0 30px #000, 2px 2px 10px rgba(0,0,0,1);
    animation: pulseLogo 1.5s infinite alternate;
}

@keyframes pulseLogo { 0% { transform: scale(1); } 100% { transform: scale(1.05); } }

#main-menu {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, #1a4a1c 0%, #082109 100%); z-index: 2000;
    display: flex; justify-content: center; align-items: center; text-align: center;
}
.menu-content { display: flex; flex-direction: column; align-items: center; gap: 40px; }
.menu-logo { font-size: 80px; animation: none; filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5)); }

.menu-buttons { display: flex; flex-direction: column; gap: 15px; width: 100%; max-width: 300px; }
.main-btn {
    background: rgba(0, 0, 0, 0.6); border: 2px solid #555; border-radius: 30px;
    color: white; font-size: 20px; font-weight: 600; padding: 15px 30px; cursor: pointer;
    font-family: 'Montserrat', sans-serif; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}
.main-btn:hover { background: rgba(0, 0, 0, 0.8); border-color: #fff; transform: translateY(-3px); }
.main-btn:active { transform: translateY(1px); }
.play-btn { background: #F74A0A; border-color: #F74A0A; color: #fff; font-size: 24px; text-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.play-btn:hover { background: #ff5e23; border-color: #fff; }
.round-btn { width: 48%; }

.modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 2500; display: flex; justify-content: center; align-items: center; }
.modal-box { background: #111; border: 2px solid #555; border-radius: 20px; padding: 30px; width: 85%; max-width: 400px; color: #fff; box-shadow: 0 10px 40px rgba(0,0,0,0.9); text-align: center; }

.auction-modal-box {
    max-width: 280px !important;
    padding: 20px !important;
    transform: translateY(-40%);
}

.green-modal { 
    background: linear-gradient(135deg, #16401a 0%, #071f09 100%) !important; 
    border-color: #2e7d32 !important; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.9), inset 0 0 20px rgba(0,0,0,0.5) !important;
}

.setting-item { display: flex; justify-content: space-between; align-items: center; margin: 20px 0; font-size: 18px; font-weight: 600;}
.toggle-btn { padding: 8px 15px; font-weight: bold; border-radius: 8px; border: none; cursor: pointer; font-family: 'Montserrat'; transition: 0.3s; }
.toggle-btn.active { background: #4caf50; color: white; }
.toggle-btn.inactive { background: #ff5252; color: white; }
.rules-text { text-align: left; font-size: 14px; line-height: 1.6; color: #ccc; margin-bottom: 20px; }
.rules-text ul { padding-left: 20px; margin-top: 5px; }
.rules-text li { margin-bottom: 8px; }
.close-btn { background: #333; color: white; border: 1px solid #777; border-radius: 10px; padding: 10px 20px; cursor: pointer; font-family: 'Montserrat'; transition: 0.3s; font-size: 16px; }
.close-btn:hover { background: #555; }

.modern-btn-top {
    position: absolute; top: 15px;
    background: rgba(0,0,0,0.7);
    border: 2px solid #777;
    border-radius: 15px;
    padding: 8px 15px;
    color: #fff;
    font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 1000; transition: 0.3s;
    display: flex; align-items: center; justify-content: center;
}
button.modern-btn-top { cursor: pointer; }
button.modern-btn-top:hover { background: rgba(0,0,0,0.85); transform: translateY(-2px); border-color:#fff;}

.player-panel {
    position: absolute; background: rgba(0, 0, 0, 0.75); color: white;
    border-radius: 18px; display: flex; align-items: center; padding: 8px 18px;
    border: 1px solid #555; box-shadow: 0 4px 12px rgba(0,0,0,0.6); z-index: 10;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.active-turn {
    border-color: #F74A0A !important;
    box-shadow: 0 0 20px 4px rgba(247, 74, 10, 0.5) !important;
    transform: scale(1.05);
}
#player-bottom-bar.active-turn { transform: translateX(-50%) scale(1.05); }

.player-panel img { width: 50px; height: 50px; border-radius: 50%; margin-right: 12px; border: 2px solid #444; }
.panel-info { display: flex; flex-direction: column; }
.player-name { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.player-score { font-size: 12px; color: #aaa; }
.player-total { font-size: 13px; font-weight: 600; color: #4caf50; margin-top: 2px;}

#player-top { top: 15px; left: 50%; transform: translateX(-50%); }
#player-top.active-turn { transform: translateX(-50%) scale(1.05); }
#player-left { top: 45%; left: 15px; transform: translateY(-50%); }
#player-left.active-turn { transform: translateY(-50%) scale(1.05); }
#player-right { top: 45%; right: 15px; transform: translateY(-50%); }
#player-right.active-turn { transform: translateY(-50%) scale(1.05); }

/* MERKEZ ALAN KARTLARIN KESİŞMEMESİ İÇİN DAHA YUKARI ÇEKİLDİ (Top: 38%) */
#center-area {
    position: absolute; top: 38%; left: 50%; width: 250px; height: 250px;
    transform: translate(-50%, -50%); z-index: 5;
}

.played-card {
    position: absolute; width: 94px; height: 140px;
    background: white; border-radius: 8px; border: 1px solid #ccc;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5); 
    box-sizing: border-box; font-family: Arial, sans-serif;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease;
    will-change: transform, opacity;
}

#player-hand {
    position: absolute; bottom: 85px; left: 0; width: 100%; height: 200px; z-index: 50;
}

.card {
    position: absolute; width: 94px; height: 140px;
    background: white; border-radius: 8px; border: 1px solid #ccc;
    box-shadow: -2px 0px 8px rgba(0,0,0,0.3); cursor: grab;
    box-sizing: border-box; font-family: Arial, sans-serif;
    transform-origin: 50% 150%; 
    bottom: var(--base-bottom, 10px);
    transition: bottom 0.2s, filter 0.2s, opacity 0.2s; touch-action: none;
    will-change: transform, bottom;
}
.card:active:not(.unplayable) { cursor: grabbing; }
.card.dragging { z-index: 150 !important; box-shadow: 0 10px 25px rgba(0,0,0,0.6); opacity: 0.9; transition: none; }

.card.unplayable { cursor: pointer; }

.card.invalid-click {
    opacity: 0.5 !important;
    filter: grayscale(100%);
    transform: scale(0.95);
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .card:not(.unplayable):not(.dragging):hover {
        bottom: calc(var(--base-bottom, 10px) + 20px) !important;
        z-index: 200 !important; box-shadow: 0 0 20px rgba(255,255,255,0.6);
    }
}

.red { color: #d32f2f; }
.black { color: #212121; }

.card-top { position: absolute; top: 6px; left: 8px; text-align: center; font-size: 20px; font-weight: 900; line-height: 1; }
.card-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 42px; text-align: center; font-weight: bold; }
.card-bottom { position: absolute; bottom: 6px; right: 8px; text-align: center; font-size: 20px; font-weight: 900; line-height: 1; transform: rotate(180deg); }

@media (max-width: 900px) {
    .card { width: 83px; height: 124px; }
    
    .card-top { font-size: 17px; left: 6px; top: 5px; bottom: auto; right: auto; }
    .card-bottom { font-size: 17px; right: 6px; bottom: 5px; top: auto; left: auto; }
    
    .card-center { font-size: 34px; }
    #player-hand { bottom: 60px; height: 170px; }
    .played-card { width: 83px; height: 124px; }
    #center-area { top: 40%; transform: translate(-50%, -50%) scale(0.85); } /* Daha yukarı taşındı */
    #player-bottom-bar { padding: 4px 15px; bottom: 5px; }
}

@media (max-width: 768px) {
    .logo-text { font-size: 48px; }
    .menu-logo { font-size: 56px; }
    #table-watermark { font-size: 40px; letter-spacing: 5px; }
    
    .player-panel { padding: 5px 12px; }
    .player-panel img { width: 35px; height: 35px; margin-right: 8px;}
    .player-name { font-size: 12px; }
    .player-score { font-size: 10px; }
    .player-total { font-size: 11px; }
    
    .modern-btn-top { font-size: 12px; padding: 6px 10px; }
    #trump-indicator { left: 10px; top: 10px;}
    
    #btn-restart-game { right: 10px !important; top: 10px !important; }
    #btn-sound { right: 10px !important; top: 55px !important; padding: 4px 10px !important; }
    
    #player-left { left: 5px; }
    #player-right { right: 5px; }
    #player-top { top: 5px; }
    
    /* PROFİL KUTULARI GENİŞLETİLDİ VE METİN KAYMASI ENGELLENDİ */
    #player-left, #player-right {
        flex-direction: column !important; 
        text-align: center;
        padding: 6px 5px !important;
        max-width: 95px; /* Yazının sığması için 75px'den 95px'e çıkarıldı */
        min-width: 85px; 
    }
    #player-left img, #player-right img {
        margin-right: 0 !important;
        margin-bottom: 4px !important;
        width: 35px; height: 35px;
    }
    #player-left .panel-info, #player-right .panel-info {
        align-items: center;
    }
    #player-left .player-name, #player-right .player-name {
        font-size: 11px; white-space: normal; line-height: 1.1; margin-bottom: 3px;
    }
    #player-left .player-score, #player-right .player-score {
        font-size: 9px; line-height: 1.1; margin-bottom: 2px;
        white-space: nowrap; /* 0 Rakamının alt satıra düşmesini engeller */
    }
    #player-left .player-total, #player-right .player-total {
        font-size: 10px;
    }
    
    .card { width: 69px; height: 104px; }
    
    .card-top { font-size: 14px; left: 5px; top: 4px; bottom: auto; right: auto; }
    .card-bottom { font-size: 14px; right: 5px; bottom: 4px; top: auto; left: auto; }
    
    .card-center { font-size: 28px; }
    .played-card { width: 69px; height: 104px; }
    #player-hand { bottom: 55px; height: 140px; }
    
    #center-area { top: 38%; transform: translate(-50%, -50%) scale(0.8); } /* Mobilde de merkez daha yukarıda */
}