/* Lobby / menu principal — tudo escopado em #lobby-screen para não colidir com style.css */
#lobby-screen {
    --lb-primary: #006CE6;
    --lb-secondary: #0056b3;
    --lb-accent: #FEE440;
    --lb-glass: rgba(255, 255, 255, 0.96);
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 24px 16px;
    box-sizing: border-box;
    background: #1b2a8a; /* ilustração de fundo: canvas.lb-bg (jss/lobby_bg.js) */
    font-family: 'Outfit', 'Segoe UI', sans-serif;
}
#lobby-screen.hidden { display: none; }
#lobby-screen *, #lobby-screen *::before, #lobby-screen *::after { box-sizing: border-box; }

#lobby-screen .lb-stage {
    width: 100%;
    max-width: 520px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

#lobby-screen .lb-card {
    width: 100%;
    padding: 26px 32px 28px;
    background: var(--lb-glass);
    border: 4px solid #fff;
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(0, 10, 40, .6), 0 0 0 6px rgba(255, 255, 255, .12);
    color: #333;
    position: relative;
    z-index: 1;
}

#lobby-screen .lb-header { text-align: center; margin-bottom: 0; }
#lobby-screen.lb-compact .lb-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px dashed #e6ecf5;
}

#lobby-screen .lb-panel.hidden { display: none; }

#lobby-screen label.lb-label {
    display: block;
    margin: 0 0 8px 4px;
    color: #444;
    font-weight: 600;
}
#lobby-screen input[type=text],
#lobby-screen textarea {
    width: 100%;
    padding: 14px 16px;
    border: 3px solid #e6e6e6;
    border-radius: 16px;
    background: #fff;
    color: #333;
    font: 1.05rem 'Outfit', 'Segoe UI', sans-serif;
    transition: border-color .2s;
}
#lobby-screen textarea {
    height: 92px;
    resize: none;
    font: 0.78rem/1.35 Consolas, 'Courier New', monospace;
    word-break: break-all;
}
#lobby-screen input[type=text]:focus,
#lobby-screen textarea:focus { outline: none; border-color: var(--lb-primary); }

#lobby-screen .lb-btn {
    width: 100%;
    margin: 10px 0 0;
    padding: 15px 20px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #0076f5 0%, #0056b3 100%);
    color: #fff;
    font: 700 1.1rem 'Outfit', 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0, 108, 230, 0.2);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
#lobby-screen .lb-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(0, 108, 230, 0.3); }
#lobby-screen .lb-btn:disabled { opacity: .45; cursor: not-allowed; }
#lobby-screen .lb-btn.secondary { background: linear-gradient(135deg, #ff6c00 0%, #ff449c 100%); box-shadow: 0 8px 15px rgba(255, 68, 156, 0.2); }
#lobby-screen .lb-btn.ai { background: linear-gradient(135deg, #7928ca 0%, #4338ca 100%); box-shadow: 0 8px 18px rgba(121, 40, 202, 0.3); }
#lobby-screen .lb-btn.ai:hover:not(:disabled) { box-shadow: 0 12px 26px rgba(121, 40, 202, 0.45); }
#lobby-screen .lb-btn.local { background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%); box-shadow: 0 8px 15px rgba(46, 204, 113, 0.2); }
#lobby-screen .lb-btn.ghost { background: #eef1f5; color: #445; box-shadow: none; }
#lobby-screen .lb-btn.danger { background: #FF5252; box-shadow: none; }
#lobby-screen .lb-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
#lobby-screen .lb-btn-row .lb-btn {
    flex: 1;
    margin: 0;
    padding: 14px 6px;
    font-size: 0.95rem;
    white-space: nowrap;
    gap: 8px;
}
@media (max-width: 480px) {
    #lobby-screen .lb-btn-row .lb-btn {
        font-size: 0.8rem;
        padding: 12px 4px;
        gap: 5px;
    }
}
#lobby-screen .lb-btn.small { padding: 10px 14px; font-size: .95rem; border-radius: 14px; }

/* COPIAR: a ação mais importante da tela -> verde forte, grande, com leve pulso chamando atenção */
#lobby-screen .lb-btn.copy {
    padding: 17px 20px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: .5px;
    background: linear-gradient(135deg, #2ecc71 0%, #1fa855 100%);
    box-shadow: 0 8px 18px rgba(46, 204, 113, 0.35);
    animation: lb-pulse 1.8s ease-in-out infinite;
}
#lobby-screen .lb-btn.copy:hover:not(:disabled) { box-shadow: 0 12px 24px rgba(46, 204, 113, 0.45); }
/* Depois de copiar: para de pulsar e confirma */
#lobby-screen .lb-btn.copy.done {
    animation: none;
    background: linear-gradient(135deg, #0076f5 0%, #0056b3 100%);
    box-shadow: 0 6px 14px rgba(0, 108, 230, 0.25);
}
@keyframes lb-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

#lobby-screen .lb-sep { border: none; border-top: 2px dashed #e3e3e3; margin: 20px 0 10px; }

#lobby-screen .lb-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: #eef1f5; padding: 5px; border-radius: 16px; }
#lobby-screen .lb-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #556;
    font: 700 .92rem 'Outfit', 'Segoe UI', sans-serif;
    cursor: pointer;
}
#lobby-screen .lb-tab.active { background: #fff; color: var(--lb-primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

#lobby-screen .lb-step { margin-top: 14px; }
#lobby-screen .lb-step.hidden,
#lobby-screen .hidden { display: none; }
#lobby-screen .lb-hint { color: #778; font-size: .88rem; margin: 6px 4px 0; }

#lobby-screen .lb-ip {
    margin: 4px 0 10px;
    padding: 14px;
    border-radius: 16px;
    background: #f4f8ff;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--lb-secondary);
    letter-spacing: .5px;
    word-break: break-all;
}

/* Link discreto para os modos avançados (rede local / manual) */
#lobby-screen .lb-more {
    display: block;
    margin: 12px auto 0;
    padding: 4px 8px;
    border: none;
    background: none;
    color: #8a93a6;
    font: 600 .85rem 'Outfit', 'Segoe UI', sans-serif;
    text-decoration: underline;
    cursor: pointer;
}
#lobby-screen .lb-more:hover { color: var(--lb-primary); }
#lobby-screen .lb-more.hidden { display: none; }

/* Código curto da sala */
#lobby-screen .lb-code {
    margin: 4px 0 6px;
    padding: 18px 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f4f8ff 0%, #fff7e0 100%);
    border: 3px dashed #c9dcff;
    text-align: center;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--lb-secondary);
    user-select: all;
    word-break: break-word;
}
#lobby-screen .lb-code-wrap {
    position: relative;
    width: 100%;
}
#lobby-screen input.lb-code-input {
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding-left: 88px;
    padding-right: 88px;
}
#lobby-screen input.lb-code-input:focus::placeholder {
    opacity: 0;
}
#lobby-screen input.lb-code-input::placeholder {
    color: #c8cfdb;
    font-weight: 600;
    transition: opacity 0.15s ease;
}
#lobby-screen .lb-paste-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 7px 12px;
    border: none;
    border-radius: 12px;
    background: #eef3fb;
    color: var(--lb-secondary);
    font: 700 0.88rem 'Outfit', 'Segoe UI', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    user-select: none;
}
#lobby-screen .lb-paste-btn:hover {
    background: var(--lb-primary);
    color: #fff;
}
#lobby-screen .lb-paste-btn:active {
    transform: translateY(-50%) scale(0.95);
}
@media (max-width: 480px) {
    #lobby-screen input.lb-code-input {
        font-size: 1.3rem;
        padding-left: 74px;
        padding-right: 74px;
    }
    #lobby-screen .lb-paste-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}
#lobby-screen .lb-detected {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 6px;
    padding: 10px 12px 10px 16px;
    border-radius: 16px;
    background: #fff8d6;
    border: 2px solid #FEE440;
    font-weight: 600;
    color: #5a4a00;
    animation: lb-in .25s ease;
}
#lobby-screen .lb-detected > div { flex: 1; }
#lobby-screen .lb-detected .lb-btn { width: auto; margin: 0; flex-shrink: 0; }

#lobby-screen .lb-players { list-style: none; padding: 0; margin: 8px 0 0; }
#lobby-screen .lb-players li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 7px;
    background: #fff;
    border: 2px solid #eef1f5;
    border-radius: 14px;
    font-weight: 600;
}
#lobby-screen .lb-players li .tag { margin-left: auto; font-size: .78rem; color: #c49b00; font-weight: 800; }
#lobby-screen .lb-players li .ping { margin-left: auto; font-size: .78rem; color: #889; }
#lobby-screen .lb-players li.empty { color: #aab; border-style: dashed; font-weight: 400; }

#lobby-screen .lb-row { display: flex; gap: 10px; }
#lobby-screen .lb-row > * { flex: 1; }

#lobby-screen .lb-status {
    margin-bottom: 14px;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 600;
    font-size: .95rem;
    animation: lb-in .25s ease;
}
#lobby-screen .lb-status.info { background: #e8f2ff; color: #004a9c; border: 2px solid #b9d6ff; }
#lobby-screen .lb-status.error { background: #ffe9e9; color: #b71c1c; border: 2px solid #ffb4b4; }
#lobby-screen .lb-status.ok { background: #e3f7ea; color: #14612f; border: 2px solid #9fe0b6; }
@keyframes lb-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 560px) {
    #lobby-screen .lb-card { padding: 22px 18px; }
    #lobby-screen .lb-header h1 { font-size: 2rem; }
}

/* --- Barra superior estratégica (fora do .lb-card, nos cantos da tela) --- */
#lobby-screen .lb-topbar {
    position: fixed;
    top: 16px;
    left: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}
#lobby-screen .lb-topbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}
#lobby-screen .lb-top-btn {
    height: 40px;
    padding: 0 14px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 14px;
    background: rgba(15, 28, 75, 0.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font: 700 0.88rem/1 'Outfit', 'Segoe UI', sans-serif;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 10, 40, 0.32);
    transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
    user-select: none;
}
#lobby-screen .lb-top-btn span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
    #lobby-screen .lb-top-btn i {
        font-size: 1rem;
        color: #cde2fb;
        transition: color .15s;
    }
