/* ================================================================
   PIŞTI — Card Table Styles
   ================================================================ */

:root {
    --primary-color: #1b5e20;
    --secondary-color: #2e7d32;
    --accent-color: #f57c00;
    --text-color: #ffffff;
    --card-width: 100px;
    --card-height: 140px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    /* Rich felt table — radial highlight at center + faint diamond weave */
    background:
        radial-gradient(ellipse at 50% 45%, rgba(55, 115, 75, 0.85) 0%, rgba(18, 48, 32, 1) 75%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 14px,
            rgba(0,0,0,0.025) 14px,
            rgba(0,0,0,0.025) 15px
        );
    touch-action: manipulation;
}

/* ── Game Container ── */
.game-container {
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    display: grid;
    grid-template-rows: 1fr 1.8fr 1fr;
    gap: 8px;
    padding: 10px;
    padding-top: 58px; /* reserve space for absolutely-positioned controls */
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* Wooden rail border */
.game-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 6px solid rgba(101, 67, 33, 0.35);
    border-radius: 12px;
    box-shadow:
        inset 0 0 0 2px rgba(180, 130, 60, 0.18),
        inset 0 0 50px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 200;
}

/* ── Controls (centred at top) ── */
.game-controls-top {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

/* ── Player / Opponent Areas ── */
.opponent-area,
.player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    padding: 4px 0;
}

/* Active turn: subtle glow line at the edge nearest to the board */
.opponent-area::after,
.player-area::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.opponent-area::after { bottom: 0; background: rgba(231, 76, 60, 0.7); box-shadow: 0 0 8px rgba(231,76,60,0.5); }
.player-area::after   { top:    0; background: rgba(52, 152, 219, 0.7); box-shadow: 0 0 8px rgba(52,152,219,0.5); }

.opponent-area.active::after,
.player-area.active::after { opacity: 1; }

/* ── Card Hand ── */
.hand {
    display: flex;
    gap: 8px;
    min-height: var(--card-height);
    align-items: flex-end;
    justify-content: center;
    flex-grow: 0;
    width: auto;
    z-index: 1;
    overflow: visible;
}

/* Glow on active player's cards */
.opponent-area.active .opponent-card {
    box-shadow: 0 0 14px rgba(231, 76, 60, 0.55);
}
.player-area.active .card {
    box-shadow: 0 0 14px rgba(52, 152, 219, 0.55);
}

/* ── Info Pill (outer wrapper, centres the pill) ── */
.player-info-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* The actual horizontal pill */
.info-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 5px 14px 5px 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    max-width: 95vw;
}

