:root {
  --fundo: #0b0f17;
  --cartao: #141a26;
  --cartao-2: #1c2433;
  --linha: #263044;
  --texto: #eef2f8;
  --suave: #8c97ab;
  --verde: #22d172;
  --verde-escuro: #052e18;
  --time1: #f4f6fb;
  --time2: #07080a;
  --vermelho: #ff5a67;
  --amarelo: #ffc933;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--fundo); color: var(--texto); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }
h2 { font-size: 1.05rem; }
h2 em { color: var(--suave); font-style: normal; font-weight: 400; }
small, .suave { color: var(--suave); }

.topo { flex: none; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto; padding: 18px 16px 8px; }
.marca { display: flex; align-items: center; gap: 12px; }
.marca strong { display: block; font-size: 1.25rem; letter-spacing: -.02em; }
.bola { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--verde); font-size: 22px; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 99px; background: var(--cartao-2); font-size: .82rem; white-space: nowrap; }

/* Menu em abas no topo; continua visível ao rolar a página */
.abas { flex: none; width: 100%; display: flex; max-width: 760px; margin: 0 auto 4px; padding: 0 12px; background: var(--fundo); border-bottom: 1px solid var(--linha); }
.abas button { flex: 1; padding: 13px 0 11px; color: var(--suave); font-size: .88rem; font-weight: 600; border-bottom: 3px solid transparent; }
.abas button:hover { color: var(--texto); }
.abas button.ativo { color: var(--verde); border-bottom-color: var(--verde); }

