:root {
  color-scheme: light;
  --ink: #141414;
  --muted: #585658;
  --paper: #f5f4f2;
  --red: #bd0916;
  --line: #dedbd8;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #3164d0; outline-offset: 3px; }
.wrap { width: min(100% - 32px, 920px); margin-inline: auto; }
.top { background: var(--ink); color: white; }
.top-inner, .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-inner { min-height: 65px; justify-content: space-between; }
.brand { font-weight: 900; letter-spacing: .045em; }
.brand img { border-radius: 50%; }
.top a { font-size: .875rem; padding-block: 12px; text-underline-offset: 4px; white-space: nowrap; }
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: white;
  background: #850817;
  margin-top: 24px;
  min-height: 250px;
  border-radius: 16px;
  display: flex;
  gap: clamp(14px, 2.4vw, 24px);
  align-items: center;
  padding: clamp(20px, 5vw, 48px);
}
.hero-emblem {
  flex: none;
  width: clamp(72px, 11vw, 114px);
  height: auto;
  padding: clamp(7px, 1vw, 11px);
  background: #fff;
  border-radius: 10px;
}
.hero-text p { margin: 0; font-size: .875rem; font-weight: 800; letter-spacing: .09em; }
.hero h1 {
  margin: 8px 0 14px;
  font-family: Impact, Haettenschweiler, "Arial Narrow", system-ui, sans-serif;
  font-weight: 950;
  font-size: clamp(1.95rem, 7.5vw, 4.7rem);
  line-height: 1;
  text-transform: uppercase;
}
.hero-text > span { font-weight: 650; }
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 35%;
  background:
    linear-gradient(90deg, #850817 0%, rgb(101 10 24 / 88%) 21%, rgb(59 7 15 / 40%) 47%, rgb(31 4 9 / 8%) 76%),
    url("jogo-dos-galitos.jpg") 45% 28% / cover no-repeat;
}
.view-bar { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-block: 14px 22px; gap: 22px; }
.view { background: none; border: 0; padding: 14px 4px 11px; border-bottom: 3px solid transparent; font-weight: 750; color: var(--muted); min-height: 46px; }
.view[aria-pressed="true"] { border-color: var(--red); color: var(--red); }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
h2 { margin: 0; font-size: clamp(1.35rem, 4vw, 1.8rem); letter-spacing: -.035em; }
.teams { display: flex; gap: 6px; flex-wrap: wrap; }
.teams button {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  min-height: 44px;
  padding-inline: 12px;
  font-weight: 680;
  font-size: .875rem;
  color: var(--ink);
}
.teams button[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.game { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 13px; padding: 15px 16px 8px; display: flex; flex-direction: column; }
.game-meta, .line, .game-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.game-meta { font-size: .875rem; font-weight: 750; }
.category { color: var(--red); }
.date, .competition, .venue { color: var(--muted); }
.competition, .venue { margin: 4px 0 0; font-size: .875rem; }
.lineup { list-style: none; padding: 10px 0; margin: 10px 0 0; border-top: 1px solid var(--line); }
.line { min-height: 36px; }
.team-name { overflow-wrap: anywhere; }
.galitos { font-weight: 800; }
.points { font-size: 1.45rem; line-height: 1; font-variant-numeric: tabular-nums; }
.galitos .points { color: var(--red); }
.game-footer { border-top: 1px solid var(--line); margin-top: auto; }
.venue { margin: 0 0 12px; }
.outcome { font-size: .875rem; font-weight: 750; border-radius: 6px; padding: 4px 8px; background: #eeecea; }
.win { background: #e4f2e7; color: #1d5b31; }
.match-link { font-size: .875rem; font-weight: 750; padding: 13px 0; text-underline-offset: 3px; }
footer { margin-block: 26px 32px; border-top: 1px solid var(--line); padding-top: 8px; color: var(--muted); }
.social-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.social-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 750; }
.instagram-panel { max-width: 650px; }
.instagram-account { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.instagram-account img { border-radius: 50%; }
.instagram-account h3 { margin: 0 0 4px; }
.instagram-posts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
  margin-top: 10px;
}
.instagram-post-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 0;
  overflow: hidden;
  color: inherit;
  font: inherit;
  min-height: 64px;
}
.instagram-post-card:hover { border-color: var(--red); }
.instagram-thumbnail { width: 100%; aspect-ratio: 1; object-fit: cover; }
.instagram-post-description { display: block; padding: 10px; font-size: .9rem; font-weight: 650; }
.instagram-post-date { display: block; margin-top: 5px; font-size: .8rem; color: var(--muted); font-weight: 500; }
.instagram-post iframe {
  display: block;
  width: 100%;
  height: min(660px, 67dvh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
footer p { font-size: .875rem; line-height: 1.55; }
summary { cursor: pointer; font-weight: 700; min-height: 44px; padding-block: 10px; }
.hashtag { color: var(--red); font-weight: 850; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 520px) {
  .hero {
    min-height: 209px;
    margin-top: 14px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
  }
  .hero-emblem { width: 72px; border-radius: 8px; }
  .hero-text p { font-size: .75rem; }
  .hero h1 { margin-block: 4px 8px; }
  .hero::before {
    inset-inline-start: 22%;
    background-position: center, 39% 25%;
    background-image:
      linear-gradient(90deg, #850817 0%, rgb(101 10 24 / 80%) 26%, rgb(59 7 15 / 36%) 58%, rgb(31 4 9 / 9%) 100%),
      url("jogo-dos-galitos.jpg");
  }
  .section-top { align-items: flex-start; flex-direction: column; }
  .view-bar { margin-bottom: 16px; }
}

[hidden] { display: none !important; }
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: start;
  gap: 12px;
}
.roster-card { background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; min-width: 0; }
.roster-header { padding: 16px 16px 4px; }
.roster-header p { margin: 0; font-size: .875rem; }
.roster-header .category, .sheet-header .category { font-weight: 750; }
.roster-header h4 { margin: 4px 0; font-size: 1.24rem; }
.roster-header .match-link { display: inline-block; }
.roster-list { list-style: none; padding: 0; margin: 0; }
.roster-list li { border-top: 1px solid var(--line); }
.player-row {
  width: 100%;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 0;
  padding: 9px 16px;
  text-align: left;
  background: white;
  color: var(--ink);
}
.player-row:hover { background: var(--paper); }
.player-row:focus-visible { outline-offset: -3px; }
.player-number {
  display: grid;
  place-items: center;
  min-height: 35px;
  border-radius: 7px;
  background: #fae9e9;
  color: var(--red);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.player-row-name strong { display: block; overflow-wrap: anywhere; }
.player-position, .player-row-action { font-size: .875rem; color: var(--muted); }
.player-row-action { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.player-sheet {
  width: min(100% - 32px, 480px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: clamp(16px, 5vw, 24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
}
.player-sheet::backdrop { background: rgb(20 20 20 / 65%); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-header .category { margin: 0; font-size: .875rem; }
.sheet-close {
  padding: 0 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}
.player-identity {
  display: grid;
  grid-template-columns: clamp(64px, 17vw, 88px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 3vw, 16px);
  margin-top: 12px;
}
.player-portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: #fae9e9;
  color: var(--red);
  font-size: 1.35rem;
  font-weight: 850;
}
.player-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.player-sheet h2 { overflow-wrap: anywhere; }
.player-sheet h3 { font-size: 1rem; margin-bottom: 8px; }
.player-sheet .match-link { display: inline-block; }
.player-details, .player-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-block: 14px;
}
.player-details > div, .player-totals > div { padding: 8px; background: var(--paper); border-radius: 7px; }
.player-sheet dt { font-size: .875rem; color: var(--muted); }
.player-sheet dd { margin: 3px 0 0; font-weight: 750; }
.player-totals dd { font-size: 1.2rem; }
@media (max-width: 359px) {
  .view-bar { gap: 10px; }
  .player-row { padding-inline: 9px; gap: 8px; }
}
.feed-status {
  min-height: 1.4em;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .875rem;
}
.feed-status[data-state="stale"] { color: #85430f; }
.empty-games { margin: 8px 0 16px; color: var(--muted); }
.team-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.team-picker label { font-size: .875rem; font-weight: 750; }
.team-picker select {
  min-width: 0;
  width: min(100%, 28rem);
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  color: var(--ink);
  background: white;
  background-image: linear-gradient(45deg, transparent 50%, #585658 50%), linear-gradient(135deg, #585658 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.roster-group + .roster-group { margin-top: 21px; }
.roster-group-title { margin: 0 0 10px; font-size: 1.15rem; }
.roster-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.roster-games, .more-games {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: .875rem;
  font-weight: 750;
}
.more-games { margin-top: 13px; }
.roster-details, .roster-empty { border-top: 1px solid var(--line); }
.roster-summary {
  padding: 11px 16px;
  min-height: 44px;
  color: var(--red);
  font-weight: 750;
}
.roster-summary:hover { background: var(--paper); }
.roster-empty {
  padding: 12px 16px;
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
}
.standing-card {
  min-width: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 14px 4px;
}
.standing-card > .category { margin: 0; font-size: .875rem; font-weight: 750; }
.standing-card h4 { margin: 4px 0 6px; font-size: 1.15rem; overflow-wrap: anywhere; }
.standing-competition { margin: 5px 0 0; font-weight: 700; font-size: .875rem; }
.standing-phase { margin-block: 4px; }
.standing-metrics {
  margin: 11px 0 3px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}
.standing-metrics > div { min-width: 0; padding: 6px 1px; }
.standing-metrics > div + div { border-left: 1px solid var(--line); }
.standing-metrics > div:first-child { color: var(--red); }
.standing-metrics dt { font-size: .8125rem; }
.standing-metrics dd { margin: 3px 0 0; font-size: 1.125rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.standing-source { display: inline-block; }
.standing-table-details > summary, .standing-alternates > summary { font-size: .875rem; }
.standing-alternates { border-top: 1px solid var(--line); }
.alternate-standing { padding: 7px 0; border-top: 1px solid var(--line); }
.standing-table { width: 100%; border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums; }
.standing-table th, .standing-table td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: right; }
.standing-table th:nth-child(2) { width: 52%; text-align: left; overflow-wrap: anywhere; }
.standing-table tbody th { font-weight: 500; }
.standing-table .club-standing { background: #fae9e9; color: var(--red); font-weight: 750; }
.standing-table .club-standing th { font-weight: inherit; }
@media (max-width: 520px) {
  .view-bar { gap: clamp(5px, 2vw, 14px); }
  .view { font-size: .875rem; padding-inline: 3px; }
}
@media (max-width: 359px) {
  .view-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
}
.team-identity {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}
.team-identity .team-name { min-width: 0; }
.team-emblem {
  width: 24px;
  height: 24px;
  flex: none;
  object-fit: contain;
}
.standing-table .team-emblem { width: 19px; height: 19px; }
.standing-table .team-identity { gap: 5px; }
.team-photo {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin: 8px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}
.team-photo-label { padding: 8px 12px; font-size: .875rem; font-weight: 650; }
.team-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e8e5e3;
  opacity: 0;
}
.team-photo img.loaded { opacity: 1; }
#manage-team-photos { display: inline-block; }
.photo-notice { margin: 0 0 10px; font-size: .875rem; color: var(--muted); }
.photo-notice:empty, #team-photo-status:empty { display: none; }
.team-photo-message { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.team-photo-dialog label { display: block; font-weight: 750; margin: 14px 0 6px; }
.team-photo-dialog input { max-width: 100%; padding: 6px 0; font: inherit; }
.team-photo-dialog img { display: block; width: 100%; max-height: 260px; object-fit: contain; margin-top: 10px; border-radius: 8px; }
.team-photo-dialog p { margin-block: 8px; font-size: .875rem; }
.team-photo-dialog .category { font-weight: 750; }
.team-photo-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.publish-photo {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
  border-radius: 9px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: .875rem;
  font-weight: 750;
}
.publish-photo:disabled { opacity: .5; cursor: default; }
.team-photo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 14px 12px;
}