/* Avatar */
.player-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 210, 50, 0.7);
    flex-shrink: 0;
}
.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Name badge */
.player-badge {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mini captured-cards pile */
.captured-cards-container {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.captured-cards {
    width: 28px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 5px;
    position: relative;
    transition: all 0.3s ease;
}

.captured-cards.has-cards {
    background-color: white;
    border: 2px solid #666;
    /* Stacked-cards depth illusion */
    box-shadow: 2px 2px 0 rgba(0,0,0,0.25), 4px 4px 0 rgba(0,0,0,0.12);
}

.captured-cards.has-cards::before {
    content: '';
    position: absolute;
    inset: 2px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="15" fill="none" stroke="rgba(0,0,0,0.08)" stroke-width="2"/></svg>');
    background-size: 14px 14px;
    border-radius: 3px;
    z-index: 1;
}

.captured-count {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 17px;
    height: 17px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 9px;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.4);
    z-index: 2;
}

/* Score & Pişti inline badges */
.points-display {
    background: #388e3c;
    color: white;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.pisti-count {
    background: #1565c0;
    color: white;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.75em;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: unset;
}

/* ================================================================
   GAME BOARD
   ================================================================ */

.game-board {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.deck-area {
    display: flex;
    gap: 36px;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    /* Sunken table surface */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 20px 36px;
    box-shadow:
        inset 0 3px 10px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.25);
    position: relative;
}

.deck, .pile {
    width: var(--card-width);
    height: var(--card-height);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.pile .card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.pile .stack-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.pile .card:hover {
    transform: translate(-50%, -50%) translateY(-5px) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000 !important;
}

.pile {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
    margin: 0 auto;
    perspective: 1000px;
    background: rgba(0,0,0,0.1);
    border: 2px dashed rgba(255,255,255,0.15);
}

.pile-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    pointer-events: none;
}

.deck {
    background: var(--primary-color);
    background-image: linear-gradient(
        45deg,
        var(--secondary-color) 25%,
        transparent 25%,
        transparent 75%,
        var(--secondary-color) 75%
    );
    background-size: 10px 10px;
    border: 2px solid var(--secondary-color);
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.deck::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.3),
        inset 0 4px 8px rgba(0,0,0,0.2),
        inset 0 -2px 4px rgba(255,255,255,0.1);
}

.deck::after {
    content: attr(data-count);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    z-index: 2;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Pile card back style */
.pile .card-back {
    background: var(--primary-color);
    background-image: linear-gradient(
        45deg,
        var(--secondary-color) 25%,
        transparent 25%,
        transparent 75%,
        var(--secondary-color) 75%
    );
    background-size: 10px 10px;
    border: 2px solid var(--secondary-color);
}

/* ================================================================
   CARDS
   ================================================================ */

.card {
    width: var(--card-width);
    height: var(--card-height);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform-style: preserve-3d;
    cursor: pointer;
    position: relative;
    user-select: none;
    border: 1px solid #ddd;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-12px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.card-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 3px;
}

.card-top, .card-bottom {
    display: flex;
    align-items: center;
    min-height: 15%;
}

.card-bottom {
    transform: rotate(180deg);
}

.card-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 60%;
}

.big-suit { font-size: 3em; }

.card.red   { color: #e74c3c; }
.card.black { color: #2c3e50; }

.card-back {
    background: #1e88e5;
    cursor: default;
}

.card-back::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="rgba(255,255,255,0.7)" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
}

.card-pattern {
    height: 100%;
    width: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="15" fill="none" stroke="rgba(255,255,255,0.2)" stroke-width="2"/></svg>');
    background-size: 30px 30px;
    background-position: center;
}

/* Face cards */
.face-card {
    background-image: linear-gradient(to bottom right, #fff, #f0f0f0);
}
.face-card .big-suit {
    font-size: 3.5em;
    text-shadow: 0 2px 3px rgba(0,0,0,0.2);
}
.face-card .card-inner {
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.face-card .card-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}
.face-card.red .big-suit   { color: #e74c3c; text-shadow: 0 2px 3px rgba(231,76,60,0.3); }
.face-card.black .big-suit { color: #2c3e50; text-shadow: 0 2px 3px rgba(44,62,80,0.3); }

/* Opponent card backs — rotated for correct orientation */
.opponent-card {
    transform: rotate(180deg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
}
.opponent-card:hover {
    transform: rotate(180deg) translateY(5px);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

/* ================================================================
   UI ELEMENTS
   ================================================================ */

/* Start button */
#start-game {
    background: linear-gradient(135deg, var(--accent-color), #e65100);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    white-space: nowrap;
}
#start-game:hover {
    background: linear-gradient(135deg, #ff9800, #bf360c);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

/* Fallback global button */
button {
    padding: 12px 24px;
    font-size: 1.1em;
    background: var(--accent-color);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    font-weight: bold;
}
button:hover {
    background: #ff9800;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* Game status */
.game-status {
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.88em;
    font-weight: 500;
    color: white;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.08);
    animation: statusChange 0.3s ease-out;
}

@keyframes statusChange {
    0%   { transform: scale(0.95); opacity: 0.7; }
    100% { transform: scale(1);    opacity: 1; }
}

/* ================================================================
   NOTIFICATIONS
   ================================================================ */

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease-out;
    max-width: 80%;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    pointer-events: none;
}
.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.notification.success { background-color: #4CAF50; border-left: 4px solid #2E7D32; }
.notification.warning { background-color: #FF9800; border-left: 4px solid #E65100; }
.notification.error   { background-color: #F44336; border-left: 4px solid #B71C1C; }
.notification.info    { background-color: #2196F3; border-left: 4px solid #0D47A1; }

/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes captureCard {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--throw-x, 0px), var(--throw-y, 0px)) rotate(var(--throw-rotate, 0deg)) scale(0.2);
        opacity: 0;
    }
}

@keyframes modalEntry {
    from { transform: scale(0.85) translateY(24px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

@keyframes cardGlow {
    0%   { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
    50%  { box-shadow: 0 0 20px rgba(52, 152, 219, 0.8); }
    100% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
}

@keyframes selected {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-15px); }
    100% { transform: translateY(0); }
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.3); }
}

/* Pişti slam — fast, direct, punchy bounce at landing */
@keyframes throwCardSlam {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    }
    10% {
        transform:
            translate(
                calc(var(--throw-x, 0px) * 0.08),
                calc(var(--throw-y, 0px) * 0.08 - 10px)
            )
            rotate(calc(var(--throw-rotate, 0deg) * 0.2))
            scale(1.1);
        box-shadow: 0 22px 38px rgba(0, 0, 0, 0.5);
    }
    88% {
        transform: translate(var(--throw-x, 0px), var(--throw-y, 0px)) rotate(var(--throw-rotate, 0deg)) scale(1.07);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
    }
    100% {
        transform: translate(var(--throw-x, 0px), var(--throw-y, 0px)) rotate(var(--throw-rotate, 0deg)) scale(0.94);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
}

/* Pişti impact: expanding ring shockwave */
@keyframes pistiRing {
    0%   { transform: translate(-50%, -50%) scale(0.25); opacity: 1;   border-width: 4px; }
    100% { transform: translate(-50%, -50%) scale(3.8);  opacity: 0;   border-width: 1px; }
}

/* Pişti impact: centre glow burst */
@keyframes pistiGlow {
    0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.6); }
    25%  { opacity: 0.95; transform: translate(-50%, -50%) scale(1);   }
    100% { opacity: 0;    transform: translate(-50%, -50%) scale(1.5); }
}

/* Card throw — fast exit, smooth arc, gentle landing */
@keyframes throwCard {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    }
    15% {
        /* Initial lift: card rises off the hand before arcing to target */
        transform:
            translate(
                calc(var(--throw-x, 0px) * 0.12),
                calc(var(--throw-y, 0px) * 0.12 + var(--arc-y, -15px))
            )
            rotate(calc(var(--throw-rotate, 0deg) * 0.3))
            scale(1.06);
        box-shadow: 0 20px 35px rgba(0, 0, 0, 0.42);
    }
    100% {
        transform: translate(var(--throw-x, 0px), var(--throw-y, 0px)) rotate(var(--throw-rotate, 0deg)) scale(0.97);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }
}

@keyframes confettiFall {
    0%   { transform: translateY(-10vh) rotate(0deg)   scale(0.8); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg) scale(1.2); opacity: 0; }
}

/* Animation classes */
.card-dealing {
    position: fixed;
    animation: throwCard 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
    backface-visibility: hidden;
}

.card-capturing {
    position: fixed;
    animation: captureCard 0.32s ease-in forwards;
    pointer-events: none;
    z-index: 999;
    will-change: transform;
}

.highlight { animation: cardGlow     1.5s infinite; }
.selected  { animation: selected     0.3s ease; }
.pulse     { animation: pulse        0.4s ease-in-out; }
.bounce    { animation: bounce       0.3s ease-in-out; }

.throwing {
    position: fixed;
    animation: throwCard 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
    backface-visibility: hidden;
}

.throwing-slam {
    position: fixed;
    animation: throwCardSlam 0.33s cubic-bezier(0.4, 0, 0.6, 1) forwards;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
    backface-visibility: hidden;
}

.ai-throwing {
    position: fixed;
    animation: throwCard 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
    backface-visibility: hidden;
}

.ai-throwing-slam {
    position: fixed;
    animation: throwCardSlam 0.28s cubic-bezier(0.4, 0, 0.6, 1) forwards;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
    backface-visibility: hidden;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    animation: confettiFall 0.9s ease-out forwards;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ================================================================
   MODAL
   ================================================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.72);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 24px;
    border-radius: 14px;
    max-width: 560px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal h2 { color: #2c3e50; margin-bottom: 16px; text-align: center; }
.modal h3 { color: #2c3e50; margin: 12px 0; text-align: center; }

.score-breakdown {
    margin: 16px 0;
    padding: 14px;
    border-radius: 10px;
}
.score-breakdown.player { background-color: #e8f5e9; border: 1px solid #81c784; }
.score-breakdown.ai     { background-color: #fff3e0; border: 1px solid #ffb74d; }

.score-breakdown h4    { margin: 0 0 8px 0; color: #2c3e50; }
.score-breakdown ul    { list-style-type: none; padding-left: 16px; margin: 4px 0; }
.score-breakdown ul ul { border-left: 2px solid rgba(0,0,0,0.1); margin: 4px 0; }
.score-breakdown li    { margin: 4px 0; color: #37474f; }

.winner-announcement { text-align: center; margin: 16px 0; }
.winner-announcement h3 { font-size: 24px; color: #2196f3; }

.play-again-btn {
    display: block;
    margin: 16px auto;
    padding: 10px 24px;
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.play-again-btn:hover { background-color: #1976d2; }

/* ================================================================
   RESPONSIVE — Tablet (≤768px)
   ================================================================ */

@media (max-width: 768px) {
    :root {
        --card-width: 80px;
        --card-height: 112px;
    }

    .big-suit { font-size: 2em; }
    .face-card .big-suit { font-size: 2.5em; }

    .game-container { gap: 6px; padding: 8px; }

    .hand { gap: 5px; }

    .info-pill { gap: 6px; padding: 4px 10px 4px 4px; }

    .player-badge { font-size: 0.75em; padding: 2px 8px; }

    .points-display,
    .pisti-count { font-size: 0.75em; padding: 2px 7px; }

    .notification { max-width: 90%; font-size: 14px; padding: 10px 15px; }
}

/* ================================================================
   RESPONSIVE — Mobile (≤480px)
   ================================================================ */

@media (max-width: 480px) {
    :root {
        --card-width: 62px;
        --card-height: 87px;
    }

    .card-inner { padding: 2px; }
    .big-suit { font-size: 1.3em; }
    .face-card .big-suit { font-size: 1.7em; }
    .face-card .card-center { transform: scale(0.9); }
    .value, .suit { font-size: 0.8em; }

    .game-container {
        grid-template-rows: 1fr 1.6fr 1fr;
        gap: 4px;
        padding: 6px;
        padding-top: 52px;
    }

    .hand { gap: 3px; }

    .deck-area {
        gap: 20px;
        padding: 14px 20px;
    }

    .game-controls-top { top: 8px; gap: 6px; }

    #start-game { padding: 6px 11px; font-size: 0.82em; }

    .game-status { font-size: 0.78em; padding: 5px 10px; }

    .info-pill {
        gap: 5px;
        padding: 4px 8px 4px 4px;
        border-radius: 28px;
    }

    .player-avatar { width: 28px; height: 28px; }

    .player-badge { font-size: 0.7em; padding: 2px 7px; }

    .badge-text { display: none; }

    .points-display,
    .pisti-count { font-size: 0.7em; padding: 2px 6px; }

    .captured-cards { width: 22px; height: 32px; }

    .captured-count { width: 14px; height: 14px; font-size: 8px; bottom: -5px; right: -5px; }

    .notification { max-width: 95%; font-size: 12px; padding: 8px 12px; top: 10px; }

    .modal-content { padding: 15px; width: 96%; }
    .modal h2 { font-size: 1.2em; }
    .modal h3 { font-size: 1em; }
    .score-breakdown { padding: 10px; margin: 8px 0; }
    .score-breakdown h4 { font-size: 0.9em; }
    .score-breakdown li { font-size: 0.8em; }
    .play-again-btn { padding: 8px 16px; font-size: 14px; }

    button { padding: 10px 15px; font-size: 0.9em; min-height: 44px; min-width: 44px; }
}

/* ================================================================
   RESPONSIVE — Extra small (≤360px)
   ================================================================ */

@media (max-width: 360px) {
    :root {
        --card-width: 52px;
        --card-height: 73px;
    }

    .game-container { padding: 5px; padding-top: 50px; gap: 3px; }

    .card:hover { transform: translateY(-5px); }

    .deck-area { gap: 14px; padding: 12px 16px; }

    .hand { gap: 2px; }

    .info-pill { gap: 4px; padding: 3px 7px 3px 3px; }

    .player-avatar { width: 24px; height: 24px; }

    .points-display,
    .pisti-count { font-size: 0.65em; padding: 1px 5px; }

    .throwing, .ai-throwing { box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
}

/* ================================================================
   TOUCH DEVICES
   ================================================================ */

@media (hover: none) {
    .card:hover { transform: none; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
    .card:active { transform: translateY(-8px); box-shadow: 0 10px 20px rgba(0,0,0,0.3); }

    .opponent-card:hover { transform: rotate(180deg); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
    .opponent-card:active { transform: rotate(180deg) translateY(5px); }

    button:hover  { background: var(--accent-color); transform: none; }
    button:active { background: #ff9800; transform: translateY(-2px); }

    .pile .card:hover  { transform: translate(-50%, -50%) !important; }
    .pile .card:active { transform: translate(-50%, -50%) translateY(-5px) !important; }
}

/* ================================================================
   BLÖFLÜ PİŞTİ
   ================================================================ */

/* Face-down bluff card overlay on pile */
.bluff-card-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 12;
    border: 2px solid #e74c3c !important;
    box-shadow: 0 0 14px rgba(231, 76, 60, 0.6) !important;
}

.bluff-badge {
    position: absolute;
    top: -11px; right: -8px;
    background: #e74c3c;
    color: white;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 8px;
    z-index: 13;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Choice panel (Normal vs Blöf) */
.bluff-choice-panel {
    position: fixed;
    bottom: 155px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(8, 16, 36, 0.94);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 10px 16px;
    z-index: 500;
    backdrop-filter: blur(6px);
    animation: bluffPanelIn 0.18s ease-out;
}

.bluff-choice-label {
    color: rgba(255,255,255,0.75);
    font-size: 12px;
    margin-right: 4px;
}

/* Response panel (Kabul / Aç) */
.bluff-response-panel {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(8, 16, 36, 0.96);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 18px;
    padding: 22px 30px;
    z-index: 500;
    text-align: center;
    backdrop-filter: blur(8px);
    animation: bluffPanelIn 0.2s ease-out;
}

.bluff-response-title {
    color: #f9ca24;
    font-size: 16px;
    font-weight: 700;
}

.bluff-response-subtitle {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    margin-top: -4px;
}

.bluff-response-buttons {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

/* Shared button base */
.btn-normal-play, .btn-bluff-play, .btn-accept, .btn-challenge {
    padding: 9px 20px;
    border: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, filter 0.1s;
}
.btn-normal-play:hover, .btn-bluff-play:hover,
.btn-accept:hover, .btn-challenge:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-normal-play:active, .btn-bluff-play:active,
.btn-accept:active, .btn-challenge:active { transform: translateY(0); }

.btn-normal-play { background: rgba(255,255,255,0.14); color: white; }
.btn-bluff-play  { background: #e74c3c; color: white; }
.btn-accept      { background: #27ae60; color: white; }
.btn-challenge   { background: #e74c3c; color: white; }

@keyframes bluffPanelIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Score History Sidebar ──────────────────────────────── */
#score-history {
  position: fixed;
  top: 0;
  right: 0;
  width: 160px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.score-history-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  padding: 14px 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

#score-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.history-entry {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: default;
}

.history-entry.win  { background: rgba(46, 160, 67, 0.18); }
.history-entry.loss { background: rgba(218, 54, 51, 0.15); }
.history-entry.tie  { background: transparent; }

.history-entry-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.history-entry-score {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.history-entry-date {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 1px;
}

.history-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  padding: 20px 10px;
}

@media (max-width: 600px) {
  #score-history { display: none; }
}