#lobby-screen .lb-top-btn kbd {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font: 800 0.72rem 'Outfit', sans-serif;
    color: #e0f2fe;
}
#lobby-screen .lb-top-btn:hover {
    transform: translateY(-2px);
    background: var(--lb-primary);
    border-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 8px 22px rgba(0, 108, 230, 0.45);
}
#lobby-screen .lb-top-btn:hover i { color: #fff; }
#lobby-screen .lb-top-btn.lb-quit {
    background: rgba(120, 20, 40, 0.68);
    border-color: rgba(255, 120, 120, 0.35);
}
#lobby-screen .lb-top-btn.lb-quit i { color: #fca5a5; }
#lobby-screen .lb-top-btn.lb-quit:hover {
    background: #ef4444;
    border-color: #fecaca;
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.45);
}
#lobby-screen .lb-top-btn.lb-quit:hover i { color: #fff; }

/* --- Linha de Perfil (Nome + Personagem em 2 colunas) --- */
#lobby-screen .lb-profile-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}
#lobby-screen .lb-col-nick {
    flex: 1 1 180px;
    min-width: 0;
}
#lobby-screen .lb-col-char {
    flex: 1.35 1 230px;
    min-width: 0;
}
#lobby-screen input#lb-nick {
    height: 52px;
    padding: 0 14px;
    font-weight: 700;
}

/* --- Escolha de personagem na tela inicial --- */
#lobby-screen label.lb-label.lb-label-char { margin-top: 0; }
#lobby-screen .lb-char {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 0;
    height: 52px;
}
#lobby-screen .lb-char-arrow {
    flex: 0 0 34px;
    border: none;
    border-radius: 14px;
    background: #eef3fb;
    color: var(--lb-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background .2s, transform .12s;
}
#lobby-screen .lb-char-arrow:hover { background: #dfe9f8; }
#lobby-screen .lb-char-arrow:active { transform: scale(0.92); }
#lobby-screen .lb-char-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 10px 2px 4px;
    border: 3px solid #e6e6e6;
    border-radius: 16px;
    background: radial-gradient(circle at 30px 50%, #eaf3ff 0, #fff 55px);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color .2s;
}
#lobby-screen .lb-char-main:hover { border-color: var(--lb-primary); }
#lobby-screen #lb-char-canvas { width: 44px; height: 44px; flex-shrink: 0; background: transparent; box-shadow: none; border: none; }
#lobby-screen .lb-char-info { display: flex; flex-direction: column; min-width: 0; justify-content: center; }
#lobby-screen .lb-char-info b {
    color: #263238;
    font-size: 0.96rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
}
#lobby-screen .lb-char-info small { color: var(--lb-primary); font-weight: 700; font-size: .75rem; line-height: 1; }

/* Modais (configurações / personagens) abrem por cima da tela inicial */
#modal-overlay, #avatar-modal-overlay { z-index: 6000; }
#lobby-screen .lb-char-info small { white-space: nowrap; }
@media (max-width: 560px) {
    #lobby-screen .lb-profile-row { flex-direction: column; gap: 8px; }
    #lobby-screen .lb-col-nick,
    #lobby-screen .lb-col-char { width: 100%; }
    #lobby-screen .lb-topbar { top: 10px; left: 10px; right: 10px; }
    #lobby-screen .lb-top-btn { height: 36px; padding: 0 10px; font-size: 0.8rem; border-radius: 12px; }
    #lobby-screen .lb-top-btn kbd,
    #lobby-screen .lb-top-btn.lb-fs { display: none; }
    #lobby-screen .lb-char { gap: 6px; }
    #lobby-screen .lb-char-arrow { flex-basis: 36px; border-radius: 14px; }
    #lobby-screen .lb-char-main { gap: 6px; padding: 4px 8px 4px 2px; }
    #lobby-screen #lb-char-canvas { width: 44px; height: 44px; }
    #lobby-screen .lb-char-info b { font-size: 0.95rem; white-space: normal; line-height: 1.15; }
}
#lobby-screen .lb-header { user-select: none; -webkit-user-select: none; }

/* --- Mesmo PC: quantos jogadores --- */
#lobby-screen .lb-count { display: flex; gap: 10px; margin-bottom: 12px; }
#lobby-screen .lb-count button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px 10px;
    border: 3px solid #e6e6e6;
    border-radius: 18px;
    background: #fff;
    color: #607d8b;
    font-family: inherit;
    cursor: pointer;
    transition: transform .12s, border-color .2s, background .2s;
}
#lobby-screen .lb-count button b { font-size: 2rem; line-height: 1; font-weight: 800; }
#lobby-screen .lb-count button small { font-size: .8rem; font-weight: 700; }
#lobby-screen .lb-count button:hover { border-color: #b7d3f5; }
#lobby-screen .lb-count button:active { transform: scale(.96); }
#lobby-screen .lb-count button.on {
    border-color: #2ecc71;
    background: linear-gradient(180deg, #ecfbf2, #fff);
    color: #1e8e4e;
    box-shadow: 0 6px 16px rgba(46, 204, 113, .2);
}
#lobby-screen .lb-who { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#lobby-screen .lb-who-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--pc) 10%, #fff);
    border: 2px solid color-mix(in srgb, var(--pc) 45%, #fff);
}
#lobby-screen .lb-who-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--pc);
    color: #fff;
    font-weight: 800;
    font-size: .85rem;
}
#lobby-screen .lb-who-keys { color: #37474f; font-weight: 700; font-size: .9rem; white-space: nowrap; }
#lobby-screen .lb-link {
    display: block;
    margin: 8px auto 0;
    border: none;
    background: none;
    color: var(--lb-primary);
    font: 700 .95rem 'Outfit', sans-serif;
    cursor: pointer;
}
#lobby-screen .lb-link:hover { text-decoration: underline; }

/* --- Logo oficial "Bomber Bang!" fora do .lb-card, flutuando sobre o fundo estrelado --- */
#lobby-screen .lb-stage {
    transform: translateY(-28px);
}
#lobby-screen h1.bb-logo {
    margin: -18px 0 28px;
    width: 620px;
    max-width: 92vw;
    line-height: 0;
    text-align: center;
    position: relative;
    z-index: 2;
    user-select: none;
    -webkit-user-select: none;
}
#lobby-screen .bb-logo-img {
    width: 100%;
    max-width: 620px;
    height: auto;
    display: inline-block;
    filter: drop-shadow(0 16px 32px rgba(0, 8, 32, 0.65));
    animation: bb-bob 3.2s ease-in-out infinite;
    pointer-events: none;
}
#lobby-screen .lb-sub-title {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: 800 1.25rem 'Fredoka', 'Outfit', sans-serif;
    color: var(--lb-secondary);
    letter-spacing: -0.3px;
}
#lobby-screen .lb-sub-title i {
    color: var(--lb-primary);
    font-size: 1.08rem;
}
#lobby-screen .lb-sub-title.hidden { display: none; }
@keyframes bb-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { #lobby-screen .bb-logo-img { animation: none !important; } }

/* --- Fundo: ilustração assets/mainbg.jpg + estrelinhas (jss/lobby_bg.js) atrás do cartão --- */
#lobby-screen canvas.lb-bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; display: block; border-radius: 0; box-shadow: none; background: #0a1a86 url("../assets/mainbg.jpg") center / cover no-repeat; }

/* --- Telas internas (IA, Mesmo PC, Criar, Entrar): logo externa no topo --- */
#lobby-screen.lb-compact .lb-stage {
    transform: translateY(-16px);
}
#lobby-screen.lb-compact h1.bb-logo {
    margin: -12px 0 20px;
    width: 360px;
}
#lobby-screen.lb-compact .bb-logo-img {
    max-width: 360px;
}
@media (max-height: 820px) {
    #lobby-screen { padding: 12px 16px; }
    #lobby-screen .lb-stage { transform: translateY(-14px); }
    #lobby-screen .lb-card { padding: 20px 26px; }
    #lobby-screen h1.bb-logo { width: 490px; margin: -10px 0 18px; }
    #lobby-screen .bb-logo-img { max-width: 490px; }
    #lobby-screen.lb-compact h1.bb-logo { width: 270px; margin: -8px 0 12px; }
    #lobby-screen.lb-compact .bb-logo-img { max-width: 270px; }
    #lobby-screen .lb-players li { padding: 8px 12px; margin-bottom: 5px; }
}
@media (max-height: 680px) {
    #lobby-screen h1.bb-logo { width: 340px; margin: -6px 0 12px; }
    #lobby-screen .bb-logo-img { max-width: 340px; }
    #lobby-screen.lb-compact h1.bb-logo { display: none; }
}
/* Se ainda assim não couber, a rolagem fica visível */
#lobby-screen::-webkit-scrollbar { width: 10px; }
#lobby-screen::-webkit-scrollbar-thumb { background: rgba(255,255,255,.45); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
#lobby-screen::-webkit-scrollbar-track { background: rgba(0,0,0,.15); }
/* Vagas da sala em grade 2x2 (cabe em janela baixa; cara de sala de jogo) */
#lobby-screen .lb-players { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
#lobby-screen .lb-players li { margin-bottom: 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 420px) { #lobby-screen .lb-players { grid-template-columns: 1fr; } }
@media (max-height: 740px) {
    #lobby-screen .bb-art { max-width: 270px; }
    #lobby-screen .lb-header h1.bb-logo { margin-top: 26px; }
    #lobby-screen .lb-header h1.bb-logo + p { margin-top: 2px; font-size: .9rem; }
    #lobby-screen label.lb-label.lb-label-char { margin-top: 10px; }
}

/* --- Linha combinada: Mapa + Troféus lado a lado (harmônico e menos vertical) --- */
#lobby-screen .lb-setup-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 12px;
}
#lobby-screen .lb-setup-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
#lobby-screen .lb-col-map { flex: 1.38; }
#lobby-screen .lb-col-wins { flex: 1; }
#lobby-screen .lb-setup-row label.lb-label {
    margin: 0 0 6px 2px;
    font-size: 0.92rem;
    white-space: nowrap;
}

