:root {
  color-scheme: light;
  --green: #0e6b3b;
  --green-dark: #08401f;
  --green-soft: #e8f3ec;
  --gold: #c9a24a;
  --gold-soft: #f6efdc;
  --ink: #17221b;
  --muted: #5f6d64;
  --line: #dfe6e1;
  --bg: #f5f7f5;
  --card: #fff;
  --red: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(8,64,31,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img { max-width: 100%; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Cabeçalho ---------- */
.hero {
  background: radial-gradient(120% 140% at 50% 0%, #138048 0%, var(--green) 45%, var(--green-dark) 100%);
  color: #fff; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 4px;
  background: linear-gradient(90deg, var(--gold), #f3d98b, var(--gold));
}
.hero-inner {
  max-width: 1100px; margin: 0 auto; padding: 18px 16px 20px;
  display: flex; align-items: center; gap: 16px;
}
.hero-logo { width: 76px; height: auto; flex: none; filter: drop-shadow(0 3px 8px rgba(0,0,0,.3)); }
.hero h1 { margin: 0; font-size: 1.35rem; letter-spacing: .02em; line-height: 1.15; text-transform: uppercase; }
.hero h1 span { color: #f3d98b; display: block; font-size: .8em; letter-spacing: .12em; }
.hero p { margin: 4px 0 0; opacity: .9; font-size: .92rem; }
@media (min-width: 720px) {
  .hero-inner { padding: 26px 24px 28px; gap: 22px; }
  .hero-logo { width: 110px; }
  .hero h1 { font-size: 2rem; }
}

/* ---------- Navegação ---------- */
.nav {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.nav-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  white-space: nowrap; padding: 14px 12px; text-decoration: none; color: var(--muted);
  font-weight: 600; font-size: .93rem; border-bottom: 3px solid transparent;
}
.tabs a.active { color: var(--green); border-bottom-color: var(--gold); }
.seg { display: inline-flex; background: var(--green-soft); border-radius: 999px; padding: 3px; flex: none; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: .85rem; color: var(--green-dark);
}
.seg button.on { background: var(--green); color: #fff; }

/* ---------- Conteúdo ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 16px 12px 48px; }
@media (min-width: 720px) { main { padding: 24px 24px 64px; } }
h2 { font-size: 1.25rem; margin: 8px 0 14px; color: var(--green-dark); }
h3 { font-size: 1.02rem; margin: 0 0 10px; color: var(--green-dark); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.notice {
  background: var(--gold-soft); border: 1px solid #ead9a8; color: #5c4710; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 16px; font-weight: 600;
}
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); text-transform: uppercase; letter-spacing: .04em; }
.badge.live { background: #fde8e7; color: var(--red); animation: pulse 1.6s infinite; }
.badge.done { background: #eceff0; color: #4a5258; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Início ---------- */
.intro { display: grid; gap: 16px; }
.welcome-title { font-size: 1.55rem; line-height: 1.2; margin-top: 4px; }
@media (min-width: 860px) { .welcome-title { font-size: 2.1rem; } .welcome .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 860px) { .intro { grid-template-columns: 1.2fr .8fr; align-items: start; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.fact { background: var(--green-soft); border-radius: 12px; padding: 10px 12px; }
.fact b { display: block; color: var(--green-dark); font-size: 1.05rem; }
.fact span { font-size: .8rem; color: var(--muted); }
.countdown { display: flex; gap: 8px; margin-top: 6px; }
.countdown div { background: var(--green-dark); color: #fff; border-radius: 10px; padding: 8px 0; min-width: 62px; text-align: center; }
.countdown b { display: block; font-size: 1.4rem; line-height: 1; }
.countdown span { font-size: .7rem; text-transform: uppercase; opacity: .8; }
.poster { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; display: block; }
.quote { font-style: italic; color: #33443a; }

/* ---------- Jogos ---------- */
.match {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center;
  padding: 12px 4px; border-top: 1px solid var(--line);
}
.match:first-child { border-top: 0; }
.match .time { text-align: center; font-weight: 700; color: var(--green-dark); line-height: 1.1; }
.match .time small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; margin-top: 3px; }
.match .meta { font-size: .75rem; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.team.away { flex-direction: row-reverse; text-align: right; }
.team .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team.tbd { color: var(--muted); font-weight: 500; font-style: italic; }
.team.win .nm { color: var(--green-dark); }
.logo { width: 28px; height: 28px; object-fit: contain; flex: none; }
.logo.lg { width: 44px; height: 44px; }
.logo.xl { width: 64px; height: 64px; }
.score {
  min-width: 64px; text-align: center; font-weight: 800; font-size: 1.1rem; background: var(--green-dark); color: #fff;
  border-radius: 8px; padding: 3px 8px; font-variant-numeric: tabular-nums;
}
.score.pending { background: #eef2ef; color: var(--muted); font-weight: 600; font-size: .9rem; }
.score small { display: block; font-size: .65rem; font-weight: 600; opacity: .85; }
.scorers { font-size: .78rem; color: var(--muted); margin-top: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scorers div:last-child { text-align: right; }
@media (max-width: 420px) { .team .nm { font-size: .9rem; } .logo { width: 24px; height: 24px; } .score { min-width: 54px; } }

.day-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; }
.day-title h3 { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- Classificações ---------- */
table.std { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.std th, .std td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.std th { font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.std td.tm { text-align: left; }
.std td.tm .team { font-weight: 600; }
.std td.pts { font-weight: 800; color: var(--green-dark); }
.std tr.q td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.std tr.q2 td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.std .hide-sm { display: none; }
@media (min-width: 560px) { .std .hide-sm { display: table-cell; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Fase final ---------- */
.bracket { display: grid; gap: 12px; }
@media (min-width: 860px) { .bracket { grid-template-columns: 1fr 1fr 1fr; align-items: center; } }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kcard .ttl { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; }
.kcard.final { border: 2px solid var(--gold); background: linear-gradient(180deg, #fffdf6, #fff); }
.krow { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-weight: 600; }
.krow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.krow.tbd { color: var(--muted); font-style: italic; font-weight: 500; }
.krow.win { color: var(--green-dark); }
.krow b { font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.podium { display: grid; gap: 8px; }
.podium .pos { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--green-soft); font-weight: 600; }
.podium .pos .n { width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: .85rem; flex: none; }
.podium .pos.p1 .n { background: var(--gold); }

/* ---------- Equipas ---------- */
.team-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tcard { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 14px; text-align: center; cursor: pointer; border: 2px solid transparent; }
.tcard:hover, .tcard:focus { border-color: var(--green-soft); outline: none; }
.tcard .logo { width: 64px; height: 64px; margin: 0 auto 8px; display: block; }
.tcard b { display: block; font-size: .95rem; }
.roster { columns: 2; column-gap: 24px; padding: 0; margin: 0; list-style: none; }
.roster li { padding: 4px 0; border-bottom: 1px dashed var(--line); break-inside: avoid; }
.roster .num { display: inline-block; min-width: 28px; font-weight: 800; color: var(--green); }

/* ---------- Diversos ---------- */
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.prog-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.prog-item:first-child { border-top: 0; }
.prog-item .t { font-weight: 800; color: var(--green-dark); min-width: 92px; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 12px 40px; }
footer img { width: 40px; opacity: .9; display: block; margin: 0 auto 6px; }
.qr { width: 160px; height: 160px; image-rendering: pixelated; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; border-radius: 10px;
  padding: 10px 16px; font-weight: 700; background: var(--green); color: #fff; text-decoration: none;
}
.btn.ghost { background: var(--green-soft); color: var(--green-dark); }
.btn.gold { background: var(--gold); color: #2c220a; }
.btn.danger { background: #fdecea; color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 560px; width: calc(100% - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(8,30,18,.5); }
dialog .dhead { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
dialog .dbody { padding: 16px; max-height: 70vh; overflow: auto; }
.close { margin-left: auto; background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.demo-bar { background: #fff7e0; color: #6b5310; text-align: center; font-size: .8rem; padding: 6px 10px; border-bottom: 1px solid #f0e2b4; }

.tabs .seg { align-self: center; margin: 0 6px; flex: none; }
@media (max-width: 559px) {
  .seg button { padding: 5px 10px; font-size: .8rem; }
  .tabs a { padding: 12px 9px; font-size: .9rem; }
}
dialog { background: #fff; color: var(--ink); }
.roster li { font-size: .88rem; padding: 3px 0; }
.roster .num { min-width: 24px; font-size: .85rem; }
.scorers .gl { display: block; line-height: 1.5; }
.scorers .gl b { font-weight: 700; color: var(--ink, #1b2a22); }
.teams .mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.teams .mid .badge { font-size: .62rem; padding: 1px 7px; white-space: nowrap; }
.teams { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.teams .mid .badge { font-size: .56rem; letter-spacing: .02em; padding: 1px 5px; }
.teams .mid .score { min-width: 62px; }
.map-card { margin-top: 16px; }
.map { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--green-soft); }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 16px; text-decoration: none; color: var(--green-dark);
  background: repeating-linear-gradient(45deg, #e8f3ec 0 14px, #dfeee5 14px 28px); }
.map-ph .pin { font-size: 2.2rem; }
.hero-info span { display: block; }
.hero-info .hero-date { font-weight: 700; color: #f3d98b; }
.hero-logo { width: 100px; }
@media (min-width: 720px) { .hero-logo { width: 150px; } }
/* Seletor de escalão fica sempre visível ao deslizar os separadores no telemóvel */
.tabs .seg { position: sticky; left: 0; z-index: 2; box-shadow: 0 0 0 6px #fff; }
/* PC: cartaz maior, alinhado com o topo das informações e sempre visível ao percorrer */
@media (min-width: 860px) {
  main, .hero-inner, .nav-inner { max-width: 1240px; }
  .intro { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
  .intro > div:last-child { position: relative; }
  .intro .poster { position: sticky; top: 72px; }
}
@media (min-width: 1200px) {
  .intro { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
}
footer .copy { font-size: .75rem; opacity: .85; }
/* Telemóvel: nomes compridos passam a duas linhas em vez de serem cortados */
@media (max-width: 559px) {
  .teams .team .nm, .krow .nm { white-space: normal; overflow-wrap: anywhere; line-height: 1.2; font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .teams .team { gap: 6px; }
}
@media (max-width: 559px) {
  .teams .team .nm { font-size: .8rem; overflow-wrap: normal; word-break: normal; hyphens: auto; }
  .teams .logo { width: 22px; height: 22px; }
  .match { grid-template-columns: 46px 1fr; gap: 8px; }
  .teams { gap: 6px; }
}
@media (max-width: 559px) { .match .time small { font-size: .66rem; } }

/* Regulamento */
.reg { line-height: 1.6; }
.reg h3 { margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.reg h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.reg h4 { margin: 14px 0 6px; color: var(--green-dark); }
.reg p { margin: 0 0 10px; }
.reg ul { margin: 0 0 10px; padding-left: 20px; }
.reg li { margin-bottom: 6px; }
@media (min-width: 860px) { .reg { padding: 28px 36px; } }

/* Regulamento em PDF */
.reg-dl { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px; }
.reg-ico { width: 52px; height: 64px; border-radius: 8px; background: #b3261e; color: #fff; font-weight: 800; font-size: .8rem; display: grid; place-items: center; flex: none; }
.reg-txt { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; }
.reg-btns { display: flex; gap: 8px; }
.reg-btns .btn { text-decoration: none; }
