/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Figtree', system-ui, sans-serif;
}

/* O reset acima seta font-family direto em TODO ::before/::after da página —
   isso inclui o ::before dos ícones do Font Awesome, que é onde o glifo é
   desenhado (via `content`). O CSS do próprio Font Awesome só define a fonte
   no elemento <i> (herdada pelo ::before); uma declaração direta no
   pseudo-elemento (mesmo vindo de um seletor universal, pouco específico)
   sempre vence um valor herdado — não importa a especificidade de onde ele
   foi herdado. Resultado sem isso: todo ícone vira um quadrado (glifo
   "tofu", fonte errada não tem esse caractere). Restaura a fonte certa aqui.
*/
.fa-solid::before, .fas::before,
.fa-regular::before, .far::before {
    font-family: "Font Awesome 6 Free" !important;
}
.fa-brands::before, .fab::before {
    font-family: "Font Awesome 6 Brands" !important;
}

html, body {
    height: 100%; overflow: hidden;
    -webkit-user-select: none; user-select: none;
    touch-action: none; overscroll-behavior: none;
    position: fixed; width: 100%;
}

/* ── Variáveis ──────────────────────────────────────────────────────────────── */
:root {
    --c-red:    #d22626;
    --c-orange: #ff8200;
    --c-dark:   #09090f;
    --c-panel:  #111118;
    --c-surf:   #18181f;
    --c-card:   #1c1c28;
    --c-border: #2a2a38;
    --c-text:   #eeeef4;
    --c-muted:  #7878a0;
    /* Cor de "tema" dinâmica — segue o time atual do jogador local (não
       fixa em home). Sobrescrita em runtime sempre que o time muda — ver
       _syncAccentColor() em arena.js. Espectador cai no --c-red neutro. */
    --c-accent: var(--c-red);
    /* Fallback — sobrescrito em runtime por arena.js a partir de TEAM_COLORS.
       Nunca hardcode cor de time em outro lugar do CSS; use estas vars. */
    --c-home:   #4a8fff;
    --c-away:   #ff5555;
    --radius:   10px;
    --gap:      0.5rem;
    --tab-h:    62px;
    --header-h: 56px;
}

/* ══════════════════════════════════════════════════════════
   LOBBY — estilo FIFA 23
   ══════════════════════════════════════════════════════════ */

#view-lobby {
    position: fixed; inset: 0;
    background: var(--c-dark);
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: lobby-enter .55s cubic-bezier(.16,1,.3,1) both;
}

@keyframes lobby-enter {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

#view-arena { position: fixed; inset: 0; }

/* ── Background atmosférico ─────────────────────────────────────────────────── */

.lb-bg {
    position: absolute; inset: 0;
    pointer-events: none; overflow: hidden; z-index: 0;
}

.lb-orb {
    position: absolute; border-radius: 50%;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

#lobby-header {
    position: relative; z-index: 10; flex-shrink: 0;
    height: var(--header-h);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.05);
    background: rgba(9,9,15,.6);
    backdrop-filter: blur(12px);
}

.logo-text {
    font-size: 1.25rem; font-weight: 900;
    color: var(--c-text); letter-spacing: -0.04em;
    text-transform: uppercase;
}
.logo-text span { color: var(--c-red); }

.lh-online {
    display: flex; align-items: center; gap: 7px;
    font-size: .72rem; color: var(--c-muted); font-weight: 500;
    letter-spacing: .02em;
}

.online-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #1ec85c; flex-shrink: 0;
    animation: dot-pulse 2.2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(30,200,92,.5); }
    50%      { opacity: .6; box-shadow: 0 0 0 5px rgba(30,200,92,0); }
}

/* ── Lobby content (área das abas) ──────────────────────────────────────────── */

#lobby-content {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    position: relative; z-index: 10;
    overflow: hidden;
}

/* ── Sections / Abas ────────────────────────────────────────────────────────── */

.section {
    display: none;
    flex-direction: column;
    flex: 1; min-height: 0;
    padding: 1.25rem 1.25rem 0.75rem;
    overflow: hidden;
}

.section.active {
    display: flex;
}

@keyframes slide-from-right {
    from { opacity: 0; transform: translateX(32px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-from-left {
    from { opacity: 0; transform: translateX(-32px); }
    to   { opacity: 1; transform: translateX(0); }
}

.section.slide-from-right { animation: slide-from-right .28s cubic-bezier(.2,.9,.3,1) both; }
.section.slide-from-left  { animation: slide-from-left  .28s cubic-bezier(.2,.9,.3,1) both; }

/* ── ABA: Início ─────────────────────────────────────────────────────────────── */

#dashboardArea {
    gap: 0;
    justify-content: center;
}

/* Action cards */
#actionCards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    flex-shrink: 0;
    animation: cards-enter .5s .2s cubic-bezier(.2,.9,.3,1) both;
}

@keyframes cards-enter {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.action-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column;
    align-items: flex-start; justify-content: flex-end;
    gap: 0;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: var(--c-card);
    cursor: pointer;
    min-height: 100px;
    text-align: left;
    transition: transform .18s cubic-bezier(.2,.9,.3,1),
                border-color .18s,
                box-shadow .18s;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,.4);
}