/* --- Seletor de mapa (jss/map_picker.js): carrossel, escolhido grande no meio --- */
#lobby-screen .lb-setup-row { flex-direction: column; align-items: stretch; gap: 10px; }
#lobby-screen .lb-col-map, #lobby-screen .lb-col-wins { flex: none; }
#lobby-screen .lb-col-wins { flex-direction: row; align-items: center; gap: 12px; }
#lobby-screen .lb-col-wins label.lb-label { margin: 0; }
#lobby-screen .lb-col-wins .lb-wins { flex: 1; height: 50px; }
#lobby-screen .lb-map {
    --mp-color: #f59e0b;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    user-select: none;
    -webkit-user-select: none;
}
#lobby-screen .mp-car { display: flex; align-items: center; gap: 6px; }
#lobby-screen .mp-arrow {
    flex: 0 0 42px; height: 42px;
    border: none; border-radius: 50%;
    background: #fff; color: var(--lb-secondary);
    box-shadow: 0 3px 10px rgba(0,0,0,.14);
    font-size: 1rem; cursor: pointer; z-index: 20;
    transition: transform .12s, background .2s;
}
#lobby-screen .mp-arrow:hover { background: #fff7e0; transform: scale(1.08); }
#lobby-screen .mp-arrow:active { transform: scale(.92); }
#lobby-screen .mp-track {
    position: relative; flex: 1; min-width: 0;
    height: 164px;
    overflow: hidden;
    touch-action: pan-y;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
}
#lobby-screen .mp-card {
    position: absolute; left: 50%; top: 50%;
    width: var(--mp-w, 220px); aspect-ratio: 5 / 3;
    padding: 0; border: 4px solid #fff; border-radius: 18px;
    background: #ccc; overflow: hidden; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    transition: transform .38s cubic-bezier(.3, 1.35, .5, 1), opacity .3s, box-shadow .3s, border-color .3s;
}
#lobby-screen .mp-card canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
#lobby-screen .mp-card .mp-tag {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 14px 6px 5px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
    color: #fff; font-weight: 800; font-size: 1.5rem; letter-spacing: .5px;
    text-shadow: 0 2px 3px rgba(0,0,0,.5);
    pointer-events: none;
}
#lobby-screen .mp-card.on .mp-tag { display: none; }
#lobby-screen .mp-card:not(.on):hover { filter: brightness(1.08); }
#lobby-screen .mp-card.on {
    border-color: var(--mp-color);
    box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 10px 26px rgba(0,0,0,.28);
    cursor: default;
}
#lobby-screen .mp-card.on.pop canvas { animation: mpPop .42s ease-out; }
@keyframes mpPop { 0% { transform: scale(1.12); } 100% { transform: scale(1); } }
#lobby-screen .mp-card .mp-music-badge {
    position: absolute; top: 7px; right: 7px;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(20, 14, 42, .72); color: #d8b4fe;
    font-size: .72rem; box-shadow: 0 2px 6px rgba(0,0,0,.35);
    pointer-events: none;
}
#lobby-screen .mp-info {
    display: flex; flex-direction: column; align-items: center;
    margin-top: 4px; line-height: 1.15; text-align: center;
    min-height: 44px;
}
#lobby-screen .mp-name { color: #fff; text-shadow: 0 3px 0 var(--mp-color), 0 4px 8px rgba(0,0,0,.35); font-size: 1.45rem; font-weight: 800; letter-spacing: .5px; white-space: nowrap; }
#lobby-screen .mp-desc { color: #b8c4d6; font-weight: 600; font-size: .9rem; }
#lobby-screen .mp-dots { display: flex; justify-content: center; gap: 6px; margin-top: 7px; }
#lobby-screen .mp-dot { width: 7px; height: 7px; border-radius: 50%; background: #d7dde5; transition: background .2s, transform .2s; }
#lobby-screen .mp-dot.on { background: var(--mp-color); transform: scale(1.35); }
@media (max-height: 820px) {
    #lobby-screen .mp-track { height: 140px; }
    #lobby-screen .mp-name { font-size: 1.25rem; }
}
@media (max-height: 680px) {
    #lobby-screen .mp-track { height: 112px; }
    #lobby-screen .mp-dots { display: none; }
}
@media (max-width: 480px) {
    #lobby-screen .mp-arrow { flex-basis: 34px; height: 34px; }
    #lobby-screen .mp-track { height: 124px; }
    #lobby-screen .lb-col-wins { flex-direction: column; align-items: stretch; gap: 6px; }
}

/* --- Seletor de Troféus / Vitórias para vencer (3, 4 ou 5) na mesma altura do Mapa --- */
#lobby-screen .lb-wins {
    display: flex;
    gap: 6px;
    height: 60px;
    margin-bottom: 0;
    user-select: none;
    -webkit-user-select: none;
}
#lobby-screen .lb-win-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border: 2.5px solid #e6e6e6;
    border-radius: 16px;
    background: #fff;
    color: #607d8b;
    font-family: inherit;
    cursor: pointer;
    transition: transform .12s, border-color .2s, background .2s, box-shadow .2s;
}
#lobby-screen .lb-win-btn .win-top {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}
#lobby-screen .lb-win-btn i { font-size: 0.92rem; color: #cbd5e1; transition: color .2s; }
#lobby-screen .lb-win-btn b { font-size: 1.25rem; line-height: 1; font-weight: 800; color: #334155; }
#lobby-screen .lb-win-btn small { font-size: .68rem; font-weight: 700; line-height: 1; }
#lobby-screen .lb-win-btn:hover { border-color: #fcd34d; }
#lobby-screen .lb-win-btn:active { transform: scale(.96); }
#lobby-screen .lb-win-btn.on {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    color: #b45309;
    box-shadow: 0 5px 14px rgba(245, 158, 11, 0.22);
}
#lobby-screen .lb-win-btn.on i { color: #f59e0b; filter: drop-shadow(0 1px 0 rgba(180, 90, 0, .25)); }
#lobby-screen .lb-win-btn.on b { color: #b45309; }

/* Botões de ação lado a lado no rodapé (Voltar menor à esquerda, Ação principal maior à direita) */
#lobby-screen .lb-actions-row {
    margin-top: 4px;
}
#lobby-screen .lb-actions-row .lb-btn {
    margin-top: 0;
}
#lobby-screen .lb-actions-row .lb-btn.danger {
    flex: 0.72;
}
#lobby-screen .lb-actions-row .lb-btn:not(.danger) {
    flex: 1.28;
}

@media (max-width: 480px) {
    #lobby-screen .lb-setup-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
}

/* Resumo de Mapa e Troféus para convidados na sala online */
#lobby-screen .lb-room-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 10px;
    padding: 9px 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
}
#lobby-screen .lb-room-info span { display: inline-flex; align-items: center; gap: 6px; }
#lobby-screen .lb-room-info i.fa-map { color: var(--lb-primary); }
#lobby-screen .lb-room-info i.fa-trophy { color: #f59e0b; }

/* --- Painel Jogar contra IA --- */
#lobby-screen .lb-diff-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
#lobby-screen .lb-diff-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px;
    border: 3px solid #e6e6e6;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: transform .12s, border-color .2s, box-shadow .2s, background .2s;
}
#lobby-screen .lb-diff-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
}
#lobby-screen .lb-diff-card:active {
    transform: scale(0.96);
}
#lobby-screen .lb-diff-card .diff-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}
#lobby-screen .lb-diff-card .diff-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
#lobby-screen .lb-diff-card .diff-name {
    font-size: 1.05rem;
    font-weight: 800;
}
#lobby-screen .lb-diff-card .diff-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 2px;
}

/* Fácil (Verde) */
#lobby-screen .lb-diff-card.facil .diff-icon { color: #10b981; }
#lobby-screen .lb-diff-card.facil.on {
    border-color: #10b981;
    background: linear-gradient(180deg, #ecfdf5 0%, #fff 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.22);
}
#lobby-screen .lb-diff-card.facil.on .diff-name { color: #059669; }

/* Normal (Laranja/Amarelo) */
#lobby-screen .lb-diff-card.normal .diff-icon { color: #f59e0b; }
#lobby-screen .lb-diff-card.normal.on {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.22);
}
#lobby-screen .lb-diff-card.normal.on .diff-name { color: #d97706; }

/* Difícil (Vermelho) */
#lobby-screen .lb-diff-card.dificil .diff-icon { color: #ef4444; }
#lobby-screen .lb-diff-card.dificil.on {
    border-color: #ef4444;
    background: linear-gradient(180deg, #fef2f2 0%, #fff 100%);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.22);
}
#lobby-screen .lb-diff-card.dificil.on .diff-name { color: #dc2626; }

/* Insano (Preto) */
#lobby-screen .lb-diff-card.insano .diff-icon { color: #111111; }
#lobby-screen .lb-diff-card.insano.on {
    border-color: #111111;
    background: linear-gradient(180deg, #f3f4f6 0%, #fff 100%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
#lobby-screen .lb-diff-card.insano.on .diff-name { color: #7c3aed; }

/* Preview dos Bots */
#lobby-screen .lb-ai-opponents-box {
    margin-bottom: 12px;
}
#lobby-screen .lb-ai-opponents-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
#lobby-screen .lb-ai-bot-chip {
    flex: 1;
    min-width: 130px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
}
#lobby-screen .lb-ai-bot-chip canvas {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: transparent;
}
#lobby-screen .lb-ai-bot-chip .bot-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
#lobby-screen .lb-ai-bot-chip .bot-meta b {
    font-size: 0.85rem;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#lobby-screen .lb-ai-bot-chip .bot-meta small {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6366f1;
}

/* Local Mode AI Slot Switch */
#lobby-screen .lb-who-row {
    justify-content: space-between;
}
#lobby-screen .lb-slot-mode-btn {
    padding: 3px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    color: #475569;
}
#lobby-screen .lb-slot-mode-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}
#lobby-screen .lb-slot-mode-btn.is-ai {
    background: #6366f1;
    color: #fff;
    border-color: #4f46e5;
}

