:root {
  --bg-body: #0f172a;
  --card-bg: #020617;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.15);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --border-soft: rgba(148, 163, 184, 0.3);
  --error: #ef4444;
  --radius-lg: 20px;
  --radius-full: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  overflow-x: hidden;
}

body {
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #1e293b 0, #020617 55%, #000 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app-shell {
  width: 100%;
  max-width: 1920px;
}

.card {
  background: rgba(15, 23, 42, 0.92);
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.public-index-card {
  min-height: auto;
}

/* ===========================
   BRAND
=========================== */
.brand-section {
  padding: 22px 20px 18px;
  text-align: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 55%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.brand-section-top {
  width: 100%;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(34, 197, 94, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  background: radial-gradient(circle at 30% 0, rgba(34, 197, 94, 0.3), transparent 60%);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 14px;
  text-transform: uppercase;
  color: #bbf7d0;
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.15;
  text-align: center;
}

/* ===========================
   LAYOUT DERECHO
=========================== */
.card-layout {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.content {
  padding: 20px;
  display: grid;
  gap: 20px;
  min-width: 0;
}

.public-home-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* ===========================
   BLOQUES
=========================== */
.home-block {
  min-width: 0;
}

.form-card,
.clubs-section,
.public-table-card {
  padding: 18px 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  min-width: 0;
  overflow: hidden;
}

.form-card {
  background: radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), rgba(15, 23, 42, 0.95));
}

.public-table-card,
.clubs-section {
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.10), rgba(15, 23, 42, 0.95));
}

.form-header {
  margin-bottom: 12px;
}

.form-title,
.public-table-title,
.clubs-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.15;
}

.form-subtitle,
.public-table-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.public-table-header {
  margin-bottom: 12px;
}

.public-table-empty {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===========================
   FORMULARIO
=========================== */
.login-inner {
  width: 100%;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-main);
}

input {
  width: 100%;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: rgba(148, 163, 184, 0.7);
  font-size: 12px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
  background: rgba(15, 23, 42, 1);
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  cursor: pointer;
  margin-top: 6px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.35);
}

.form-footer {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.form-footer a {
  color: #a5b4fc;
  text-decoration: none;
  font-size: 11px;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* ===========================
   TABLAS
=========================== */
.public-table-wrap {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.28);
}

.public-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.public-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  border: 2px solid rgba(2, 6, 23, 0.35);
}

.public-table-wrap:hover::-webkit-scrollbar-thumb {
  background: rgba(34, 197, 94, 0.35);
}

.public-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.public-table thead tr {
  background: rgba(15, 23, 42, 0.95);
}

.public-table th,
.public-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(55, 65, 81, 0.85);
  vertical-align: middle;
}

.public-table th {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
}

.public-table td {
  color: #e5e7eb;
}

.public-table tbody tr:last-child td {
  border-bottom: none;
}

.public-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.public-table-sumatoria th:nth-child(1),
.public-table-sumatoria td:nth-child(1) {
  width: 56px;
  text-align: center;
}

.public-table-sumatoria th:nth-child(3),
.public-table-sumatoria td:nth-child(3) {
  width: 80px;
  text-align: center;
  font-weight: 700;
}

.public-table-resultados th:nth-child(1),
.public-table-resultados td:nth-child(1) {
  width: 98px;
  white-space: nowrap;
}

.public-table-resultados th:nth-child(2),
.public-table-resultados td:nth-child(2) {
  width: 110px;
}

.public-table-resultados th:nth-child(3),
.public-table-resultados td:nth-child(3) {
  min-width: 320px;
}

.public-table-resultados th:nth-child(4),
.public-table-resultados td:nth-child(4) {
  width: 110px;
  white-space: nowrap;
}

.result-cell {
  min-width: 320px;
}

.result-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
}

.result-team {
  display: block;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-match > .result-team:first-child {
  text-align: right;
}

.result-match > .result-team:last-child {
  text-align: left;
}

.result-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
  font-weight: 800;
  white-space: nowrap;
  font-size: 12px;
  justify-self: center;
}

/* ===========================
   CLUBES
=========================== */
.clubs-section {
  display: flex;
  flex-direction: column;
}

.clubs-title {
  margin-bottom: 10px;
}

.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.club-slot {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.55);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.club-slot-content {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35));
  transform: translateZ(0);
}

@media (hover: hover) and (pointer: fine) {
  .club-slot:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(2, 6, 23, 0.75);
  }
}

/* ===========================
   FOOTER
=========================== */
.footer {
  padding: 14px 18px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
  background: rgba(2, 6, 23, 0.9);
  flex: 0 0 auto;
}

/* ===========================
   MOBILE
=========================== */
@media (max-width: 767px) {
  .public-index-card {
    min-height: auto;
  }

  .brand-section {
    padding: 20px 20px 14px;
  }

  .brand-title {
    font-size: 20px;
  }

  .card-layout {
    overflow: visible;
  }

  .content {
    padding: 18px;
  }

  .public-home-content {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .home-login { order: 1; }
  .home-sumatoria { order: 2; }
  .home-resultados { order: 3; }
  .home-clubes { order: 4; }

  .form-card,
  .clubs-section,
  .public-table-card {
    padding: 16px 14px;
    border-radius: 16px;
  }

  .public-table {
    font-size: 12px;
  }

  .public-table th,
  .public-table td {
    padding: 9px 10px;
  }

  .clubs-grid {
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  }
}

/* ===========================
   DESKTOP / PC
=========================== */
@media (min-width: 768px) {
  html,
  body {
    height: 100vh;
    overflow: hidden;
  }

  body {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .app-shell {
    width: 100vw;
    height: 100vh;
    max-width: none;
  }

  .card {
    border-radius: 34px;
  }

  .public-index-card {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .brand-section-top {
    flex: 0 0 22vh;
    min-height: 140px;
    max-height: 190px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 20px 28px;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
    font-size: 16px;
    border-radius: 20px;
    margin-bottom: 14px;
  }

  .brand-title {
    font-size: 34px;
    text-align: center;
  }

  .card-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .public-home-content {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    align-items: stretch;
  }

  .home-login { grid-column: 1; }
  .home-sumatoria { grid-column: 2; }
  .home-resultados { grid-column: 3; }
  .home-clubes { grid-column: 4; }

  .home-block {
    height: 100%;
    min-height: 0;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: 1px solid rgba(148, 163, 184, 0.20);
    border-right: none;
    padding: 22px 18px;
  }

  .home-login {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .home-login .login-inner {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
  }

  .home-sumatoria,
  .home-resultados,
  .home-clubes {
    display: flex;
    flex-direction: column;
  }

  .public-table-wrap,
  .clubs-grid {
    flex: 1 1 auto;
    min-height: 0;
  }

  .public-table-wrap {
    overflow: auto;
  }

  .clubs-grid {
    overflow: auto;
    align-content: start;
    padding-right: 4px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .clubs-grid::-webkit-scrollbar {
    width: 10px;
  }

  .clubs-grid::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.25);
    border-radius: 999px;
    border: 2px solid rgba(2,6,23,0.35);
  }

  .clubs-grid:hover::-webkit-scrollbar-thumb {
    background: rgba(34,197,94,0.35);
  }

  .footer {
    flex: 0 0 16vh;
    min-height: 110px;
    max-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
  }
}

/* ===========================
   PC ancho
=========================== */
@media (min-width: 1280px) {
  .brand-title {
    font-size: 38px;
  }

  .form-title,
  .public-table-title,
  .clubs-title {
    font-size: 22px;
  }

  .public-table {
    font-size: 13px;
  }
}