body {
    overflow: auto;
}

.lobby {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 28px;
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header  header"
        "rooms   sidebar"
        "chat    chat";
    gap: 22px;
    min-height: 100vh;
}

header.lobby-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 16px;
}

header.lobby-header h1 {
    margin: 0;
    color: #ffd700;
    font-size: 28px;
    letter-spacing: 2px;
}

header.lobby-header .me {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

header.lobby-header .me strong {
    color: #88ccff;
    font-size: 15px;
}

/* ─── Rooms ──────────────────────────────────────────── */
section.rooms { grid-area: rooms; }

section h2 {
    margin: 0 0 12px;
    color: #aaccff;
    font-size: 16px;
    letter-spacing: 1px;
}

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

.room-card {
    background: linear-gradient(180deg, #1c2838 0%, #0c1420 100%);
    border: 1px solid #2a4a6a;
    border-radius: 8px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 220px;
}
.room-card.full {
    border-color: #6a3030;
    opacity: 0.85;
}

.room-card .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.room-card .head .name {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
}
.room-card .head .count {
    background: #2a4a6a;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.room-card.full .head .count {
    background: #6a2a2a;
}

.room-card .info {
    display: flex;
    justify-content: space-between;
    color: #aaa;
    font-size: 12px;
}
.room-card .info strong { color: #ff9966; }

.room-card .players {
    flex-grow: 1;
    font-size: 12px;
    color: #aaccff;
    line-height: 1.6;
    min-height: 60px;
}
.room-card .players .empty { color: #555; }
.room-card .players .row {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
    border-bottom: 1px dashed #2a3848;
}

.room-card .actions { text-align: right; }

/* ─── Sidebar (nickname + HOF) ───────────────────────── */
.sidebar { grid-area: sidebar; display: flex; flex-direction: column; gap: 18px; }

.hall-of-fame {
    background: rgba(0,0,0,0.25);
    border: 1px solid #2a3848;
    border-radius: 6px;
    padding: 14px;
}

.hall-of-fame ol {
    margin: 0;
    padding-left: 22px;
    font-size: 13px;
}
.hall-of-fame li {
    padding: 3px 0;
    border-bottom: 1px dashed #2a3848;
}
.hall-of-fame li:last-child { border-bottom: none; }
.hall-of-fame .nick { color: #88ccff; }
.hall-of-fame .score { color: #ffd700; font-weight: bold; }
.hall-of-fame .stage { color: #ff9966; font-size: 11px; }
.hall-of-fame .when { color: #555; font-size: 11px; }

.hof-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.hof-tabs button {
    flex: 1;
    padding: 4px;
    font-size: 11px;
}
.hof-tabs button.active { background: #2a4a6a; border-color: #88ccff; }

/* ─── Chat ─────────────────────────────────────────── */
section.chat {
    grid-area: chat;
    background: rgba(0,0,0,0.25);
    border: 1px solid #2a3848;
    border-radius: 6px;
    padding: 14px;
    height: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 6px 8px;
    background: #0a0f15;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
}
#chat-log .msg { padding: 2px 0; }
#chat-log .msg .from { color: #88ccff; font-weight: bold; }
#chat-log .msg .from.self { color: #ffd700; }
#chat-log .msg .time { color: #555; font-size: 11px; margin-left: 8px; }
#chat-log .sys { color: #888; font-style: italic; }

#chat-form { display: flex; gap: 6px; }
#chat-form input { flex-grow: 1; }
