:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --table-purple: #4c1d95;
    --table-border: #2e1065;
    --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 */
.rummy-table {
    background: var(--table-purple);
    border: 8px solid var(--table-border);
    border-radius: 40px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 550px;
    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) {
    .rummy-table { padding: 0.5rem; min-height: 450px; border-radius: 20px;}
}

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

.dimmed { opacity: 0.4; pointer-events: none; }

.player-info {
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}
.player-info h3 { color: #cbd5e1; }
.score { color: #fbbf24; font-weight: 700; font-size: 1rem; margin-top: 0.2rem; }

.deadwood-badge {
    text-align: center;
    background: #ef4444; color: white;
    padding: 2px 10px; border-radius: 12px;
    font-size: 0.9rem; font-weight: bold;
    align-self: center;
}

.hand { position: relative; min-height: var(--card-height); }
.flex-center { display: flex; justify-content: center; flex-wrap: wrap; gap: -35px; }
.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.selected { transform: translateY(-20px); border-color: #fbbf24; border-width: 3px; z-index: 21; box-shadow: 0 0 15px #fbbf24; }

.hidden-hand {
    display: flex; gap: -40px; justify-content: center;
    transform: scale(0.8); margin-top: -10px;
}
.hidden-hand .card { margin-left: -40px; pointer-events: none; }

.showdown-hand .card { margin-left: -35px; }

.center-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

.deck-area {
    display: flex; gap: 20px;
}

.draw-pile, .discard-pile {
    width: var(--card-width); height: var(--card-height);
    border-radius: 6px; position: relative;
    cursor: pointer;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
.draw-pile:active, .discard-pile:active { transform: scale(0.95); }
.draw-pile { background: #1e3a8a; border: 2px solid white; display: flex; align-items: center; justify-content: center;}
.discard-pile { border: 2px dashed rgba(255,255,255,0.3); background: transparent; }

.action-prompt {
    background: rgba(0,0,0,0.7);
    padding: 0.5rem 1rem; border-radius: 20px;
    font-size: 1rem; color: #fbbf24; font-weight: bold;
}

/** 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; }
}
