
:root {
  --green-900: #053b2c;
  --green-800: #07513a;
  --green-700: #2e7d32;
  --green-600: #4f943f;
  --orange: #f28c00;
  --orange-600: #d97800;
  --red: #c62828;
  --bg: #f6f7f5;
  --card: #ffffff;
  --line: #dfe5dc;
  --text: #202421;
  --muted: #66706a;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: white;
  border-right: 1px solid var(--line);
  padding: 34px 24px;
  z-index: 20;
}
.brand {
  display: block;
  color: #ff4f4f;
  font-family: Oswald, Impact, sans-serif;
  font-size: 28px;
  line-height: 1.05;
  margin-bottom: 42px;
}
.nav { display: grid; gap: 8px; }
.nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: #2c302d;
  font-size: 15px;
}
.nav a:hover, .nav a.active { background: #202020; color: white; }
.main {
  width: min(1120px, 100%);
  padding: 36px clamp(18px, 4vw, 56px);
}
.hero {
  min-height: 290px;
  border-radius: 0 0 30px 30px;
  background:
    linear-gradient(90deg, rgba(5, 59, 44, .92), rgba(5, 59, 44, .56)),
    radial-gradient(circle at 80% 40%, rgba(242, 140, 0, .34), transparent 28%),
    linear-gradient(135deg, #0b3d2f, #65401f);
  color: white;
  display: grid;
  align-content: center;
  padding: 42px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(38px, 7vw, 70px); line-height: .95; margin: 0; }
.hero p { max-width: 650px; font-size: 18px; opacity: .92; }
.actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.btn {
  border: 0;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 12px;
  color: white;
  background: var(--green-700);
  font-weight: 800;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.btn.orange { background: var(--orange); }
.btn.red { background: var(--red); }
.btn.ghost { background: white; color: var(--green-800); border: 1px solid var(--line); }
.btn.full { width: 100%; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
}
.card h2 { margin: 0 0 10px; }
.muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.page-title { margin: 0 0 18px; font-size: clamp(28px, 4vw, 44px); color: #0b3d2b; }
.page-subtitle { margin: -8px 0 22px; color: #666; }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { font-size: 24px; margin-bottom: 14px; }
  .nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .nav a { white-space: nowrap; font-size: 14px; padding: 9px 10px; }
  .main { padding: 20px 12px 34px; }
  .hero { padding: 28px 22px; min-height: 240px; }
  .grid-2 { grid-template-columns: 1fr; }
}


/* =========================================================
   App mode - Etapas 1 y 2
   - Evita scroll horizontal en móvil.
   - Convierte la navegación en barra inferior tipo app.
   - Mantiene una barra superior compacta en celular.
   ========================================================= */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overscroll-behavior-x: none;
}

img,
svg,
canvas,
video,
iframe,
table {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

.layout,
.main,
.app-main,
.card,
.hero,
.programacion-app,
.rankings-app,
.reglamento-viewer,
.reglamento-page,
.card-partido,
.cancha-card,
.semana-box,
.categoria-ranking,
.card-jugador,
.detalle-box,
.detalle-grid,
.mobile-detalle-grid,
.mobile-detalle-extra {
  min-width: 0;
}

.main {
  margin: 0 auto;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-icon {
  line-height: 1;
  flex: 0 0 auto;
}

.nav-label {
  min-width: 0;
}

/* Refuerzos de responsividad para módulos heredados desde Google Sites */
.programacion-app table,
.rankings-app table {
  min-width: 760px;
}

.desktop-view,
.desktop-ranking {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.reglamento-page img {
  width: 100%;
  height: auto;
}

@media (max-width: 900px) {
  .desktop-view,
  .desktop-ranking {
    display: none !important;
  }

  .mobile-view,
  .cards-ranking {
    display: block !important;
  }

  .programacion-app table,
  .rankings-app table {
    display: none !important;
  }
}

@media (max-width: 820px) {
  body {
    background: #f5f7f4;
  }

  .layout {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(223,229,220,0.95);
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 150;
    box-shadow: 0 5px 18px rgba(0,0,0,0.06);
  }

  .brand {
    margin: 0;
    color: var(--green-900);
    font-size: 21px;
    line-height: 0.98;
    letter-spacing: 0.2px;
  }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(68px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
    overflow: visible;
    background: rgba(255,255,255,0.98);
    border-top: 1px solid rgba(223,229,220,0.98);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.11);
    z-index: 250;
  }

  .nav a {
    min-width: 0;
    width: 100%;
    height: 56px;
    padding: 7px 4px 6px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    text-align: center;
    color: #2f3b35;
    font-size: 10.8px;
    line-height: 1.05;
    font-weight: 900;
    white-space: normal;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  .nav a:hover,
  .nav a.active {
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
    color: white;
  }

  .nav-icon {
    display: block;
    font-size: 20px;
    line-height: 1;
  }

  .nav-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main {
    width: 100%;
    max-width: 720px;
    padding: 14px 12px 22px;
    overflow-x: hidden;
  }

  .page-title {
    margin-top: 4px;
    font-size: clamp(28px, 8vw, 42px);
  }

  .hero {
    min-height: auto;
    padding: 30px 20px;
    border-radius: 22px;
    margin-bottom: 16px;
  }

  .hero h1 {
    font-size: clamp(34px, 10vw, 52px);
  }

  .hero p {
    font-size: 15.5px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn {
    min-height: 46px;
    border-radius: 14px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .bloque {
    margin-bottom: 22px;
  }

  .bloque h2,
  .rankings-header h2 {
    font-size: 20px;
  }

  #buscador {
    width: 100% !important;
    min-height: 46px;
    font-size: 16px;
  }

  .semana-box,
  .cancha-card,
  .card-partido,
  .categoria-ranking,
  .card-jugador,
  .reglamento-page {
    width: 100%;
    max-width: 100%;
  }

  .cancha-titulo,
  .semana-btn,
  .categoria-titulo {
    touch-action: manipulation;
  }

  .partido-jugadores,
  .card-jugadores,
  .card-nombre,
  .mobile-detalle-extra-linea,
  .historial-item {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .card-jugador-main,
  .mobile-ranking-header {
    grid-template-columns: 36px minmax(0, 1fr) 34px 28px 58px;
  }

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

  .reglamento-viewer {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .nav a {
    font-size: 9.8px;
    border-radius: 14px;
  }

  .nav-icon {
    font-size: 18px;
  }

  .main {
    padding-left: 9px;
    padding-right: 9px;
  }

  .mobile-detalle-grid {
    grid-template-columns: 1fr;
  }
}
