/* Tic-Tac-Oh! Specific Styles */

body {
    font-family: 'Patrick Hand', cursive;
    background-color: #FDF5E6; /* Creamy color - Linen */
    color: #3A3A3A; /* Dark grey for text */
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    min-height: 100vh;
    padding: 15px;
    box-sizing: border-box;
}

.game-header {
    width: 100%;
    max-width: 600px;
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 2px dashed #3A3A3A; /* Dashed line for doodle feel */
}

.game-header h1 {
    font-size: 3em;
    margin: 0;
    color: #D9534F; /* A slightly muted red */
}

.back-to-lobby-btn {
    font-family: 'Patrick Hand', cursive;
    display: inline-block;
    margin-top: 10px;
    padding: 8px 15px;
    border: 2px solid #5A5A5A;
    border-radius: 12px;
    color: #5A5A5A;
    background-color: transparent;
    text-decoration: none;
    font-size: 1.2em;
    transition: background-color 0.2s, color 0.2s;
}

.back-to-lobby-btn:hover {
    background-color: #5A5A5A;
    color: #FDF5E6;
}

.game-content {
    background-color: rgba(255, 255, 255, 0.7); /* Slight transparency for paper feel */
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 0 0 5px #3A3A3A, 0 0 0 10px #FDF5E6, 0 0 0 12px #3A3A3A; /* Doodle-like border */
    text-align: center;
    width: 100%;
    max-width: 450px; /* Max width for game area */
    margin-bottom: 25px; /* Added margin to prevent shadow overlap with footer */
}

#gameInfo {
    margin-bottom: 20px;
}

#gameInfo p {
    margin: 8px 0;
    font-size: 1.4em; /* Larger text for game info */
}

#playerSymbol {
    font-weight: bold;
}

#turnInfo {
    font-style: italic;
}

#turnTimerDisplay {
    font-weight: bold;
    color: #D9534F; /* Muted red */
    font-size: 1.2em;
}

#gridContainer {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 10px; /* Slightly larger gap */
    margin: 20px auto;
    width: 320px; /* 3*100 + 2*10 */
    border: none; /* Remove default border, handled by cell borders */
    position: relative; /* For pseudo-element grid lines */
}

/* Doodle grid lines using pseudo-elements on container */
#gridContainer::before, #gridContainer::after {
    content: "";
    position: absolute;
    background-color: #3A3A3A;
    z-index: 0; /* Behind cells */
}
/* Vertical lines */
#gridContainer::before {
    left: calc(100px + 5px); /* cell width + gap/2 */
    top: -5px; bottom: -5px; width: 3px;
    box-shadow: calc(100px + 10px) 0 0 #3A3A3A; /* cell width + gap */
}
/* Horizontal lines */
#gridContainer::after {
    top: calc(100px + 5px); /* cell height + gap/2 */
    left: -5px; right: -5px; height: 3px;
    box-shadow: 0 calc(100px + 10px) 0 #3A3A3A; /* cell height + gap */
}


.cell {
    width: 100px;
    height: 100px;
    background-color: transparent; /* Cells are transparent over the container background */
    border: none; /* Individual cell borders removed */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4.5em; /* Larger marks */
    cursor: pointer;
    box-sizing: border-box;
    position: relative; /* For z-index to be above grid lines */
    z-index: 1;
    transition: background-color 0.2s;
    border-radius: 5px; /* Slight rounding for a softer feel */
}

.cell:hover:not(.X):not(.O) { /* Only hover on empty cells */
    background-color: rgba(0, 0, 0, 0.05); /* Subtle hover */
}

/* Styles for X and O */
.cell.X {
    color: #D9534F; /* Red for X - from specs.md (muted) */
    /* Optional: slight rotation for hand-drawn feel, requires JS to vary */
    /* transform: rotate(-2deg); */
}

.cell.O {
    color: #4A90E2; /* Blue for O - from specs.md (muted) */
    /* Optional: slight rotation for hand-drawn feel, requires JS to vary */
    /* transform: rotate(3deg); */
}

#gameResult {
    margin-top: 20px;
    font-size: 1.8em;
    font-weight: bold;
    min-height: 1.8em; /* Prevent layout shift */
}

button#rematchBtn {
    font-family: 'Patrick Hand', cursive;
    padding: 12px 25px;
    font-size: 1.5em;
    cursor: pointer;
    background-color: transparent;
    color: #3A3A3A;
    border: 3px solid #3A3A3A;
    border-radius: 20px; /* More rounded for hand-drawn feel */
    margin-top: 15px;
    display: block; /* Ensure it's a block for auto margins to work for centering */
    margin-left: auto;
    margin-right: auto;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
    box-shadow: 2px 2px 0px #5A5A5A; /* Simple shadow for depth */
}

