:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --table-green: #115e59;
    --card-width: 60px;
    --card-height: 85px;
}

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    overflow-x: hidden;
    user-select: none;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 10;
}

.game-header { text-align: center; }
.game-header h1 { font-size: 2.5rem; margin: 1rem 0 0 0; }

.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    margin: 2rem auto;
    text-align: center;
}

.btn-group { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }

/** Table Area */
.hearts-table {
    background: var(--table-green);
    border: 8px solid #0f172a;
    border-radius: 40px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 600px;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.8), 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

@media (max-width: 600px) {
    .hearts-table { padding: 0.5rem; min-height: 450px; border-radius: 20px;}
}

.middle-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.player-spot {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0.5rem;
    transition: opacity 0.3s;
}

.dimmed { opacity: 0.4; }

.player-info {
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    margin-bottom: 0.5rem;
    display: flex; flex-direction: column; align-items: center;
}

.player-info h3 { margin: 0; font-size: 0.9rem; color: #cbd5e1; }
.score { color: #fbbf24; font-weight: 700; font-size: 0.9rem; margin-top: 0.2rem; }

.hand { position: relative; }
.flex-center { display: flex; justify-content: center; flex-wrap: wrap; gap: -30px; }
.my-hand .card { margin-left: -35px; transition: transform 0.2s, margin 0.2s; cursor: pointer; }
.my-hand .card:first-child { margin-left: 0; }
.my-hand .card:hover { transform: translateY(-15px); z-index: 20; }
.my-hand .card.invalid { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; }
.my-hand .card.invalid:hover { transform: none; margin-right: 0;}

.hidden-hand {
    display: flex; gap: -50px; justify-content: center;
    transform: scale(0.6); margin-top: -20px;
}
.hidden-hand .card { margin-left: -45px; }

.hidden-hand-vert {
    display: flex; flex-direction: column; gap: -60px;
    transform: scale(0.6);
}
.hidden-hand-vert .card { margin-top: -65px; transform: rotate(90deg); }
.pos-left .card { transform: rotate(90deg); }
.pos-right .card { transform: rotate(-90deg); }

.trick-area {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 150px; height: 150px;
}

.trick-card-spot {
    position: absolute;
    width: var(--card-width); height: var(--card-height);
    transition: all 0.3s ease-out;
}
#trick-p3 { top: 0; left: 50%; transform: translateX(-50%) scale(0.9); z-index: 1; } /* Top Bot */
#trick-p1 { bottom: 0; left: 50%; transform: translateX(-50%) scale(1.1); z-index: 4; } /* Me */
#trick-p4 { top: 50%; left: 0; transform: translateY(-50%) rotate(15deg); z-index: 2; } /* Left Bot */
#trick-p2 { top: 50%; right: 0; transform: translateY(-50%) rotate(-15deg); z-index: 3; } /* Right Opp */

/** Cards CSS */
.card {
    width: var(--card-width);
    height: var(--card-height);
    background: white;
    border-radius: 6px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
    box-sizing: border-box;
    position: relative;
    border: 1px solid #ccc;
    font-family: Arial, sans-serif;
}
.card.red { color: #ef4444; }
.card.black { color: #0f172a; }

.card-top {
    font-size: 0.9rem; font-weight: bold; line-height: 1; display: flex; flex-direction: column; align-items: center; align-self: flex-start;
}
.card-bottom {
    font-size: 0.9rem; font-weight: bold; line-height: 1; display: flex; flex-direction: column; align-items: center; align-self: flex-end; transform: rotate(180deg);
}
.card-suit { font-size: 1rem; }
.card-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 1.8rem; opacity: 0.3; }

.card.back {
    background: #1e3a8a;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.1) 10px, rgba(255,255,255,0.1) 20px);
    border: 2px solid white;
}
.card.back * { display: none; }

.hidden { display: none !important; }

@media (max-width: 600px) {
    :root {
        --card-width: 45px;
        --card-height: 65px;
    }
    .my-hand .card { margin-left: -25px; }
    .card-center { font-size: 1.2rem; }
    .trick-area { transform: translate(-50%, -50%) scale(0.8); }
}
