/* Paleta base = identidade decker.app.br (ver decker-app-brand-context.md).
   --primary/--secondary/--text é a cascata de tema (spec 6.3): decker ->
   liga -> skin do time; o resto (--bg/--surface/--ink/--border) é o "chrome"
   neutro do site e não muda com liga/time. */
:root {
  --base-primary: #185FA5;   /* color-blue-strong */
  --base-secondary: #378ADD; /* color-blue-mid */
  --base-text: #FFFFFF;

  --primary: var(--base-primary);
  --secondary: var(--base-secondary);
  --text: var(--base-text);

  --bg: #0A0F1E;             /* color-bg-primary — inegociável, não é #000 */
  --surface: #111827;        /* color-bg-surface — superfícies elevadas, modais */
  --surface-alt: #0C1F3F;    /* color-bg-secondary — seções alternadas, cards */
  --ink: #FFFFFF;            /* color-text-primary */
  --ink-muted: rgba(255, 255, 255, 0.55); /* color-text-secondary */
  --border: rgba(255, 255, 255, 0.12);    /* color-border-mid */

  --radius: 10px;
  --gap: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Header / league picker ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--primary);
  color: var(--text);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06); /* color-border-subtle */
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 10px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.decker-home-link {
  flex: 0 0 auto;
  display: flex;
  line-height: 0;
}

.decker-mark {
  width: 22px;
  height: 22px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-dot {
  opacity: 0.6;
}

.league-picker-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  max-width: 60vw;
}

.league-picker-toggle .league-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.league-picker-toggle .chevron {
  opacity: 0.7;
  font-size: 0.7rem;
}

.league-picker {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.league-option {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.league-option img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.league-option[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.league-option .soon-badge {
  font-size: 0.65rem;
  opacity: 0.7;
}

/* ---------- Live bar ---------- */

.live-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #b30f1f;
  color: #fff;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  position: sticky;
  top: 49px;
  z-index: 35;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* ---------- Tabs ---------- */

.tab-bar {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.tab-btn.is-active {
  background: var(--primary);
  color: var(--text);
  border-color: transparent;
}

.tab-panel {
  display: none;
  padding: 14px;
  max-width: 900px;
  margin: 0 auto;
}

.tab-panel.is-active {
  display: block;
}

.section-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin: 22px 0 10px;
}

.section-title:first-child {
  margin-top: 4px;
}

/* ---------- Home: team skin frame ---------- */

.skin-reset-row {
  display: flex;
  justify-content: flex-end;
  min-height: 20px;
}

.skin-reset-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.team-frame {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
}

.team-frame-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}

.team-frame-item.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary) inset;
}

.team-frame-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Match cards ---------- */

.match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.85rem;
}

.match-card.is-clickable {
  cursor: pointer;
}