.action-card:active { transform: scale(.96); }

.action-primary {
    background: linear-gradient(135deg, #8a0f0f 0%, #d22626 60%, #e8441c 100%);
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(210,38,38,.3);
}

.action-primary:hover {
    box-shadow: 0 12px 36px rgba(210,38,38,.5);
    border-color: rgba(255,100,50,.3);
}

.action-secondary {
    background: linear-gradient(135deg, var(--c-card) 0%, #201c2e 100%);
}
.action-secondary:hover { border-color: var(--c-orange); }

/* Brilho no card ao hover */
.ac-shine {
    position: absolute; inset: 0;
    background: linear-gradient(110deg,
        transparent 30%,
        rgba(255,255,255,.07) 50%,
        transparent 70%);
    transform: translateX(-120%);
    transition: transform .55s ease;
    pointer-events: none;
}
.action-card:hover .ac-shine { transform: translateX(120%); }

/* Glow de fundo no card primário */
.ac-bg-glow {
    position: absolute; inset: -20px;
    background: radial-gradient(circle at 70% 30%, rgba(255,130,0,.18), transparent 60%);
    pointer-events: none;
    animation: glow-pulse 3s ease-in-out infinite alternate;
}
@keyframes glow-pulse {
    from { opacity: .6; }
    to   { opacity: 1; }
}

.ac-inner {
    display: flex; align-items: center; gap: .6rem;
    position: relative; z-index: 1;
}

.ac-icon {
    font-size: 1.3rem; color: rgba(255,255,255,.9);
    flex-shrink: 0;
}

.action-secondary .ac-icon { color: var(--c-muted); }

.ac-text {
    display: flex; flex-direction: column; gap: 1px;
}

.ac-title {
    font-size: .875rem; font-weight: 800;
    color: #fff; letter-spacing: -.01em;
    line-height: 1;
}

.action-secondary .ac-title { color: var(--c-text); }

.ac-sub {
    font-size: .65rem; font-weight: 500;
    color: rgba(255,255,255,.65); letter-spacing: .01em;
}

.action-secondary .ac-sub { color: var(--c-muted); }

.ac-badge {
    position: absolute; top: 8px; right: 8px;
    font-size: .58rem; font-weight: 800;
    letter-spacing: .09em; text-transform: uppercase;
    background: rgba(255,255,255,.14);
    color: rgba(255,255,255,.85);
    border-radius: 4px; padding: 2px 6px;
}

.ac-badge-dim {
    background: color-mix(in srgb, var(--c-orange) 15%, transparent);
    color: var(--c-orange);
}

/* Footer da aba */
.lb-footer {
    text-align: center; font-size: .65rem;
    color: var(--c-border); font-weight: 500;
    letter-spacing: .06em; padding: 0.5rem 0 0;
    flex-shrink: 0;
}

/* ── ABA: Salas ──────────────────────────────────────────────────────────────── */

#roomsSection { gap: 0.75rem; }

.section-header {
    display: flex; align-items: center;
    justify-content: space-between;
    flex-shrink: 0; padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-border);
}

.section-title {
    font-size: 1rem; font-weight: 800;
    color: var(--c-text); letter-spacing: -0.02em;
}

.icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--c-surf); border: 1px solid var(--c-border);
    border-radius: 8px; color: var(--c-muted); font-size: .9rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--c-card); border-color: var(--c-orange); color: var(--c-text); }
.icon-btn:active { transform: scale(.92); }

#availableRooms {
    flex: 1; min-height: 0; overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
    scrollbar-width: thin; scrollbar-color: var(--c-border) transparent;
}

#roomListHeader {
    display: flex; align-items: center;
    padding: 0 0 0.4rem 0;
    flex-shrink: 0; color: var(--c-muted);
    font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
}
#roomListName  { flex: 1; padding-left: 1rem; }
#roomListPass, #roomListCount { width: 72px; text-align: center; }

.room-item {
    display: flex; align-items: stretch;
    background: var(--c-surf);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    cursor: pointer; overflow: hidden;
    transition: border-color .15s, background .15s, transform .15s;
    position: relative;
}
.room-item::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--c-orange);
    transform: scaleY(0); transform-origin: center;
    transition: transform .2s cubic-bezier(.2,.9,.3,1);
}
.room-item:hover {
    border-color: rgba(210,38,38,.4);
    background: color-mix(in srgb, var(--c-surf) 80%, var(--c-red));
    transform: translateX(2px);
}
.room-item:hover::before { transform: scaleY(1); }
.room-item:active { transform: scale(.98); }

