:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.8);
    --border-color: rgba(48, 54, 61, 0.8);
    --accent: #58a6ff;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --x-color: #3fb950;
    --o-color: #f85149;
    --cyan-glow: 0 0 15px rgba(63, 185, 80, 0.5);
    --red-glow: 0 0 15px rgba(248, 81, 73, 0.5);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #161b22, #0d1117);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

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

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.accent {
    color: var(--accent);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-left: 12px;
}

input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 20px;
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

button {
    width: 100%;
    border-radius: 12px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.primary-btn {
    background: var(--accent);
    color: #fff;
    margin-top: 10px;
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.secondary-btn {
    background: rgba(48, 54, 61, 0.5);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-top: 24px;
}

.secondary-btn:hover {
    background: var(--border-color);
}

.text-link {
    background: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 10px;
}

.text-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    margin: 15px 0;
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider:not(:empty)::before {
    margin-right: .5em;
}

.divider:not(:empty)::after {
    margin-left: .5em;
}

.lobby-actions {
    display: flex;
    flex-direction: column;
}

.room-tag {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    width: auto;
    filter: grayscale(1);
    transition: var(--transition);
}

.icon-btn:hover {
    filter: grayscale(0);
    transform: scale(1.2);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 16px;
}

.player-info {
    display: flex;
    flex-direction: column;
    width: 40%;
}

.player-info .name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.player-info .score {
    font-size: 1.5rem;
    font-weight: 700;
}

.player-x .score { color: var(--x-color); }
.player-o .score { color: var(--o-color); }

.vs {
    font-weight: 800;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.turn-indicator {
    padding: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent);
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 0 auto;
    width: 300px;
    height: 300px;
}

.cell {
    background: rgba(48, 54, 61, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 1;
}

.cell:hover:not(.x):not(.o) {
    background: rgba(48, 54, 61, 0.6);
}

.cell.x {
    color: var(--x-color);
    text-shadow: var(--cyan-glow);
}

.cell.o {
    color: var(--o-color);
    text-shadow: var(--red-glow);
}

.cell.win {
    background: rgba(88, 166, 255, 0.2);
    transform: scale(1.05);
}

.status-msg {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-msg-big {
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: 700;
}

.hidden {
    display: none !important;
}

@media (max-width: 400px) {
    .board {
        width: 100%;
        height: auto;
    }
}