/* Badge no HUD */
.ps-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    margin-left: 4px;
    vertical-align: middle;
}
.ps-ai-badge.facil { background: #10b981; }
.ps-ai-badge.normal { background: #f59e0b; }
.ps-ai-badge.dificil { background: #ef4444; }
.ps-ai-badge.insano { background: #8b5cf6; }

/* --- Botões principais da tela inicial: cores tiradas do logo (azul do "Bomber",
   laranja do "Bang!", rosa da faísca e um verde-menta). Só estes quatro. --- */
#lobby-screen #btn-create { background: linear-gradient(135deg, #3FA2FF 0%, #1F5FE0 100%); box-shadow: 0 8px 16px rgba(31, 95, 224, .28); }
#lobby-screen #btn-join { background: linear-gradient(135deg, #FFB21A 0%, #FF6A2B 100%); box-shadow: 0 8px 16px rgba(255, 106, 43, .28); text-shadow: 0 2px 0 rgba(150, 50, 0, .25); }
#lobby-screen #btn-ai { background: linear-gradient(135deg, #FF6FB5 0%, #D6337A 100%); box-shadow: 0 8px 16px rgba(214, 51, 122, .28); }
#lobby-screen #btn-local { background: linear-gradient(135deg, #2FE0B0 0%, #0FA77F 100%); box-shadow: 0 8px 16px rgba(15, 167, 127, .28); }
#lobby-screen #btn-create:hover:not(:disabled) { box-shadow: 0 12px 22px rgba(31, 95, 224, .38); }
#lobby-screen #btn-join:hover:not(:disabled) { box-shadow: 0 12px 22px rgba(255, 106, 43, .38); }
#lobby-screen #btn-ai:hover:not(:disabled) { box-shadow: 0 12px 22px rgba(214, 51, 122, .38); }
#lobby-screen #btn-local:hover:not(:disabled) { box-shadow: 0 12px 22px rgba(15, 167, 127, .38); }

/* Dono da sala: só a coroa (dourada), sem texto */
#lobby-screen .lb-players li i.fa-crown { color: #FFB300; filter: drop-shadow(0 1px 0 rgba(150, 90, 0, .35)); }

/* --- Painel contra IA: menos vertical (cartões na horizontal: ícone/número ao lado do texto) --- */
#lobby-screen #panel-ai .lb-count { gap: 8px; margin-bottom: 8px; }
#lobby-screen #panel-ai .lb-count button {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding: 8px 6px;
    border-width: 2px;
    border-radius: 14px;
}
#lobby-screen #panel-ai .lb-count button b { font-size: 1.7rem; }
#lobby-screen #panel-ai .lb-count button small { font-size: .74rem; line-height: 1.1; text-align: left; max-width: 4.2em; }
#lobby-screen #panel-ai .lb-diff-group { gap: 8px; margin-bottom: 8px; }
#lobby-screen #panel-ai .lb-diff-card {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding: 8px 6px;
    border-width: 2px;
    border-radius: 14px;
}
#lobby-screen #panel-ai .lb-diff-card .diff-icon { margin-bottom: 0; font-size: 1.35rem; }
#lobby-screen #panel-ai .lb-diff-card .diff-info { align-items: flex-start; text-align: left; }
#lobby-screen #panel-ai .lb-diff-card .diff-name { font-size: .98rem; line-height: 1.1; }
#lobby-screen #panel-ai .lb-diff-card .diff-tag { font-size: .68rem; margin-top: 0; }
#lobby-screen #panel-ai .lb-ai-opponents-box { margin-bottom: 8px; }
/* --- Contra IA, redesenho: seções em blocos claros, controles segmentados, menos texto --- */
/* Vale para todas as telas de configuração (Contra IA, Mesmo PC, Criar, Entrar) */
#lobby-screen .lb-stage:has(.lb-panel:not(#panel-menu):not(.hidden)) { max-width: 600px; }
/* Telas com seletor de mapa: mais largas para valorizar as miniaturas do carrossel (mesma especificidade + ordem vence) */
#lobby-screen .lb-stage:has(.lb-panel:not(#panel-menu):not(.hidden) [data-map-picker]) { max-width: min(780px, calc(100vw - 32px)); }
#lobby-screen .lb-panel:not(#panel-menu) { padding-left: 24px; padding-right: 24px; }
#lobby-screen .lb-panel .ai-sec {
    background: #f4f6fb;
    border-radius: 18px;
    padding: 12px 14px 14px;
    margin: 0 0 12px;
}
#lobby-screen .lb-panel .ai-sec.hidden { display: none; }
#lobby-screen .lb-panel .ai-sec .lb-label { margin: 0 0 9px 2px; font-size: .95rem; }
#lobby-screen .lb-panel .ai-sec .lb-tabs { background: #e3e8f2; margin-bottom: 12px; }
#lobby-screen .lb-panel .ai-sec .lb-players { margin-bottom: 0; }
#lobby-screen .lb-panel .ai-sec .lb-link { margin-top: 8px; }
/* Segmentado: 1 trilho com as opções; a escolhida "salta" em branco */
#lobby-screen .lb-panel .lb-count,
#lobby-screen #panel-ai .lb-diff-group {
    gap: 6px; margin: 0; padding: 5px;
    background: #e3e8f2; border-radius: 15px;
}
#lobby-screen .lb-panel .lb-count button,
#lobby-screen #panel-ai .lb-diff-card {
    flex-direction: row; justify-content: center; gap: 8px;
    padding: 10px 6px; min-height: 52px;
    border: 2px solid transparent; border-radius: 11px;
    background: transparent; box-shadow: none;
}
#lobby-screen .lb-panel .lb-count button.on,
#lobby-screen #panel-ai .lb-diff-card.on { background: #fff; box-shadow: 0 3px 8px rgba(30, 50, 90, .14); }
#lobby-screen .lb-panel .lb-count button b { font-size: 1.55rem; }
#lobby-screen .lb-panel .lb-count button small { font-size: .85rem; max-width: none; align-self: center; }
#lobby-screen .lb-panel .lb-setup-row.ai-sec { gap: 12px; padding: 12px 14px 14px; }
#lobby-screen .lb-panel .lb-setup-row .lb-col-map { flex: 1.5; }
#lobby-screen #panel-ai .lb-diff-card .diff-tag { display: none; } /* rótulo + ícone bastam */
#lobby-screen #panel-ai .lb-diff-card .diff-name { font-size: 1.02rem; }
/* Adversários: avatares com o nome embaixo, cor do jogador no anel */
#lobby-screen #panel-ai .lb-ai-opponents-box { margin: 12px 0 0; }
#lobby-screen #panel-ai .lb-ai-opponents-list { justify-content: center; gap: 18px; }
#lobby-screen #panel-ai .lb-ai-bot-chip {
    flex: 0 0 auto; min-width: 0; width: 92px;
    flex-direction: column; align-items: center; gap: 5px;
    padding: 0; border: 0; background: none; box-shadow: none;
}
#lobby-screen #panel-ai .lb-ai-bot-chip canvas {
    width: 52px; height: 52px; border-radius: 50%;
    background: #fff; border: 3px solid var(--bc); box-shadow: 0 2px 6px rgba(30, 50, 90, .12);
}
#lobby-screen #panel-ai .lb-ai-bot-chip .bot-meta { align-items: center; min-width: 0; width: 100%; }
#lobby-screen #panel-ai .lb-ai-bot-chip .bot-meta b {
    font-size: .8rem; text-align: center; line-height: 1.15; width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#lobby-screen #panel-ai .lb-setup-row { gap: 12px; padding: 12px 14px 14px; }
#lobby-screen #panel-ai .lb-col-map { flex: 1.5; }
#lobby-screen #panel-ai .lb-actions-row { margin-top: 4px; }
/* Criar Sala: "Outras formas de conectar" vira o "?" no fim da dica (economiza uma linha) */
#lobby-screen #host-tabs-wrap .lb-more { display: none; }
#lobby-screen .lb-q {
    width: 20px; height: 20px; margin-left: 4px; padding: 0;
    border: 0; border-radius: 50%; vertical-align: middle;
    background: #dfe5f0; color: #556; font: 800 .78rem/20px 'Outfit', 'Segoe UI', sans-serif;
    cursor: pointer;
}
#lobby-screen .lb-q:hover { background: var(--lb-primary); color: #fff; }

/* Janela baixa: tudo cabe sem cortar o logo nem os botões */
@media (max-height: 940px) {
    #lobby-screen.lb-compact h1.bb-logo { width: 230px; margin: -10px 0 8px; }
    #lobby-screen.lb-compact .bb-logo-img { max-width: 230px; }
    #lobby-screen.lb-compact .lb-card { padding-top: 16px; padding-bottom: 16px; }
    #lobby-screen.lb-compact .lb-status { margin-bottom: 9px; padding: 8px 14px; }
    #lobby-screen .lb-panel .ai-sec { padding: 9px 12px 11px; margin-bottom: 9px; }
    #lobby-screen .lb-panel .ai-sec .lb-label { margin-bottom: 6px; }
    #lobby-screen .lb-panel .lb-code { padding: 10px; margin: 2px 0 8px; font-size: 1.7rem; }
    #lobby-screen .lb-panel .lb-ip { padding: 10px; }
    #lobby-screen .lb-panel .lb-hint { margin-top: 4px; }
    #lobby-screen .lb-panel .lb-more { margin-top: 6px; }
    #lobby-screen .lb-panel .lb-players li { min-height: 0; padding-top: 7px; padding-bottom: 7px; }
    #lobby-screen .lb-panel .lb-count button { min-height: 46px; padding: 7px 6px; }
}
@media (max-width: 640px) {
    #lobby-screen .lb-stage:has(.lb-panel:not(#panel-menu):not(.hidden)) { max-width: 520px; }
    #lobby-screen .lb-panel:not(#panel-menu) { padding-left: 16px; padding-right: 16px; }
    #lobby-screen #panel-ai .lb-ai-bot-chip { width: 78px; }
}

/* ======================================================================
   TEMA "MOLDURA DE PEDRA + PERGAMINHO" (lobby e telas de configuração)
   Cartão com moldura de pedra, cantoneiras e rebites; miolo cor de pergaminho;
   botões grossos com borda inferior escura (3D) que afunda ao clicar.
   Só aparência: estrutura e fluxo das telas continuam os mesmos.
   ====================================================================== */
#lobby-screen {
    --pg-1: #f4e9d0;        /* pergaminho claro */
    --pg-2: #e6d4ad;        /* pergaminho escuro */
    --pg-field: #e3d2ac;    /* campos */
    --pg-field-2: #d8c49a;
    --pg-line: rgba(110, 80, 40, .22);
    --pg-ink: #4a3a26;      /* texto */
    --pg-ink-soft: #7a6448;
    --stone-1: #9a9ca3;     /* pedra */
    --stone-2: #6b6d75;
    --stone-3: #43454d;
}

