* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Fredoka', sans-serif;
    background-color: #0f5132; /* Casino Green Felt */
    background-image: radial-gradient(circle, #198754 0%, #0f5132 100%);
    color: white;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header HUD */
.header {
    background: rgba(0,0,0,0.4);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 10;
}
.logo { font-size: 1.5rem; font-weight: 700; color: #ffd15c; }
.stats { display: flex; gap: 20px; }
.stat-box { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,0.3); padding: 5px 15px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); }
.stat-label { font-size: 0.65rem; color: #ccc; letter-spacing: 1px; }
.stat-value { font-size: 1.2rem; font-weight: 700; color: white; }
.btn { background: #4f46e5; color: white; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn:hover { background: #4338ca; transform: translateY(-2px); }

/* Ad Banner Area */
.ad-banner {
    width: 90%;
    max-width: 728px;
    height: 90px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin: 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.ad-label {
    position: absolute;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    pointer-events: none;
}
.ad-bottom { margin-top: auto; margin-bottom: 20px; }

/* Game Board */
.board {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.top-row {
    display: flex;
    justify-content: space-between;
    height: 140px; /* Base card height */
}

.top-left {
    display: flex;
    gap: 15px;
}

.top-right {
    display: flex;
    gap: 15px;
}

.tableau-row {
    display: flex;
    justify-content: space-between;
    flex-grow: 1;
    position: relative;
}

/* Piles */
.pile {
    width: 95px;
    height: 135px;
    border-radius: 8px;
    border: 2px dashed rgba(255,255,255,0.3);
    position: relative;
}

.foundation-pile::before {
    content: '♠'; /* Default icon */
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255,255,255,0.15);
}
#foundation-0::before { content: '♠'; }
#foundation-1::before { content: '♥'; }
#foundation-2::before { content: '♣'; }
#foundation-3::before { content: '♦'; }

.stock-pile::before {
    content: '↺';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: rgba(255,255,255,0.2);
}

/* CARDS */
.card {
    width: 95px;
    height: 135px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 1px 2px 5px rgba(0,0,0,0.3);
    position: absolute;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    cursor: grab;
    transition: box-shadow 0.2s, filter 0.2s;
    background-color: white; /* Important for drag overlay */
}
.card:active { cursor: grabbing; }
.card.dragging {
    opacity: 0.9;
    box-shadow: 5px 10px 20px rgba(0,0,0,0.5);
    z-index: 1000 !important;
}

/* Card Values & Suits */
.card .value { font-size: 1.2rem; line-height: 1; }
.card .suit { font-size: 1.2rem; line-height: 1; margin-top: -2px; }
.card .center-suit { font-size: 3.5rem; text-align: center; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.card.red { color: #dc3545; }
.card.black { color: #212529; }

/* Card Layout */
.card .top-left { display: flex; flex-direction: column; align-items: center; position: absolute; top: 6px; left: 6px; height: auto; }
.card .bottom-right { display: flex; flex-direction: column; align-items: center; position: absolute; bottom: 6px; right: 6px; transform: rotate(180deg); height: auto; }

/* Card Back (Facedown) */
.card.facedown {
    background-color: #1e3a8a;
    background-image: radial-gradient(#3b82f6 2px, transparent 2px);
    background-size: 12px 12px;
    border: 3px solid white;
    cursor: default;
}
.card.facedown .top-left, .card.facedown .bottom-right, .card.facedown .center-suit {
    display: none;
}

/* Stock Pile specific interaction */
.stock-pile .card.facedown { cursor: pointer; }
.stock-pile .card.facedown:hover { filter: brightness(1.1); }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.3s;
    z-index: 9999;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-card { background: white; color: #333; padding: 30px; border-radius: 15px; text-align: center; min-width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.modal-card h2 { color: #198754; margin-bottom: 15px; font-size: 2rem; }
.btn-primary { background: #198754; padding: 10px 20px; font-size: 1.1rem; }
.btn-primary:hover { background: #157347; }

/* Responsive adjustments */
@media (max-width: 800px) {
    .pile { width: 70px; height: 100px; }
    .card { width: 70px; height: 100px; padding: 4px; }
    .card .value, .card .suit { font-size: 1rem; }
    .card .center-suit { font-size: 2.5rem; }
    .top-row { height: 105px; }
}
