/* ============================================
   SATRANÇ OYUNU STİLLERİ
   ============================================ */

/* Tahta */
.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: clamp(280px, 80vw, 420px);
    aspect-ratio: 1;
    margin: 0.3rem auto;
    border: 3px solid #5D4037;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    overflow: hidden;
    contain: layout style;
}

/* Hücreler - sabit kare */
.chess-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    aspect-ratio: 1;
}
.chess-cell.light { background: #F0D9B5; }
.chess-cell.dark { background: #B58863; }

.chess-cell.selected { background: #7FC8F8 !important; }
.chess-cell.last-move { background: #F6F086 !important; }
.chess-cell.in-check {
    background: #EF5350 !important;
    animation: checkPulse 0.8s ease-in-out infinite;
}

@keyframes checkPulse {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(244,67,54,0); }
    50% { box-shadow: inset 0 0 12px 2px rgba(244,67,54,0.5); }
}

/* Geçerli hamle göstergesi */
.chess-cell.valid-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(0,0,0,0.15);
    border-radius: 50%;
    pointer-events: none;
}
.chess-cell.valid-capture::after {
    width: 90%;
    height: 90%;
    background: transparent;
    border: 4px solid rgba(0,0,0,0.15);
    border-radius: 50%;
}

.chess-cell:hover {
    filter: brightness(1.08);
}

/* Taşlar - absolute pozisyon (layout shift önleme) */
.chess-piece {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.35));
    object-fit: contain;
}
.chess-cell.selected .chess-piece {
    transform: translate(-50%, -50%) scale(1.12);
    filter: drop-shadow(1px 2px 4px rgba(0,0,0,0.5));
}

/* Koordinatlar */
.chess-coord {
    position: absolute;
    font-size: 0.55rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0.6;
}
.chess-coord.rank { top: 2px; left: 3px; }
.chess-coord.file { bottom: 1px; right: 3px; }
.chess-cell.light .chess-coord { color: #B58863; }
.chess-cell.dark .chess-coord { color: #F0D9B5; }

/* Oyuncu bilgi */
.chess-player-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.8rem;
    max-width: min(440px, 95vw);
    margin: 0.2rem auto;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
}
.chess-player-info.opponent {
    background: rgba(0,0,0,0.05);
    color: #555;
}
.chess-player-info.player {
    background: rgba(0,150,136,0.1);
    color: #00796B;
}
.chess-captured {
    font-size: 1rem;
    letter-spacing: -2px;
    display: flex;
    align-items: center;
    gap: 1px;
    flex-wrap: wrap;
}
.chess-captured-piece {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
}

/* Geri al butonu */
.chess-undo-btn {
    display: block;
    margin: 0.3rem auto;
    padding: 6px 18px;
    border: 2px solid #E0E0E0;
    border-radius: 20px;
    background: white;
    font-weight: 700;
    font-size: 0.8rem;
    color: #777;
    cursor: pointer;
    transition: all 0.2s;
}
.chess-undo-btn:hover {
    border-color: #FF9800;
    color: #E65100;
    background: #FFF3E0;
}
.chess-undo-btn:active { transform: scale(0.95); }

/* Durum mesajı */
.chess-status {
    text-align: center;
    padding: 0.3rem;
    font-weight: 700;
    font-size: 0.85rem;
}
.chess-thinking {
    color: #FF9800;
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.chess-check {
    color: #E53935;
    animation: shakeText 0.5s ease;
}
@keyframes shakeText {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Kaybetme mesajı */
.chess-lose-msg {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
}
.chess-lose-card {
    background: linear-gradient(135deg, #fd79a8, #e17055);
    color: white;
    text-align: center;
    padding: 2rem;
    border-radius: 24px;
    max-width: 300px;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.chess-lose-card h3 { margin: 0.5rem 0; font-size: 1.5rem; }
.chess-lose-card p { opacity: 0.9; font-size: 0.9rem; }
.chess-retry-btn {
    margin-top: 1rem;
    padding: 0.7rem 2rem;
    border: none;
    border-radius: 50px;
    background: white;
    color: #e17055;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.chess-retry-btn:active { transform: scale(0.95); }

/* Zorluk Seçim Ekranı */
.chess-diff-screen {
    text-align: center;
    padding: 1.5rem 1rem;
    animation: fadeIn 0.4s ease;
}
.chess-diff-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-warm);
    margin-bottom: 0.3rem;
}
.chess-diff-subtitle {
    font-size: 1rem;
    color: #888;
    margin-bottom: 1rem;
}
.chess-diff-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}
.chess-diff-grid > :last-child {
    grid-column: 1 / -1;
    max-width: 154px;
    margin: 0 auto;
}
.chess-diff-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border: 3px solid #E0E0E0;
    border-radius: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}
.chess-diff-card:hover {
    border-color: var(--diff-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.chess-diff-card:active { transform: scale(0.95); }
.chess-diff-emoji { font-size: 2.2rem; }
.chess-diff-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--diff-color);
}
.chess-diff-desc {
    font-size: 0.75rem;
    color: #999;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* MP özel */
.chess-mp-turn {
    text-align: center;
    padding: 0.4rem;
    font-weight: 700;
    border-radius: 8px;
    margin: 0.2rem auto;
    max-width: 300px;
}
.chess-mp-turn.my-turn { background: #E8F5E9; color: #2E7D32; }
.chess-mp-turn.op-turn { background: #FFF3E0; color: #E65100; }
