:root {
  --fundo: #0b1530; --fundo2: #111d3f; --cartao: #16244d; --cartao2: #1c2d5e; --linha: #2a3c73; --texto: #eef2ff; --suave: #a9b4d6;
  --acento: #ffb703; --acento2: #fb8500; --verde: #22c55e; --vermelho: #ef4444; --azul: #38bdf8; --roxo: #a78bfa;
  --raio: 12px; --sombra: 0 6px 24px rgba(0,0,0,.35);
  --seguro-topo: env(safe-area-inset-top, 0px); --seguro-baixo: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fundo); color: var(--texto); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--texto); background: var(--fundo2); border: 1px solid var(--linha); border-radius: 8px; padding: 8px 10px; }
select { padding-right: 24px; }
a { color: var(--azul); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 18px; } h3 { font-size: 15px; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; }
.oculto { display: none !important; }
.suave { color: var(--suave); } .pequeno { font-size: 12.5px; } .forte { font-weight: 700; }
.verde { color: var(--verde); } .vermelho { color: var(--vermelho); } .acento { color: var(--acento); }
.direita { text-align: right; } .centro { text-align: center; }
.linha-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.espaco { flex: 1; }

/* ---------- botões ---------- */
.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--cartao2); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 40px; }
.btn:hover { filter: brightness(1.15); } .btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.prim { background: linear-gradient(135deg, var(--acento), var(--acento2)); color: #1a1203; }
.btn.verde { background: var(--verde); color: #06210f; } .btn.verm { background: var(--vermelho); color: #fff; }
.btn.fant { background: transparent; border: 1px solid var(--linha); }
.btn.peq { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.btn.grande { padding: 14px 20px; font-size: 17px; }

/* ---------- estrutura ---------- */
#app { height: 100%; }
.casca { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; height: 100%; }
.topo { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--seguro-topo)) 14px 8px; background: var(--fundo2); border-bottom: 1px solid var(--linha); min-height: 60px; }
.topo .clube-nome { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .data { font-size: 12.5px; color: var(--suave); }
.lateral { background: var(--fundo2); border-right: 1px solid var(--linha); overflow-y: auto; padding: 10px 8px; }
.lateral button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; background: none; border: 0; padding: 9px 10px; border-radius: 8px; color: var(--suave); font-weight: 600; }
.lateral button.ativo { background: var(--cartao2); color: var(--texto); }
.lateral .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f7cab; margin: 12px 10px 4px; }
.conteudo { overflow-y: auto; padding: 16px; padding-bottom: calc(24px + var(--seguro-baixo)); }
.barra-baixo { display: none; }
.badge-n { background: var(--vermelho); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 6px; margin-left: auto; }

