/*
 * =======================================================
 * GAME-SPECIFIC CSS: OCEAN BIG 5 (Card Flip)
 * =======================================================
 */

/* Controls (Player count, Target Score, Start Button) — VERTICAL STACK */
.game-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background-color: var(--secondary-light);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.game-controls label {
    font-weight: 600;
    margin: 0;
}

.game-controls select,
.game-controls button {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--primary-light);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

#start-button,
#reset-button {
padding: 10px;
font-size: 1.1rem;
background-color: var(--accent-color);
color: var(--primary-light);
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
width: 100%;
}

#start-button:hover,
#reset-button:hover {
background-color: #2980b9;
}

#start-button:disabled,
#reset-button:disabled {
background-color: #95a5a6;
cursor: not-allowed;
}

/* 1. Main Game Layout Wrapper */
.game-area-wrapper {
    display: flex; /* Arranges the scoreboard and game container side-by-side */
    gap: 15px;
    max-width: 800px; /* Max width for the whole game area */
    width: 100%;
    align-items: flex-start; /* Aligns content to the top */
    margin: 0 auto;
}

/* 2. Player Scoreboard (Left Side) */
#player-scoreboard {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    padding: 15px;
    background-color: var(--secondary-light);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    font-weight: 600;
}

.player-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
    opacity: 0.6; /* Dim inactive players */
    transition: opacity 0.3s ease;
}

.player-score-item.active-player {
    opacity: 1.0; /* Highlight current player */
    font-weight: 700;
}

.player-score-item:last-child {
    border-bottom: none;
}

.player-token {
    background-color: var(--accent-color);
    color: var(--primary-light);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 5px;
    min-width: 30px;
    text-align: center;
}

/* 3. Game Container (Slot Machine Area) */
.game-container {
    height: 450px; /* Taller height for the background image */
    max-width: 600px;
    width: 100%;
    position: relative; 
    padding: 10px; 
    border: 5px solid #f1c40f; /* Yellow accent for slot machine */
    background-color: #2c3e50; 
    
    /* Marine Background Image Placeholder */
    /* REMEMBER TO REPLACE THIS with your actual image path */
    background-image: url('images/ocean2.png'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    display: flex; 
    align-items: center; 
    justify-content: center;
}

/* 4. Card Reel Container (The 5 horizontal card slots) */
#card-reel-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%; 
    padding: 0 10px;
}

/* 5. Individual Card Slot */
.card-slot {
    width: 100px; 
    height: 150px; 
    perspective: 1000px; 
    position: relative;
    cursor: default;
    border: 2px solid #f1c40f; 
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.1); 
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Active State (Player can select this card) */
.card-slot.active {
    cursor: pointer;
    box-shadow: 0 0 15px rgba(52, 152, 219, 1); /* Blue glow when selectable */
    transform: scale(1.05);
    transition: all 0.2s ease-in-out;
}

/* Disabled/Greyed-out State (For fewer players) */
.card-slot.disabled {
    cursor: not-allowed;
    opacity: 0.3;
    pointer-events: none; 
    border-color: var(--dark-border);
    box-shadow: none;
}

/* Selected State (Card chosen by a player) */
.card-slot.selected {
    cursor: default;
    opacity: 0.8;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.8); /* Red/Orange glow when selected */
}


/* 6. Card Faces and Flip Animation */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; 
    transition: transform 0.5s;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--dark-text);
    background-size: cover; /* For the animal images */
    background-position: center;
}

/* Card Back (Initial state) */
.card-back {
    background-color: var(--accent-color);
    transform: rotateY(0deg);
    /* Placeholder for card back pattern */
    background-image: repeating-linear-gradient(45deg, var(--accent-color), var(--accent-color) 10px, #2980b9 10px, #2980b9 20px);
}

/* Card Front (Revealed state - use background images for animals) */
.card-front {
    background-color: var(--primary-light);
    transform: rotateY(180deg);
    /* Text for points will be placed here by JS */
}

/* Flip Class (JS applies this to the card-slot parent) */
.card-slot.is-flipped .card-back {
    transform: rotateY(180deg);
}

.card-slot.is-flipped .card-front {
    transform: rotateY(0deg);
}

/* 7. Player Token Area (Below the Card) */
.card-token-area {
    position: absolute;
    bottom: -30px; 
    left: 0;
    width: 100%;
    height: 25px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--dark-text); 
    display: flex;
    justify-content: center;
    align-items: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* Shadow for readability on dark background */
}

/* Blackout Effect for Anticipation */
.game-container.blackout {
    transition: background-color 0.3s ease-in-out;
    background-color: blue !important;
}

/* Dark Theme Adjustments */
body.dark-theme #player-scoreboard {
    background-color: var(--dark-secondary);
}

body.dark-theme .game-controls {
    background-color: var(--dark-secondary);
}

body.dark-theme .game-controls select {
    background-color: var(--dark-card);
    color: var(--dark-text);
    border-color: var(--dark-border);
}

body.dark-theme .card-slot {
    border-color: #f1c40f; 
}
/*
 * =======================================================
 * CARD FRONT IMAGE STYLES (REQUIRED FOR JS)
 * =======================================================
 */

/* NOTE: Replace the url('...') with your actual image paths */

.card-front.whale-bg {
    background-image: url('images/whale.png');
    background-size: cover;
    color: white; /* Ensure text is readable */
    text-shadow: 1px 1px 3px black;
}

.card-front.shark-bg {
    background-image: url('images/shark.png');
    background-size: cover;
    color: white;
    text-shadow: 1px 1px 3px black;
}

.card-front.dolphin-bg {
    background-image: url('images/dolphin.png');
    background-size: cover;
    color: white;
    text-shadow: 1px 1px 3px black;
}

.card-front.seal-bg {
    background-image: url('images/seal.png');
    background-size: cover;
    color: white;
    text-shadow: 1px 1px 3px black;
}

.card-front.penguin-bg {
    background-image: url('images/penguin.');
    background-size: cover;
    color: black; /* Use black text for light backgrounds */
    text-shadow: 1px 1px 3px white;
}
/* ==============================
 *  GAME LAYOUT: DESKTOP & MOBILE
 *  ============================== */

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Panels for controls and scoreboard */
.game-controls-panel,
.score-panel {
    width: 100%;
    max-width: 600px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--secondary-light);
}

body.dark-theme .game-controls-panel,
body.dark-theme .score-panel {
    background-color: var(--dark-secondary);
    border-color: var(--dark-border);
}

/* Improve spacing inside score items */
.player-score-item {
    gap: 0.4rem; /* adds vertical space between token, score, card */
}

/* Ensure card reel has ~1rem gap */
#card-reel-container {
gap: 1rem !important; /* override any existing spacing */
padding: 0 10px;
justify-content: center;
}

/* Desktop: side-by-side layout */
@media (min-width: 768px) {
    .game-layout {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .game-controls-panel {
        flex: 0 0 220px;
    }

    .game-container {
        flex: 1;
        max-width: 650px;
        min-width: 450px;
    }

    .score-panel {
        flex: 0 0 220px;
    }

    /* Landscape-style player item on desktop */
    .player-score-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 0.8rem;
    }

    .player-token,
    .player-score,
    .player-card-choice {
        white-space: nowrap;
    }
}

/* Mobile: ensure vertical stacking */
@media (max-width: 767px) {
    .player-score-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 0;
    }
}