#roomName {
    flex: 1; padding: .65rem .75rem .65rem 1rem;
    color: var(--c-text); font-size: .85rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#roomCount, #roomHasPass {
    width: 72px; text-align: center;
    padding: .65rem 0; color: var(--c-muted); font-size: .78rem;
}

.room-headless-badge {
    background: var(--c-red); color: #fff;
    font-size: .6rem; font-weight: 700;
    padding: 2px 6px; border-radius: 3px;
    margin-left: 6px; vertical-align: middle;
    letter-spacing: .05em;
}

#roomActionButtons { flex-shrink: 0; }

/* ── ABA: Perfil ─────────────────────────────────────────────────────────────── */

.form-label {
    font-size: .7rem; font-weight: 700;
    color: var(--c-muted); text-transform: uppercase;
    letter-spacing: .08em;
}

/* ── Tab bar ─────────────────────────────────────────────────────────────────── */

#tabBar {
    position: relative; z-index: 20; flex-shrink: 0;
    height: var(--tab-h);
    display: flex; align-items: stretch;
    background: rgba(9,9,15,.88);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-indicator {
    position: absolute; top: 0; left: 0;
    height: 2px; width: 50%;
    background: linear-gradient(90deg, var(--c-red), var(--c-orange));
    border-radius: 0 0 2px 2px;
    transform: translateX(0);
    transition: transform .32s cubic-bezier(.2,.9,.3,1);
    pointer-events: none;
}

.tab-btn {
    flex: 1; display: flex;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; border: none; background: transparent;
    color: var(--c-muted); cursor: pointer;
    font-size: .62rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    transition: color .2s;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn i {
    font-size: 1.15rem;
    transition: color .2s, transform .2s cubic-bezier(.2,.9,.3,1);
}

.tab-btn.active { color: var(--c-red); }
.tab-btn.active i { transform: scale(1.15); color: var(--c-red); }
.tab-btn:not(.active):active i { transform: scale(.88); }

/* ── Botões compartilhados ───────────────────────────────────────────────────── */

.btn {
    padding: .75rem 1rem;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-surf);
    color: var(--c-text);
    font-size: .875rem; font-weight: 700;
    cursor: pointer; letter-spacing: .01em; text-align: center;
    transition: border-color .15s, background .15s, color .15s, transform .12s;
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn:hover { border-color: var(--c-orange); background: var(--c-card); }
.btn:active { transform: scale(.97); }

.btn-primary {
    background: var(--c-red); border-color: transparent; color: #fff;
    box-shadow: 0 4px 16px rgba(210,38,38,.28);
}
.btn-primary:hover {
    background: color-mix(in srgb, var(--c-red) 82%, var(--c-orange));
    box-shadow: 0 6px 22px rgba(210,38,38,.4);
    border-color: transparent;
}

.btn-sm {
    padding: .45rem .85rem;
    font-size: .78rem; font-weight: 700;
    width: auto; border-radius: 8px;
}

/* ── Inputs ──────────────────────────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="file"] {
    padding: .72rem 1rem;
    border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-dark); color: var(--c-text);
    font-size: .875rem; outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--c-red);
    box-shadow: 0 0 0 3px rgba(210,38,38,.14);
}
input[type="text"]::placeholder,
input[type="password"]::placeholder { color: var(--c-muted); }

/* ── Popup overlay ───────────────────────────────────────────────────────────── */
.popupOverlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(9,9,15,.84);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center; align-items: center;
}

.popup {
    position: relative;
    background: var(--c-panel); border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 1.5rem; min-width: 400px;
    max-width: 90vw; max-height: 80vh; overflow-y: auto; overflow-x: hidden;
    display: none; flex-direction: column; gap: 0.65rem;
    animation: popup-in .24s cubic-bezier(.2,.9,.3,1) both;
}

@keyframes popup-in {
    from { opacity: 0; transform: translateY(18px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.popup > p {
    font-size: .72rem; font-weight: 800; color: var(--c-muted);
    text-transform: uppercase; letter-spacing: .09em;
}

.popup-desc {
    font-size: .82rem; color: var(--c-text);
    line-height: 1.6; padding: .15rem 0;
}

.popup-tag {
    display: inline-block; align-self: flex-start;
    font-size: .62rem; font-weight: 800;
    letter-spacing: .1em; text-transform: uppercase;
    background: color-mix(in srgb, var(--c-orange) 16%, transparent);
    color: var(--c-orange); border: 1px solid rgba(255,130,0,.35);
    border-radius: 4px; padding: 2px 7px;
}

#fzSummary {
    background: var(--c-dark); border: 1px solid var(--c-border);
    border-radius: 6px; padding: .5rem .75rem;
    font-size: .78rem; color: var(--c-muted); line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   ARENA
   ══════════════════════════════════════════════════════════ */

#camera {
    width: 100vw; height: 100svh;
    overflow: hidden; position: relative;
}

/* #canvas agora é o container de montagem do <canvas> WebGL do PixiJS —
   o pan/zoom da câmera é feito no palco do Pixi (container "world"),
   não mais via CSS transform no elemento canvas. */
#canvas { position: fixed; inset: 0; z-index: 2; }
#canvas canvas { display: block; }

#overlay {
    position: fixed; inset: 0;
    background: var(--c-dark); z-index: 100;
    display: flex; justify-content: center; align-items: center;
}

#loader {
    width: 30px; height: 30px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-red);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

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