/* Cartão: moldura de pedra (borda) + pergaminho (fundo) */
#lobby-screen .lb-card {
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .45), transparent 60%),
        linear-gradient(180deg, var(--pg-1) 0%, var(--pg-2) 100%);
    border: 12px solid var(--stone-2);
    border-radius: 20px;
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, .35),
        inset 0 0 22px rgba(120, 85, 40, .28),
        0 0 0 3px var(--stone-3),
        0 0 0 6px var(--stone-1),
        0 0 0 9px var(--stone-3),
        0 26px 60px rgba(0, 10, 40, .55);
    color: var(--pg-ink);
}
/* Cantoneiras de pedra com rebite nos 4 cantos */
#lobby-screen .lb-card::before {
    content: '';
    position: absolute;
    inset: -21px;
    pointer-events: none;
    z-index: 2;
    --c: 46px;
    background:
        radial-gradient(circle at 23px 23px, #d5d6da 0 5px, #55575f 6px 7px, transparent 8px) top left / var(--c) var(--c) no-repeat,
        radial-gradient(circle at 23px 23px, #d5d6da 0 5px, #55575f 6px 7px, transparent 8px) top right / var(--c) var(--c) no-repeat,
        radial-gradient(circle at 23px 23px, #d5d6da 0 5px, #55575f 6px 7px, transparent 8px) bottom left / var(--c) var(--c) no-repeat,
        radial-gradient(circle at 23px 23px, #d5d6da 0 5px, #55575f 6px 7px, transparent 8px) bottom right / var(--c) var(--c) no-repeat,
        linear-gradient(145deg, #a9abb2, #5c5e66) top left / var(--c) var(--c) no-repeat,
        linear-gradient(215deg, #a9abb2, #5c5e66) top right / var(--c) var(--c) no-repeat,
        linear-gradient(35deg, #a9abb2, #5c5e66) bottom left / var(--c) var(--c) no-repeat,
        linear-gradient(325deg, #a9abb2, #5c5e66) bottom right / var(--c) var(--c) no-repeat;
    -webkit-mask:
        linear-gradient(#000 0 0) top left / var(--c) var(--c) no-repeat,
        linear-gradient(#000 0 0) top right / var(--c) var(--c) no-repeat,
        linear-gradient(#000 0 0) bottom left / var(--c) var(--c) no-repeat,
        linear-gradient(#000 0 0) bottom right / var(--c) var(--c) no-repeat;
    border-radius: 10px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35));
}

/* Textos */
#lobby-screen label.lb-label { color: var(--pg-ink); font-weight: 700; }
#lobby-screen .lb-sub-title { color: var(--pg-ink); }
#lobby-screen.lb-compact .lb-header { border-bottom-color: var(--pg-line); }
#lobby-screen .lb-sep { border-top-color: var(--pg-line); }
#lobby-screen .lb-hint { color: var(--pg-ink-soft); }
#lobby-screen .lb-link { color: #8a5a1c; }

/* Campos (nome, códigos) e seletor de personagem: bege "afundado" no pergaminho */
#lobby-screen input[type=text],
#lobby-screen textarea,
#lobby-screen .lb-char-main {
    background: linear-gradient(180deg, var(--pg-field-2) 0%, var(--pg-field) 100%);
    border: 2px solid rgba(110, 80, 40, .25);
    box-shadow: inset 0 2px 4px rgba(90, 60, 25, .22);
    color: var(--pg-ink);
}
#lobby-screen input[type=text]::placeholder { color: rgba(74, 58, 38, .5); }
#lobby-screen input[type=text]:focus,
#lobby-screen textarea:focus,
#lobby-screen .lb-char-main:hover { border-color: #b8862f; }
#lobby-screen .lb-char-info b { color: var(--pg-ink); }
#lobby-screen .lb-char-info small { color: #8a5a1c; }
#lobby-screen .lb-char-arrow {
    background: linear-gradient(180deg, var(--pg-field-2), var(--pg-field));
    color: var(--pg-ink);
    border: 2px solid rgba(110, 80, 40, .25);
    box-shadow: inset 0 2px 4px rgba(90, 60, 25, .18);
}
#lobby-screen .lb-char-arrow:hover { background: #ecdcb8; }

/* Botões estilo jogo: letra grossa com contorno, borda de baixo escura (volume) */
#lobby-screen .lb-btn {
    --edge: #1846b0;
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: .4px;
    border: 2px solid rgba(0, 0, 0, .22);
    border-radius: 14px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .28), 0 0 1px rgba(0, 0, 0, .5);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, .38),
        inset 0 -3px 0 rgba(0, 0, 0, .12),
        0 5px 0 var(--edge),
        0 9px 14px rgba(40, 25, 10, .3) !important;
    transition: transform .08s, box-shadow .08s, filter .15s;
}
#lobby-screen .lb-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
#lobby-screen .lb-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), 0 1px 0 var(--edge), 0 3px 6px rgba(40, 25, 10, .3) !important;
}
#lobby-screen #btn-create { --edge: #1846b0; }
#lobby-screen #btn-join, #lobby-screen .lb-btn.secondary { --edge: #b4471a; }
#lobby-screen #btn-ai { --edge: #a22a60; }
#lobby-screen #btn-local { --edge: #0b7a5d; }
#lobby-screen .lb-btn.ai { --edge: #34248f; }
#lobby-screen .lb-btn.local { --edge: #18864a; }
#lobby-screen .lb-btn.danger { --edge: #b52a2a; }
#lobby-screen .lb-btn.copy { --edge: #18864a; }
#lobby-screen .lb-btn.ghost { --edge: #b9a57c; color: var(--pg-ink); background: #efe2c4; text-shadow: none; }
#lobby-screen .lb-btn.small { padding-top: 9px; padding-bottom: 9px; }
#lobby-screen .lb-btn:disabled { box-shadow: 0 3px 0 rgba(0, 0, 0, .2) !important; }

/* Telas internas: blocos, trilhos dos seletores e listas no tom do pergaminho */
#lobby-screen .lb-panel .ai-sec {
    background: rgba(255, 250, 238, .55);
    border: 1px solid var(--pg-line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}
#lobby-screen .lb-panel .lb-count,
#lobby-screen #panel-ai .lb-diff-group,
#lobby-screen .lb-panel .ai-sec .lb-tabs,
#lobby-screen .lb-tabs { background: #dcc9a2; box-shadow: inset 0 2px 4px rgba(90, 60, 25, .2); }
#lobby-screen .lb-panel .lb-count button,
#lobby-screen #panel-ai .lb-diff-card,
#lobby-screen .lb-tab { color: var(--pg-ink-soft); }
#lobby-screen .lb-panel .lb-count button.on,
#lobby-screen #panel-ai .lb-diff-card.on,
#lobby-screen .lb-tab.active {
    background: #fffaf0;
    box-shadow: 0 3px 0 rgba(110, 80, 40, .28), 0 4px 8px rgba(90, 60, 25, .15);
}
#lobby-screen .lb-players li { background: #fffaf0; border-color: var(--pg-line); color: var(--pg-ink); }
#lobby-screen .lb-code,
#lobby-screen .lb-ip { background: #fff7e6; border-color: #d2b47a; }
/* Texto dos botões grande e encorpado, como na arte de referência */
#lobby-screen #btn-create, #lobby-screen #btn-join { font-size: 1.5rem; padding-top: 11px; padding-bottom: 11px; }
#lobby-screen #btn-ai, #lobby-screen #btn-local { font-size: 1.08rem; }
#lobby-screen .lb-actions-row .lb-btn { font-size: 1.2rem; }
#lobby-screen .lb-btn { -webkit-text-stroke: .4px rgba(0, 0, 0, .25); text-transform: uppercase; }
/* Janela baixa: moldura mais fina para o cartão caber */
@media (max-height: 940px) {
    #lobby-screen .lb-card {
        border-width: 8px;
        box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), inset 0 0 18px rgba(120, 85, 40, .26),
            0 0 0 2px var(--stone-3), 0 0 0 5px var(--stone-1), 0 0 0 7px var(--stone-3), 0 20px 50px rgba(0, 10, 40, .55);
    }
    #lobby-screen .lb-card::before { inset: -15px; --c: 38px; }
    #lobby-screen.lb-compact .lb-actions-row .lb-btn { padding-top: 10px; padding-bottom: 10px; }
}
/* Caixa do código da sala: menos folga em volta do texto */
#lobby-screen .lb-panel .lb-code { padding: 6px 12px; margin: 2px 0 8px; line-height: 1.15; min-height: 0; }

/* ======================================================================
   TEMA "PAINEL DE METAL" (substitui as cores do pergaminho acima)
   Painel azul-ardósia escuro, cantoneiras com parafuso velho, faixas de alerta,
   campos claros, setas coloridas e barra laranja brilhante. Contra IA / Mesmo PC
   ficam FORA do painel, logo abaixo (só no menu principal).
   ====================================================================== */