main { max-width: 760px; margin: 0 auto; padding: 8px 12px; }
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.vazio { text-align: center; padding: 40px 20px; }
.vazio p { margin-bottom: 16px; color: var(--suave); }
.titulo { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.linha { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.linha.centro { justify-content: center; }
.linha.fim { justify-content: flex-end; }
.duas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }

.destaque { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #10402a, var(--cartao) 70%); }
.destaque input { display: block; background: transparent; border: 0; font-size: 1.35rem; font-weight: 700; }
.contador { text-align: center; }
.contador b { display: block; font-size: 2rem; line-height: 1; color: var(--verde); }

.btn { display: inline-block; background: var(--verde); color: var(--verde-escuro); font-weight: 700; border-radius: 10px; padding: 10px 16px; cursor: pointer; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.fraco { background: var(--cartao-2); color: var(--texto); }
.btn.texto { background: none; color: var(--suave); }
.btn.perigo { color: var(--vermelho); }
.btn.pequeno { padding: 6px 12px; font-size: .85rem; }
.btn.largo { width: 100%; margin-top: 12px; }

.lista { list-style: none; }
.lista li + li { border-top: 1px solid var(--linha); }
.item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 2px; }
.item.inativo { opacity: .45; }
.info { flex: 1; min-width: 0; }
.info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--cartao-2); font-size: .78rem; font-weight: 700; border: 2px solid var(--linha); }
.pos-ZAG { border-color: #4da3ff; }
.pos-MEI { border-color: var(--verde); }
.pos-ATA { border-color: var(--vermelho); }
.nota { min-width: 34px; text-align: center; border-radius: 7px; padding: 2px 6px; font-weight: 700; font-size: .85rem; color: #0b0f17; }
.nota.alta { background: var(--verde); }
.nota.media { background: var(--amarelo); }
.nota.baixa { background: #ff8a5c; }
.check { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--linha); font-weight: 800; }
.marcado .check { background: var(--verde); border-color: var(--verde); color: var(--verde-escuro); }
.seta { color: var(--suave); font-size: 1.4rem; }
.trocar { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--cartao-2); }

.etiqueta { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 6px; padding: 2px 8px; color: #0b0f17; text-transform: uppercase; }
.etiqueta.time-1 { background: var(--time1); }
.etiqueta.time-2 { background: var(--time2); color: #fff; border: 1px solid #5a6270; }

.placar { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin-top: 12px; }
.placar label { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.placar input { width: 88px; text-align: center; font-size: 2rem; font-weight: 800; background: var(--cartao-2); border: 1px solid var(--linha); border-radius: 12px; padding: 6px; }
.placar b { font-size: 1.5rem; color: var(--suave); padding-bottom: 14px; }

.jogo summary { cursor: pointer; list-style: none; text-align: center; }
.resultado { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 4px; }
.resultado span { color: var(--suave); text-align: right; }
.resultado span:last-child { text-align: left; }
.resultado .venceu { color: var(--texto); font-weight: 700; }
.resultado b { font-size: 1.6rem; background: var(--cartao-2); border-radius: 10px; padding: 2px 14px; }

.seletor { display: flex; gap: 6px; margin-bottom: 12px; }
.seletor button { flex: 1; padding: 9px 4px; border-radius: 99px; background: var(--cartao); border: 1px solid var(--linha); font-weight: 600; font-size: .85rem; }
.seletor button.ativo { background: var(--verde); border-color: var(--verde); color: var(--verde-escuro); }
.lider { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #4a3a08, var(--cartao) 70%); }
.lider.piores { background: linear-gradient(135deg, #4a131a, var(--cartao) 70%); }
.lider.frequencia { background: linear-gradient(135deg, #10402a, var(--cartao) 70%); }
.lider h2 { font-size: 1.5rem; }
.trofeu { font-size: 44px; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; white-space: nowrap; }
th, td { padding: 9px 5px; text-align: center; }
th { color: var(--suave); font-size: .72rem; text-transform: uppercase; }
td { border-top: 1px solid var(--linha); }
.esq { text-align: left; }
.podio td:first-child { color: var(--verde); font-weight: 800; }
.forma { display: inline-flex; gap: 2px; }
.forma i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; font-style: normal; font-size: .62rem; font-weight: 800; color: #0b0f17; }
.forma .v { background: var(--verde); }
.forma .e { background: var(--suave); }
.forma .d { background: var(--vermelho); }

.roleta { text-align: center; font-size: 1.8rem; font-weight: 800; background: var(--cartao-2); border-radius: 14px; padding: 28px 10px; margin-top: 12px; overflow-wrap: anywhere; }
.nuvem { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

label { display: block; }
input:not([type=range], [type=checkbox], [type=number], [type=date]), select, textarea { width: 100%; background: var(--cartao-2); border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; margin-top: 4px; }
input[type=range] { width: 100%; accent-color: var(--verde); }
.campo-texto { margin-top: 10px; }
dialog { margin: auto; width: min(420px, calc(100% - 24px)); background: var(--cartao); color: var(--texto); border: 1px solid var(--linha); border-radius: 18px; padding: 20px; }
dialog::backdrop { background: #000a; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
.caixa { display: flex; align-items: center; gap: 8px; }

.aviso { position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translate(-50%, 10px); width: max-content; max-width: calc(100% - 32px); background: var(--texto); color: var(--fundo); font-weight: 600; border-radius: 10px; padding: 10px 16px; opacity: 0; pointer-events: none; transition: .2s; }
.aviso.visivel { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .forma i:nth-last-child(n+4) { display: none; }
  th, td { padding: 9px 3px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- A página não rola: a rolagem fica dentro de cada bloco ---------- */
main { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-bottom: 12px; overflow: auto; }
main > * { flex: none; }
.cartao.cresce { display: flex; flex-direction: column; min-height: 0; }
main > .cresce, main > .rodada { flex: 1 1 0; min-height: 200px; }
.rolo { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--linha) transparent; }
.cartao.tabela { padding: 8px; }
thead th { position: sticky; top: 0; background: var(--cartao); }
.jogo { border-top: 1px solid var(--linha); padding: 12px 0; }
.premiados { display: flex; flex-direction: column; max-height: 30%; min-height: 130px; }

.rodada { display: flex; flex-direction: column; }
.rodada > * { flex: none; }
.rodada > .cresce { flex: 1 1 0; }
.rodada > .destaque { padding-top: 10px; padding-bottom: 10px; }

/* Computador: presença à esquerda, escalação e placar à direita */
@media (min-width: 900px) {
  body:has(.rodada.com-times) :is(.topo, .abas, main) { max-width: 1180px; }
  .so-celular { display: none; }
  .rodada.com-times { display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; column-gap: 12px; }
  .rodada.com-times > .destaque { grid-column: 1 / -1; }
  .rodada.com-times > .bloco-presenca { grid-column: 1; grid-row: 2 / 4; }
  .rodada.com-times > .bloco-times { grid-column: 2; grid-row: 2; }
  .rodada.com-times > .bloco-placar { grid-column: 2; grid-row: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .bloco-placar .placar { margin-top: 0; }
  .bloco-placar .placar input { width: 70px; font-size: 1.4rem; padding: 2px; }
  .bloco-placar .placar b { padding-bottom: 6px; }
  .bloco-placar .btn.largo { width: auto; margin-top: 0; }
}

/* Celular: um bloco por vez, escolhido em Presença | Times | Placar */
@media (max-width: 899px) {
  .rodada[data-ver="presenca"] > :is(.bloco-times, .bloco-placar),
  .rodada[data-ver="times"] > :is(.bloco-presenca, .bloco-placar),
  .rodada[data-ver="placar"] > :is(.bloco-presenca, .bloco-times) { display: none; }
}

.nota.incognita { background: var(--suave); }

/* ---------- Escalação no visual do Winning Eleven 2002 ---------- */
.we { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .92fr) minmax(0, 1fr); gap: 10px; align-items: start; background: #000; padding: 10px; border-radius: 4px; font-family: "Bahnschrift SemiCondensed", "Bahnschrift", "Arial Narrow", sans-serif; color: #f2f2f2; text-shadow: 1px 1px 0 #000; }
.we-lado.time-1 { grid-column: 1; grid-row: 1; }
.we-lado.time-2 { grid-column: 3; grid-row: 1; }
.we-formacao { background: linear-gradient(#4d7a5c, #1f3d2c); border: 1px solid #7e9c86; padding: 3px 5px 4px; margin-bottom: 5px; }
.we h3 { display: flex; align-items: center; gap: 6px; font-size: .95rem; text-transform: uppercase; letter-spacing: .14em; }
.we h3 span { white-space: nowrap; }
.we h3 em { margin-left: auto; font-style: normal; color: #ffd23a; letter-spacing: 0; }
.time-2 h3 { flex-direction: row-reverse; }
.time-2 h3 em { margin: 0 auto 0 0; }
.we-bandeira { flex: none; width: 16px; height: 11px; transform: skewX(-8deg); border: 1px solid #888; background: #fff; }
.time-2 .we-bandeira { background: #000; }
.mini { position: relative; height: clamp(70px, 14vh, 140px); margin-top: 3px; border: 1px solid #cfe3cf; background: repeating-linear-gradient(90deg, #4f8a45 0 10%, #437a3b 10% 20%); }
.mini::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid #ffffffaa; }
.mini::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 1px solid #ffffffaa; border-radius: 50%; background:
  none; }
.mini i { position: absolute; z-index: 1; width: 8px; height: 8px; transform: translate(-50%, -50%); border-radius: 50%; background: #35e0c0; box-shadow: 0 0 0 1px #05241d; }
.time-2 .mini i { background: #f06ad0; box-shadow: 0 0 0 1px #2c0624; }
.mini i.sel { width: 12px; height: 12px; background: #ffb020; }
.we-barra { height: 7px; margin-top: 4px; background: radial-gradient(circle, #5dff7a 2px, transparent 2.5px) left / 8px 7px repeat-x; }
.time-2 .we-barra { background-image: radial-gradient(circle, #ff5a6a 2px, transparent 2.5px); }
.we ul { list-style: none; }
.we li button { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 2px; width: 100%; height: clamp(24px, 3.6vh, 32px); margin-bottom: 2px; padding: 0; font-size: 1.12rem; letter-spacing: .04em; text-shadow: inherit; border: 2px solid transparent; }
.we .time-2 li button { grid-template-columns: 44px minmax(0, 1fr); }
.we-nome, .we-pos { display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; }
.we-nome { background: linear-gradient(#2c5a94, #17365f); border-top: 1px solid #5d86bd; padding: 0 4px; }
.time-2 .we-nome { order: 2; background: linear-gradient(#7a2c4c, #4a1530); border-top-color: #a85a7a; }
.we-pos { font-size: .9rem; font-style: italic; font-weight: 700; border-top: 1px solid #ffffff55; }
.we-pos.pos-ZAG { background: linear-gradient(#3a7a86, #1d4750); }
.we-pos.pos-MEI { background: linear-gradient(#3d8a55, #1f5230); }
.we-pos.pos-ATA { background: linear-gradient(#8a4a7a, #532849); }
.we li button.sel { border-color: #ffa41c; box-shadow: 0 0 6px #ffa41c; }

.we-meio { grid-column: 2; grid-row: 1; align-self: stretch; display: flex; flex-direction: column; gap: 6px; }
.we-logo { background: #000; border: 2px solid #8d8d9a; padding: 14px 8px; text-align: center; }
.we-logo div { background: #fff; color: #0a0a0a; text-shadow: none; padding: 4px 2px 0; }
.we-logo small { display: block; font-size: .6rem; letter-spacing: .3em; text-transform: uppercase; }
.we-logo b { display: block; font-size: 1.25rem; font-style: italic; font-weight: 800; }
.we-logo i { display: block; font-weight: 800; letter-spacing: .5em; color: #fff; background: repeating-linear-gradient(#d7202c 0 3px, #fff 3px 4px); text-shadow: 1px 1px 0 #7a0d14; }
.we-ficha { flex: 1; background: linear-gradient(135deg, #3b2230, #1a1420 60%, #2a1c3a); border: 2px solid #8d8d9a; padding: 6px 8px; text-transform: uppercase; }
.we-ficha header { display: flex; justify-content: space-between; gap: 6px; font-size: .8rem; color: #cfd2da; }
.we-ficha strong { display: block; text-align: center; font-size: 1.05rem; color: #ffb020; overflow-wrap: anywhere; }
.we-ficha p { text-align: center; padding: 14px 0; color: #cfd2da; }
.we-ficha dl div { display: flex; justify-content: space-between; letter-spacing: .08em; font-size: .95rem; line-height: 1.35; }
.we-ficha dd { color: #ffd23a; font-weight: 700; }
.we-ficha button { width: 100%; margin-top: 6px; padding: 4px; border: 2px solid #ffa41c; text-transform: uppercase; }

@media (max-width: 640px) {
  .we { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 5px; }
  .we-lado.time-2 { grid-column: 2; }
  .we-meio { grid-column: 1 / -1; grid-row: 2; }
  .we-logo { display: none; }
  .we h3 { font-size: .74rem; letter-spacing: .02em; }
  .we li button { font-size: .92rem; grid-template-columns: minmax(0, 1fr) 30px; }
  .we .time-2 li button { grid-template-columns: 30px minmax(0, 1fr); }
  .we-pos { font-size: .68rem; }
}

.previa { display: block; max-width: 100%; max-height: 52vh; margin: 0 auto; border-radius: 8px; }
a.btn { text-decoration: none; }

.bandeira { display: inline-block; width: 36px; height: 24px; vertical-align: middle; border: 1px solid #5a6270; border-radius: 3px; margin: 0 4px; }

/* Sorteio: o cartão de cima ocupa só o que precisa; "Já sorteados" fica com o resto */
main > .cartao.cresce:has([data-rolo="sorteio"]) { flex: 0 1 auto; min-height: 0; }
[data-rolo="sorteio"] { flex: 0 1 auto; }
main > .premiados { flex: 1 0 240px; max-height: none; min-height: 240px; }
