/* Spades Game - Premium Blue-Black Theme */
:root {
    --spades-accent: #3b82f6;
    --spades-glow: rgba(59, 130, 246, 0.4);
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.12), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.08), transparent 45%),
        var(--bg-main);
    font-family: var(--font-main);
    color: var(--text-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.header {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 24px 32px;
    background: var(--surface-1);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    box-sizing: border-box;
}

.header h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-btn {
    background: var(--surface-2);
    color: var(--text-0);
    border: 1px solid var(--border-1);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

.home-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-sm);
}

.game-container {
    display: flex;
    gap: 32px;
    max-width: 1200px;
    width: 95%;
    margin: 20px auto;
    align-items: flex-start;
}

.stats-panel {
    background: var(--surface-1);
    backdrop-filter: blur(var(--glass-blur));
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-1);
    width: 280px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-2);
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-0);
}

.controls {
    display: grid;
    gap: 12px;
}

.action-btn {
    padding: 14px;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    border: 1px solid var(--border-1);
}

.action-btn.primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

.action-btn.secondary {
    background: var(--surface-3);
    color: var(--text-1);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Game Board */
.game-board {
    flex-grow: 1;
    background: var(--surface-1);
    backdrop-filter: blur(var(--glass-blur));
    padding: 32px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-1);
    box-shadow: var(--shadow-xl);
    min-height: 700px;
    display: flex;
    flex-direction: column;
}

.play-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    gap: 20px;
}

.player-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-area.north {
    flex-direction: column;
}

.player-area.south {
    flex-direction: column-reverse;
    margin-top: auto;
}

.center-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    min-height: 350px;
}

.player-area.west {
    flex-direction: row;
}

.player-area.east {
    flex-direction: row-reverse;
}

.player-info-card {
    background: var(--surface-2);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    min-width: 120px;
}

.player-name {
    font-weight: 700;
    color: var(--text-0);
    font-size: 0.95rem;
}

.player-stats {
    display: flex;
    gap: 10px;
    align-items: center;
}

.score-badge {
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 800;
}

.bid-tricks {
    font-size: 0.85rem;
    color: var(--text-2);
    font-weight: 600;
}

/* Trick Area */
.trick-area {
    position: relative;
    width: 320px;
    height: 320px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-full);
    border: 2px dashed var(--border-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.played-card {
    position: absolute;
    width: 80px;
    height: 112px;
    z-index: 5;
}

.played-card.north-card {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.played-card.south-card {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.played-card.west-card {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.played-card.east-card {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Bidding Slots */
.bidding-slots {
    position: absolute;
    inset: 0;
    background: var(--surface-1);
    border-radius: var(--radius-full);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
}

.bidding-header {
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-0);
}

.bidding-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.bidding-slot {
    width: 35px;
    height: 35px;
    background: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition-base);
}

.bidding-slot:hover {
    background: var(--surface-hover);
}

.bidding-slot.selected {
    background: var(--accent-primary);
    color: white;
    border-color: transparent;
}

/* Cards in Hand */
.player-hand {
    display: flex;
    justify-content: center;
    min-height: 120px;
    position: relative;
}

.card {
    width: 80px;
    height: 112px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 6px;
    box-sizing: border-box;
}

.card:hover {
    transform: translateY(-10px) scale(1.05);
    z-index: 20 !important;
    box-shadow: var(--shadow-xl);
}

.card.selected {
    transform: translateY(-20px) scale(1.05);
    border: 2px solid var(--accent-primary);
    box-shadow: var(--shadow-glow-sm);
}

.card.face-down {
    background: var(--accent-gradient);
    border: 2px solid white;
}

.card.face-down::after {
    content: '♠';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.2);
}

/* Card Content Styles */
.card-top,
.card-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.card-top span,
.card-bottom span {
    font-size: 0.9rem;
}

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

.card-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.card.red {
    color: #ff3b30;
}

.card.black {
    color: #1c1c1e;
}

.card.playable {
    opacity: 1;
    cursor: pointer;
    box-shadow: 0 0 15px var(--accent-primary);
    transform: translateY(-5px);
}

.card.unplayable {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
    transform: none;
}

.card.selectable:hover:not(.unplayable) {
    transform: translateY(-15px) scale(1.05);
    z-index: 50 !important;
}

/* Trick Winner Indicator */
.trick-winner-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--accent-gradient);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 800;
    font-size: 1.4rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
    box-shadow: var(--shadow-glow-md);
    white-space: nowrap;
}

.trick-winner-indicator.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Round Results Summary */
.results-table {
    width: 100%;
    margin: 20px 0;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-1);
}

.results-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-1);
}

.results-row:last-child {
    border-bottom: none;
}

.results-row.header {
    background: var(--surface-3);
    font-weight: 800;
    color: var(--text-2);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-row .player-name {
    font-weight: 700;
    color: var(--text-0);
}

.results-row .points {
    font-weight: 800;
    color: var(--accent-primary);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-1);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-1);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-2xl);
}

.modal-content h2 {
    font-family: var(--font-display);
    text-align: center;
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.modal-btn {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.modal-btn.primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

.modal-btn.secondary {
    background: var(--surface-2);
    color: var(--text-1);
    border: 1px solid var(--border-1);
}

/* Scoreboard Styles */
.scoreboard-row {
    display: grid;
    grid-template-columns: 60px repeat(4, 1fr);
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-1);
    align-items: center;
}

.scoreboard-row.header-row {
    background: var(--surface-2);
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-2);
}

.player-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.round-score {
    font-weight: 700;
    color: var(--text-0);
}

.total-score {
    font-size: 0.8rem;
    color: var(--text-2);
}

.resume-summary {
    margin: 20px 0;
    padding: 16px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    font-weight: 500;
}

.resume-scoreboard {
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface-3);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

/* Help Panel */
.help-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 350px;
    background: var(--surface-1);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    padding: 24px;
    z-index: 100;
    box-shadow: var(--shadow-2xl);
    transition: var(--transition-base);
}

.help-panel.hidden {
    transform: translateX(400px);
}

/* Responsive */
@media (max-width: 1024px) {
    .game-container {
        flex-direction: column;
    }

    .stats-panel {
        width: auto;
        order: 2;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .game-board {
        order: 1;
        width: 100%;
        box-sizing: border-box;
    }
}