button#rematchBtn:hover {
    background-color: #3A3A3A;
    color: #FDF5E6;
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #5A5A5A;
}

button#rematchBtn:disabled {
    background-color: #E0E0E0;
    color: #A0A0A0;
    border-color: #A0A0A0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* General Game Button Style (based on rematchBtn) */
.game-button {
    font-family: 'Patrick Hand', cursive;
    padding: 12px 25px;
    font-size: 1.5em;
    cursor: pointer;
    background-color: transparent;
    color: #3A3A3A;
    border: 3px solid #3A3A3A;
    border-radius: 20px; /* More rounded for hand-drawn feel */
    margin-top: 15px;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
    box-shadow: 2px 2px 0px #5A5A5A; /* Simple shadow for depth */
}

.game-button:hover {
    background-color: #3A3A3A;
    color: #FDF5E6;
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #5A5A5A;
}

.game-button:disabled {
    background-color: #E0E0E0;
    color: #A0A0A0;
    border-color: #A0A0A0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Specific styles for the Share Streak button */
.share-streak-btn {
    margin-left: 10px;
    background-color: #ffc107;
    border-color: #ffc107;
    color: #3A3A3A;
}

.share-streak-btn:hover {
    background-color: #e0a800;
    border-color: #e0a800;
    color: #3A3A3A;
}

/* Party Info Display Area */
.party-info-display {
    display: none;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    border-radius: 5px;
    text-align: center;
}

.party-active-message {
    font-weight: bold;
    margin-bottom: 5px;
}

.party-link-input {
    width: 80%;
    margin-bottom: 10px;
    padding: 5px;
    border: 1px solid #ddd;
}

.party-status-message {
    font-style: italic;
    margin-top: 5px;
    margin-bottom: 10px;
}

.party-actions {
    margin-top: 10px;
}

/* Specific Party Button Styles */
.party-button { /* Common base for party action buttons if needed, can extend .game-button or be separate */
    font-family: 'Patrick Hand', cursive;
    padding: 10px 20px; /* Slightly smaller than main game buttons */
    font-size: 1.2em;   /* Slightly smaller */
    cursor: pointer;
    border-radius: 15px; /* Consistent rounding */
    background-color: transparent;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
    box-shadow: 1px 1px 0px #777; /* Softer shadow */
}

.party-button:hover {
    transform: translate(0.5px, 0.5px);
    box-shadow: 0.5px 0.5px 0px #777;
}

.share-button { /* Extends .party-button */
    color: #28a745; /* Green */
    border: 2px solid #28a745;
}

.share-button:hover {
    background-color: #e9f7ec; /* Very light green */
    color: #1e7e34; /* Darker green */
}

.leave-button { /* Extends .party-button */
    color: #dc3545; /* Red */
    border: 2px solid #dc3545;
    margin-left: 10px; /* Already in HTML, but can be reinforced here */
}

.leave-button:hover {
    background-color: #fbebec; /* Very light red */
    color: #b02a37; /* Darker red */
}

/* Ensure party action buttons are inline */
.party-actions .party-button {
    display: inline-block;
    vertical-align: middle;
}



.game-footer {
    margin-top: auto; /* Pushes footer to bottom */
    text-align: center;
    font-size: 0.9em;
    color: #5A5A5A;
    width: 100%;
    max-width: 600px;
    border-top: 2px dashed #3A3A3A;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 480px) {
    .game-header h1 {
        font-size: 2.5em;
    }
    #gridContainer {
        grid-template-columns: repeat(3, 80px);
        grid-template-rows: repeat(3, 80px);
        gap: 8px;
        width: calc(3*80px + 2*8px); /* Adjust width */
    }
    /* Vertical lines for smaller grid */
    #gridContainer::before {
        left: calc(80px + 4px); /* cell width + gap/2 */
        box-shadow: calc(80px + 8px) 0 0 #3A3A3A; /* cell width + gap */
    }
    /* Horizontal lines for smaller grid */
    #gridContainer::after {
        top: calc(80px + 4px); /* cell height + gap/2 */
        box-shadow: 0 calc(80px + 8px) 0 #3A3A3A; /* cell height + gap */
    }

    .cell {
        width: 80px;
        height: 80px;
        font-size: 3.5em;
    }
    #gameInfo p {
        font-size: 1.2em;
    }
    #gameResult {
        font-size: 1.5em;
    }
    button#rematchBtn {
        font-size: 1.3em;
        padding: 10px 20px;
    }
    .game-content {
        padding: 10px;
    }
}
