:root {
  --bg: #f3f4f6;
  --panel-bg: #ffffff;
  --border: #e0e0e0;
  --primary: #3cac3b;
  --primary-dark: #2a8b2b;
  --accent: #ffd700;
  --text: #111827;
  --muted: #6b7280;
  --danger: #b91c1c;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top left, #e0f2f1 0, #f3f4f6 45%, #f9fafb 100%);
  color: var(--text);
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(90deg, #001433 0, #3cac3b 45%, #ffd700 100%);
  color: #ffffff;
}

.site-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  object-fit: contain;
}

.site-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.session {
  font-size: 0.9rem;
}

#sessionBadge {
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.15);
  color: #f9fafb;
}

/* Layout */

.layout {
  max-width: 1120px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    align-items: flex-start;
  }
}

.layout.layout-authenticated {
  grid-template-columns: 1fr;
  max-width: 1500px;
}

.layout.layout-authenticated .panel-access {
  display: none;
}

.panel {
  background: var(--panel-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06);
}

.panel h2 {
  margin-top: 0;
}

.panel-inner {
  padding: 0;
}

/* Panel central más “app” */
.panel-app {
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

/* Auth */

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tab {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.auth-pane {
  display: none;
}

.auth-pane-active {
  display: block;
}

.form {
  display: grid;
  gap: 0.75rem;
}

.form label span {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

/* Buttons */

.btn {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.actions-inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Messages */

.message {
  margin-top: 0.75rem;
  min-height: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* User strip */

.user-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.user-strip-main {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.user-strip-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.user-strip-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.user-strip-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.user-strip-stats {
  display: flex;
  gap: 1rem;
}

.user-strip-stat {
  display: flex;
  flex-direction: column;
  min-width: 80px;
}

.user-strip-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.user-strip-actions {
  display: flex;
  justify-content: flex-end;
}

/* Tabs & views – pill nav */

.main-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #f3f4f6;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.main-tab {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.main-tab:hover {
  background: #e5e7eb;
}

.main-tab-active {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}

.view {
  display: none;
}

.view-active {
  display: block;
}

.hidden {
  display: none !important;
}

/* Summary */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}

.summary-card-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.summary-logo {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  object-fit: contain;
}

.summary-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.summary-value-sm {
  font-size: 0.95rem;
  line-height: 1.35;
}

/* Filters + matches */

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 240px;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.matches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 1500px) {
  .matches {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Match cards – más profundidad */

.match-card {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: radial-gradient(circle at top left, #f1f5f9 0, #ffffff 55%);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease;
}

.match-card:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.match-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.match-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.match-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.match-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Abierto: azul suave */
.match-badge-open {
  background-color: #e3f2fd;
  color: #0b5394;
}

/* Cerrado: gris */
.match-badge-locked {
  background-color: #eeeeee;
  color: #555555;
}

/* En juego: naranja/ámbar */
.match-badge-live {
  background-color: #fff3cd;
  color: #92400e;
}

/* Finalizado: verde */
.match-badge-finished {
  background-color: #e7f5e9;
  color: #14532d;
}

/* Pronóstico guardado: verde más intenso */
.match-badge-saved {
  background-color: #d1fae5;
  color: #047857;
}

/* Próximo partido resaltado */
.match-card-next {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.18),
    0 4px 10px rgba(15, 23, 42, 0.08);
}

.match-teams {
  font-weight: 600;
  font-size: 0.95rem;
}

.match-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.prediction-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  margin-top: 0.7rem;
  align-items: center;
}

.prediction-row input[type="number"] {
  text-align: center;
}

/* Lists */

.list-empty {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Leaderboard tabla */

.leaderboard-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.leaderboard-table thead th {
  text-align: left;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
  padding: 0.9rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tbody tr:hover {
  background: #f9fbff;
}

.leaderboard-rank {
  font-weight: 700;
  white-space: nowrap;
}

.leaderboard-alias {
  font-weight: 600;
}

.leaderboard-points {
  font-weight: 700;
  color: var(--primary);
}

.leaderboard-me {
  background: #f3fff4;
}

.leaderboard-me:hover {
  background: #ecfceb !important;
}

.leaderboard-you {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Mi porra */

.predictions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.prediction-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
  padding: 1rem;
}

.prediction-card-exact {
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
  background: linear-gradient(135deg, #ecfdf3 0, #ffffff 40%, #f8fafc 100%);
}

.prediction-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.prediction-kicker {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.prediction-title {
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0;
}

.prediction-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.prediction-status {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-pending {
  background: #eefbf0;
  color: #1f7a31;
}

.status-locked {
  background: #fff7e8;
  color: #9a6700;
}

.status-finished {
  background: #eef4ff;
  color: #1d4ed8;
}

.prediction-score-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.prediction-score-box {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: #f8fafc;
}

.prediction-score-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.prediction-score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.prediction-points {
  color: var(--primary);
}

/* Misc */

.note,
.save-status {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Responsivo */

@media (max-width: 1100px) {
  .matches,
  .predictions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .user-strip {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .user-strip-stats {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .leaderboard-table thead th,
  .leaderboard-table tbody td {
    padding: 0.8rem 0.75rem;
  }
}

@media (max-width: 640px) {
  .match-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .prediction-card-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .prediction-score-row,
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .prediction-row {
    grid-template-columns: 1fr 1fr;
  }

  .prediction-row .btn,
  .prediction-row .save-status {
    grid-column: 1 / -1;
  }
}

.match-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.chip {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f9fafb;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--muted);
}

.chip-active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.league-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
}

.player-details {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f9fafb;
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 0.85rem;
}

.player-details-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.player-details-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.player-details-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.player-details-position {
  text-align: right;
}

.player-details-position-label {
  font-size: 0.8rem;
  color: var(--muted);
  display: block;
}

.player-details-position-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.player-details-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.player-details-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 0.55rem 0.7rem;
}

.player-details-card-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.player-details-card-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.player-details-footer {
  font-size: 0.82rem;
  color: var(--muted);
}

.player-details-footer-strong {
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 900px) {
  .player-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .player-details-grid {
    grid-template-columns: 1fr;
  }

  .player-details-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .player-details-position {
    text-align: left;
  }
}

.leaderboard-row-click {
  cursor: pointer;
}

.player-details-tabs {
  display: inline-flex;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.player-details-tab {
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 0.8rem;
  cursor: pointer;
}

.player-details-tab-active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.player-details-section {
  display: none;
}

.player-details-section-active {
  display: block;
}

.player-predictions-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.player-prediction-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  background: #ffffff;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.player-prediction-header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

.player-prediction-match {
  margin-bottom: 0.1rem;
}

.player-prediction-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.player-prediction-status {
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  white-space: nowrap;
}

.player-prediction-body {
  margin-top: 0.25rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 0.6rem;
}

.player-prediction-line {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.player-prediction-label {
  color: var(--muted);
}

.player-prediction-value {
  font-weight: 600;
}

.player-prediction-footer {
  margin-top: 0.25rem;
}

.player-prediction-badge {
  display: inline-block;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.player-prediction-badge-exact {
  background: #dcfce7;
  color: #15803d;
}

.player-prediction-badge-sign {
  background: #e0f2fe;
  color: #0369a1;
}

.player-prediction-badge-miss {
  background: #fee2e2;
  color: #b91c1c;
}

.player-prediction-badge-neutral {
  background: #f3f4f6;
  color: #4b5563;
}

@media (max-width: 900px) {
  .player-prediction-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .player-predictions-list {
    grid-template-columns: 1fr;
  }
}

.status-live {
  background-color: #fff3cd;
  color: #92400e;
}

/* Grupos */

.groups-standings {
  display: grid;
  gap: 1rem;
}

/* Tarjeta de grupo estilo premium */
.group-card {
  background: radial-gradient(circle at top left, #f1f5f9 0, #ffffff 55%);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0.9rem 1rem 1rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease;
}

.group-card:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
  transform: translateY(-1px);
}

/* Cabecera del grupo (si se usa) */
.group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
}

.group-card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.group-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* Tabla de grupo */

.group-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.group-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.group-table thead {
  background-color: #f3f4f6;
}

.group-table th,
.group-table td {
  padding: 0.35rem 0.4rem;
  text-align: center;
  white-space: nowrap;
}

.group-table th:first-child,
.group-table td:first-child {
  text-align: left;
}

.group-table th:nth-child(2),
.group-table td:nth-child(2) {
  text-align: left;
}

/* Filas */

.group-table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

/* Top 2 clasificados */
.group-table tbody tr:nth-child(1),
.group-table tbody tr:nth-child(2) {
  font-weight: 600;
  background-color: #ecfdf3;
}

/* Borde inferior suave */
.group-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
}

/* Errores en inputs */

.input-error {
  border-color: #b91c1c !important;
  background-color: #fef2f2;
}

/* Notas y reglas */

.note {
  font-size: 0.85rem;
  color: #4b5563;
  margin-bottom: 0.75rem;
}

.rules-list {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: #374151;
}

.rules-list li {
  margin-bottom: 0.25rem;
}

.btn {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

.btn:hover {
  background: #d1d5db;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.4);
}


.team-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.flag-icon {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.flag-icon-sm {
  width: 16px;
  height: 16px;
}

.match-teams-vs {
  margin: 0 0.25rem;
  color: #6b7280;
  font-weight: 500;
}