#lobby-screen {
    --mt-1: #3d4160;   /* metal claro */
    --mt-2: #2b2e47;   /* metal escuro */
    --mt-rim: #565b7d; /* borda */
    --mt-deep: #1d1f31;
    --mt-ink: #f1f3ff;
    --mt-ink-soft: #b7bcd8;
}
#lobby-screen .lb-card {
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, .07), transparent 60%),
        linear-gradient(180deg, var(--mt-1) 0%, var(--mt-2) 100%);
    border: 12px solid var(--mt-rim);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, .08),
        inset 0 6px 18px rgba(0, 0, 0, .35),
        0 0 0 3px var(--mt-deep),
        0 0 0 6px #6c7194,
        0 0 0 9px var(--mt-deep),
        0 26px 60px rgba(0, 5, 25, .6);
    color: var(--mt-ink);
}
/* Cantoneiras com parafuso velho (cabeça com fenda, sempre centrada para qualquer --c) */
#lobby-screen .lb-card::before {
    --s: calc(var(--c) / 2 - 5px);
    background:
        linear-gradient(135deg, transparent 42%, #2a2c38 42% 58%, transparent 58%) left var(--s) top var(--s) / 10px 10px no-repeat,
        linear-gradient(45deg, transparent 42%, #2a2c38 42% 58%, transparent 58%) right var(--s) top var(--s) / 10px 10px no-repeat,
        linear-gradient(45deg, transparent 42%, #2a2c38 42% 58%, transparent 58%) left var(--s) bottom var(--s) / 10px 10px no-repeat,
        linear-gradient(135deg, transparent 42%, #2a2c38 42% 58%, transparent 58%) right var(--s) bottom var(--s) / 10px 10px no-repeat,
        radial-gradient(circle at 50% 50%, #b9bcc6 0 4px, #8b8f9b 5px 7px, #34363f 8px 9px, transparent 10px) top left / var(--c) var(--c) no-repeat,
        radial-gradient(circle at 50% 50%, #b9bcc6 0 4px, #8b8f9b 5px 7px, #34363f 8px 9px, transparent 10px) top right / var(--c) var(--c) no-repeat,
        radial-gradient(circle at 50% 50%, #b9bcc6 0 4px, #8b8f9b 5px 7px, #34363f 8px 9px, transparent 10px) bottom left / var(--c) var(--c) no-repeat,
        radial-gradient(circle at 50% 50%, #b9bcc6 0 4px, #8b8f9b 5px 7px, #34363f 8px 9px, transparent 10px) bottom right / var(--c) var(--c) no-repeat,
        linear-gradient(145deg, #6b7090, #3a3d55) top left / var(--c) var(--c) no-repeat,
        linear-gradient(215deg, #6b7090, #3a3d55) top right / var(--c) var(--c) no-repeat,
        linear-gradient(35deg, #6b7090, #3a3d55) bottom left / var(--c) var(--c) no-repeat,
        linear-gradient(325deg, #6b7090, #3a3d55) bottom right / var(--c) var(--c) no-repeat;
}
/* Faixas de alerta amarelas na borda (topo e base, à direita) */
#lobby-screen .lb-card::after {
    content: '';
    position: absolute;
    right: 56px;
    top: -12px;
    bottom: -12px;
    width: 46px;
    pointer-events: none;
    z-index: 2;
    background:
        repeating-linear-gradient(-55deg, #ffc93c 0 7px, #2b2e47 7px 13px) top / 100% 9px no-repeat,
        repeating-linear-gradient(-55deg, #ffc93c 0 7px, #2b2e47 7px 13px) bottom / 100% 9px no-repeat;
    opacity: .95;
}

/* Textos claros no metal */
#lobby-screen label.lb-label,
#lobby-screen .lb-sub-title { color: var(--mt-ink); }
#lobby-screen .lb-hint { color: var(--mt-ink-soft); }
#lobby-screen .lb-link { color: #ffcf5a; }
#lobby-screen.lb-compact .lb-header { border-bottom-color: rgba(255, 255, 255, .14); }

/* Campos claros; setas azul (anterior) e laranja (próximo) */
#lobby-screen input[type=text],
#lobby-screen textarea {
    background: #fff;
    border: 3px solid #1d1f31;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .15);
    color: #23253a;
}
#lobby-screen input[type=text]::placeholder { color: #9aa0b8; }
#lobby-screen .lb-char-main {
    background: #e7eaf3;
    border: 3px solid #1d1f31;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12);
}
#lobby-screen .lb-char-info b { color: #23253a; }
#lobby-screen .lb-char-info small { color: #4a4f6e; }
#lobby-screen .lb-char-arrow {
    color: #fff;
    border: 2px solid rgba(0, 0, 0, .3);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 3px 0 #1a3f9e;
    background: linear-gradient(180deg, #4aa8ff, #1f5fe0);
}
#lobby-screen #lb-char-next { background: linear-gradient(180deg, #ffb21a, #ff6a2b); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 3px 0 #b4471a; }
#lobby-screen .lb-char-arrow:hover { filter: brightness(1.08); }

/* Barra laranja brilhante no lugar do tracejado */
#lobby-screen .lb-sep {
    border: none;
    height: 6px;
    margin: 18px 14px 4px;
    border-radius: 6px;
    background: linear-gradient(90deg, #ff8a1a, #ffc23d, #ff8a1a);
    box-shadow: 0 0 10px rgba(255, 150, 40, .75), 0 0 2px rgba(255, 220, 140, .9) inset;
}

/* Contra IA / Mesmo PC fora do painel, só no menu principal */
#lobby-screen .lb-menu-extra { width: 100%; margin-top: 16px; position: relative; z-index: 1; gap: 14px; }
#lobby-screen .lb-menu-extra .lb-btn { margin-top: 0; }
#lobby-screen .lb-stage:has(#panel-menu.hidden) .lb-menu-extra { display: none; }

/* Telas internas no metal */
#lobby-screen .lb-panel .ai-sec {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
#lobby-screen .lb-panel .lb-count,
#lobby-screen #panel-ai .lb-diff-group,
#lobby-screen .lb-panel .ai-sec .lb-tabs,
#lobby-screen .lb-tabs { background: rgba(0, 0, 0, .28); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3); }
#lobby-screen .lb-panel .lb-count button,
#lobby-screen #panel-ai .lb-diff-card,
#lobby-screen .lb-tab { color: var(--mt-ink-soft); }
#lobby-screen .lb-panel .lb-count button small { color: inherit; }
#lobby-screen #panel-ai .lb-diff-card .diff-name { color: var(--mt-ink); }
#lobby-screen .lb-panel .lb-count button.on,
#lobby-screen #panel-ai .lb-diff-card.on,
#lobby-screen .lb-tab.active {
    background: #fff;
    color: #23253a;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
#lobby-screen .lb-players li { background: #e7eaf3; border-color: rgba(0, 0, 0, .25); color: #23253a; }
#lobby-screen .lb-code, #lobby-screen .lb-ip { background: #fff; border-color: #ffc23d; }
/* Dificuldade escolhida: texto escuro no fundo branco (igual à quantidade) */
#lobby-screen #panel-ai .lb-diff-card.on .diff-name { color: #23253a; }

/* ======================================================================
   CORES POR FUNÇÃO (mesmo significado em todas as telas)
   Verde = começar/confirmar · Ardósia = voltar (neutro) · Vermelho = fechar/sair
   Azul = ação secundária (copiar, gerar) · Menu: cada modo mantém sua cor de identidade
   ====================================================================== */
/* Começar / confirmar: sempre verde */
#lobby-screen #ai-start,
#lobby-screen #local-start,
#lobby-screen #host-start,
#lobby-screen #join-room-ok,
#lobby-screen #join-lan-ok,
#lobby-screen #join-invite-ok,
#lobby-screen #host-answer-ok,
#lobby-screen #lb-detected-go {
    background: linear-gradient(180deg, #3ddc84 0%, #1fa85a 100%);
    --edge: #137a40;
}
/* Voltar: neutro (não é destrutivo) */
#lobby-screen .lb-btn.danger,
#lobby-screen #ai-back,
#lobby-screen #local-back,
#lobby-screen #host-leave,
#lobby-screen #join-leave {
    background: linear-gradient(180deg, #8b91b0 0%, #636a8c 100%);
    --edge: #444a68;
}
/* Ação secundária (copiar código/convite, gerar convite) */
#lobby-screen .lb-btn.copy,
#lobby-screen #host-invite {
    background: linear-gradient(180deg, #4aa8ff 0%, #1f5fe0 100%);
    --edge: #1846b0;
}
#lobby-screen .lb-btn.copy.done { background: linear-gradient(180deg, #3ddc84 0%, #1fa85a 100%); --edge: #137a40; }
/* Fechar o jogo: vermelho */
#lobby-screen .lb-top-btn.lb-quit { background: linear-gradient(180deg, #ff5a5a, #c62828); border-color: rgba(0, 0, 0, .25); color: #fff; }

/* Barra de topo só com ícones (o nome aparece na dica ao passar o mouse) */
#lobby-screen .lb-top-btn > span { display: none; }
#lobby-screen .lb-top-btn { width: 44px; height: 44px; padding: 0; justify-content: center; gap: 0; }
#lobby-screen .lb-top-btn i { font-size: 1.15rem; margin: 0; }
/* Sem texto: botões maiores e com mais destaque */
#lobby-screen .lb-top-btn { width: 58px; height: 58px; border-radius: 16px; }
#lobby-screen .lb-top-btn i { font-size: 1.6rem; }
@media (max-height: 820px) {
    #lobby-screen .lb-top-btn { width: 50px; height: 50px; border-radius: 14px; }
    #lobby-screen .lb-top-btn i { font-size: 1.4rem; }
}

/* Sala online: completar vagas com bots (texto em vez de número) */
#lobby-screen #host-bots { gap: 6px; margin-bottom: 4px; }
#lobby-screen #host-bots button { padding: 8px 4px; min-height: 0; }
#lobby-screen #host-bots button b { font-size: .95rem; }

/* Criar Sala em 2 colunas (tela larga): código + personagem | jogadores + bots; mapa/troféus + botões */
@media (min-width: 700px) {
    #lobby-screen .lb-stage:has(#panel-host:not(.hidden)) { max-width: min(900px, calc(100vw - 32px)) !important; }
    #lobby-screen #panel-host:not(.hidden) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "code    players"
            "char    bots"
            "setup   setup"
            "actions actions";
        column-gap: 14px;
        align-items: stretch;
    }
    #lobby-screen #panel-host > #host-tabs-wrap { grid-area: code; }
    #lobby-screen #panel-host > #host-players-sec { grid-area: players; }
    #lobby-screen #panel-host > #host-char-sec { grid-area: char; display: flex; flex-direction: column; justify-content: center; }
    #lobby-screen #panel-host > #host-bots-sec { grid-area: bots; }
    #lobby-screen #panel-host > .lb-setup-row { grid-area: setup; }
    #lobby-screen #panel-host > .lb-actions-row { grid-area: actions; }
    /* jogadores: 1 por linha (cabe o nome inteiro) */
    #lobby-screen #panel-host .lb-players { grid-template-columns: 1fr; display: grid; }
}
#lobby-screen .lb-host-char-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
#lobby-screen .lb-host-char-preview {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 3px 9px 3px 4px;
    border-radius: 11px;
    background: rgba(14, 16, 30, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color .15s, background .15s;
}
#lobby-screen .lb-host-char-preview:hover {
    background: rgba(74, 168, 255, 0.16);
    border-color: rgba(110, 185, 255, 0.55);
}
#lobby-screen #host-char-canvas,
#lobby-screen #join-char-canvas {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 8px;
    background: radial-gradient(circle at 50% 60%, rgba(86, 160, 255, 0.28), rgba(12, 15, 28, 0.55));
}
#lobby-screen #host-char-name,
#lobby-screen #join-char-name {
    color: #f1f3ff;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#lobby-screen #host-char-btn.lb-host-char-btn,
#lobby-screen #join-char-btn.lb-host-char-btn {
    width: auto;
    flex-shrink: 0;
    margin-top: 0;
    padding: 8px 14px;
    font-size: 0.86rem;
    white-space: nowrap;
    background: linear-gradient(180deg, #6b7399 0%, #4b5275 100%);
    --edge: #313652;
}

/* ======================================================================
   CÓDIGO DA SALA COLORIDO POR PALAVRA (CASAVELOZ42, sem hífen)
   Azul x laranja: par que continua distinto para os 3 tipos de daltonismo
   (rosa vira azul-acinzentado para protanopes e se confunde com o azul).
   ====================================================================== */
#lobby-screen {
    --rc-1: #1d5fd6;   /* 1ª palavra: azul */
    --rc-2: #d26f00;   /* 2ª palavra: laranja */
    --rc-3: #4a4f5c;   /* número: cinza escuro */
}
#lobby-screen .rc-1 { color: var(--rc-1); }
#lobby-screen .rc-2 { color: var(--rc-2); }
#lobby-screen .rc-3 { color: var(--rc-3); }
/* Fora do campo de digitar: um respiro entre as partes (não depende só da cor) */
#lobby-screen .rc.rc-gap .rc-2,
#lobby-screen .rc.rc-gap .rc-3 { margin-left: .14em; }
#lobby-screen .lb-detected .rc,
#lobby-screen .lb-status .rc { font-weight: 800; background: #fff; padding: 0 6px; border-radius: 6px; }

/* Campo de digitar: o texto real fica invisível e a camada por cima desenha as cores */
#lobby-screen input.lb-code-input.has-mirror { color: transparent; caret-color: #23253a; }
#lobby-screen input.lb-code-input.has-mirror::placeholder { color: transparent; }
#lobby-screen .lb-code-mirror {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    color: #23253a;
    text-transform: uppercase;
    box-sizing: border-box;
}
#lobby-screen .lb-code-mirror .lb-code-example { opacity: .38; font-weight: 600; }
#lobby-screen input.lb-code-input:focus + .lb-code-mirror.is-empty { opacity: 0; }
/* Código do host: seleção contínua num amarelo claro que não apaga as cores das palavras */
#lobby-screen #host-room-code.is-ready { cursor: pointer; }
#lobby-screen #host-room-code ::selection,
#lobby-screen #host-room-code::selection { background: #ffe27a; }

/* Telas internas (IA, Mesmo PC, Criar, Entrar): sem a logo (ela fica só no início); mais espaço para o painel */
#lobby-screen.lb-compact h1.bb-logo { display: none !important; }
#lobby-screen.lb-compact .lb-stage { transform: none; }

/* Completar vagas com bots: cada nível com sua cor (Não neutro, Fácil verde, Normal azul,
   Difícil amarelo, Insano preto com vermelho) */
#lobby-screen #host-bots button[data-host-bots] { transition: background .2s, color .2s, box-shadow .2s, transform .12s; }
#lobby-screen #host-bots button[data-host-bots="off"] { color: #94a3b8; }
#lobby-screen #host-bots button[data-host-bots="facil"] { color: #34d399; }
#lobby-screen #host-bots button[data-host-bots="normal"] { color: #60a5fa; }
#lobby-screen #host-bots button[data-host-bots="dificil"] { color: #fbbf24; }
#lobby-screen #host-bots button[data-host-bots="insano"] { color: #f87171; }
#lobby-screen #host-bots button.on[data-host-bots] { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
#lobby-screen #host-bots button.on[data-host-bots="off"] { background: linear-gradient(180deg, #cbd5e1, #94a3b8); color: #1e293b; text-shadow: none; box-shadow: 0 3px 0 #64748b; }
#lobby-screen #host-bots button.on[data-host-bots="facil"] { background: linear-gradient(180deg, #34d399, #059669); box-shadow: 0 3px 0 #047857; }
#lobby-screen #host-bots button.on[data-host-bots="normal"] { background: linear-gradient(180deg, #60a5fa, #2563eb); box-shadow: 0 3px 0 #1d4ed8; }
#lobby-screen #host-bots button.on[data-host-bots="dificil"] { background: linear-gradient(180deg, #fcd34d, #f59e0b); color: #5b3a00; text-shadow: none; box-shadow: 0 3px 0 #b45309; }
#lobby-screen #host-bots button.on[data-host-bots="insano"] { background: linear-gradient(180deg, #2b2b2b, #0a0a0a); color: #ff5252; box-shadow: 0 3px 0 #7f1d1d, inset 0 0 0 2px #b91c1c; }
#lobby-screen #host-bots button.on[data-host-bots] { border-color: transparent; }

/* Poder do personagem no cartão (nome + tecla; a dica completa fica no title) */
#lobby-screen .lb-char-power { font-size: .72rem; font-weight: 700; line-height: 1.2; margin: 2px 0 3px; color: #b26a00; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lobby-screen .lb-char-power .fa-bolt { color: #FFB300; }
#lobby-screen .lb-char-power kbd { font-weight: 800; font-size: .68rem; line-height: 1; font-family: inherit; padding: 1px 5px; border-radius: 4px; background: #fff3d6; border: 1px solid #f0c060; color: #6b4300; }

/* ======================================================================
   VITRINE DO PERSONAGEM NA TELA INICIAL (2 colunas: Vitrine | Nome + Jogar)
   ====================================================================== */
@media (min-width: 740px) {
    #lobby-screen .lb-stage:has(#panel-menu:not(.hidden)) {
        max-width: min(820px, calc(100vw - 32px));
    }
}
#lobby-screen:not(.lb-compact) h1.bb-logo {
    width: 470px;
    margin: -14px 0 18px;
}
#lobby-screen:not(.lb-compact) .bb-logo-img {
    max-width: 470px;
}
@media (max-height: 820px) {
    #lobby-screen:not(.lb-compact) h1.bb-logo { width: 390px; margin: -10px 0 14px; }
    #lobby-screen:not(.lb-compact) .bb-logo-img { max-width: 390px; }
}
@media (max-height: 680px) {
    #lobby-screen:not(.lb-compact) h1.bb-logo { width: 300px; margin: -6px 0 10px; }
    #lobby-screen:not(.lb-compact) .bb-logo-img { max-width: 300px; }
}

#lobby-screen .lb-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
    gap: 22px;
    align-items: stretch;
}
#lobby-screen .lb-hero-col {
    background: linear-gradient(180deg, rgba(16, 19, 36, 0.52) 0%, rgba(22, 26, 48, 0.42) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#lobby-screen .lb-hero-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
#lobby-screen .lb-hero-head label.lb-label {
    margin: 0;
    font-size: 0.92rem;
}
#lobby-screen .lb-char-index {
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #d6dcf5;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.3px;
}
#lobby-screen .lb-char-stage {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
#lobby-screen .lb-char-stage .lb-char-arrow {
    flex: 0 0 42px;
    height: 52px;
    border-radius: 14px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