/* ── Scoreboard (estilo GML) ────────────────────────────────────────────────── */
#sb-wrapper {
    position: fixed; top: 14px; left: 14px;
    z-index: 5; display: flex; flex-direction: column;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.3s  ease;
}
#sb-wrapper.sb-hidden {
    transform: translateY(calc(-100% - 24px));
    opacity: 0;
    pointer-events: none;
}

/* ── Replay de gol ───────────────────────────────────────────────────────────── */
#pause-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 30; pointer-events: none;
    align-items: center; justify-content: center;
}
#pause-overlay span {
    font-family: 'Figtree', Arial, sans-serif;
    font-size: 4rem; font-weight: 900;
    letter-spacing: .2em; text-transform: uppercase;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0,0,0,0.7);
}
#pause-overlay.visible { display: flex; }

#replay-box {
    position: fixed; top: 18px; left: 50%;
    transform: translateX(-50%);
    z-index: 20; pointer-events: none;
    opacity: 0; transition: opacity 0.25s ease;
}
#replay-box.visible { opacity: 1; }
.replay-badge {
    display: inline-block;
    padding: 5px 18px;
    background: rgba(0,0,0,0.72);
    border: 1.5px solid rgba(255,255,255,0.22);
    border-radius: 6px;
    color: #fff;
    font-family: 'Figtree', Arial, sans-serif;
    font-size: .78rem; font-weight: 900;
    letter-spacing: .25em; text-transform: uppercase;
    backdrop-filter: blur(8px);
    animation: replay-pulse 1.2s ease-in-out infinite;
}
@keyframes replay-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

#scoreboard {
    width: 152px; border-radius: 8px 8px 0 0;
    overflow: hidden; background: var(--c-panel);
    border: 1px solid var(--c-border); border-bottom: none;
    display: flex; flex-direction: column; position: relative;
}

.sb-accent {
    position: absolute; left: 0; top: 0; bottom: 0;
    display: flex; z-index: 1; pointer-events: none;
}
.sb-accent-red    { width: 3px; background: var(--c-red); }
.sb-accent-orange { width: 3px; background: var(--c-orange); }

.sb-body {
    padding: 5px 10px 5px 16px;
    display: flex; flex-direction: column;
    position: relative; z-index: 2;
}

.sb-row {
    display: flex; align-items: center;
    justify-content: space-between; height: 30px;
}

.sb-name {
    font-size: 10px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--c-text);
}

.sb-score {
    font-size: 16px; font-weight: 800;
    color: var(--c-text); min-width: 16px; text-align: right;
    display: inline-block;
    transition: transform .15s cubic-bezier(.2,.9,.3,1), color .2s;
}
.sb-score.pulse { transform: scale(1.45); color: var(--c-red); }

.sb-sep { height: 1px; background: var(--c-border); }

.sb-timebar {
    background: rgba(0,0,0,.45);
    border-top: 1px solid var(--c-border);
    height: 20px; display: flex;
    align-items: center; justify-content: center;
    position: relative; z-index: 2;
}

#timer {
    font-size: 9px; font-weight: 600;
    color: var(--c-muted); letter-spacing: .1em;
}

/* ── Banner de gol ───────────────────────────────────────────────────────────── */
#goalBanner {
    width: 152px; border-radius: 0 0 8px 8px;
    overflow: hidden; background: var(--c-red);
    display: flex; align-items: stretch;
    height: 0; opacity: 0;
    transition: height .22s cubic-bezier(.2,.9,.3,1), opacity .18s;
    border: 1px solid var(--c-red); border-top: none;
}
#goalBanner.visible { height: 26px; opacity: 1; }

.gb-strip { width: 3px; background: var(--c-orange); flex-shrink: 0; }

.gb-body {
    display: flex; align-items: center; gap: 5px;
    padding: 0 8px; overflow: hidden;
}

.gb-label {
    font-size: 8px; font-weight: 800; color: #fff;
    letter-spacing: .12em; flex-shrink: 0;
}

#goalAuthor {
    font-size: 8px; font-weight: 600;
    color: rgba(255,255,255,.85);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Botões HUD ──────────────────────────────────────────────────────────────── */
#buttons {
    position: fixed; top: 14px; right: 14px;
    z-index: 5; display: flex; flex-direction: column; gap: 4px;
}

