/* Dots and Boxes Specific Styles */
/* Note: Global resets and shared styles are in shared/base.css */

:root {
    /* Override or add specific vars if needed, but try to use base.css vars */
    /* Reuse base vars: --primary, --secondary, --bg-color, etc */

    /* Game specific colors */
    --p1-color: #FF4757;
    /* Red */
    --p2-color: #3742fa;
    /* Blue */

    --line-hover: rgba(255, 255, 255, 0.3);
    --line-taken: #fff;
    --box-bg-p1: rgba(255, 71, 87, 0.3);
    --box-bg-p2: rgba(55, 66, 250, 0.3);
    --dot-color: #a4b0be;

    /* Reuse base.css card-bg */
}

/* Game Over Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    /* Darker backdrop */
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(20, 20, 30, 0.95);
    margin: auto;
    padding: 40px;
    border: 1px solid var(--primary);
    width: 80%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.2), inset 0 0 20px rgba(0, 243, 255, 0.05);
    text-align: center;
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal h2 {
    font-size: 3rem !important;
    /* Force override inline styles if present */
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.modal p {
    font-size: 1.5rem !important;
    color: var(--text-dim);
    margin-bottom: 40px;
}

.modal-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.modal-actions button {
    padding: 12px 30px;
    font-size: 1.1rem;
    min-width: 160px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Lobby Overrides */
.game-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    flex: 1 1 280px;
    max-width: 320px;
    transition: all 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 30px rgba(0, 243, 255, 0.15);
}

.mode-card h3 {
    margin: 0 0 10px 0;
    color: var(--primary);
    font-size: 1.4rem;
}

.mode-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.full-width {
    width: 100%;
}

.small {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.neon-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-family: inherit;
}

#stats-banner {
    background: rgba(0, 243, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 243, 255, 0.2);
    display: inline-block;
    color: var(--primary);
    font-family: monospace;
    margin-bottom: 20px;
}

/* Difficulty Buttons (Matches Pong) */
.difficulty-group {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.diff-btn {
    flex: 1;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.diff-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.lobby-card h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text);
}

.subtitle {
    color: var(--text-dim);
    margin-bottom: 30px;
}


/* Game Header */
/* .game-header in base.css handles layout, we just style internals */
.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-info.p2 {
    flex-direction: row-reverse;
    text-align: right;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #555;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.avatar.red {
    background: var(--p1-color);
    box-shadow: 0 0 15px var(--p1-color);
}

.avatar.blue {
    background: var(--p2-color);
    box-shadow: 0 0 15px var(--p2-color);
}

.details {
    display: flex;
    flex-direction: column;
}

.name {
    font-size: 0.9rem;
    opacity: 0.8;
}

.score {
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.game-status {
    text-align: center;
}

.turn-badge {
    background: var(--surface);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.turn-badge.red {
    background: rgba(255, 71, 87, 0.2);
    border-color: var(--p1-color);
    color: var(--p1-color);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.4);
}

.turn-badge.blue {
    background: rgba(55, 66, 250, 0.2);
    border-color: var(--p2-color);
    color: var(--p2-color);
    box-shadow: 0 0 15px rgba(55, 66, 250, 0.4);
}

/* Game Board */
.game-board-container {
    background: rgba(255, 255, 255, 0.03);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.dots-board {
    display: grid;
    gap: 0;
    user-select: none;
    margin: 0 auto;
    width: 100%;
    max-width: 500px;
    /* Limit size for 6x6 grid */
    aspect-ratio: 1;
    /* Ensure square aspect ratio */
}

.dot {
    width: 12px;
    height: 12px;
    background: var(--dot-color);
    border-radius: 50%;
    margin: auto;
    box-shadow: 0 0 5px var(--dot-color);
    z-index: 2;
}

.line {
    border-radius: 5px;
    transition: background 0.2s, box-shadow 0.2s;
    cursor: pointer;
    z-index: 1;
}

.line.h {
    height: 8px;
    width: 100%;
    margin-top: 2px;
}

.line.v {
    width: 8px;
    height: 100%;
    margin-left: 2px;
}

.line:hover {
    background: var(--line-hover);
    box-shadow: 0 0 10px var(--line-hover);
}

.line.taken.red {
    background: var(--p1-color);
    cursor: default;
    box-shadow: 0 0 10px var(--p1-color);
}

.line.taken.blue {
    background: var(--p2-color);
    cursor: default;
    box-shadow: 0 0 10px var(--p2-color);
}

.line.last-move {
    box-shadow: 0 0 10px 2px #fff !important;
    filter: brightness(1.5);
    z-index: 10;
}

.box {
    width: 100%;
    height: 100%;
    border-radius: 5px;
    transition: background 0.5s ease;
}

.box.red {
    background: var(--box-bg-p1);
    box-shadow: inset 0 0 20px rgba(255, 71, 87, 0.2);
}

.box.blue {
    background: var(--box-bg-p2);
    box-shadow: inset 0 0 20px rgba(55, 66, 250, 0.2);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .game-board-container {
        padding: 15px;
    }

    .line.h {
        height: 6px;
    }

    .line.v {
        width: 6px;
    }

    .dot {
        width: 8px;
        height: 8px;
    }
}