/* ===== Bolão Copa 2026 — estilos ===== */
:root {
  --bg: #0b1020;
  --bg2: #131a30;
  --card: #1a2340;
  --card2: #212c4f;
  --line: #2c3760;
  --txt: #eef2ff;
  --muted: #9aa6c7;
  --accent: #00c389;     /* verde campo */
  --accent2: #2563eb;    /* azul */
  --gold: #ffd24a;
  --danger: #ff5d6c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b264a 0%, var(--bg) 55%) fixed;
  color: var(--txt);
  min-height: 100vh;
  font-size: 15px;
}
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: linear-gradient(90deg, var(--bg2), #0d1428);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.brand .ball { font-size: 22px; }
.brand small { color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 6px; margin-left: 10px; flex-wrap: wrap; }
.nav button {
  background: transparent; color: var(--muted); border: 0;
  padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.nav button:hover { color: var(--txt); background: rgba(255,255,255,.05); }
.nav button.active { color: #04221a; background: var(--accent); }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.userbox b { color: var(--txt); }
.badge-admin { background: var(--gold); color: #2a2200; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-mode { background: var(--card2); color: var(--muted); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.namebtn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 5px; border-radius: 7px; line-height: 1; }
.namebtn:hover { color: var(--txt); background: rgba(255,255,255,.07); }

/* modal genérico */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 120; padding: 18px; animation: fade .15s ease; }
.modal-card { width: 100%; max-width: 400px; padding: 22px; }
.modal-card h3 { font-size: 17px; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { width: auto; flex: 1; margin-top: 0; }

/* ===== Layout ===== */
.wrap { max-width: 1180px; margin: 26px auto; padding: 0 18px 60px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }
h1.page { font-size: 24px; margin: 4px 0 4px; }
.sub { color: var(--muted); margin: 0 0 22px; }

/* ===== Cards ===== */
.card {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.grid-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.group-card { padding: 16px; }
.group-card h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.group-tag { background: var(--accent2); color: #fff; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }

/* standings mini-table */
table.stand { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
table.stand th, table.stand td { text-align: center; padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.stand th { color: var(--muted); font-weight: 600; }
table.stand td.team { text-align: left; font-weight: 600; }
table.stand tr.q1 td.team { color: var(--accent); }
table.stand tr.q2 td.team { color: #7fb2ff; }
table.stand tr.q3 td.team { color: var(--gold); }
.posdot { display:inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--line); }
tr.q1 .posdot { background: var(--accent);} tr.q2 .posdot{background:#7fb2ff;} tr.q3 .posdot{background:var(--gold);}

/* match row */
.match-wrap { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.match-wrap:last-child { border-bottom: 0; }
.mmeta { font-size: 11px; color: var(--muted); margin-bottom: 5px; line-height: 1.5; }
.mmeta .dot { margin: 0 6px; opacity: .5; }
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.match .home { text-align: right; }
.match .away { text-align: left; }
.match .tname { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 0; }
.match .home .tname { justify-content: flex-end; }
.match .away .tname { justify-content: flex-start; }

/* bandeiras */
.flag {
  width: 22px; height: 15px; object-fit: cover; border-radius: 2px;
  margin-right: 7px; vertical-align: middle; flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.tname .tn { vertical-align: middle; }
.score-input {
  width: 42px; height: 38px; text-align: center; font-size: 16px; font-weight: 700;
  background: var(--bg); color: var(--txt); border: 1px solid var(--line); border-radius: 9px;
}
.score-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,195,137,.25); }
.vs { display: flex; align-items: center; gap: 6px; }
.vs .x { color: var(--muted); font-weight: 700; }
.round-label { color: var(--muted); font-size: 12px; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .5px; }

/* pk chooser */
.pk { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.pk button { font-size: 11px; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.pk button.sel { background: var(--gold); color: #2a2200; border-color: var(--gold); font-weight: 800; }
.pk-label { font-size: 11px; color: var(--muted); text-align: center; }

/* ===== Bracket ===== */
.bracket-scroll { overflow-x: auto; padding-bottom: 14px; }
.bracket { display: flex; gap: 26px; min-width: 1500px; }
.bcol { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 240px; }
.bcol h4 { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin: 0 0 4px; }
.ko-match { padding: 10px; }
.ko-match.waiting { opacity: .72; }
.ko-match.waiting .tname.tbd { font-style: normal; }
.ko-num { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; opacity: .7; }
.ko-match .mmeta { margin-top: 8px; margin-bottom: 0; border-top: 1px solid var(--line); padding-top: 6px; }
.ko-team { display: flex; align-items: center; gap: 8px; padding: 5px 4px; }
.ko-team .tname { flex: 1; font-size: 13px; font-weight: 600; display: flex; align-items: center; }
.ko-team .tname.tbd { color: var(--muted); font-weight: 500; font-style: italic; }
.ko-team.win .tname { color: var(--accent); }
.ko-team .score-input { width: 38px; height: 32px; font-size: 14px; }
.ko-sep { height: 1px; background: var(--line); margin: 2px 0; }

/* ===== Leaderboard ===== */
table.board { width: 100%; border-collapse: collapse; }
table.board th, table.board td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.board th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.board td.pts { text-align: right; font-weight: 800; font-size: 17px; }
table.board tr.me { background: rgba(0,195,137,.08); }
.rank { font-weight: 800; width: 36px; }
.rank.r1 { color: var(--gold);} .rank.r2{color:#cdd3e6;} .rank.r3{color:#d8975a;}

/* ===== Auth ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 410px; padding: 30px; }
.auth-card h2 { margin: 0 0 6px; }
.auth-tabs { display: flex; gap: 8px; margin: 18px 0; }
.auth-tabs button { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-weight: 700; }
.auth-tabs button.active { background: var(--accent); color: #04221a; border-color: var(--accent); }
label.field { display: block; margin: 12px 0; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input.txt {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--txt); font-size: 15px;
}
input.txt:focus { outline: none; border-color: var(--accent); }
.btn {
  width: 100%; padding: 12px; border: 0; border-radius: 10px; font-weight: 800; font-size: 15px;
  background: var(--accent); color: #04221a; margin-top: 8px;
}
.btn.secondary { background: var(--card2); color: var(--txt); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.msg { margin-top: 12px; font-size: 14px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #04221a; padding: 12px 20px; border-radius: 10px; font-weight: 700; box-shadow: var(--shadow); z-index: 100; animation: fade .2s; max-width: 90vw; text-align: center; }
.toast.err { background: var(--danger); color: #fff; }

/* indicador "Salvo ✓" */
.savebar {
  position: fixed; bottom: 18px; right: 18px; padding: 8px 14px; border-radius: 10px;
  font-weight: 700; font-size: 13px; opacity: 0; transform: translateY(8px);
  pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; box-shadow: var(--shadow);
}
.savebar.show { opacity: 1; transform: none; }
.savebar.saving { background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.savebar.ok { background: var(--accent); color: #04221a; }
.savebar.err { background: var(--danger); color: #fff; }

/* trava de palpite */
.score-input:disabled, .score-input.locked { opacity: .5; cursor: not-allowed; background: #10162b; }
.pk button:disabled { opacity: .45; cursor: not-allowed; }
.lockchip { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.lockchip.closed { background: rgba(255,93,108,.16); color: #ff97a1; border: 1px solid rgba(255,93,108,.4); }
.lockchip.open { background: rgba(0,195,137,.12); color: #7ee5c2; border: 1px solid rgba(0,195,137,.3); }

/* admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }
.note { background: rgba(255,210,74,.1); border: 1px solid rgba(255,210,74,.4); color: #ffe7a3; padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.section-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 24px; }
.statline { color: var(--muted); font-size: 14px; margin: -10px 0 18px; }
.tname.inp { width: 100%; }
.team-edit { display: grid; grid-template-columns: 40px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.team-edit span { color: var(--muted); font-size: 12px; }

/* termo de participação */
.terms-box { max-height: 46vh; overflow-y: auto; font-size: 13.5px; line-height: 1.55; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 16px 0; }
.terms-box p { margin: 0 0 11px; }
.terms-box p:last-child { margin-bottom: 0; }
.terms-check { display: flex; align-items: center; gap: 9px; font-size: 14px; margin: 4px 0 12px; cursor: pointer; }
.terms-check input { width: 17px; height: 17px; }

/* seletor de artilheiro */
.ts-row { display: flex; align-items: center; gap: 10px; }
.ts-flag { display: inline-flex; flex: 0 0 auto; }
.ts-flag .flag { width: 30px; height: 20px; margin: 0; }
select.txt { appearance: auto; -webkit-appearance: auto; }

/* página de regras */
.rules-card { padding: 18px; margin-bottom: 16px; }
.rules-card h3 { margin: 0 0 12px; font-size: 16px; }
.rules-list { margin: 0; padding-left: 20px; line-height: 1.6; font-size: 14px; }
.rules-list li { margin-bottom: 7px; }
.rules-table td { padding: 9px 12px; }
.rules-table td.pts { font-size: 16px; }

/* ===== Responsivo / Mobile ===== */
@media (max-width: 820px) {
  body { font-size: 14px; }
  .topbar { flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px; }
  .topbar .spacer { display: none; }
  .brand { font-size: 15px; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap;
         -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .nav::-webkit-scrollbar { height: 4px; }
  .nav button { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .userbox { margin-left: auto; font-size: 13px; }
  .wrap { margin: 16px auto; padding: 0 12px 50px; }
  .grid-groups { grid-template-columns: 1fr; gap: 14px; }
  h1.page { font-size: 20px; }
  .sub { margin-bottom: 16px; }
}
@media (max-width: 560px) {
  .userbox .greet { display: none; }            /* esconde "Olá," para sobrar espaço */
  .group-card { padding: 13px; }
  .match .tname { font-size: 13px; }
  .flag { width: 19px; height: 13px; margin-right: 5px; }
  .score-input { width: 40px; height: 40px; }    /* alvo de toque maior */
  table.stand { font-size: 11.5px; }
  table.stand th, table.stand td { padding: 4px 2px; }
  /* ranking: esconde coluna "Detalhe" no celular */
  table.board th:nth-child(3), table.board td:nth-child(3) { display: none; }
  table.board th, table.board td { padding: 9px 8px; }
  .auth-card { padding: 22px 18px; }
  .section-actions .btn.small { flex: 1 1 auto; }
}