#buttons i {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--c-panel); border: 1px solid var(--c-border);
    border-radius: 6px; color: var(--c-muted); font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
#buttons i:hover {
    background: var(--c-surf); border-color: var(--c-orange); color: var(--c-text);
}

/* ── Ping ────────────────────────────────────────────────────────────────────── */
#ping {
    position: fixed; bottom: 14px; left: 14px;
    color: var(--c-muted); z-index: 5;
    font-size: 9px; font-weight: 500; letter-spacing: .04em;
}

/* ── Chat ────────────────────────────────────────────────────────────────────── */
/* Notificação discreta de chat (não é o popup — só um texto flutuante) */
#chatPill {
    position: fixed;
    bottom: 14px; left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    max-width: 280px;
    cursor: pointer;
    opacity: 0; pointer-events: none;
    transition: opacity .4s;
}
#chatPill.visible  { opacity: 1; pointer-events: all; }
#chatPill.fadeout  { opacity: 0; pointer-events: none; }

#chatPillText {
    font-size: 11px; color: rgba(255,255,255,.85);
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block;
}

#chatDiv {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.38);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-box {
    width: 320px; height: 240px;
    display: flex; flex-direction: column; gap: 4px;
}

.chat-messages {
    flex: 1;
    background: rgba(14,14,20,0.88);
    border: 1px solid var(--c-border);
    border-radius: 8px 8px 0 0;
    overflow-y: auto; padding: .4rem .5rem;
    font-size: 10px; color: var(--c-text);
    scrollbar-width: thin;
    scrollbar-color: var(--c-border) transparent;
}

#inputMessage {
    padding: .45rem .6rem;
    border: 1px solid var(--c-border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: rgba(28,28,42,0.95);
    color: var(--c-text);
    font-size: 10px; outline: none; width: 100%;
    transition: border-color .15s;
}
#inputMessage:focus    { border-color: var(--c-orange); }
#inputMessage::placeholder { color: var(--c-muted); }

/* ── Painéis modais (árbitro, settings) ──────────────────────────────────────── */
#refereeDiv, #settingsDiv {
    position: fixed; inset: 0;
    padding: 2rem 1rem;
    background: rgba(8,8,14,.85);
    backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 999;
}

/* ── Referee Panel ────────────────────────────────────────────────────────────── */
#ref-panel {
    background: var(--c-panel);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    width: 100%; max-width: 680px;
    max-height: calc(100vh - 4rem);
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

#ref-head {
    display: flex; align-items: center;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--c-border);
    flex-shrink: 0;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c-accent) 8%, transparent), transparent 60%);
}
#ref-title {
    flex: 1;
    font-size: .82rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--c-text);
}
#ref-close-btn {
    background: none; border: none;
    color: var(--c-muted); font-size: .9rem;
    cursor: pointer; padding: .3rem .55rem; border-radius: 6px;
    transition: background .12s, color .12s; line-height: 1;
}
#ref-close-btn:hover { background: var(--c-border); color: var(--c-text); }

/* Settings row (host only) */
#ref-settings-row {
    display: flex; align-items: center;
    padding: .55rem 1rem; gap: .75rem;
    background: color-mix(in srgb, var(--c-surf) 60%, transparent);
    border-bottom: 1px solid var(--c-border);
    flex-shrink: 0;
}
/* Linha de configuração padrão dentro de popups — mesmo fundo sólido dos
   inputs (var(--c-dark)), pra tudo no popup ter a mesma "profundidade" */
.popup-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem;
    padding: .65rem .8rem;
    background: var(--c-dark);
    border: 1px solid var(--c-border); border-radius: 10px;
}
.popup-row-lbl {
    font-size: .76rem; font-weight: 600; color: var(--c-text);
    flex-shrink: 0;
}
.popup-row-file { flex-wrap: wrap; }

.popup-toggle-row { /* usa .popup-row como base — ver acima */ }
.ref-toggle-wrap { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.ref-toggle-lbl { font-size: .76rem; font-weight: 600; color: var(--c-text); }
.ref-toggle-hint { font-size: .67rem; color: var(--c-muted); }

/* Select customizado (tamanho do campo etc.) */
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background: var(--c-surf); color: var(--c-text);
    border: 1px solid var(--c-border); border-radius: 8px;
    padding: .45rem 2.1rem .45rem .85rem;
    font-size: .82rem; font-weight: 600;
    cursor: pointer; outline: none;
    transition: border-color .15s, box-shadow .15s;
    min-width: 130px;
}
.select-wrap select:hover  { border-color: var(--c-orange); }
.select-wrap select:focus  { border-color: var(--c-red); box-shadow: 0 0 0 3px rgba(210,38,38,.14); }
.select-wrap select option { background: var(--c-surf); color: var(--c-text); }
.select-caret {
    position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
    font-size: .65rem; color: var(--c-muted); pointer-events: none;
}