#lobby-screen .lb-char-showcase {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 138px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    background: radial-gradient(circle at 50% 58%, rgba(86, 160, 255, 0.28) 0%, rgba(20, 24, 48, 0.55) 70%, rgba(12, 14, 28, 0.72) 100%);
    box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: border-color .2s, transform .15s, box-shadow .2s;
}
#lobby-screen .lb-char-showcase::after {
    content: '';
    position: absolute;
    bottom: 11px;
    width: 78px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(110, 185, 255, 0.38) 0%, rgba(0, 0, 0, 0.35) 72%, transparent 100%);
    pointer-events: none;
}
#lobby-screen .lb-char-showcase:hover {
    border-color: rgba(110, 185, 255, 0.7);
    box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 18px rgba(74, 168, 255, 0.28);
    transform: translateY(-2px);
}
#lobby-screen .lb-char-showcase:active {
    transform: scale(0.98);
}
#lobby-screen #lb-char-canvas {
    position: relative;
    z-index: 1;
    width: 126px;
    height: 126px;
    background: transparent;
    border: none;
    box-shadow: none;
}
#lobby-screen .lb-char-name {
    font: 800 1.2rem/1.2 'Fredoka', 'Outfit', sans-serif;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    margin: 8px 0 8px;
    text-align: center;
    letter-spacing: 0.2px;
}
#lobby-screen .lb-char-power-box {
    width: 100%;
    min-height: 84px;
    padding: 9px 11px;
    border-radius: 13px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: left;
    transition: background .2s, border-color .2s;
}
#lobby-screen .lb-char-power-box.has-power {
    background: rgba(255, 179, 0, 0.13);
    border: 1px solid rgba(255, 195, 60, 0.38);
}
#lobby-screen .lb-char-power-box.no-power {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.13);
}
#lobby-screen .lb-pw-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    line-height: 1.2;
}
#lobby-screen .lb-char-power-box.has-power .lb-pw-head i { color: #ffc93c; }
#lobby-screen .lb-char-power-box.has-power .lb-pw-head b { color: #ffe082; font-weight: 800; }
#lobby-screen .lb-char-power-box.no-power .lb-pw-head i { color: #94a3b8; }
#lobby-screen .lb-char-power-box.no-power .lb-pw-head b { color: #cbd5e1; font-weight: 800; }
#lobby-screen .lb-pw-key {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #cbd5e1;
    white-space: nowrap;
}
#lobby-screen .lb-char-power-box.no-power .lb-pw-key {
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #9aa3bf;
}
#lobby-screen .lb-pw-key kbd {
    font: 800 0.72rem/1 'Outfit', sans-serif;
    padding: 2px 7px;
    border-radius: 6px;
    background: #fff3d6;
    border: 1px solid #f0c060;
    color: #6b4300;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
#lobby-screen .lb-pw-desc {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.32;
    color: #e4e8f8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
#lobby-screen .lb-char-power-box.no-power .lb-pw-desc {
    color: #a6aec9;
}
#lobby-screen .lb-char-all-btn {
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #eef2ff;
    font: 700 0.85rem 'Outfit', 'Segoe UI', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
#lobby-screen .lb-char-all-btn:hover {
    background: rgba(74, 168, 255, 0.24);
    border-color: rgba(110, 185, 255, 0.55);
    color: #fff;
}
#lobby-screen .lb-char-all-btn:active {
    transform: scale(0.98);
}

#lobby-screen .lb-play-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
#lobby-screen .lb-play-col .lb-col-nick {
    flex: none;
    margin-bottom: 10px;
}
#lobby-screen .lb-play-col #lb-nick {
    height: 54px;
    font-size: 1.12rem;
}
#lobby-screen .lb-play-col .lb-sep {
    margin: 22px 6px 4px;
}