.grelha { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); align-items: start; }
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px; }
.cartao.clicavel { cursor: pointer; } .cartao.clicavel:hover { border-color: var(--acento); }
.separadores { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.separadores button { white-space: nowrap; background: var(--cartao); border: 1px solid var(--linha); border-radius: 99px; padding: 6px 14px; color: var(--suave); font-weight: 600; }
.separadores button.ativo { background: var(--acento); color: #1a1203; border-color: var(--acento); }
.separadores.quebra { flex-wrap: wrap; overflow: visible; }

/* ---------- emblema ---------- */
.emb { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.emb svg { width: 100%; height: 100%; display: block; }
.emb.peq { width: 24px; height: 24px; }
.emb.grd { width: 72px; height: 72px; }
.clube { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.clube span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tabelas ---------- */
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; color: var(--suave); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px; border-bottom: 1px solid var(--linha); position: sticky; top: 0; background: var(--cartao); }
.tabela td { padding: 7px 6px; border-bottom: 1px solid rgba(42,60,115,.5); }
.tabela tr.meu td { background: rgba(255,183,3,.12); }
.tabela tr.clicavel { cursor: pointer; } .tabela tr.clicavel:hover td { background: rgba(255,255,255,.04); }
.tabela td.num, .tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela tr.zona-po td:first-child { box-shadow: inset 3px 0 var(--verde); }
.tabela tr.zona-desce td:first-child { box-shadow: inset 3px 0 var(--vermelho); }
.rolar-x { overflow-x: auto; }
.forma { display: inline-flex; gap: 2px; } .forma i { width: 16px; height: 16px; border-radius: 4px; font-style: normal; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.forma i.V { background: var(--verde); color: #06210f; } .forma i.D { background: var(--vermelho); color: #fff; }

/* ---------- jogadores ---------- */
.pos { display: inline-block; min-width: 26px; text-align: center; border-radius: 6px; font-size: 11px; font-weight: 800; padding: 2px 5px; }
.pos.D { background: #7c3aed; } .pos.O { background: #dc2626; } .pos.C { background: #0891b2; } .pos.P { background: #16a34a; } .pos.L { background: #ca8a04; color: #1a1203; }
.aval { font-weight: 800; font-variant-numeric: tabular-nums; }
.barra { height: 6px; border-radius: 3px; background: #26386d; overflow: hidden; min-width: 40px; }
.barra > i { display: block; height: 100%; background: var(--verde); }
.barra.en > i { background: linear-gradient(90deg, var(--vermelho), var(--acento) 50%, var(--verde)); }
.attr { display: grid; grid-template-columns: 100px 1fr 34px; gap: 8px; align-items: center; margin: 5px 0; font-size: 13.5px; }
.attr .barra { height: 8px; }
.estrela { color: var(--acento); }
.icone-lesao { color: var(--vermelho); font-weight: 800; }

/* ---------- mensagens ---------- */
.msg-lista { display: flex; flex-direction: column; gap: 6px; }
.msg-item { display: flex; gap: 10px; padding: 10px 12px; background: var(--cartao); border: 1px solid var(--linha); border-radius: 10px; cursor: pointer; align-items: flex-start; }
.msg-item.nova { border-left: 4px solid var(--acento); }
.msg-item .as { font-weight: 700; } .msg-item.lida .as { font-weight: 500; color: var(--suave); }
.msg-texto { white-space: pre-wrap; }

/* ---------- modal / aviso ---------- */
.veu { position: fixed; inset: 0; background: rgba(3,8,22,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--cartao); border: 1px solid var(--linha); border-radius: 16px; max-width: 720px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px; box-shadow: var(--sombra); }
.modal .fechar { float: right; background: none; border: 0; font-size: 22px; color: var(--suave); }
.aviso { position: fixed; left: 50%; bottom: calc(80px + var(--seguro-baixo)); transform: translateX(-50%); background: #0f1d44; border: 1px solid var(--acento); padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: var(--sombra); max-width: 90vw; }

/* ---------- arranque ---------- */
.arranque { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 0%, #1d3a8a 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #7a3d07 0%, transparent 55%), var(--fundo); }
.arranque .caixa { background: rgba(17,29,63,.92); border: 1px solid var(--linha); border-radius: 18px; padding: 24px; max-width: 760px; width: 100%; box-shadow: var(--sombra); }
.logo { font-weight: 900; font-size: 34px; letter-spacing: -.02em; line-height: 1; }
.logo b { color: var(--acento); } .logo small { display: block; font-size: 14px; letter-spacing: .3em; color: var(--suave); margin-top: 6px; font-weight: 700; }
.bola { display: inline-block; width: 38px; height: 38px; border-radius: 50%; background: conic-gradient(var(--acento) 0 33%, #fff 0 66%, #2563eb 0); vertical-align: middle; margin-right: 10px; }
.opcoes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 14px 0; }
.opcao { background: var(--cartao); border: 2px solid var(--linha); border-radius: 12px; padding: 14px; text-align: left; }
.opcao.sel, .opcao:hover { border-color: var(--acento); }
.lista-clubes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-height: 46vh; overflow-y: auto; padding-right: 4px; }

/* ---------- jogo ao vivo ---------- */
.marcador { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: linear-gradient(180deg, #0f1f4a, #0b1736); border: 1px solid var(--linha); border-radius: 14px; padding: 10px 14px; }
.marcador .eq { display: flex; align-items: center; gap: 8px; font-weight: 800; min-width: 0; }
.marcador .eq.fora { justify-content: flex-end; text-align: right; }
.marcador .pts { font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; text-align: center; line-height: 1; }
.marcador .sets { text-align: center; font-size: 12.5px; color: var(--suave); }
.serve { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--acento); box-shadow: 0 0 8px var(--acento); }
.campo { position: relative; display: grid; grid-template-columns: 1fr 6px 1fr; background: #c26b2c; border-radius: 10px; padding: 8px; margin: 10px 0; aspect-ratio: 2.1 / 1; max-height: 300px; width: 100%; }
.meio-campo { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 6px; padding: 6px; border: 2px solid rgba(255,255,255,.85); }
.rede { background: repeating-linear-gradient(0deg, #fff 0 3px, #222 3px 6px); border-radius: 2px; }
.jcampo { background: rgba(11,21,48,.86); border-radius: 8px; padding: 4px 6px; font-size: 11.5px; display: flex; flex-direction: column; justify-content: center; min-width: 0; border: 2px solid transparent; cursor: pointer; }
.jcampo .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jcampo.sel { border-color: var(--acento); } .jcampo.lib { background: rgba(202,138,4,.9); color: #1a1203; }
.jcampo .barra { height: 4px; margin-top: 3px; }
.relato { height: 260px; overflow-y: auto; background: var(--fundo2); border: 1px solid var(--linha); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.relato div { padding: 3px 0; border-bottom: 1px dashed rgba(42,60,115,.6); }
.relato .pl { display: inline-block; min-width: 46px; color: var(--suave); font-variant-numeric: tabular-nums; }
.relato .e-set, .relato .e-fimSet, .relato .e-fim { color: var(--acento); font-weight: 700; }
.relato .e-tempo, .relato .e-sub, .relato .e-tatica { color: var(--azul); }
.controlos { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.vivo-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.banco { display: flex; gap: 6px; flex-wrap: wrap; } .banco button { font-size: 12px; padding: 5px 8px; min-height: 30px; }

/* ---------- telemóvel ---------- */
@media (max-width: 860px) {
  .casca { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .lateral { display: none; }
  .conteudo { padding: 12px; }
  .barra-baixo { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--fundo2); border-top: 1px solid var(--linha); padding-bottom: var(--seguro-baixo); }
  .barra-baixo button { background: none; border: 0; padding: 8px 2px 6px; color: var(--suave); font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
  .barra-baixo button .ic { font-size: 19px; line-height: 1; }
  .barra-baixo button.ativo { color: var(--acento); }
  .barra-baixo .badge-n { position: absolute; top: 2px; right: 18%; margin: 0; }
  .grelha { grid-template-columns: minmax(0, 1fr); }
  .grelha > * { min-width: 0; }
  .grelha select { max-width: 100%; }
  .topo { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .topo .clube-nome { font-size: 14px; }
  .topo .btn.prim { padding: 10px 12px; }
  .vivo-grid { grid-template-columns: 1fr; }
  .marcador .pts { font-size: 32px; }
  .relato { height: 200px; }
  .esconder-movel { display: none !important; }
  .tabela { font-size: 13px; } .tabela td, .tabela th { padding: 6px 4px; }
  .modal { padding: 14px; border-radius: 14px; }
  .attr { grid-template-columns: 88px 1fr 30px; }
}
@media (max-width: 420px) {
  .esconder-mini { display: none !important; }
  .logo { font-size: 28px; }
  .campo { aspect-ratio: 1.6 / 1; }
  .jcampo { font-size: 10.5px; padding: 3px 4px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .topo { min-height: 48px; padding-top: 4px; padding-bottom: 4px; }
  .relato { height: 150px; }
  .campo { max-height: 190px; }
}