/* Botão de arquivo customizado (substitui o input file nativo) */
.file-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem .85rem;
    background: var(--c-surf); border: 1px solid var(--c-border); border-radius: 8px;
    font-size: .78rem; font-weight: 700; color: var(--c-text);
    cursor: pointer; transition: border-color .15s, background .15s;
    flex-shrink: 0; white-space: nowrap;
}
.file-btn:hover { border-color: var(--c-orange); background: var(--c-card); }
#fzFileLabel {
    font-size: .74rem; color: var(--c-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Toggle switch */
.toggle-switch { flex-shrink: 0; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
    display: block; width: 36px; height: 20px;
    background: var(--c-border); border-radius: 20px;
    position: relative; transition: background .2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--c-accent); }
.toggle-thumb {
    position: absolute; top: 3px; left: 3px;
    width: 14px; height: 14px;
    background: #fff; border-radius: 50%;
    transition: left .18s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb { left: 19px; }

/* ── Colunas de times ─────────────────────────────────────────────────────────── */
#ref-columns {
    flex: 1; display: flex; gap: 8px;
    padding: 10px; overflow: hidden; min-height: 180px;
}
.ref-col {
    flex: 1; display: flex; flex-direction: column;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--c-border);
    background: var(--c-surf);
    transition: border-color .15s;
}
.ref-col-head {
    display: flex; align-items: center; gap: 6px;
    padding: .45rem .65rem;
    border-bottom: 1px solid var(--c-border);
    flex-shrink: 0; cursor: default;
}
.ref-col-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ref-col-home .ref-col-dot { background: var(--c-home); box-shadow: 0 0 6px color-mix(in srgb, var(--c-home) 60%, transparent); }
.ref-col-spec .ref-col-dot { background: var(--c-muted); }
.ref-col-away .ref-col-dot { background: var(--c-away); box-shadow: 0 0 6px color-mix(in srgb, var(--c-away) 60%, transparent); }
.ref-col-name {
    flex: 1; font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--c-text);
}
.ref-col-count {
    font-size: .67rem; font-weight: 600;
    background: var(--c-border); border-radius: 10px;
    padding: 1px 7px; color: var(--c-muted);
}

/* ── Drop zones ───────────────────────────────────────────────────────────────── */
.ref-drop-zone {
    flex: 1; padding: 4px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 3px;
    min-height: 40px; border-radius: 0 0 9px 9px;
    transition: background .12s;
}
.ref-drop-zone.drag-over {
    background: color-mix(in srgb, var(--c-orange) 10%, transparent);
    outline: 2px dashed var(--c-orange); outline-offset: -3px;
}
.ref-col[data-team="home"] .ref-drop-zone.drag-over {
    background: color-mix(in srgb, var(--c-home) 12%, transparent);
    outline-color: var(--c-home);
}
.ref-col[data-team="away"] .ref-drop-zone.drag-over {
    background: color-mix(in srgb, var(--c-away) 12%, transparent);
    outline-color: var(--c-away);
}
.ref-col[data-team="spectator"] .ref-drop-zone.drag-over {
    background: color-mix(in srgb, var(--c-muted) 10%, transparent);
    outline-color: var(--c-muted);
}

