:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: #0d1b2e;
  --card: rgba(13, 27, 46, 0.88);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #e6eef8;
  --muted: #9cb0c9;
  --live: #ff4d6d;
  --scheduled: #ffb703;
  --finished: #2dd4bf;
  --accent: #3b82f6;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 30%),
    linear-gradient(180deg, #06101d 0%, #081423 100%);
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #7dd3fc;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.share-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-panel {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.input-panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#jsonFileInput {
  display: none;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(125, 211, 252, 0.08);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.json-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  outline: none;
}

.share-title,
.share-subtitle {
  margin: 0;
}

.share-title {
  font-size: 1rem;
  font-weight: 800;
}

.share-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.share-toolbar-actions,
.share-board-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.date-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  font: inherit;
  color-scheme: dark;
}

.reload-button {
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.secondary-button {
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(125, 211, 252, 0.08);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.secondary-button:disabled,
.reload-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 18px;
  backdrop-filter: blur(10px);
}

.summary-card strong {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.status {
  margin-bottom: 18px;
  color: var(--muted);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* ─── Share Arts Grid ─── */

.share-boards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 8px;
}

.share-board-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-board-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.share-board-title {
  font-weight: 800;
}

/* ─── Exportable Art Card ─── */

.share-board {
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #060d1b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  font-family: "Inter", sans-serif;
  display: flex;
  flex-direction: column;
}

.share-board-top-bar {
  height: 5px;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 55%, rgba(22, 163, 74, 0) 100%);
}

.share-board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.share-board-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-board-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.share-board-eyebrow {
  margin: 0;
  color: #22c55e;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.share-board-heading {
  margin: 3px 0 0;
  font-size: 1rem;
  font-weight: 900;
  color: #f1f5f9;
}

.share-board-page {
  font-size: 0.72rem;
  color: #334155;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.share-board-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Match row inside the art ─── */

.sgc {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sgc:last-child {
  border-bottom: none;
}

.sgc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

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

.sgc-comp-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px;
  flex-shrink: 0;
}

.sgc-comp-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sgc-status {
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sgc-status.ao_vivo {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.sgc-status.encerrado {
  background: rgba(100, 116, 139, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.sgc-status.agendado {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.sgc-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}

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

.sgc-team.sgc-away {
  flex-direction: row-reverse;
  text-align: right;
}

.sgc-team-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px;
  flex-shrink: 0;
}

.sgc-team-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #e2e8f0;
  line-height: 1.2;
}

.sgc-scoreboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
}

.sgc-score-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sgc-score-num {
  font-size: 1.75rem;
  font-weight: 900;
  color: #f8fafc;
  line-height: 1;
}

.sgc-score-sep {
  font-size: 1.1rem;
  font-weight: 900;
  color: #334155;
}

.sgc-vs {
  font-size: 1.3rem;
  font-weight: 900;
  color: #475569;
  letter-spacing: 0.1em;
}

.sgc-time {
  font-size: 0.65rem;
  color: #475569;
  font-weight: 700;
}

.sgc-bottom {
  margin-top: 8px;
}

.sgc-channel {
  font-size: 0.68rem;
  color: #334155;
  font-weight: 600;
}

.share-board-footer {
  padding: 10px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
}

.share-board-watermark {
  font-size: 0.6rem;
  font-weight: 800;
  color: #1a2a3d;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 260px;
  padding: 18px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card-header,
.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.competition-wrap {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.competition-image,
.team-image {
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
}

.competition-image {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  padding: 6px;
}

.competition-name,
.game-time,
.channel,
.team-name {
  margin: 0;
}

.competition-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.game-time,
.channel {
  color: var(--muted);
  font-size: 0.86rem;
}

.game-status {
  align-self: flex-start;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.game-status.encerrado {
  color: #052e2b;
  background: var(--finished);
}

.game-status.ao_vivo {
  color: white;
  background: var(--live);
}

.game-status.agendado {
  color: #3b2500;
  background: var(--scheduled);
}

.teams-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.team-image {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  padding: 6px;
}

.team-name {
  font-weight: 700;
  line-height: 1.3;
}

.score-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.55rem;
  font-weight: 800;
}

.score-separator {
  color: var(--muted);
  font-size: 1rem;
}

.match-link {
  align-self: flex-end;
  color: #7dd3fc;
  text-decoration: none;
  font-weight: 700;
}

.match-link:hover {
  text-decoration: underline;
}

@media (max-width: 1280px) {
  .games-grid,
  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .share-toolbar,
  .share-board-actions,
  .input-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .url-input {
    width: 100%;
  }

  .games-grid,
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .share-boards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 16px;
  }

  .games-grid,
  .summary {
    grid-template-columns: 1fr;
  }

  .share-game-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .share-team,
  .share-team.away {
    justify-content: center;
    flex-direction: column;
  }

  .share-score {
    justify-content: center;
  }
}
