html {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    background-color: #ffffff !important;
    color: #000000;
    min-height: 100vh;
    height: 100%;
    overflow: hidden;
}

.screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-bottom: 3rem;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

/* Main menu */
#main-menu, #game-screen {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.menu-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.username-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #f5f7fa;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.25);
}

.game-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 4rem;
    margin: 0;
    color: #f5f7fa;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.35);
    text-align: center;
}

.play-button {
    margin-top: 2rem;
    padding: 1rem 3rem;
    font-size: 1.5rem;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.play-button:hover {
    transform: translateY(-2px);
    background-color: #27ae60;
}

.logout-button {
    position: relative;
    font-size: 1.2rem;
    z-index: 1000;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1.5rem;
}

.logout-button:hover {
    background-color: #c0392b;
}

/* Game screen */
#game-screen {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-bottom: 3rem;
    box-sizing: border-box;
}

.game-header {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    height: 20px;
    flex-shrink: 0;
}

.game-header-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    margin: 0;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.leave-button {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: auto;
    z-index: 1;
    height: 32px;
    line-height: 1;
}

.leave-button:hover {
    background-color: #c0392b;
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 2rem;
}

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

.player-info {
    margin-bottom: 1rem;
}

.current-player {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 0 0 1rem 0;
}

.player-symbols {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.player-symbol {
    font-size: 2rem;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background-color: #ecf0f1;
    color: #2c3e50;
}

.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    background-color: #2c3e50;
    padding: 8px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    width: 300px;
    height: 300px;
}

.board-cell {
    background-color: #ecf0f1;
    border: none;
    border-radius: 10px;
    font-size: 3rem;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.board-cell:hover {
    background-color: #d5dbdb;
    transform: scale(1.05);
}

.board-cell:active {
    transform: scale(0.95);
}

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

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

.board-cell.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.board-cell.disabled:hover {
    background-color: #ecf0f1;
    transform: none;
}

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

.status-message {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    min-height: 2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

/* Banner */
#banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
}

#banner p {
    background-color: #2ecc71;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    margin: 0;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#banner.show {
    opacity: 1;
}

/* Loading spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#waiting-screen {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}

#waiting-screen .game-title {
    margin-bottom: 2rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-title {
        font-size: 3rem;
    }
    
    .game-board {
        width: 250px;
        height: 250px;
    }
    
    .board-cell {
        font-size: 2.5rem;
    }
    
    .current-player {
        font-size: 1.2rem;
    }
    
    .player-symbol {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .game-board {
        width: 200px;
        height: 200px;
    }
    
    .board-cell {
        font-size: 2rem;
    }
    
    .game-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .player-symbols {
        gap: 1rem;
    }
    
    .player-symbol {
        font-size: 1.2rem;
        padding: 0.3rem 0.8rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Remove the override for #main-menu, #game-screen since it's now default */
} 

.powered-by-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.45rem 0;
    font-size: 0.85rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.75);
    color: #f0f6ff;
    letter-spacing: 0.02em;
    z-index: 2500;
}

.powered-by-footer a {
    color: #2ecc71;
    text-decoration: none;
    font-weight: 600;
}

.powered-by-footer a:hover {
    text-decoration: underline;
}