/* ── Player Cards ─────────────────────────────────────────────────────────────── */
.ref-card {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 7px; border-radius: 7px;
    background: transparent; transition: background .1s;
    user-select: none; position: relative;
}
.ref-card:hover { background: color-mix(in srgb, var(--c-border) 70%, transparent); }
.ref-card.dragging { opacity: .35; pointer-events: none; }
.ref-card.selected {
    background: color-mix(in srgb, var(--c-orange) 14%, transparent);
    outline: 1px solid var(--c-orange); outline-offset: -1px;
}
.ref-card-handle {
    color: var(--c-muted); font-size: .75rem;
    cursor: grab; flex-shrink: 0; opacity: .35;
    transition: opacity .12s; padding: 0 1px;
}
.ref-card:hover .ref-card-handle { opacity: .9; }
.ref-card-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    flex-shrink: 0;
    display: block;
}
.ref-card-name {
    flex: 1; font-size: .78rem; color: var(--c-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.ref-card-badges { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.ref-badge {
    font-size: .6rem; background: var(--c-border);
    border-radius: 4px; padding: 1px 5px;
    color: var(--c-muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.ref-badge-you  { background: color-mix(in srgb, var(--c-text) 12%, transparent); color: var(--c-text); }
.ref-badge-host { background: color-mix(in srgb, #f0c040 18%, transparent); color: #f0c040; }
.ref-badge-admin{ background: color-mix(in srgb, var(--c-orange) 18%, transparent); color: var(--c-orange); }
.ref-grant-btn {
    background: none; border: none; color: var(--c-muted);
    font-size: .72rem; cursor: pointer; padding: 2px 4px;
    border-radius: 4px; transition: background .1s, color .1s;
    flex-shrink: 0; opacity: 0; transition: opacity .12s, background .1s, color .1s;
}
.ref-card:hover .ref-grant-btn { opacity: .7; }
.ref-grant-btn:hover { background: var(--c-border); color: var(--c-orange); opacity: 1 !important; }
.ref-grant-btn.active { color: var(--c-orange); opacity: 1; }

#refereeActionButtons {
    border-top: 1px solid var(--c-border);
    display: flex; flex-shrink: 0;
}
#refereeActionButtons > button {
    flex: 1; border: none; padding: .65rem;
    background: transparent; color: var(--c-muted);
    font-size: .78rem; font-weight: 600;
    cursor: pointer; transition: background .12s, color .12s;
}
#refereeActionButtons > button:first-child { border-right: 1px solid var(--c-border); }
#refereeActionButtons > button:hover {
    background: color-mix(in srgb, var(--c-surf) 55%, var(--c-red));
    color: var(--c-text);
}

#settings {
    background: var(--c-panel); border: 1px solid var(--c-border);
    border-radius: var(--radius); padding: 1.5rem;
    flex-direction: column; overflow-y: auto; gap: var(--gap);
    position: relative; width: auto; height: auto;
}
#settings::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--c-red), var(--c-orange));
    border-radius: var(--radius) var(--radius) 0 0;
}

/* ── Controles de settings ───────────────────────────────────────────────────── */
#controlsSettings { display: flex; gap: 1rem; flex-wrap: wrap; }

#joySettings, #kickSettings, #generalSettings {
    display: flex; flex-direction: column; gap: .5rem;
    color: var(--c-text); font-size: .75rem; min-width: 210px;
}
#joySettings > p, #kickSettings > p, #generalSettings > p {
    font-size: .75rem; font-weight: 700; color: var(--c-orange);
    text-transform: uppercase; letter-spacing: .07em; margin-bottom: .2rem;
}

.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem;
}
.setting-lbl { color: var(--c-text); white-space: nowrap; }

.stepper {
    display: inline-flex; align-items: center; gap: 0;
    background: var(--c-dark); border: 1px solid var(--c-border);
    border-radius: 8px; overflow: hidden; flex-shrink: 0;
}
.stepper-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: var(--c-surf); border: none;
    color: var(--c-text); font-size: .8rem;
    cursor: pointer; transition: background .12s, color .12s;
}
.stepper-btn:hover:not(:disabled)  { background: var(--c-orange); color: #fff; }
.stepper-btn:active:not(:disabled) { transform: scale(.92); }
.stepper-btn:disabled { color: var(--c-muted); cursor: not-allowed; opacity: .5; }
.stepper-value {
    min-width: 44px; text-align: center;
    font-size: .75rem; font-weight: 700; color: var(--c-text);
    font-variant-numeric: tabular-nums;
    user-select: none;
}

/* ── Joystick / Kick ──────────────────────────────────────────────────────────── */
#joy, #kick { position: fixed; z-index: 4; }
#kick { width: 90px; height: 90px; background-size: cover; background-position: center; background-repeat: no-repeat; }
#kick { background-image: url('../images/kick.png'); }

/* ── Sidebar desktop ─────────────────────────────────────────────────────────── */

#lobby-body {
    display: flex; flex-direction: column;
    flex: 1; min-width: 0; overflow: hidden;
}

/* Sidebar: nav vertical estilo FIFA 23 — display: none por padrão; flex só no desktop */
#lobby-sidebar {
    display: none;
    width: 240px; flex-shrink: 0;
    background: rgba(9,9,15,.75);
    border-right: 1px solid rgba(255,255,255,.06);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1.5rem 0;
    position: relative; z-index: 10;
    animation: sidebar-enter .5s cubic-bezier(.16,1,.3,1) both;
}

