/* --- General Styles --- */
:root {
    --bg-color: #f0f2f5;
    --container-bg: #ffffff;
    --text-color: #1c1e21;
    --border-color: #d1d5db;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --p1-token-color: #dc3545;
    --p2-token-color: #17a2b8;
    --win-highlight: rgba(40, 167, 69, 0.2);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: grid;
    place-items: center;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden {
    display: none !important;
}

.game-container {
    background-color: var(--container-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.game-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

/* --- Lobby & Share Section --- */
.lobby-section, .share-section {
    padding: 1rem 0;
}
.lobby-section h2 { margin-bottom: 1rem; }
.or-divider { margin-top: 1rem; color: #6c757d; }

.share-section h3 { margin-bottom: 0.5rem; font-weight: 600; }
.share-link-wrapper { display: flex; margin-bottom: 1rem; }
#game-link-input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px 0 0 6px;
    background-color: #e9ecef;
    font-size: 1rem;
}
#copy-link-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-color);
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    transition: background-color 0.2s;
}
#copy-link-btn:hover { background-color: var(--accent-hover); }

/* --- Game Area --- */
#game-status {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    height: 25px;
}

.board-container {
    margin-bottom: 1.5rem;
}

#board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background-color: #343a40;
    padding: 10px;
    border-radius: 8px;
}

.cell {
    width: 110px;
    height: 110px;
    background-color: var(--bg-color);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}
.cell:hover { background-color: #d1d5db; }
.cell.✖ { color: var(--p1-token-color); }
.cell.Ｏ { color: var(--p2-token-color); }
.cell.highlight { background-color: var(--win-highlight); }


/* --- Controls --- */
.controls-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.control-btn {
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}
.control-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}
.control-btn:active { transform: translateY(0); }

/* --- Responsive --- */
@media (max-width: 550px) {
    .cell {
        width: 80px;
        height: 80px;
        font-size: 2.8rem;
    }
    .game-container { padding: 1.5rem; }
}
