/* Core Variables - Brand Colors */
:root {
    --primary-color: #00ccff;
    --secondary-color: #ff00aa;
    --accent-color: #FFD700;
    --tertiary-color: #00ffaa;
    --dark-bg: #0a0a16;
    --dark-bg-alt: #0f0f22;
    --green-primary: #065f46;
    --green-secondary: #047857;
    --card-width: 60px;
    --card-height: 84px;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-secondary) 100%);
    color: white;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Typography */
.font-game, .font-press-start {
    font-family: 'Press Start 2P', cursive;
}

/* Header Styles */
.game-header {
    background: var(--dark-bg);
    border-bottom: 2px solid var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-btn {
    background: var(--green-primary);
    color: white;
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-btn:hover {
    background: var(--primary-color);
    color: var(--dark-bg);
    transform: translateY(-2px);
}

.nav-btn.primary {
    background: var(--accent-color);
    color: var(--dark-bg);
    border-color: var(--accent-color);
}

/* Game Container */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Score Board */
.score-board {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 1rem;
    border: 2px solid var(--primary-color);
    margin-bottom: 2rem;
}

.team-score {
    text-align: center;
}

.team-score h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.score-display {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.tricks-won {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.game-info {
    text-align: center;
    padding: 0 2rem;
}

.trump-display, .dealer-display {
    margin: 0.5rem 0;
    font-size: 1.2rem;
}

/* Modify .trump-display for flex layout */
.trump-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Adds space between "Trump:", the card, and the suit symbol */
}

/* New style rules for the up-card display element */
.up-card-display {
    width: calc(var(--card-width) * 0.6); /* About 60% of the regular card size */
    height: calc(var(--card-height) * 0.6);
    background-size: cover;
    background-position: center;
    border-radius: 4px; /* Slightly smaller border radius for a smaller card */
    border: 1px solid var(--dark-bg);
    /* background-color: #ccc; /* Placeholder background, JS will set the image */
}

.trump-suit {
    font-size: 2rem; /* Original size for the suit symbol (e.g., ♥️) */
    /* margin-left: 0.5rem; /* This is now handled by the 'gap' in .trump-display */
}

/* Game Table */
.game-table {
    position: relative;
    width: 100%;
    max-width: 1000px; /* Increased from previous constraint */
    height: 600px;
    min-height: 500px; /* Added minimum height */
    background: var(--green-primary);
    border-radius: 2rem;
    border: 4px solid var(--dark-bg);
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 204, 255, 0.3);
    margin: 2rem auto; /* Center the table */
}

/* Player Areas */
.player-area {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-area.top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.player-area.bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.player-area.left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: row;
}

.player-area.right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: row-reverse;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
    border: 1px solid var(--primary-color);
}

.player-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: var(--accent-color);
}

.player-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
}

.player-indicator.active {
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Player Hands */
.player-hand {
    display: flex;
    gap: 0.5rem;
}

.player-area.left .player-hand,
.player-area.right .player-hand {
    flex-direction: column;
}

/* Cards */
.card {
    width: var(--card-width);
    height: var(--card-height);
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 2px solid var(--dark-bg);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.card.playable {
    border-color: var(--accent-color);
}

.card.playable:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}

.card.valid-play {
    border-color: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.card.invalid-play {
    border-color: #ef4444;
    opacity: 0.5;
}

.card.discard-candidate:hover {
    box-shadow: 0 0 15px var(--secondary-color);
    border-color: var(--secondary-color);
}

.player-hand.partner-alone .card {
    opacity: 0.5;
    background-image: url('../images/cards/back.svg') !important; /* Ensure back is shown */
    cursor: not-allowed;
}

/* Center Area */
.center-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.played-cards {
    display: grid;
    grid-template-areas: 
        ". top ."
        "left center right"
        ". bottom .";
    gap: 0.5rem;
    align-items: center;
    justify-items: center;
    min-width: 200px;
    min-height: 200px;
}

.deck-area {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.control-btn {
    background: var(--green-secondary);
    color: white;
    border: 2px solid var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background: var(--primary-color);
    color: var(--dark-bg);
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--primary-color);
}

/* Modals */
.modal {
    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;
    z-index: 1000;
}

.modal-content {
    background: var(--dark-bg-alt);
    border: 2px solid var(--primary-color);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    color: white;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--primary-color);
}

/* Trump Selection */
.trump-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.trump-option {
    background: var(--green-primary);
    color: white;
    border: 2px solid var(--primary-color);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
}

.trump-option:hover {
    background: var(--primary-color);
    color: var(--dark-bg);
    transform: scale(1.05);
}

/* Rules Modal */
.rules-content {
    max-width: 600px;
}

.rules-content h2 {
    font-family: 'Press Start 2P', cursive;
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 2rem;
}

.rules-content h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem 0;
}

.rules-content ul, .rules-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.rules-content li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

/* Game Messages */
.game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--dark-bg);
    color: var(--accent-color);
    padding: 1rem 2rem;
    border-radius: 1rem;
    border: 2px solid var(--primary-color);
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    z-index: 1001;
    box-shadow: 0 0 20px var(--primary-color);
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --card-width: 45px;
        --card-height: 63px;
    }
    
    .game-container {
        padding: 1rem;
    }
    
    .game-table {
        height: 450px; /* Slightly larger for mobile */
        transform: scale(0.9); /* Less aggressive scaling */
        transform-origin: center;
        margin: 1rem auto;
    }
    
    .score-board {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .game-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .control-btn {
        font-size: 0.7rem;
        padding: 0.6rem 1rem;
    }
    
    .trump-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .game-table {
        transform: scale(0.8); /* Less aggressive scaling for small screens */
        height: 400px;
    }
    
    .modal-content {
        padding: 1rem;
        margin: 1rem;
    }
    
    .rules-content h2 {
        font-size: 1rem;
    }
}

/* Animations */
@keyframes dealCard {
    from {
        transform: translateY(-100px) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

@keyframes flipCard {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.card-dealing {
    animation: dealCard 0.5s ease-out;
}

.card-flipping {
    animation: flipCard 0.6s ease-in-out;
}

/* SEO Content Styling */
.seo-content {
    background: var(--green-secondary);
    color: white;
    line-height: 1.6;
}

.seo-content h2, .seo-content h3 {
    color: var(--accent-color);
}

.seo-content .text-primary-color {
    color: var(--primary-color);
}

.seo-content a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.seo-content a:hover {
    color: var(--accent-color);
}

.related-games .game-link {
    transition: all 0.3s;
}

.related-games .game-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .card,
    .control-btn,
    .player-indicator {
        transition: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 1; }
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #ffffff;
        --accent-color: #ffff00;
        --dark-bg: #000000;
    }
    
    .card {
        border-width: 3px;
    }
}