@keyframes sidebar-enter {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.ls-brand {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.ls-online {
    display: flex; align-items: center; gap: 6px;
    font-size: .68rem; color: var(--c-muted); font-weight: 500;
}

/* Nav vertical */
.ls-nav {
    display: flex; flex-direction: column;
    gap: 2px; padding: 1rem 0.75rem;
}

/* Tab buttons — aparência comum (sidebar e tabBar) */
/* Estilos base do .tab-btn ficam na seção Tab bar */

/* Sidebar tab buttons */
.ls-nav .tab-btn {
    flex-direction: row; justify-content: flex-start;
    gap: 0.75rem; height: 44px; padding: 0 1rem;
    border-radius: 10px;
    font-size: .82rem; font-weight: 700;
    letter-spacing: .02em; text-transform: none;
    color: var(--c-muted);
    transition: background .15s, color .15s;
    position: relative;
    padding: 1rem;
}

.ls-nav .tab-btn i { font-size: 1rem; transition: none; transform: none !important; }
.ls-nav .tab-btn span { display: block; }

.ls-nav .tab-btn::before {
    content: '';
    position: absolute; left: 0; top: 25%; bottom: 25%;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--c-red);
    transform: scaleY(0); transition: transform .2s cubic-bezier(.2,.9,.3,1);
}

.ls-nav .tab-btn:hover {
    background: rgba(255,255,255,.05);
    color: var(--c-text);
}

.ls-nav .tab-btn.active {
    background: rgba(210,38,38,.1);
    color: var(--c-red);
}

.ls-nav .tab-btn.active::before { transform: scaleY(1); }

.ls-footer {
    padding: 0 1.5rem;
    font-size: .62rem; color: var(--c-border);
    font-weight: 500; letter-spacing: .06em;
}

/* ── Responsivo: portrait arena ─────────────────────────────────────────────── */
@media (orientation: portrait) {
    #refereeActionButtons { flex-direction: column; }
    #refereeActionButtons > button:first-child { border-right: none; border-bottom: 1px solid var(--c-border); }
}

/* ── Desktop (sidebar layout) ────────────────────────────────────────────────
   min-width: 860px garante que só PCs e tablets largos entram aqui.
   ─────────────────────────────────────────────────────────────────────────── */
@media (min-width: 860px) {
    #view-lobby { flex-direction: row; }

    /* Sidebar visível */
    #lobby-sidebar { display: flex; }

    /* Esconde elementos mobile */
    #lobby-header { display: none; }
    #tabBar       { display: none; }
    .lb-footer    { display: none; }

    /* Body ocupa o restante */
    #lobby-body { flex: 1; min-width: 0; }

    /* Content preenche body inteiro */
    #lobby-content { display: flex; flex-direction: column; }

    /* Seções ocupam tudo */
    .section { padding: 2rem 2.5rem; }

    /* ── Dashboard desktop ─────────────────────────────────────── */
    #dashboardArea { justify-content: center; gap: 1.5rem; }

    #actionCards {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        flex: 1; max-height: 380px;
        animation: cards-enter .4s cubic-bezier(.2,.9,.3,1) both;
    }

    .action-card {
        flex-direction: column;
        justify-content: flex-end;
        min-height: 0;
        padding: 1.5rem;
    }

    .ac-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }

    .ac-icon  { font-size: 2rem; }
    .ac-title { font-size: 1.1rem; }
    .ac-sub   { font-size: .75rem; }

    /* ── Salas desktop ─────────────────────────────────────────── */
    #roomsSection { gap: 1rem; }
}

/* ── Landscape mobile ─────────────────────────────────────────────────────────
   max-height: 520px + max-width: 859px = telefones em paisagem.
   ─────────────────────────────────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 859px) {
    :root { --header-h: 42px; --tab-h: 46px; }

    #lobby-header { padding: 0 1rem; }
    .logo-text    { font-size: 1.05rem; }

    /* Dashboard compacto */
    #dashboardArea {
        padding: 0.6rem 1.25rem;
        justify-content: center;
    }

    #actionCards { animation-delay: 0s; }

    .action-card { min-height: 82px; padding: .75rem; }
    .ac-icon  { font-size: 1.1rem; }
    .ac-title { font-size: .8rem; }
    .ac-sub   { font-size: .6rem; }

    .lb-footer { display: none; }

    /* Salas compacta */
    #roomsSection { padding: 0.5rem 1.25rem; gap: 0.5rem; }
    .section-header { padding-bottom: 0.3rem; }
    .btn { padding: .55rem 1rem; font-size: .8rem; }

    /* Tab bar compacta */
    #tabBar { height: 46px; }
    .tab-btn        { gap: 0; }
    .tab-btn span   { display: none; }
    .tab-btn i      { font-size: 1rem; }
    .tab-indicator  { height: 2px; }
}

/* ══════════════════════════════════════════════════════════
   VIEW: APELIDO (gate — primeira tela)
   ══════════════════════════════════════════════════════════ */

#view-nickname {
    position: fixed; inset: 0;
    background: var(--c-dark);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    animation: lobby-enter .55s cubic-bezier(.16,1,.3,1) both;
}

#nickname-card {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center;
    gap: 0.85rem;
    width: min(90vw, 340px);
    padding: 2rem 1.75rem 1.75rem;
    background: var(--c-surf); border: 1px solid var(--c-border);
    border-radius: 18px;
}
#nickname-card .logo-text { font-size: 1.6rem; margin-bottom: .25rem; }

#nickname-card .form-label { align-self: flex-start; margin-top: .25rem; }
#nickname-card input[type="text"] { text-align: center; font-size: 1rem; }
#nickname-card .btn-primary { margin-top: .35rem; }

@media (max-width: 480px) {
    #nickname-card { padding: 1.5rem 1.25rem; }
}

.input-shake { animation: input-shake .32s ease; border-color: var(--c-red) !important; }
@keyframes input-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}
