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

body {
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden { display: none !important; }

/* LOBBY */
#lobby, #waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
}

.lobby-box {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 16px;
    padding: 48px 40px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: #e2b96f;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.logo.small { font-size: 1.2rem; margin-bottom: 0; }

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: #0f3460;
    border: 1px solid #1a4a7a;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: #e2b96f; }
input[type="text"]::placeholder { color: #5a7a9a; }

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

.btn-primary {
    background: #e2b96f;
    color: #1a1a2e;
    width: 100%;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background: #0f3460;
    color: #e0e0e0;
    border: 1px solid #1a4a7a;
    white-space: nowrap;
}
.btn-secondary:hover { background: #1a4a7a; }

.divider {
    color: #5a7a9a;
    font-size: 0.85rem;
    text-align: center;
    width: 100%;
    position: relative;
}
.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: #0f3460;
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.join-row {
    display: flex;
    gap: 8px;
    width: 100%;
}
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }

.error-msg { color: #e05c5c; font-size: 0.9rem; min-height: 1.2em; text-align: center; }

.game-code {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 8px;
    color: #e2b96f;
    background: #0f3460;
    padding: 16px 32px;
    border-radius: 12px;
}

.muted { color: #5a7a9a; font-size: 0.9rem; }

.spinner {
    width: 36px; height: 36px;
    border: 3px solid #0f3460;
    border-top-color: #e2b96f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* GAME */
#game {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
}

.game-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

#boardWrap {
    border: 3px solid #0f3460;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

#board { width: 480px; }

.player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 10px;
    padding: 10px 20px;
    width: 480px;
    font-size: 1rem;
    font-weight: 600;
}
.player-card .piece { font-size: 1.4rem; }
.player-card.you { border-color: #e2b96f; }
.player-card.active-turn { background: #0f3460; }

.status {
    font-size: 1rem;
    color: #e2b96f;
    font-weight: 600;
    text-align: center;
    min-height: 1.4em;
}

/* highlight last move squares */
.highlight-from { background: rgba(226, 185, 111, 0.35) !important; }
.highlight-to   { background: rgba(226, 185, 111, 0.55) !important; }

@media (max-width: 540px) {
    #board { width: 320px; }
    .player-card { width: 320px; }
}
