body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #ff4b1f, #ff9068);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    user-select: none;
    color: white;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#header {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    background-color: rgba(0,0,0,0.3);
    color: white;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
    position: absolute;
    top: 0;
    z-index: 10;
}

#main-content {
    flex-grow: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
    padding-top: 80px; /* Space for absolute header */
}

/* Menu Styles */
.menu-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.menu-title {
    font-family: 'Arial Black', sans-serif;
    font-size: 72px;
    color: white;
    margin-bottom: 40px;
    text-align: center;
    text-shadow: 4px 4px 8px rgba(0,0,0,0.4);
    letter-spacing: 2px;
}

.menu-button {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 32px;
    padding: 15px 40px;
    margin: 12px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    width: 80%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.menu-button.highlight {
    /* Color set by JS */
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0,0,0, 0.4);
    border-style: solid;
    border-width: 4px;
    z-index: 5;
}

.menu-button.highlight-full {
    transform: scale(1.1);
    box-shadow: 0 4px 25px rgba(0,0,0,0.5);
    z-index: 10;
    color: black;
    font-weight: 900;
}

/* Game Board Styles & Responsiveness */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    /* Fill screen as much as possible */
    width: 90vw;
    height: auto;
    aspect-ratio: 1/1;
    max-height: calc(100vh - 120px);
    max-width: calc(100vh - 120px);
    box-sizing: border-box;
}

.cell {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Responsive font size based on the smaller dimension to fit */
    font-size: min(20vw, 20vh); 
    font-weight: bold;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    user-select: none;
    line-height: 1; /* Prevent vertical expansion */
    overflow: hidden; /* Ensure content stays inside */
}

.cell.highlight {
    /* Border Color set by JS */
    border-style: solid;
    border-width: 5px;
    transform: scale(1.02);
    z-index: 5;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

.cell.highlight-full {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 0 20px rgba(0,0,0,0.4);
    border: 3px solid white;
}

.cell.x-mark {
    color: #e74c3c;
}

.cell.o-mark {
    color: #3498db;
}

/* Pause Menu & Overlays */
.pause-overlay {
    position: fixed; /* Fixed to cover screen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.pause-title {
    font-size: 60px;
    color: white;
    margin-bottom: 30px;
    font-family: 'Arial Black', sans-serif;
    text-align: center;
}

.status-message {
    font-size: 36px;
    margin-bottom: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: bold;
    text-align: center;
}

/* Small screen adjustments */
@media (max-width: 768px) {
    .menu-title {
        font-size: 40px;
        margin-bottom: 20px;
    }
    .menu-button {
        font-size: 20px;
        padding: 10px 20px;
        width: 90%;
    }
    .pause-title {
        font-size: 40px;
    }
    .game-board {
        width: 95vw;
        max-width: 95vw;
        gap: 10px;
        padding: 10px;
    }
}

/* Pause Button and Grid */
#pause-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    z-index: 1000;
    user-select: none;
    border: 2px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#pause-button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 90%;
    max-width: 1000px;
    justify-items: center;
}

.menu-grid .menu-button {
    width: 100%;
    margin: 0; 
}

.menu-grid .menu-button.span-two-cols {
    grid-column: 1 / -1;
    width: 60%;
}
