/* =============================================================
   public.css — página pública, visual "painel ao vivo" (cyber).
   As cores vêm de variáveis que o JS ajusta com o que está
   salvo no admin (Config > Modo da página e cores):
     --bg, --text, --card, --card-2, --line, --muted, --accent
     --c13 / --c22 (cores dos times)
   ============================================================= */

body.public {
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: "Space Grotesk", var(--font);
  font-family: var(--display);
  background-color: var(--page, #07090d);
  /* grade de fundo bem sutil */
  background-image:
    linear-gradient(rgba(var(--accent-rgb, 0, 229, 160), 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb, 0, 229, 160), 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: fixed;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Barra do topo ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--page, #07090d);
  background: color-mix(in srgb, var(--page, #07090d) 85%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 59, 59, 0.14);
  color: #ff5c5c;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: #ff3b3b; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.brand h1 {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.countdown {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card, #0f1319);
  color: var(--cd-text, #ffcc00);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Grade de painéis ----------
   Celular: uma coluna só, na ordem definida por "order".
   Computador: 3 colunas (esquerda: foto/placar/meta, meio: gráfico,
   direita: ranking/feed), como um painel de apuração. */

.dash {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 12px;
}
.col { display: contents; }
.hero { order: 1; }
.score { order: 2; }
.goal { order: 3; }
.chart-panel { order: 4; }
.feed { order: 5; }
.rank { order: 6; }

@media (min-width: 980px) {
  .dash {
    display: grid;
    grid-template-columns: minmax(300px, 25%) minmax(0, 1fr) minmax(300px, 24%);
    padding: 16px;
    gap: 16px;
    align-items: start;
  }
  .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .col > .panel { order: 0; }
  .col-mid { position: sticky; top: 64px; }
  /* o gráfico ocupa a altura da tela */
  .chart-panel .chart-box { height: max(380px, calc(100vh - 150px)); }
}

.panel {
  position: relative;
  min-width: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--card, #0d1117);
  border: 1px solid var(--line);
}
/* cantinhos "de mira" no painel */
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border-color: rgba(var(--accent-rgb, 0, 229, 160), 0.55);
  border-style: solid;
  pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: 12px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: 12px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.tag::before { content: "// "; opacity: 0.5; }
.small { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

/* ---------- Foto + frase ---------- */

.hero { padding: 0; overflow: hidden; }
.photo-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 70vh;
  width: 100%;
  display: grid;
  place-items: center;
  background: var(--card-2, #131922);
  overflow: hidden;
}
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder { font-size: 4rem; opacity: 0.5; }
/* linhas de "monitor" por cima da foto */
.photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
    linear-gradient(to top, var(--card, #0d1117) 0%, transparent 45%);
  pointer-events: none;
}
.hero-text { padding: 0 14px 14px; margin-top: -18px; position: relative; }
.subtitle { color: var(--soft-text, #b8c0cc); font-size: 0.92rem; text-wrap: pretty; }

/* ---------- Placar ---------- */

.score-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.side { display: flex; flex-direction: column; min-width: 0; }
.side.right { align-items: flex-end; text-align: right; }
.team-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c);
}
.team-name::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.side.right .team-name { flex-direction: row-reverse; }
.pct {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 7.5vw, 2.05rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--c);
  text-shadow: 0 0 10px rgba(var(--c-rgb), 0.25);
}
.side.is-leader .pct { text-shadow: 0 0 20px rgba(var(--c-rgb), 0.6); }
.amt { font-family: var(--mono); font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cnt { font-size: 0.75rem; color: var(--muted); }
.lead {
  visibility: hidden;
  margin-top: 6px;
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--c);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.side.right .lead { align-self: flex-end; }
.side.is-leader .lead { visibility: visible; }
.vs { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); padding-bottom: 30px; }

.tug {
  position: relative;
  display: flex;
  height: 10px;
  margin-top: 14px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--card-2, #131922);
}
.tug > div { height: 100%; width: 50%; transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1); }
.tug-13 { background: var(--c13); box-shadow: 0 0 12px rgba(var(--c13-rgb), 0.6); }
.tug-22 { background: var(--c22); box-shadow: 0 0 12px rgba(var(--c22-rgb), 0.6); }
.tug-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: 0.6; }
.duel-diff { margin-top: 10px; font-size: 0.85rem; color: var(--soft-text, #b8c0cc); }
.duel-diff b { font-weight: 700; }

/* ---------- Meta ---------- */

.goal-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 10px; }
.goal-line strong {
  font-family: var(--mono);
  font-size: clamp(1.7rem, 8vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.goal-line span { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.goal-pct { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.bar {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: var(--card-2, #131922);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb, 0, 229, 160), 0.7);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
/* risquinhos a cada 10% */
.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--card, #0d1117) calc(10% - 2px) 10%);
  pointer-events: none;
}
.goal-meta { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.goal.is-reached #goal-left { color: var(--accent); font-weight: 700; }

/* ---------- Gráfico ---------- */

.chart-box { position: relative; height: 210px; }
.chart-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.legend { display: flex; gap: 10px; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.legend span::before { content: "■ "; color: var(--c); }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-grid text { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: 0.12; }
.chart-dot { stroke: var(--card, #0d1117); stroke-width: 2; }

/* ---------- Feed ---------- */

.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.feed-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--card-2, #131922);
  border-left: 3px solid var(--c);
}
.feed-item time {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 52px;
}
.feed-text { grid-column: 2; font-size: 0.85rem; min-width: 0; overflow-wrap: anywhere; }
.feed-text .ago { color: var(--muted); font-size: 0.75rem; }
.feed-text b { font-weight: 700; }
.feed-team { color: var(--c); font-weight: 700; }
.feed-amount { font-family: var(--mono); font-weight: 700; color: var(--c); }
.feed-empty { color: var(--muted); font-family: var(--mono); font-size: 0.8rem; padding: 8px 0; }
.feed-item.is-new { animation: arrive 2s ease-out; }
@keyframes arrive {
  0% { background: rgba(var(--accent-rgb, 0, 229, 160), 0.25); transform: translateX(-6px); }
  30% { transform: none; }
  100% { background: var(--card-2, #131922); }
}

/* ---------- Ranking ---------- */

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: rank; }
.rank-item {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 4px 10px;
}
.rank-item::before {
  content: counter(rank, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.rank-name { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-amt { font-family: var(--mono); font-size: 0.82rem; font-weight: 700; color: var(--c); }
.rank-bar { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: var(--card-2, #131922); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--c); box-shadow: 0 0 8px var(--c); }

.foot { padding: 4px 16px 24px; color: var(--muted); font-family: var(--mono); font-size: 0.7rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
