* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f6fa;
    color: #20212a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 460px;
}

.header {
    text-align: center;
    margin-bottom: 35px;
}

.header h1 {
    font-size: 55px;
    font-weight: 800;
    letter-spacing: -4px;
}

.header h1 span {
    color: #999;
}

.header p {
    color: #858590;
    margin-top: 8px;
}

.lobby {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid #e9e9ef;
}

.card h2 {
    font-size: 19px;
    margin-bottom: 8px;
}

.card p {
    color: #858590;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

button {
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: 0.2s;
}

.card button {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    background: #20212a;
    color: white;
}

button:hover:not(:disabled) {
    opacity: 0.85;
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

input {
    width: 100%;
    padding: 14px;
    border: 1px solid #e2e2e8;
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 4px;
    outline: none;
    margin-bottom: 12px;
}

input:focus {
    border-color: #20212a;
}

#lobbyMessage {
    text-align: center;
    color: #e04e4e;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* Game */

.game {
    background: white;
    padding: 25px;
    border-radius: 18px;
    border: 1px solid #e9e9ef;
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px solid #eee;
}

.small-text {
    font-size: 11px;
    color: #999;
    letter-spacing: 1px;
}

.room-info h2 {
    margin-top: 5px;
    letter-spacing: 4px;
}

.copy-btn {
    background: #f1f1f5;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 12px;
}

.players {
    display: flex;
    gap: 12px;
    margin: 22px 0;
}

.player {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f5f5f8;
    border-radius: 10px;
    border: 1px solid transparent;
}

.player.active {
    border-color: #20212a;
    background: white;
}

.symbol {
    font-size: 25px;
    font-weight: 800;
}

.player-name {
    font-size: 12px;
    color: #666;
}

.game-status {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin: 20px 0;
    color: #555;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.cell {
    aspect-ratio: 1;
    background: #f4f4f7;
    border-radius: 12px;
    font-size: 55px;
    font-weight: 800;
    color: #20212a;
}

.cell:disabled {
    opacity: 1;
}

.cell:disabled:hover {
    transform: none;
}

.cell.x {
    color: #333;
}

.cell.o {
    color: #8b6cf6;
}

.game-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.game-actions button {
    flex: 1;
    padding: 13px 8px;
    border-radius: 10px;
    font-size: 13px;
}

.rematch-btn {
    background: #20212a;
    color: white;
}

.leave-btn {
    background: #f1f1f5;
    color: #555;
}

.my-role {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-top: 18px;
}

footer {
    text-align: center;
    color: #aaa;
    font-size: 12px;
    margin-top: 30px;
}

@media (max-width: 400px) {
    .game {
        padding: 16px;
    }

    .cell {
        font-size: 42px;
    }

    .player {
        padding: 9px;
    }

    .player-name {
        font-size: 10px;
    }
}