.game-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
    z-index: 10;
}

.game-header {
    width: 100%;
    text-align: center;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

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

.score-board {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
}

.player-score {
    background: var(--glass-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s;
    opacity: 0.5;
}

.player-score.active {
    opacity: 1;
    transform: scale(1.05);
}

.player-score.player1.active {
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.player-score.player2.active {
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.player-score .name {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.player-score .score {
    font-size: 2.5rem;
    font-weight: 700;
}

.player1 .score { color: #3b82f6; }
.player2 .score { color: #ef4444; }

#status-message {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: var(--text-main);
    font-weight: 500;
    height: 1.5rem;
}

.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.panel h2 {
    margin-bottom: 1.5rem;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.join-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

#join-code {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 10px 15px;
    color: white;
    font-family: var(--font-family);
    font-size: 1rem;
    text-align: center;
    text-transform: uppercase;
}

#join-code:focus {
    outline: none;
    border-color: var(--primary);
}

.hidden {
    display: none !important;
}

/* Base style for grid to be controlled by Javascript */
#game-board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid-container {
    position: relative;
    user-select: none;
    margin: 2rem auto;
}

/* Dots */
.dot {
    position: absolute;
    background: var(--text-muted);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

/* Lines */
.line {
    position: absolute;
    cursor: pointer;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
}

.line.h {
    transform: translateY(-50%);
}

.line.v {
    transform: translateX(-50%);
}

.line-inner {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s;
}

.line.h .line-inner { width: 100%; height: 6px; }
.line.v .line-inner { height: 100%; width: 6px; }

.line:hover:not(.claimed) .line-inner {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.line.claimed .line-inner {
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.line.claimed.recent .line-inner {
    box-shadow: 0 0 20px #fbbf24; /* highlight most recent line */
    background: #fdf6e3;
}

/* Boxes */
.box {
    position: absolute;
    transition: all 0.4s ease-out;
    z-index: 1;
    border-radius: 8px;
    transform: scale(0.8);
    opacity: 0;
}

.box.p1 {
    opacity: 1;
    transform: scale(1);
    background: rgba(59, 130, 246, 0.4);
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.2);
}

.box.p2 {
    opacity: 1;
    transform: scale(1);
    background: rgba(239, 68, 68, 0.4);
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.2);
}

@media (max-width: 600px) {
    .back-btn {
        position: relative;
        top: 0;
        transform: none;
        display: block;
        margin-bottom: 1rem;
    }
    .score-board {
        gap: 1rem;
    }
    .player-score {
        padding: 0.5rem 1rem;
    }
    .player-score .score {
        font-size: 1.8rem;
    }
}
