:root {
  --bg: #0b1220; --bg2: #0f172a; --card: #131c2e; --card2: #1a2438; --line: #24304a;
  --txt: #e8eef7; --mut: #8b9ab3; --acc: #22c55e; --acc2: #16a34a; --gold: #facc15;
  --red: #ef4444; --yel: #facc15; --blue: #3b82f6;
  --r: 14px; --top: 56px; --tab: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--mut); } .small { font-size: 13px; } .center { text-align: center; } .grow { flex: 1; min-width: 0; }
.pad { padding: 14px 16px; }

/* ---------- topo e abas ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: calc(var(--top) + var(--safe-t)); padding: var(--safe-t) 12px 0; display: flex; align-items: center; gap: 10px;
  background: rgba(11, 18, 32, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .2px; }
.brand em { font-style: normal; color: var(--acc); }
.top-title { margin-left: auto; color: var(--mut); font-size: 13px; font-weight: 600; }
.icon-btn { background: none; border: 0; font-size: 30px; line-height: 1; padding: 0 6px 4px; cursor: pointer; }
.demo { background: var(--gold); color: #111; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }
.offline { background: #7c2d12; color: #fde68a; text-align: center; font-size: 13px; padding: 6px; }
.view { max-width: 720px; margin: 0 auto; padding: 12px 12px calc(var(--tab) + var(--safe-b) + 24px); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(11, 18, 32, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--mut); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--acc); }

/* ---------- seções ---------- */
.sec { display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: #cbd5e1; margin: 22px 4px 10px; }
.sec a { margin-left: auto; font-size: 12px; color: var(--acc); text-transform: none; letter-spacing: 0; font-weight: 600; }
.sec .muted, .sec small { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; }
.live-title { color: var(--red); }
.live-title i, .chip.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 10px; }
.list { display: grid; gap: 8px; }
.note { background: var(--card2); border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.note.err { border-color: var(--red); }
.legend { color: var(--mut); font-size: 12px; margin: 6px 4px 14px; }
.empty { text-align: center; color: var(--mut); padding: 24px 12px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }
.empty-ico { font-size: 28px; opacity: .6; }
.skeleton { height: 92px; border-radius: var(--r); margin: 12px 0; background: linear-gradient(90deg, var(--card) 0, var(--card2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
.skeleton.short { height: 200px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- hero ---------- */
.hero { background: radial-gradient(120% 140% at 0 0, #14532d 0, #0f2a1d 45%, var(--card) 100%); border: 1px solid #1f3d2c; border-radius: 18px; padding: 18px 16px; }
.hero-title span { color: var(--acc); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.hero h1 { font-size: 26px; font-weight: 900; margin-top: 2px; }
.hero-stats { display: flex; gap: 10px; margin-top: 14px; }
.hero-stats div { flex: 1; background: rgba(0,0,0,.25); border-radius: 12px; padding: 8px 10px; }
.hero-stats b { display: block; font-size: 20px; } .hero-stats small { color: var(--mut); font-size: 11px; }

/* ---------- escudo ---------- */
.crest { --s: 32px; --c: #334155; width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-size: calc(var(--s) * .38); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); letter-spacing: -.3px; }

/* ---------- card de partida ---------- */
.match { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 12px; }
.match:active { background: var(--card2); }
.match.is-live { border-color: rgba(239,68,68,.55); box-shadow: 0 0 0 1px rgba(239,68,68,.2) inset; }
.match-meta { display: flex; align-items: center; gap: 6px; color: var(--mut); font-size: 12px; margin-bottom: 8px; }
.match-meta .chip { margin-left: auto; }
.match-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.match-row .tn { flex: 1; font-weight: 600; }
.match-row .sc { font-weight: 800; font-size: 18px; min-width: 22px; text-align: right; }
.match-row.lose .tn, .match-row.lose .sc { color: var(--mut); font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card2); color: var(--mut); text-transform: uppercase; letter-spacing: .3px; }
.chip.live { background: rgba(239,68,68,.15); color: #fca5a5; }
.chip.encerrada { background: rgba(34,197,94,.12); color: #86efac; }
.chip.adiada, .chip.cancelada { background: rgba(250,204,21,.12); color: #fde68a; }

/* ---------- placar grande ---------- */
.board { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: 18px; padding: 14px 10px 16px; }
.board.is-live { border-color: rgba(239,68,68,.5); }
.board-meta, .board-info { text-align: center; color: var(--mut); font-size: 12px; }
.board-info { margin-top: 12px; }
.board-main { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; margin-top: 12px; }
.board-team { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.board-team b { font-size: 15px; }
.board-score { text-align: center; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-width: 120px; }
.board-score > span { font-size: 46px; font-weight: 900; line-height: 1; }
.board-score em { font-style: normal; color: var(--mut); font-size: 28px; }
.board-score em.vs { font-size: 36px; }
.board-score > div { flex-basis: 100%; }

/* ---------- linha do tempo ---------- */
.timeline { padding: 4px 0; }
.ev { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 14px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev.a { flex-direction: row-reverse; text-align: right; }
.ev .ev-txt { flex: 1; } .ev .ev-min { color: var(--mut); font-size: 12px; min-width: 44px; }
.ev.a .ev-min { text-align: left; }
.ev.editable { cursor: pointer; } .ev.editable:active { background: var(--card2); }
.card-y, .card-r { display: inline-block; width: 10px; height: 14px; border-radius: 2px; background: var(--yel); vertical-align: -2px; }
.card-r { background: var(--red); }

/* ---------- tabelas ---------- */
.table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table.scroll { overflow-x: auto; }
.table th { color: var(--mut); font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .l { text-align: left; }
.table td:first-child { color: var(--mut); font-weight: 700; width: 30px; }
.table tr.lead td:first-child { color: var(--acc); box-shadow: inset 3px 0 0 var(--acc); }
.team-cell { font-weight: 600; }
.team-cell a { display: inline-flex; align-items: center; gap: 8px; }
td.team-cell > .crest { vertical-align: middle; margin-right: 8px; }
.forma { white-space: nowrap; }
.forma .f + .f { margin-left: 3px; }
.f { width: 18px; height: 18px; border-radius: 4px; font-size: 10px; font-style: normal; font-weight: 800; display: inline-grid; place-items: center; color: #fff; }
.f.V { background: var(--acc2); } .f.E { background: #64748b; } .f.D { background: #dc2626; }

/* ---------- linhas ---------- */
.srow { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.srow:last-child { border-bottom: 0; }
.srow b { display: block; font-weight: 600; } .srow small { color: var(--mut); font-size: 12px; display: block; }
.srow.off { opacity: .5; }
.btnrow { cursor: pointer; } .btnrow:active { background: var(--card2); }
.pos { width: 28px; color: var(--mut); font-weight: 800; } .pos.gold { color: var(--gold); }
.goals { font-size: 20px; font-weight: 900; color: var(--acc); }
.num { width: 24px; color: var(--mut); font-weight: 700; text-align: center; font-size: 13px; }
.stat { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; margin-left: 6px; }
.badge { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.badge.red { background: rgba(239,68,68,.15); color: #fca5a5; } .badge.gray { background: var(--card2); color: var(--mut); }
.chev { color: var(--mut); font-size: 22px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.menu-item:last-child { border-bottom: 0; }
.menu-item small { display: block; color: var(--mut); font-size: 12px; }
.mi { font-size: 22px; width: 30px; text-align: center; }
details.more summary { padding: 12px 14px; cursor: pointer; color: var(--mut); font-weight: 600; }

/* ---------- equipes ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.team-tile { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--r); padding: 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.team-tile small { color: var(--mut); font-size: 12px; }
.team-head { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, var(--card)), var(--card)); border: 1px solid var(--line); }
.team-head h1 { font-size: 24px; } .team-head p { margin: 4px 0 0; color: #cbd5e1; font-size: 13px; }
.rules { line-height: 1.6; }
.pts { display: flex; gap: 10px; text-align: center; } .pts div { flex: 1; background: var(--card2); border-radius: 10px; padding: 10px; }
.pts b { display: block; font-size: 24px; color: var(--acc); } .pts small { color: var(--mut); }
.crit { margin: 0; padding-left: 20px; line-height: 1.8; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #04210f; }
.btn.danger { background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.45); color: #fca5a5; }
.btn.ghost { background: transparent; }
.btn.wa { background: #25d366; border-color: #25d366; color: #052e16; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; }
.share-bar { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.row-btns { display: flex; gap: 8px; margin-top: 14px; } .row-btns .btn { flex: 1; }

/* ---------- admin ---------- */
.admin-top { position: sticky; top: calc(var(--top) + var(--safe-t)); z-index: 10; background: var(--bg); padding: 4px 0 8px; margin: -4px 0 4px; }
.segs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--mut); }
.seg.on { background: var(--card2); color: var(--txt); box-shadow: 0 0 0 1px var(--line); }
.acard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.acard.is-live { border-color: rgba(239,68,68,.55); }
.acard .t { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.acard .t.r { justify-content: flex-end; }
.acard .s { font-weight: 900; font-size: 20px; }
.acard .m { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--mut); font-size: 12px; }
.console-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.back { color: var(--acc); font-weight: 700; }
.actions { display: flex; gap: 8px; margin: 12px 0; } .actions .btn { flex: 1; min-height: 50px; }
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.tab { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 13px; color: var(--mut); }
.tab.on { background: var(--acc); border-color: var(--acc); color: #04210f; }
.pad-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pad-team { display: flex; align-items: center; gap: 8px; justify-content: center; min-width: 0; }
.pad-team b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big-btn { min-height: 76px; border-radius: 14px; border: 0; font-size: 22px; font-weight: 900; letter-spacing: 1px; cursor: pointer; }
.big-btn.goal { background: var(--acc); color: #04210f; box-shadow: 0 6px 18px rgba(34,197,94,.25); }
.big-btn:active, .mini-btn:active, .pick-btn:active { transform: scale(.97); }
.pad-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mini-btn { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.link-btn { background: none; border: 0; color: var(--mut); font-size: 12px; text-decoration: underline; padding: 4px; cursor: pointer; }
.team-admin .ta-head, .round-admin .ta-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.team-admin > .btn, .round-admin > .btn { border-radius: 0; border: 0; border-top: 1px solid var(--line); color: var(--acc); }
.team-admin, .round-admin { margin-bottom: 12px; }
.login { max-width: 400px; margin: 24px auto; text-align: center; }
.login-ico { font-size: 36px; }
.login form { text-align: left; margin-top: 12px; }

/* ---------- formulários ---------- */
label { display: block; font-size: 13px; color: var(--mut); font-weight: 600; margin: 10px 0 0; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--txt); font-size: 16px; }
input[type=color] { padding: 4px; }
textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: 0; border-color: transparent; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--txt); font-weight: 500; font-size: 14px; }
label.check input { width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: var(--acc); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form h3 { margin: 20px 0 2px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: #cbd5e1; }
.form .btn.block { margin-top: 18px; }
.crit-edit { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.crit-edit li { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-bottom: 1px solid var(--line); }
.crit-edit li:last-child { border-bottom: 0; }
.crit-edit label { flex: 1; margin: 0; }
.crit-edit button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card2); color: var(--mut); cursor: pointer; }

/* ---------- folha inferior ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet.open { pointer-events: auto; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fade .15s; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto; background: var(--card); border-top-left-radius: 20px; border-top-right-radius: 20px;
  padding: 8px 16px calc(18px + var(--safe-b)); max-width: 720px; margin: 0 auto; animation: up .2s ease-out; border: 1px solid var(--line); }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-size: 18px; margin-bottom: 4px; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.pick-btn { min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; padding: 0 12px; text-align: left; cursor: pointer; }
.pick-btn small { margin-left: auto; color: #fca5a5; font-size: 10px; text-transform: uppercase; }
.pick-btn.sus { border-color: rgba(239,68,68,.45); opacity: .8; }
.pick-btn.ghosty { grid-column: 1 / -1; justify-content: center; color: var(--mut); background: transparent; border-style: dashed; }
.quick-add { display: flex; gap: 8px; margin-top: 6px; } .quick-add input { margin: 0; } .quick-add .btn { white-space: nowrap; }
.sug { background: var(--card2); border-radius: 10px; padding: 10px 12px; margin: 8px 0; } .sug b { display: block; color: var(--acc); font-size: 13px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab) + var(--safe-b) + 12px); z-index: 60; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  background: #f8fafc; color: #0f172a; border-radius: 12px; padding: 12px 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { transform: none; opacity: 1; pointer-events: auto; }
.toast.err { background: #fee2e2; color: #7f1d1d; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--acc2); font-weight: 800; text-transform: uppercase; font-size: 13px; cursor: pointer; padding: 6px; }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .board-score > span { font-size: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
