/* ===== LOBBY SCREEN ===== */
#menu-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lobby-container {
    min-height: 100vh;
    background: linear-gradient(180deg, #1a3a5c 0%, #2d1b4e 50%, #1a0a2e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px env(safe-area-inset-bottom, 20px);
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
    color: #fff;
}

.lobby-header {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    margin-bottom: 8px;
}

.tg-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid #3498db;
}

.tg-avatar-placeholder {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #3498db;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: bold;
    border: 2px solid #74b9ff;
}

.lobby-username {
    font-size: 14px;
    color: #74b9ff;
}

.lobby-title {
    font-size: 36px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(52,152,219,0.8), 0 2px 4px rgba(0,0,0,0.8);
    margin: 8px 0 4px;
    background: linear-gradient(180deg, #fff 0%, #74b9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lobby-subtitle {
    font-size: 18px;
    color: #f39c12;
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 24px;
    text-shadow: 0 0 10px rgba(243,156,18,0.6);
}

.lobby-section {
    width: 100%;
    max-width: 360px;
    margin-bottom: 16px;
}

.lobby-label {
    display: block;
    font-size: 12px;
    color: #74b9ff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.lobby-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(116,185,255,0.3);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.lobby-input:focus {
    border-color: #3498db;
    background: rgba(52,152,219,0.15);
}

.lobby-input-code {
    font-size: 28px !important;
    text-align: center;
    letter-spacing: 8px;
    font-weight: bold;
}

/* Theme grid */
.theme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.theme-btn {
    padding: 10px 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.theme-btn.active {
    background: rgba(52,152,219,0.3);
    border-color: #3498db;
    color: #fff;
    box-shadow: 0 0 12px rgba(52,152,219,0.4);
}

.theme-btn:active {
    transform: scale(0.96);
}

/* Buttons */
.lobby-btn {
    width: 100%;
    max-width: 360px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    display: block;
    text-align: center;
    box-sizing: border-box;
}

.lobby-btn:active {
    transform: scale(0.97);
}

.lobby-btn.primary {
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(39,174,96,0.4);
}

.lobby-btn.secondary {
    background: linear-gradient(180deg, #2980b9 0%, #1a6fa0 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(41,128,185,0.4);
}

.lobby-btn.ghost {
    background: rgba(255,255,255,0.08);
    color: #aaa;
    border: 1px solid rgba(255,255,255,0.15);
}

/* Waiting screen */
.lobby-waiting-text {
    font-size: 16px;
    color: #aaa;
    text-align: center;
    margin: 12px 0;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.lobby-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 16px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Players list */
.lobby-players {
    width: 100%;
    max-width: 360px;
    margin: 12px 0;
}

.lobby-player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 15px;
}

.lobby-player-card.ready {
    border-color: #27ae60;
    background: rgba(39,174,96,0.1);
}

.lobby-player-card.empty {
    color: #666;
    justify-content: center;
    border-style: dashed;
}

.player-team-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ready-badge {
    margin-left: auto;
    color: #27ae60;
    font-size: 13px;
    font-weight: bold;
}

.waiting-badge {
    margin-left: auto;
    color: #f39c12;
    font-size: 13px;
}

/* Share section */
.lobby-share {
    width: 100%;
    max-width: 360px;
    text-align: center;
    margin: 8px 0 16px;
}

.room-code-display {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 10px;
    color: #f1c40f;
    text-shadow: 0 0 20px rgba(241,196,15,0.6);
    margin: 8px 0 12px;
    font-family: monospace;
}

/* Error */
.lobby-error {
    background: rgba(231,76,60,0.2);
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 10px 14px;
    color: #ff6b6b;
    font-size: 14px;
    text-align: center;
    margin-top: 8px;
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
}