@media (max-width: 739px) {
    #lobby-screen .lb-home-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
@media (max-height: 760px) {
    #lobby-screen .lb-hero-col { padding: 11px 13px; }
    #lobby-screen .lb-char-showcase { height: 118px; }
    #lobby-screen #lb-char-canvas { width: 108px; height: 108px; }
    #lobby-screen .lb-char-name { font-size: 1.08rem; margin: 6px 0; }
    #lobby-screen .lb-char-power-box { min-height: 74px; padding: 8px 10px; }
    #lobby-screen .lb-char-all-btn { margin-top: 8px; padding: 8px 10px; }
}

/* ======================================================================
   COMPACTAÇÃO PROPORCIONAL DO LOBBY (mais respiro em volta, sem mexer no jogo)
   ====================================================================== */
#lobby-screen .lb-stage { max-width: 480px; }
#lobby-screen .lb-stage:has(.lb-panel:not(#panel-menu):not(.hidden)) { max-width: 490px; }
#lobby-screen .lb-stage:has(.lb-panel:not(#panel-menu):not(.hidden) [data-map-picker]) { max-width: min(650px, calc(100vw - 32px)); }
@media (min-width: 740px) {
    #lobby-screen .lb-stage:has(#panel-menu:not(.hidden)) { max-width: min(710px, calc(100vw - 32px)); }
}
@media (min-width: 700px) {
    #lobby-screen .lb-stage:has(#panel-host:not(.hidden)) { max-width: min(750px, calc(100vw - 32px)) !important; }
    #lobby-screen #panel-host:not(.hidden) { column-gap: 11px; }
}
@media (max-width: 640px) {
    #lobby-screen .lb-stage:has(.lb-panel:not(#panel-menu):not(.hidden)) { max-width: 460px; }
}

/* Logo proporcional ao cartão menor */
#lobby-screen:not(.lb-compact) h1.bb-logo { width: 390px; margin: -10px 0 14px; }
#lobby-screen:not(.lb-compact) .bb-logo-img { max-width: 390px; }
@media (max-height: 820px) {
    #lobby-screen:not(.lb-compact) h1.bb-logo { width: 330px; margin: -8px 0 10px; }
    #lobby-screen:not(.lb-compact) .bb-logo-img { max-width: 330px; }
}
@media (max-height: 680px) {
    #lobby-screen:not(.lb-compact) h1.bb-logo { width: 265px; margin: -4px 0 8px; }
    #lobby-screen:not(.lb-compact) .bb-logo-img { max-width: 265px; }
}

/* Moldura e cabeçalho compactos */
#lobby-screen .lb-card {
    padding: 18px 22px 20px;
    border-width: 9px;
    border-radius: 18px;
}
#lobby-screen .lb-card::before { inset: -18px; --c: 38px; }
#lobby-screen .lb-card::after { right: 48px; top: -9px; bottom: -9px; width: 40px; }
#lobby-screen .lb-panel:not(#panel-menu) { padding-left: 6px; padding-right: 6px; }
#lobby-screen.lb-compact .lb-card { padding-top: 14px; padding-bottom: 14px; }
#lobby-screen.lb-compact .lb-header { margin-bottom: 9px; padding-bottom: 7px; }
#lobby-screen .lb-sub-title { font-size: 1.12rem; }
#lobby-screen .lb-status,
#lobby-screen.lb-compact .lb-status { margin-bottom: 8px; padding: 7px 12px; font-size: 0.86rem; border-radius: 11px; }

/* Seções e controles internos */
#lobby-screen .lb-panel .ai-sec {
    padding: 9px 11px 10px;
    margin-bottom: 8px;
    border-radius: 14px;
}
#lobby-screen label.lb-label,
#lobby-screen .lb-panel .ai-sec .lb-label { font-size: 0.86rem; margin-bottom: 6px; }
#lobby-screen .lb-panel .lb-code { font-size: 1.65rem; padding: 6px 10px; margin: 2px 0 6px; border-radius: 14px; }
#lobby-screen .lb-ip { font-size: 1.3rem; padding: 10px; border-radius: 13px; }
#lobby-screen input.lb-code-input { font-size: 1.35rem; height: 46px; padding-top: 8px; padding-bottom: 8px; border-radius: 13px; }
#lobby-screen .lb-tabs { margin-bottom: 10px; padding: 4px; border-radius: 13px; }
#lobby-screen .lb-tab { padding: 7px 8px; font-size: 0.85rem; border-radius: 10px; }
#lobby-screen .lb-players { gap: 5px; }
#lobby-screen .lb-players li { padding: 6px 11px; font-size: 0.88rem; border-radius: 11px; }
#lobby-screen .lb-hint { font-size: 0.8rem; margin-top: 4px; }
#lobby-screen .lb-room-info { margin-top: 8px; padding: 7px 12px; font-size: 0.83rem; border-radius: 12px; }

#lobby-screen .lb-panel .lb-count,
#lobby-screen #panel-ai .lb-diff-group { padding: 4px; gap: 5px; border-radius: 13px; }
#lobby-screen .lb-panel .lb-count button,
#lobby-screen #panel-ai .lb-diff-card { min-height: 40px; padding: 6px; border-radius: 10px; gap: 6px; }
#lobby-screen .lb-panel .lb-count button b { font-size: 1.3rem; }
#lobby-screen .lb-panel .lb-count button small { font-size: 0.78rem; }
#lobby-screen #panel-ai .lb-diff-card .diff-icon { font-size: 1.15rem; }
#lobby-screen #panel-ai .lb-diff-card .diff-name { font-size: 0.92rem; }
#lobby-screen #host-bots { gap: 5px; margin-bottom: 2px; }
#lobby-screen #host-bots button { min-height: 0; padding: 6px 4px; }
#lobby-screen #host-bots button b { font-size: 0.86rem; }

/* Botões principais e de ação */
#lobby-screen .lb-btn { padding: 10px 16px; font-size: 0.96rem; border-radius: 12px; margin-top: 8px; }
#lobby-screen #btn-create, #lobby-screen #btn-join { font-size: 1.22rem; padding: 10px 16px; }
#lobby-screen #btn-ai, #lobby-screen #btn-local { font-size: 0.95rem; padding: 10px 12px; }
#lobby-screen .lb-actions-row .lb-btn { font-size: 1.05rem; padding: 10px 14px; }
#lobby-screen .lb-btn.copy { padding: 11px 16px; font-size: 1.02rem; }
#lobby-screen .lb-menu-extra { margin-top: 12px; gap: 12px; }

/* Carrossel de mapa e troféus */
#lobby-screen .lb-panel .lb-setup-row.ai-sec { gap: 8px; padding: 9px 11px 10px; margin-top: 4px; margin-bottom: 8px; }
#lobby-screen .mp-track { height: 126px; }
#lobby-screen .mp-arrow { flex: 0 0 34px; height: 34px; font-size: 0.88rem; }
#lobby-screen .mp-info { min-height: 36px; margin-top: 2px; }
#lobby-screen .mp-name { font-size: 1.18rem; }
#lobby-screen .mp-desc { font-size: 0.8rem; }
#lobby-screen .mp-dots { margin-top: 4px; gap: 5px; }
#lobby-screen .mp-dot { width: 6px; height: 6px; }
#lobby-screen .lb-col-wins .lb-wins { height: 44px; }
#lobby-screen .lb-win-btn { border-radius: 12px; }
#lobby-screen .lb-win-btn b { font-size: 1.08rem; }
#lobby-screen .lb-win-btn small { font-size: 0.65rem; }
@media (max-height: 820px) {
    #lobby-screen .mp-track { height: 112px; }
    #lobby-screen .mp-name { font-size: 1.1rem; }
}
@media (max-height: 680px) {
    #lobby-screen .mp-track { height: 98px; }
}

/* Vitrine do personagem na tela inicial */
#lobby-screen .lb-home-grid { gap: 16px; }
#lobby-screen .lb-hero-col { padding: 11px 13px; border-radius: 15px; }
#lobby-screen .lb-hero-head { margin-bottom: 5px; }
#lobby-screen .lb-hero-head label.lb-label { font-size: 0.86rem; }
#lobby-screen .lb-char-index { font-size: 0.7rem; padding: 2px 8px; }
#lobby-screen .lb-char-stage { gap: 8px; }
#lobby-screen .lb-char-stage .lb-char-arrow { flex: 0 0 36px; height: 44px; border-radius: 12px; font-size: 0.9rem; }
#lobby-screen .lb-char-showcase { height: 114px; border-radius: 16px; }
#lobby-screen .lb-char-showcase::after { bottom: 8px; width: 66px; height: 14px; }
#lobby-screen #lb-char-canvas { width: 106px; height: 106px; }
#lobby-screen .lb-char-name { font-size: 1.08rem; margin: 6px 0; }
#lobby-screen .lb-char-power-box { min-height: 74px; padding: 8px 10px; border-radius: 11px; gap: 3px; }
#lobby-screen .lb-pw-head { font-size: 0.8rem; }
#lobby-screen .lb-pw-desc { font-size: 0.74rem; line-height: 1.3; }
#lobby-screen .lb-char-all-btn { margin-top: 8px; padding: 7px 10px; font-size: 0.8rem; border-radius: 10px; }
#lobby-screen .lb-play-col #lb-nick { height: 46px; font-size: 1rem; border-radius: 13px; }
#lobby-screen .lb-play-col .lb-sep { margin: 16px 6px 2px; height: 5px; }

/* Barra de topo discreta */
#lobby-screen .lb-top-btn { width: 46px; height: 46px; border-radius: 13px; }
#lobby-screen .lb-top-btn i { font-size: 1.25rem; }
@media (max-height: 820px) {
    #lobby-screen .lb-top-btn { width: 42px; height: 42px; border-radius: 12px; }
    #lobby-screen .lb-top-btn i { font-size: 1.15rem; }
}

/* ======================================================================
   CARROSSEL DE MAPAS EM COVERFLOW 3D (5 a 7 miniaturas visíveis em arco)
   ====================================================================== */
#lobby-screen .mp-car {
    position: relative;
    gap: 0;
}
#lobby-screen .mp-arrow {
    position: relative;
    z-index: 30;
    margin: 0 -4px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
#lobby-screen .mp-track {
    height: 138px;
    perspective: 820px;
    perspective-origin: 50% 50%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
}
@media (max-height: 820px) {
    #lobby-screen .mp-track { height: 124px; }
}
@media (max-height: 680px) {
    #lobby-screen .mp-track { height: 108px; }
}
#lobby-screen .mp-card {
    transform-style: preserve-3d;
    backface-visibility: hidden;
    border-width: 3px;
    border-radius: 15px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
    transition: transform .38s cubic-bezier(.25, 1.15, .45, 1), opacity .3s, filter .25s, box-shadow .3s, border-color .3s;
}
#lobby-screen .mp-card.on {
    border-width: 3.5px;
    border-color: var(--mp-color);
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, .92),
        0 12px 28px rgba(0, 0, 0, .45),
        0 0 22px color-mix(in srgb, var(--mp-color) 45%, transparent);
}
#lobby-screen .mp-card:not(.on):hover {
    filter: brightness(1.06) !important;
}
#lobby-screen .mp-card .mp-tag {
    font-size: 1.05rem;
    padding: 14px 6px 5px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .75));
}
#lobby-screen .mp-card[data-dist="3"] .mp-tag {
    opacity: 0.75;
}
#lobby-screen .mp-dot {
    cursor: pointer;
}
