:root {
    --bg-color: #0f172a;
    --board-bg: #dcb37b;
    --board-line: #5c4033;
    --text-color: #f8fafc;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --black-stone: #111111;
    --white-stone: #f3f4f6;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: radial-gradient(circle at top right, #1e293b, #0f172a);
    overflow-x: hidden;
}

/* LOBBY UI */
.lobby {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

.lobby-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 2rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 450px;
}

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.join-container {
    display: flex;
    gap: 0.5rem;
}

.join-container input {
    flex: 1;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1.1rem;
    font-family: inherit;
    text-align: center;
    text-transform: uppercase;
}

.join-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.divider span { padding: 0 10px; }

.btn-primary {
    width: 100%;
    padding: 1.2rem;
    border-radius: 1rem;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #059669);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
}

.error-text {
    color: #ef4444;
    margin-top: 1rem;
    min-height: 1.5rem;
}

/* GAME UI */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    max-width: 800px;
    width: 100%;
    animation: fadeInDown 0.8s ease-out;
}

.room-info {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.highlight {
    font-weight: 800;
    color: white;
    letter-spacing: 2px;
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.8rem;
    border-radius: 0.5rem;
    user-select: all;
}

.badge {
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

header { text-align: center; }
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 0.2rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
}

.subtitle {
    color: #94a3b8;
    font-size: 1rem;
    letter-spacing: 0.3rem;
    text-transform: uppercase;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.9);
}

.player.active { opacity: 1; transform: scale(1.15); }
.player .stone {
    width: 28px; height: 28px;
    border-radius: 50%;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

#player-black .stone { background: radial-gradient(circle at 30% 30%, #555, var(--black-stone)); }
#player-white .stone { background: radial-gradient(circle at 30% 30%, #fff, var(--white-stone)); }

.status {
    font-size: 1.1rem;
    font-weight: 600;
    color: #cbd5e1;
    text-align: center;
    min-width: 160px;
}

.board-container {
    position: relative;
    padding: 1rem;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 1rem;
    box-shadow: 15px 15px 40px rgba(0,0,0,0.6), -5px -5px 20px rgba(255,255,255,0.03);
    animation: zoomIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#omok-board {
    background-color: var(--board-bg);
    border-radius: 0.5rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.4);
    cursor: pointer;
    display: block;
    max-width: 100%;
    touch-action: none; 
}

.wait-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(3px);
    border-radius: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.wait-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.controls {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
}

button {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}
button:active { transform: translateY(1px); }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 1000;
}

.modal.show { opacity: 1; pointer-events: all; }

.modal-content {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    padding: 3.5rem 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    border: 1px solid var(--glass-border);
    transform: translateY(30px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}
.modal.show .modal-content { transform: translateY(0) scale(1); }
.modal-content h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 640px) {
    .container { padding: 0.5rem; gap: 1rem; }
    h1 { font-size: 2.2rem; }
    .game-info { padding: 0.8rem 1rem; }
    .board-container { padding: 0.5rem; border-radius: 0.8rem; }
    .lobby-content { padding: 2rem 1.5rem; }
}