.match-card .round-label {
  grid-column: 1 / -1;
  font-size: 0.65rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.match-card .team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-card .team.away {
  justify-content: flex-end;
  text-align: right;
}

.match-card .team img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

.match-card .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-card .center {
  text-align: center;
  min-width: 70px;
}

.match-card .score {
  font-weight: 700;
  font-size: 1rem;
}

.match-card .datetime,
.match-card .venue {
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.match-card.is-live .score {
  color: #ff4d4f;
}

.match-card .live-badge {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff4d4f;
  margin-right: 4px;
  animation: pulse 1.4s infinite;
}

.empty-state {
  color: var(--ink-muted);
  font-size: 0.85rem;
  padding: 20px 0;
}

/* ---------- Standings ---------- */

.standings-badge {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 560px;
}

.standings-table th,
.standings-table td {
  padding: 7px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table .col-team {
  text-align: left;
}

.standings-table td.col-team {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.standings-table td.col-team img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.standings-table tr.zone-row td:first-child {
  box-shadow: inset 4px 0 0 var(--zone-color, transparent);
}

.form-pill {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 0.6rem;
  line-height: 16px;
  color: #fff;
  margin-left: 2px;
}

.form-pill.W { background: #1f9d55; }
.form-pill.D { background: #8a8f98; }
.form-pill.L { background: #d3423e; }

.zones-legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.zones-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zones-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ---------- Accordion (Rodadas / Meses) ---------- */

.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface);
}

.accordion-header {
  width: 100%;
  background: var(--surface-alt);
  border: none;
  color: var(--ink);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.accordion-header .chevron {
  transition: transform 0.15s ease;
  color: var(--ink-muted);
}

.accordion-item.is-open .accordion-header .chevron {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 10px;
}

.accordion-item.is-open .accordion-body {
  display: block;
}

.accordion-day-label {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.accordion-day-label:first-child {
  margin-top: 0;
}

/* ---------- Squad modal ---------- */

.squad-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
}

.squad-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.squad-modal-content {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 14px 14px 0 0;
  padding: 16px;
}

@media (min-width: 720px) {
  .squad-modal {
    align-items: center;
    justify-content: center;
  }
  .squad-modal-content {
    max-width: 640px;
    border-radius: 14px;
    max-height: 80vh;
  }
}

/* ---------- Estatísticas ---------- */

.stats-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stats-controls select,
.toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.toggle-btn.is-active {
  background: var(--primary);
  color: var(--text);
  border-color: transparent;
}

.team-stats-block {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.team-stats-block div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}

.team-stats-block strong {
  display: block;
  font-size: 1.1rem;
}

.team-stats-block span {
  font-size: 0.65rem;
  color: var(--ink-muted);
}

.stats-table,
.squad-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 480px;
}

.stats-table th,
.stats-table td,
.squad-table th,
.squad-table td {
  padding: 7px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.stats-table th[data-sort] {
  cursor: pointer;
}

.stats-table th[data-sort].is-active {
  color: var(--primary);
}

.stats-table .col-team,
.squad-table td:nth-child(2),
.squad-table td:nth-child(3) {
  text-align: left;
}

.stats-table td.col-team {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.stats-table td.col-team img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.top20-group {
  margin-bottom: 20px;
}

.top20-group h4 {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

/* ---------- Squad modal content ---------- */

.squad-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface-alt);
  border: none;
  color: var(--ink);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.9rem;
}

.squad-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.squad-header img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.squad-header h3 {
  margin: 0;
}

.squad-team-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.squad-team-stats div {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  text-align: center;
}

.squad-team-stats strong {
  display: block;
  font-size: 1rem;
}

.squad-team-stats span {
  font-size: 0.6rem;
  color: var(--ink-muted);
}

.squad-position-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 16px 0 6px;
}

.squad-position-label:first-of-type {
  margin-top: 0;
}

/* ---------- Classificação ao vivo (parcial) ---------- */

.pos-arrow {
  font-size: 0.6rem;
  margin-left: 3px;
}

.pos-arrow.up {
  color: #2ecc71;
}

.pos-arrow.down {
  color: #ff4d4f;
}

/* ---------- Match modal ---------- */

.match-modal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.match-modal-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: 0.8rem;
}

.match-modal-team img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.match-modal-score {
  text-align: center;
}

.match-modal-score .big-score {
  font-size: 1.4rem;
  font-weight: 700;
}

.match-modal-meta {
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.match-modal-timeline {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  margin-bottom: 16px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 4px 0;
}

.timeline-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.timeline-side.home {
  justify-content: flex-end;
  text-align: right;
}

.timeline-side.away {
  justify-content: flex-start;
  text-align: left;
}

.timeline-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-minute {
  font-size: 0.7rem;
  color: var(--ink-muted);
  flex: 0 0 auto;
}

.match-modal-lineups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lineup-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
}

.lineup-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.lineup-jersey {
  color: var(--ink-muted);
  min-width: 18px;
}

/* ---------- Responsive tweaks ---------- */

@media (min-width: 600px) {
  .tab-panel {
    padding: 20px 24px;
  }
}
