* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: #051632; 
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Arial', sans-serif;
}

#game-container {
    width: 100vw;
    height: 56.25vw; 
    max-height: 100vh;
    max-width: 177.78vh; 
    position: relative;
    display: flex;
    flex-direction: column;
}

/* --- Start Screen --- */
#start-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: -5vmin;
    z-index: 100;
    padding-bottom: 10vh;
}

.title-img {
    width: 100vmin; 
    height: auto;
}

/* --- THE BUTTON CONTAINER --- */
.menu-buttons {
    display: flex;            /* Puts buttons side-by-side */
    flex-direction: row;      /* Ensures they stay in a line */
    gap: 4vmin;               /* THIS ADDS THE GAP BETWEEN THEM */
    justify-content: center;  /* Centers the pair of buttons */
    align-items: center;
    width: 100%;
    margin-top: -8vmin;       /* Adjusts the height to tuck them under the logo */
}

.menu-buttons button {
    padding: 2.5vmin 6vmin;
    font-size: 3.5vmin;
    font-weight: 700;
    border-radius: 2vmin;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    background: #e8b04f;
    color: #5a2e00;
    margin-top: -5vmin;
    border: 0.6vmin solid #8b4a00;
}

.menu-buttons button::after {
    content: "";
    position: absolute;
    top: 0.1vmin;
    left: 0.1vmin;
    right: 0.1vmin;
    bottom: 0.8vmin;
    border-radius: 1.5vmin;
    border-top: 0.6vmin solid #ffe2a8;
}

/* 1. Add this transition line inside your current button style */
.menu-buttons button, .modal-buttons button {
    /* ... keep all your other code same ... */
    transition: transform 0.2s ease-in-out;
}

/* 2. Add this new block to make it grow */
.menu-buttons button:hover, .modal-buttons button:hover {
    transform: scale(1.1); /* Makes the button 15% larger */
}


/* --- Game Screen --- */
.hidden { display: none !important; }

#game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.controls-top {
    position: absolute;
    top: 3vmin;
    right: 3vmin;
    display: flex;
    gap: 2vmin;
    z-index: 200; /* Increased to stay above board */
}

.controls-top button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 7vmin;
    height: 7vmin;
    font-size: 3.5vmin;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-layout {
    display: flex;
    flex-direction: row; 
    width: 100%;
    height: 100%;
    justify-content: space-around;
    align-items: center;
    padding: 0 3vmin;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4vmin 2vmin;
    border-radius: 3vmin;
    width: 25vmin;
    color: white;
    transition: all 0.3s ease;
    
    /* DARK STATE: No blur, just very low brightness */
    opacity: 0.2; 
    filter: brightness(0.4) grayscale(100%);
    background: rgba(0, 0, 0, 0.5);
}

#p1-profile { background: rgba(0, 0, 0, 0.3); opacity: 0.5; }
#p2-profile { background: rgba(255, 255, 255, 0.1); opacity: 0.5; }

.player-card.active {
    opacity: 1;
    filter: brightness(1.2) grayscale(0%);
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
    
    /* Add a solid glow to the active player's border */
    border: 0.5vmin solid #00f0ff;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.avatar {
    width: 14vmin;
    height: 14vmin;
    border-radius: 50%;
    border: 0.6vmin solid white;
    margin-bottom: 2vmin;
}

.p1-avatar { background: #ff0015; }
.p2-avatar { background: #ffcd36; }

.player-card h2 { font-size: 4vmin; }
.player-card p { font-size: 2.5vmin; opacity: 0.8; }

#board-grid {
    height: 75vmin; 
    aspect-ratio: 7/6;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    background-color: #091630;
    border: 1.5vmin solid #112244;
    border-radius: 2.5vmin;
    position: relative;
    box-shadow: 0 2vmin 6vmin rgba(0,0,0,0.6);
    overflow: hidden; /* FIX: Keeps coins inside the board area */
}

.cell {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10; /* FIX: Puts the blue board in front of coins */
    background: radial-gradient(circle, transparent 60%, #3e86f7 61%, #02BCF9 65%);
}

/* Corner rounding */
.cell:nth-child(1) { border-top-left-radius: 1.5vmin; }
.cell:nth-child(7) { border-top-right-radius: 1.5vmin; }
.cell:nth-child(36) { border-bottom-left-radius: 1.5vmin; }
.cell:nth-child(42) { border-bottom-right-radius: 1.5vmin; }

.coin {
    position: absolute;
    width: 14.28%;
    height: 16.66%;
    border-radius: 50%;
    z-index: 1; /* Sits behind the cells */
    transition: top 0.5s cubic-bezier(0.5, 0, 0.5, 1.2);
    top: -20%;
    transform: scale(0.82); 
    box-shadow: inset 0 0.8vmin 0 rgba(255,255,255,0.5);
}

.coin.red { background: linear-gradient(#ff6b6b, #d63031); border: 0.5vmin solid #a32a2a; }
.coin.yellow { background: linear-gradient(#feca57, #ff9f43); border: 0.5vmin solid #c77c00; }

/* --- FIXED NEON POPUP --- */
#game-over-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 8, 20, 0.85); 
    display: flex; 
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Stays above the board */
    backdrop-filter: blur(10px); /* Blurs the game behind */
}

.modal-content {
    background: #091630; 
    padding: 5vmin;
    border-radius: 4vmin;
    text-align: center;
    border: 1.2vmin solid #00f0ff; 
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.6);
    
    /* FIX: Prevents text from going outside the box */
    width: 85vmin;
    max-width: 550px;
    overflow-wrap: break-word; 
    display: flex;
    flex-direction: column;
    align-items: center;

    animation: 
        popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
        neonPulse 2s infinite alternate;
}
/* 3. KEYFRAMES FOR THE GLOW */
@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes neonPulse {
    from { 
        box-shadow: 0 0 20px rgba(0, 240, 255, 0.4); 
        border-color: #00d0ff; 
    }
    to { 
        box-shadow: 0 0 60px rgba(0, 240, 255, 0.9); 
        border-color: #55f5ff; 
    }
}

#winner-title {
    /* FIX: Adjusted size to stay inside the box */
    font-size: 7.5vmin; 
    color: #00f0ff;
    text-shadow: 0 0 25px rgba(0, 240, 255, 1);
    margin-bottom: 2vmin;
    text-transform: uppercase;
    width: 100%; /* Ensures it respects the parent width */
}

#winner-msg {
    font-size: 3vmin;
    color: #e0e0e0;
    margin-bottom: 4vmin;
}

/* --- BUTTONS --- */
.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 3vmin;
}

.modal-buttons button {
    padding: 2vmin 5vmin;
    font-size: 3vmin;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    text-transform: uppercase;
}

/* Play Again (Chunky Yellow) */
.modal-buttons button:first-child {
    background: #ffcc00;
    color: #333;
    box-shadow: 0 0.8vmin 0 #c49c00;
}

/* Home (Gold Gradient) */
.modal-buttons button:last-child {
    background: linear-gradient(to bottom, #feca57, #ff9f43);
    color: #333;
    box-shadow: 0 0.8vmin 0 #c49c00;
}

.modal-buttons button:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

/* --- SIMPLE PULSE ANIMATION --- */
.pulse-win {
    z-index: 500 !important; /* Makes sure they stay on top */
    animation: winGrow 0.5s ease-in-out infinite alternate;
}

@keyframes winGrow {
    from {
        transform: scale(0.82); /* Your original coin scale */
    }
    to {
        transform: scale(0.9); /* Grows slightly bigger */
    }
}