/* Tema: Claro gris y azul
   Fondo gris claro, tarjetas limpias y acentos en azul oscuro.
   Incluye mejoras de lectura en móvil para la zona pública. */
:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel2: #f4f6f9;
  --txt: #172033;
  --muted: #647084;
  --accent: #0b2d5c;
  --accent2: #1d4f91;
  --danger: #c43f4d;
  --warn: #a86b00;
  --line: #d8dee8;

  --theme-body-bg:
    radial-gradient(circle at 14% -8%, rgba(11, 45, 92, 0.08), transparent 30%),
    linear-gradient(135deg, #f7f8fa 0%, #eef1f5 45%, #e2e7ef 100%);
  --theme-body-bg-mobile: #eef1f5;
  --theme-surface: #ffffff;
  --theme-surface-rgb: 255, 255, 255;
  --theme-surface-glass: rgba(255, 255, 255, 0.96);
  --theme-surface-glass-soft: rgba(255, 255, 255, 0.72);
  --theme-surface-soft: #f8fafc;
  --theme-surface-alt: #f3f7fc;
  --theme-surface-bright: #f8fbff;
  --theme-heading: #111b2d;
  --theme-strong: #26354f;
  --theme-label: #273a59;
  --theme-muted-strong: #51647d;

  --theme-top-bg: #eef3f8;
  --theme-top-border: rgba(185, 200, 221, 0.86);
  --theme-top-shadow: 0 8px 24px rgba(20, 35, 58, 0.07);
  --theme-nav-bg: #ffffff;
  --theme-nav-border: #d6dde8;
  --theme-nav-color: #233049;
  --theme-nav-hover-bg: #eef4fb;
  --theme-nav-hover-border: #b7c6db;
  --theme-active-shadow: 0 10px 22px rgba(11, 45, 92, 0.22);

  --theme-panel-head: #edf2f8;
  --theme-row-hover: #f8fafc;
  --theme-selected: #dcecff;
  --theme-border: #d6dde8;
  --theme-border-soft: #dbe2ec;
  --theme-border-softer: #e2e7ef;
  --theme-border-mid: #d6deea;
  --theme-row-border: #e0e6ef;
  --theme-pill-color: #243957;
  --theme-pill-border: #d4deeb;
  --theme-accent-soft: #eef4fb;
  --theme-accent-soft2: #eef6ff;
  --theme-blue-soft-bg: #dce5f1;
  --theme-blue-soft-border: #c7dcf8;
  --theme-active-text-dark: #061733;
  --theme-success-soft-border: #bfe8d5;
  --theme-focus-strong: #08264f;
  --theme-error: #dc2626;

  --theme-shadow: 0 14px 34px rgba(20, 35, 58, 0.1);
  --theme-shadow-soft: 0 8px 22px rgba(20, 35, 58, 0.08);
  --theme-shadow-tiny: 0 4px 12px rgba(20, 35, 58, 0.06);
}
html {
  background: var(--bg);
}
body {
  color: var(--txt);
  background: var(--theme-body-bg);
  background-attachment: fixed;
}
.top {
  background: var(--theme-top-bg);
  border-bottom: 1px solid var(--theme-top-border) !important;
  /*border-bottom-color:var(--theme-border);*/
  box-shadow: var(--theme-top-shadow);
}
.brand,
.nav a {
  color: var(--txt);
}
.nav a:hover {
  color: var(--accent);
}
.nav > div:last-child a,
.nav .main-menu > a.admin-menu-link {
  background: var(--theme-nav-bg);
  border-color: var(--theme-nav-border);
  color: var(--theme-nav-color);
  box-shadow: var(--theme-shadow-tiny);
}
.nav > div:last-child a:hover,
.nav .main-menu > a.admin-menu-link:hover {
  background: var(--theme-nav-hover-bg);
  border-color: var(--theme-nav-hover-border);
  color: var(--accent);
}
.nav a.active,
.nav > div:last-child a.active,
.nav .main-menu > a.admin-menu-link.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--theme-surface) !important;
  opacity: 1;
  box-shadow: var(--theme-active-shadow);
}

.public-menu a,
.nav .main-menu > a.admin-menu-link {
  gap: 0.46rem;
}

.nav-icon-trophy {
  color: #f2b705;
}
.nav-icon-football {
  color: #111827;
}
.nav-icon-table {
  color: #2563eb;
}
.nav-icon-bars {
  color: #059669;
}
.nav-icon-rules {
  color: #ea580c;
}
.nav-icon-user {
  color: #7c3aed;
}
.nav-icon-more {
  color: #64748b;
}

.nav-icon-trophy svg {
  stroke: #f2b705;
}
.nav-icon-football svg {
  stroke: #111827;
}
.nav-icon-table svg {
  stroke: #2563eb;
}
.nav-icon-bars svg {
  stroke: #059669;
}
.nav-icon-rules svg {
  stroke: #ea580c;
}
.nav-icon-user svg {
  stroke: #7c3aed;
}
.nav-icon-more svg {
  stroke: #64748b;
}
.nav a.active .nav-icon-trophy svg,
.nav > div:last-child a.active .nav-icon-trophy svg,
.nav .main-menu > a.admin-menu-link.active .nav-icon-trophy svg {
  stroke: #ffe082;
}
.nav a.active .nav-icon-football svg,
.nav > div:last-child a.active .nav-icon-football svg,
.nav .main-menu > a.admin-menu-link.active .nav-icon-football svg {
  stroke: var(--theme-surface);
}
.nav a.active .nav-icon-table svg,
.nav > div:last-child a.active .nav-icon-table svg,
.nav .main-menu > a.admin-menu-link.active .nav-icon-table svg {
  stroke: #bfdbfe;
}
.nav a.active .nav-icon-bars svg,
.nav > div:last-child a.active .nav-icon-bars svg,
.nav .main-menu > a.admin-menu-link.active .nav-icon-bars svg {
  stroke: #bbf7d0;
}
.nav a.active .nav-icon-rules svg,
.nav > div:last-child a.active .nav-icon-rules svg,
.nav .main-menu > a.admin-menu-link.active .nav-icon-rules svg {
  stroke: #fed7aa;
}
.nav a.active .nav-icon-user svg,
.nav > div:last-child a.active .nav-icon-user svg,
.nav .main-menu > a.admin-menu-link.active .nav-icon-user svg {
  stroke: #e9d5ff;
}
.nav a.active .nav-icon-trophy,
.nav > div:last-child a.active .nav-icon-trophy {
  color: #ffe082;
}
.nav a.active .nav-icon-football,
.nav > div:last-child a.active .nav-icon-football {
  color: var(--theme-surface);
}
.nav a.active .nav-icon-table,
.nav > div:last-child a.active .nav-icon-table {
  color: #bfdbfe;
}
.nav a.active .nav-icon-bars,
.nav > div:last-child a.active .nav-icon-bars {
  color: #bbf7d0;
}
.nav a.active .nav-icon-rules,
.nav > div:last-child a.active .nav-icon-rules {
  color: #fed7aa;
}
.nav a.active .nav-icon-user,
.nav > div:last-child a.active .nav-icon-user {
  color: #e9d5ff;
}
.card,
.visibility-group,
.theme-card,
.summary-card,
.stage-card,
.locked-card {
  background: var(--theme-surface-glass);
  border-color: var(--line);
  color: var(--txt);
  box-shadow: var(--theme-shadow);
}
.card h1,
.card h2,
.card h3,
h1,
h2,
h3 {
  color: var(--theme-heading);
}
p,
.muted,
.small,
small {
  color: var(--muted);
}
a {
  color: var(--accent2);
}
.table-wrap {
  background: var(--theme-surface);
  border-color: var(--line);
  box-shadow: var(--theme-shadow-soft);
}
th {
  background: var(--theme-panel-head);
  color: var(--theme-label);
  border-bottom-color: #d3dbe8;
}
td {
  border-bottom-color: #e3e8f0;
}
tr:hover td {
  background: var(--theme-surface-soft);
}
.pill,
.status-pill {
  background: var(--theme-panel-head);
  color: var(--theme-pill-color);
  border: 1px solid var(--theme-pill-border);
}
.status-scheduled {
  background: var(--theme-panel-head);
  color: #42536c;
  border-color: var(--theme-pill-border);
}
.status-completed {
  background: #e7f3ea;
  color: #176235;
  border-color: #b8ddc4;
}
.status-in-progress {
  background: var(--theme-surface) 7df;
  color: #8a5b00;
  border-color: #ead79c;
}
.status-postponed,
.status-cancelled {
  background: #fdecee;
  color: var(--danger);
  border-color: #efc5ca;
}
.btn,
body:not(.page-participant) button,
input[type="submit"],
.tabs a.active {
  background: var(--accent);
  color: var(--theme-surface);
  /*box-shadow:0 8px 18px rgba(11,45,92,.18);*/
}
.btn.secondary {
  background: #e8edf5;
  color: #172033;
  border: 1px solid #ccd3e1;
  box-shadow: none;
}
.page-admin .btn.secondary {
  padding: 0.2rem;
  white-space: nowrap;
}
.btn.secondary:hover {
  background: #dfe7f2;
  color: var(--accent);
}
input,
select,
textarea {
  background: var(--theme-surface);
  color: var(--txt);
  border-color: #cfd7e4;
}
input::placeholder,
textarea::placeholder {
  color: #7f8aa0;
}
label {
  color: var(--theme-label);
}
.notice {
  background: var(--theme-accent-soft);
  border-left-color: var(--accent);
  color: var(--theme-pill-color);
}
.tabs a {
  background: var(--theme-surface);
  color: #243149;
  border-color: #d3dce9;
  /*box-shadow:0 4px 12px rgba(20,35,58,.05);*/
}
.tabs a:hover {
  border-color: #aebdd1;
  color: var(--accent);
}
.page-matches .tabs a.active:hover {
  color: var(--theme-surface);
}
.hero {
  padding-bottom: 18px;
}
.ranking-hero h1,
.compact-hero h1,
.hero:not(.scoring-hero) h1 {
  letter-spacing: -0.03em;
  text-align: center;
}
.kpi,
.stat-kpi,
.total-chip strong,
.kpi-card .kpi,
.ok {
  color: var(--accent);
}
.clickable-row:hover,
.clickable-row:focus-visible {
  background-color: var(--theme-selected) !important;
}

.clickable-row:active {
  background-color: var(--theme-selected) !important;
}
.standings-table .kpi {
  color: var(--accent);
}
.bar-track {
  background: #e7ecf3;
  border-color: #d5dde8;
}
.bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.mini-list-row {
  border-bottom-color: var(--theme-border-softer);
}
.award-trend-row {
  border-bottom-color: var(--theme-border-softer);
}
.award-trend-row > strong {
  color: #1e2d45;
}
.trend-chip,
.team-chip,
.match-summary-strip span,
.participant-tabs .nav-link,
.mini-tab-link,
.actual-summary,
.compact-row,
.total-chip,
.kpi-card,
.award-admin-field {
  background: var(--theme-surface-soft);
  color: var(--txt);
  border-color: var(--line);
}
.trend-chip b {
  color: var(--accent);
}
.participant-tabs {
  background: rgba(238, 241, 245, 0.96);
}
.participant-tabs .nav-link.active,
.mini-tab-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--theme-surface);
}
.kpi-card:hover .mini-tab-link {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--theme-surface);
}
.accordion-button {
  background: #f1f5fa;
  color: var(--txt);
  border-bottom-color: var(--line);
}
.accordion-button strong {
  color: var(--accent);
}
.subtotal-row td,
.compact-row.subtotal-row {
  background: var(--theme-panel-head) !important;
  color: #172033;
}
.admin-menu-group {
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--line);
  box-shadow: var(--theme-shadow-soft);
}
.admin-menu-group:first-child {
  background: linear-gradient(
    135deg,
    var(--theme-surface),
    var(--theme-accent-soft)
  );
  border-color: #abc0da;
}
.admin-menu-group h2 {
  color: #61708a;
}
.admin-menu-group:first-child h2 {
  color: var(--accent);
}
.admin-menu-item {
  background: linear-gradient(135deg, var(--theme-surface), #f3f6fa);
  color: #1c2a42;
  border-color: var(--line);
  box-shadow: var(--theme-shadow-soft);
}
.admin-menu-item:hover,
.admin-menu-item.active {
  background: var(--theme-accent-soft);
  border-color: #9cb4d3;
  color: var(--accent);
}
.visibility-row {
  background: var(--theme-surface-soft);
  border-color: var(--line);
}
.theme-card-active {
  box-shadow:
    0 0 0 1px var(--theme-active-shadow-color, rgba(11, 45, 92, 0.22)) inset,
    var(--theme-shadow);
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  body {
    background: var(--theme-body-bg-mobile);
  }
  .wrap {
    width: min(100% - 20px, 1180px);
  }
  main.wrap {
    padding-top: 12px;
    padding-bottom: 28px;
  }
  .top {
    position: sticky;
  }
  .nav {
    padding: 10px 0;
    gap: 9px;
  }
  .brand {
    font-size: 0.94rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-icon {
    box-shadow: 0 3px 10px rgba(11, 45, 92, 0.14);
  }
  .main-menu {
    gap: 8px;
  }
  .public-menu {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 6px;
    width: 100%;
  }
  .public-menu a,
  .nav .main-menu > a.admin-menu-link {
    border-radius: 12px;
    padding: 9px 7px;
    font-size: 0.8125rem;
    line-height: 1.1;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav .main-menu > a.admin-menu-link {
    min-width: 72px;
  }
  .hero {
    padding: 16px 0 10px;
  }
  h1 {
    font-size: clamp(1.5625rem, 8vw, 2.125rem);
    line-height: 1.05;
  }
  h2 {
    font-size: 1.25rem;
  }
  .card {
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 8px 20px var(--theme-shadow-color, rgba(20, 35, 58, 0.08));
  }
  .tabs {
    gap: 6px;
    overflow: auto;
    flex-wrap: nowrap;
    padding-bottom: 3px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tabs a {
    white-space: nowrap;
    border-radius: 12px;
    padding: 9px 11px;
    font-size: 0.8125rem;
  }
  .standings-card {
    padding: 10px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .standings-card input {
    margin-bottom: 10px;
    border-radius: 14px;
    padding: 0.4rem 0.86rem;
  }
  .standings-table tr {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border-soft) !important;
    box-shadow: 0 8px 20px var(--theme-shadow-color, rgba(20, 35, 58, 0.08));
  }
  .standings-table td[data-label="Equipo"] strong {
    font-size: 1.0625rem;
    color: var(--theme-heading);
  }
  .standings-table td[data-label="Puntos"] {
    color: var(--accent) !important;
  }
  .page-matches .card {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .page-matches .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }
  .page-matches table,
  .page-matches thead,
  .page-matches tbody,
  .page-matches tr,
  .page-matches td {
    display: block;
    width: 100%;
  }
  .page-matches thead {
    display: none;
  }
  .page-matches tr {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 18px;
    padding: 12px;
    margin: 0 0 10px;
    box-shadow: 0 8px 20px var(--theme-shadow-color, rgba(20, 35, 58, 0.08));
  }
  .page-matches td {
    border: 0;
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8125rem;
  }
  .page-matches td:before {
    font-weight: 800;
    color: var(--muted);
    min-width: 92px;
  }
  .page-matches td:nth-child(1):before {
    content: "#";
  }
  .page-matches td:nth-child(2):before {
    content: "Fecha";
  }
  .page-matches td:nth-child(3):before {
    content: "Fase";
  }
  .page-matches td:nth-child(4):before {
    content: "Grupo";
  }
  .page-matches td:nth-child(5):before {
    content: "Local";
  }
  .page-matches td:nth-child(6):before {
    content: "Visitante";
  }
  .page-matches td:nth-child(7):before {
    content: "Resultado";
  }
  .page-matches td:nth-child(8):before {
    content: "Estado";
  }
  .page-matches td:nth-child(5),
  .page-matches td:nth-child(6) {
    font-weight: 800;
    color: var(--theme-heading);
  }
  .page-stats .stats-grid {
    gap: 10px;
  }
  .page-stats .stat-card {
    padding: 12px;
  }
  .page-stats .stat-kpi {
    font-size: 1.875rem;
  }
  .page-stats .mini-list-row {
    gap: 8px;
    padding: 8px 0;
  }
  .page-stats .stats-ranking .mini-list-row {
    grid-template-columns: 22px 1fr auto;
  }
  .page-stats .bar-row {
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    gap: 7px;
  }
  .page-stats .award-trend-row {
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
  }
  .award-trend-picks {
    gap: 5px;
  }
  .trend-chip {
    font-size: 0.75rem;
    padding: 5px 8px;
    background: var(--theme-surface);
  }
  .page-participant .participant-back-visible {
    margin-bottom: 10px;
  }
  .page-participant .summary-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
  }
  .page-participant .summary-card h2 {
    font-size: 1.25rem;
    margin: 0;
  }
  .page-participant .total-chip {
    min-width: 86px;
    border-radius: 16px;
    padding: 10px;
    text-align: center;
    display: block;
  }
  .page-participant .total-chip strong {
    font-size: 2rem;
  }
  .page-participant .score-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .page-participant .kpi-card {
    min-height: 118px;
    border-radius: 16px;
    padding: 11px;
  }
  .page-participant .kpi-card .kpi {
    font-size: 1.5rem;
  }
  .page-participant .kpi-card strong {
    font-size: 0.8125rem;
    line-height: 1.2;
  }
  .page-participant .card.table-wrap {
    background: var(--theme-surface);
    border: 1px solid var(--line);
    box-shadow: var(--theme-shadow-soft);
    border-radius: 18px;
    padding: 10px;
    overflow: hidden;
  }
  .page-participant .participant-detail .table-wrap {
    box-shadow: none;
    background: var(--theme-surface);
  }
  .page-participant .accordion-item.card {
    box-shadow: var(--theme-shadow-soft);
  }
}

@media (max-width: 420px) {
  .public-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .page-participant .score-kpis {
    grid-template-columns: 1fr;
  }
  .page-matches td {
    display: block;
  }
  .page-matches td:before {
    display: block;
    margin-bottom: 1px;
  }
}

/* v2 móvil: cabecera liberada con hamburguesa, tipografías en rem y tablas públicas compactas. */
.menu-toggle {
  display: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.brand span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  html {
    font-size: 1rem;
  }
  body {
    font-size: 1rem;
    line-height: 1.35;
  }
  .wrap {
    width: min(100% - 1rem, 73.75rem);
  }
  main.wrap {
    padding-top: 0rem;
    padding-bottom: 1.75rem;
  }
  .top {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #eef3f8;
  }
  .nav {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }
  .brand {
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 0.01rem;
  }
  .brand-icon {
    width: 2rem !important;
    height: auto !important;
    flex: 0 0 1.25rem !important;
  }
  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.23rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--theme-surface);
    color: var(--accent);
    box-shadow: 0 0.35rem 1rem var(--theme-shadow-color, rgba(20, 35, 58, 0.08));
    padding: 0;
    cursor: pointer;
  }
  .menu-toggle span {
    display: block;
    width: 1.15rem;
    height: 0.13rem;
    border-radius: 999px;
    background: var(--accent);
    transition:
      transform 0.18s ease,
      opacity 0.18s ease;
  }
  body.menu-open .menu-toggle span:nth-child(1) {
    transform: translateY(0.36rem) rotate(45deg);
  }
  body.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }
  body.menu-open .menu-toggle span:nth-child(3) {
    transform: translateY(-0.36rem) rotate(-45deg);
  }
  .main-menu {
    display: none !important;
    grid-column: 1/-1;
    width: 100%;
    padding: 0.45rem 0 0.15rem;
    background: transparent;
    gap: 0.45rem;
  }
  body.menu-open .main-menu {
    display: grid !important;
    grid-template-columns: 1fr;
    animation: menuDrop 0.16s ease-out;
  }
  @keyframes menuDrop {
    from {
      opacity: 0;
      transform: translateY(-0.25rem);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  .public-menu {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem;
    width: 100%;
  }
  .public-menu a,
  .nav .main-menu > a.admin-menu-link {
    border-radius: 0.85rem;
    padding: 0.75rem 0.65rem;
    font-size: 0.82rem;
    line-height: 1.1;
    min-height: 2.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .nav .main-menu > a.admin-menu-link {
    width: 100%;
    min-width: 0;
    margin: 0;
    grid-column: auto;
    background: var(--theme-surface);
    margin-top: 1.5rem;
  }
  .hero {
    padding: 0.9rem 0 0.65rem;
  }
  h1 {
    font-size: clamp(1.55rem, 7.5vw, 2.1rem);
    line-height: 1.05;
    margin: 0.15em 0 0.45em;
    margin-bottom: 0 !important;
  }
  h2 {
    font-size: 1.18rem;
    line-height: 1.15;
  }
  h3 {
    font-size: 1rem;
    line-height: 1.2;
  }
  p,
  .small,
  small,
  .muted {
    font-size: 0.86rem;
  }
  .card {
    border-radius: 1rem;
    padding: 0.85rem;
    box-shadow: 0 0.5rem 1.25rem
      var(--theme-shadow-color, rgba(20, 35, 58, 0.08));
  }
  th,
  td {
    font-size: 0.86rem;
    padding: 0.5rem 0.55rem;
  }
  .btn,
  button,
  input[type="submit"] {
    font-size: 0.88rem;
    border-radius: 0.8rem;
    padding: 0.58rem 0.8rem;
  }
  input,
  select,
  textarea {
    font-size: 0.9rem;
    border-radius: 0.8rem;
    padding: 0.72rem 0.8rem;
  }
  .tabs {
    gap: 0.38rem;
    overflow: auto;
    flex-wrap: nowrap;
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 0rem;
    scrollbar-width: none;
    position: sticky;
    top: 3.8rem; /*background-color: var(--bg);*/
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tabs a {
    white-space: nowrap;
    border-radius: 0.85rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* Partidos: tarjetas más compactas, con equipos y marcador como foco. */
  .page-matches .card {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .page-matches .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }
  .page-matches table,
  .page-matches thead,
  .page-matches tbody,
  .page-matches tr,
  .page-matches td {
    display: block;
    width: 100%;
  }
  .page-matches thead {
    display: none;
  }
  .page-matches tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.18rem 0.55rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 1rem;
    padding: 0.7rem 0.75rem;
    margin: 0 0 0.55rem;
    box-shadow: 0 0.45rem 1rem rgba(20, 35, 58, 0.075);
  }
  .page-matches td {
    border: 0;
    padding: 0;
    font-size: 0.82rem;
    color: var(--theme-strong);
  }
  .page-matches td:before {
    content: none !important;
  }
  .page-matches td:nth-child(1) {
    grid-column: 1/2;
    grid-row: 1;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
  }
  .page-matches td:nth-child(2) {
    grid-column: 1/3;
    grid-row: 2;
    color: var(--muted);
    font-size: 0.76rem;
  }
  .page-matches td:nth-child(3) {
    grid-column: 1/2;
    grid-row: 1;
    justify-self: start;
    margin-left: 2.1rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 900;
  }
  .page-matches td:nth-child(4) {
    display: none;
  }
  .page-matches td:nth-child(5) {
    grid-column: 1/2;
    grid-row: 3;
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--theme-heading);
    line-height: 1.15;
  }
  .page-matches td:nth-child(6) {
    grid-column: 1/2;
    grid-row: 4;
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--theme-heading);
    line-height: 1.15;
  }
  .page-matches td:nth-child(7) {
    grid-column: 2/3;
    grid-row: 3/5;
    align-self: center;
    justify-self: end;
    min-width: 3.8rem;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    padding: 0.45rem 0.4rem;
    background: var(--theme-surface-soft);
    font-size: 1rem;
    font-weight: 900;
    color: var(--accent);
  }
  .page-matches td:nth-child(8) {
    grid-column: 2/3;
    grid-row: 1/3;
    justify-self: end;
    align-self: start;
  }
  .page-matches .status-pill {
    font-size: 0.68rem;
    padding: 0.23rem 0.45rem;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* Detalle: tarjetas de resumen más densas. */
  .page-participant .participant-detail {
    gap: 0.75rem;
    margin-bottom: 1.75rem;
  }
  .page-participant .participant-back-visible {
    margin: 0.25rem 0 0.55rem;
  }
  .page-participant .summary-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.75rem;
    border-radius: 1rem;
  }
  .page-participant .summary-card h2 {
    font-size: 1.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-participant .total-chip {
    min-width: 4.7rem;
    border-radius: 0.85rem;
    padding: 0.5rem 0.55rem;
  }
  .page-participant .total-chip span,
  .page-participant .total-chip small {
    font-size: 0.68rem;
  }
  .page-participant .total-chip strong {
    font-size: 1.85rem;
  }
  .page-participant .score-kpis {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem;
  }
  .page-participant .kpi-card {
    min-height: 0;
    border-radius: 0.9rem;
    padding: 0.68rem;
    box-shadow: 0 0.45rem 1rem rgba(20, 35, 58, 0.075);
  }
  .page-participant .kpi-card .kpi {
    font-size: 1.35rem;
    line-height: 1;
  }
  .page-participant .kpi-card .kpi span {
    color: var(--muted);
    font-size: 0.8rem;
  }
  .page-participant .kpi-card strong {
    font-size: 1rem;
    line-height: 1.12;
    margin: 0.3rem 0 0.25rem;
  }
  .page-participant .kpi-card span {
    font-size: 0.68rem;
  }
  .page-participant .mini-tab-link {
    font-size: 0.73rem;
    padding: 0.33rem 0.6rem;
    box-shadow: none;
  }
  .page-participant .section-title {
    margin: 0.35rem 0 0.55rem;
    gap: 0.4rem;
  }
  .page-participant .section-title h2 {
    font-size: 1.15rem;
    margin: 0;
  }
  .page-participant .card.table-wrap {
    padding: 0.65rem;
    border-radius: 1rem;
    overflow: visible;
  }
  .page-participant .group-match-heading {
    gap: 0.45rem;
    margin-bottom: 0.45rem;
  }
  .page-participant .group-match-heading .match-summary-strip {
    grid-template-columns: 1fr 1fr;
    gap: 0.38rem;
  }
  .page-participant .match-summary-strip span {
    border-radius: 0.85rem;
    padding: 0.45rem 0.4rem;
    font-size: 0.72rem;
  }
  .page-participant .match-summary-strip strong {
    font-size: 1rem;
  }
  .page-participant .accordion {
    gap: 0.6rem;
  }
  .page-participant .accordion-button {
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.9rem;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* Tablas de partidos del detalle: cada fila ocupa todo el ancho y no estrangula el nombre del partido. */
  .page-participant #pane-group-matches table,
  .page-participant #pane-group-matches thead,
  .page-participant #pane-group-matches tbody,
  .page-participant #pane-group-matches tr,
  .page-participant #pane-group-matches td,
  .page-participant #pane-ko-matches table,
  .page-participant #pane-ko-matches thead,
  .page-participant #pane-ko-matches tbody,
  .page-participant #pane-ko-matches tr,
  .page-participant #pane-ko-matches td {
    display: block;
    width: 100%;
  }
  .page-participant #pane-group-matches thead,
  .page-participant #pane-ko-matches thead {
    display: none;
  }
  .page-participant #pane-group-matches tbody,
  .page-participant #pane-ko-matches tbody {
    display: grid;
    gap: 0.42rem;
  }
  .page-participant #pane-group-matches tr,
  .page-participant #pane-ko-matches tr {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.25rem 0.45rem;
    align-items: center;
    border: 1px solid var(--theme-row-border);
    border-radius: 0.85rem;
    background: var(--theme-surface);
    padding: 0.5rem 0.55rem;
    box-shadow: 0 0.25rem 0.8rem rgba(20, 35, 58, 0.045);
  }
  .page-participant #pane-group-matches td,
  .page-participant #pane-ko-matches td {
    border: 0;
    padding: 0 !important;
    font-size: 0.8rem;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  .page-participant #pane-group-matches .col-num,
  .page-participant #pane-group-matches .col-date,
  .page-participant #pane-group-matches .col-group,
  .page-participant #pane-ko-matches .col-num,
  .page-participant #pane-ko-matches .col-date,
  .page-participant #pane-ko-matches .actual-match-col {
    display: none !important;
  }
  .page-participant #pane-group-matches .match-name,
  .page-participant #pane-ko-matches .match-name {
    grid-column: 1/-1;
    font-size: 0.84rem;
    font-weight: 900;
    color: var(--theme-heading);
    line-height: 1.18;
  }
  .page-participant #pane-group-matches .score-cell,
  .page-participant #pane-group-matches .result-cell,
  .page-participant #pane-group-matches .pts-cell,
  .page-participant #pane-ko-matches .score-cell,
  .page-participant #pane-ko-matches .result-cell,
  .page-participant #pane-ko-matches .pts-cell {
    width: auto;
    text-align: center !important;
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.35rem 0.45rem !important;
    min-width: 3.1rem;
    font-size: 0.82rem;
  }
  .page-participant #pane-group-matches .score-cell:before,
  .page-participant #pane-ko-matches .score-cell:before {
    content: "Apuesta";
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 0.08rem;
  }
  .page-participant #pane-group-matches .result-cell:before,
  .page-participant #pane-ko-matches .result-cell:before {
    content: "Real";
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 0.08rem;
  }
  .page-participant #pane-group-matches .pts-cell:before,
  .page-participant #pane-ko-matches .pts-cell:before {
    content: "Pts";
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 0.08rem;
  }
  .page-participant #pane-group-matches .subtotal-row,
  .page-participant #pane-ko-matches .subtotal-row {
    display: grid;
    grid-template-columns: 1fr auto;
    background: var(--theme-panel-head) !important;
    border-color: var(--theme-border-mid);
  }
  .page-participant #pane-group-matches .subtotal-row td,
  .page-participant #pane-ko-matches .subtotal-row td {
    display: none !important;
  }
  .page-participant #pane-group-matches .subtotal-row td:first-child,
  .page-participant #pane-ko-matches .subtotal-row td:first-child {
    display: block !important;
    grid-column: 1/2;
    font-weight: 900;
  }
  .page-participant #pane-group-matches .subtotal-row td:last-child,
  .page-participant #pane-ko-matches .subtotal-row td:last-child {
    display: block !important;
    grid-column: 2/3;
    font-weight: 900;
    color: var(--accent);
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* Orden de equipos: columnas útiles, anchas y legibles. */
  .page-participant #pane-groups .accordion-body.table-wrap {
    padding: 0;
    overflow: hidden;
    border-radius: 0 0 0.9rem 0.9rem;
    background: var(--theme-surface);
  }
  .page-participant #pane-groups table {
    table-layout: auto;
    width: 100%;
  }
  .page-participant #pane-groups th,
  .page-participant #pane-groups td {
    font-size: 0.8rem;
    padding: 0.48rem 0.5rem;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  .page-participant #pane-groups th:nth-child(1),
  .page-participant #pane-groups td:nth-child(1) {
    width: 2.25rem;
    text-align: center;
  }
  .page-participant #pane-groups th:nth-child(2),
  .page-participant #pane-groups td:nth-child(2) {
    padding-left: 0.42rem !important;
    width: auto;
  }
  .page-participant #pane-groups th:nth-child(3),
  .page-participant #pane-groups td:nth-child(3) {
    padding-left: 0.42rem !important; /*display:none!important*/
  }
  .page-participant #pane-groups th:nth-child(4),
  .page-participant #pane-groups td:nth-child(4) {
    width: 3rem;
    text-align: right !important;
  }
  .page-participant #pane-groups .subtotal-row td:first-child {
    display: table-cell !important;
    text-align: left !important;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* Premios y detalle técnico: tablas convertidas a filas-card. */
  .page-participant #pane-awards table,
  .page-participant #pane-awards thead,
  .page-participant #pane-awards tbody,
  .page-participant #pane-awards tr,
  .page-participant #pane-awards td,
  .page-participant #pane-score table,
  .page-participant #pane-score thead,
  .page-participant #pane-score tbody,
  .page-participant #pane-score tr,
  .page-participant #pane-score td {
    display: block;
    width: 100%;
  }
  .page-participant #pane-awards thead,
  .page-participant #pane-score thead {
    display: none;
  }
  .page-participant #pane-awards tbody,
  .page-participant #pane-score tbody {
    display: grid;
    gap: 0.42rem;
  }
  .page-participant #pane-awards tr,
  .page-participant #pane-score tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.12rem 0.5rem;
    border: 1px solid var(--theme-row-border);
    border-radius: 0.85rem;
    background: var(--theme-surface);
    padding: 0.55rem;
  }
  .page-participant #pane-awards td,
  .page-participant #pane-score td {
    border: 0;
    padding: 0 !important;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
  }
  .page-participant #pane-awards td:nth-child(1),
  .page-participant #pane-score td:nth-child(1) {
    grid-column: 1/2;
    font-weight: 900;
    color: var(--theme-heading);
  }
  .page-participant #pane-awards td:nth-child(2),
  .page-participant #pane-score td:nth-child(2) {
    grid-column: 1/2;
    color: var(--theme-strong);
  }
  .page-participant #pane-awards td:nth-child(3),
  .page-participant #pane-score td:nth-child(3) {
    grid-column: 1/2;
    color: var(--muted);
    font-size: 0.74rem;
  }
  .page-participant #pane-awards td:nth-child(4),
  .page-participant #pane-score td:nth-child(4) {
    grid-column: 2/3;
    grid-row: 2/4;
    align-self: center;
    min-width: 3rem;
    text-align: center !important;
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.7rem 0.35rem !important;
    font-weight: 900;
    color: var(--accent);
    font-size: 1rem;
  }
  .page-participant #pane-awards td:nth-child(4):before,
  .page-participant #pane-score td:nth-child(4):before {
    content: "Pts";
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  /* Estadísticas: tablas y listados sin desbordes horizontales. */
  .page-stats .stats-grid {
    gap: 0.65rem;
  }
  .page-stats .stat-card {
    padding: 0.75rem;
    border-radius: 1rem;
  }
  .page-stats .stat-kpi {
    font-size: 1.65rem;
    line-height: 1.05;
  }
  .page-stats .stat-card .muted {
    font-size: 0.8rem;
  }
  .page-stats .mini-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    padding: 0.5rem 0;
    font-size: 0.84rem;
  }
  .page-stats .bar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    padding: 0.75rem;
    gap: 0.42rem;
    font-size: 0.82rem;
  }
  .page-stats .bar-track {
    grid-column: 1/-1;
    height: 0.55rem;
  }
  .page-stats .award-trend-row {
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    padding: 0.75rem;
    display: grid;
    gap: 0.4rem;
  }
  .page-stats .award-trend-row > strong {
    font-size: 0.86rem;
  }
  .page-stats .award-trend-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.32rem;
  }
  .page-stats .trend-chip {
    font-size: 0.72rem;
    padding: 0.28rem 0.48rem;
  }
  .page-stats .stat-full .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }
  .page-stats .stat-full table,
  .page-stats .stat-full thead,
  .page-stats .stat-full tbody,
  .page-stats .stat-full tr,
  .page-stats .stat-full td {
    display: block;
    width: 100%;
  }
  .page-stats .stat-full thead {
    display: none;
  }
  .page-stats .stat-full tbody {
    display: grid;
    gap: 0.45rem;
  }
  .page-stats .stat-full tr {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.18rem 0.42rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 0.9rem;
    padding: 0.58rem 0.75rem;
    box-shadow: 0 0.35rem 0.9rem rgba(20, 35, 58, 0.055);
  }
  .page-stats .stat-full td {
    border: 0;
    padding: 0;
    font-size: 0.8rem;
    min-width: 0;
  }
  .page-stats .stat-full td:nth-child(1) {
    grid-column: 1/-1;
    font-size: 0.86rem;
    font-weight: 900;
    color: var(--theme-heading);
  }
  .page-stats .stat-full td:nth-child(2),
  .page-stats .stat-full td:nth-child(3),
  .page-stats .stat-full td:nth-child(4) {
    text-align: center !important;
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.32rem 0.42rem;
    font-weight: 900;
    color: var(--accent);
  }
  .page-stats .stat-full td:nth-child(2):before {
    content: "Total";
    display: block;
    color: var(--muted);
    font-size: 0.6rem;
  }
  .page-stats .stat-full td:nth-child(3):before {
    content: "Media";
    display: block;
    color: var(--muted);
    font-size: 0.6rem;
  }
  .page-stats .stat-full td:nth-child(4):before {
    content: "Máx.";
    display: block;
    color: var(--muted);
    font-size: 0.6rem;
  }
  .page-stats .stat-full td:nth-child(5) {
    grid-column: 1/-1;
    color: var(--muted);
    font-size: 0.74rem;
    padding-top: 0.12rem;
  }
  .page-stats .stat-full td:nth-child(5):before {
    content: "Líder: ";
    font-weight: 900;
    color: var(--theme-label);
  }
}

@media (max-width: 420px) {
  .page-participant .score-kpis {
    grid-template-columns: 1fr 1fr !important;
  }
  .page-participant #pane-group-matches tr,
  .page-participant #pane-ko-matches tr {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .page-participant #pane-group-matches .match-name,
  .page-participant #pane-ko-matches .match-name {
    grid-column: 1/-1;
  }
  .page-matches tr {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* v3 móvil: menú realmente colapsado, fuente base .8rem y tablas completas con resultado real. */
@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  html {
    font-size: 1rem;
  }
  body {
    font-size: 0.8rem;
    line-height: 1.35;
  }
  .top {
    min-height: 3.25rem;
  }
  .nav {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.45rem 0;
  }
  .brand {
    font-size: 1.5rem;
  }
  .menu-toggle {
    display: inline-flex !important;
  }
  .main-menu {
    display: grid !important;
    grid-column: 1/-1;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    pointer-events: none;
    padding: 0 !important;
    margin: 0 !important;
    transition:
      grid-template-rows 0.18s ease,
      opacity 0.18s ease,
      visibility 0.18s ease,
      padding 0.18s ease;
  }
  .main-menu > * {
    min-height: 0;
    overflow: hidden;
  }
  body.menu-open .main-menu {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 0.55rem 0 0.18rem !important;
  }
  body.menu-open .main-menu {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(216, 222, 232, 0.95);
    border-radius: 1rem;
    box-shadow: 0 0.7rem 1.6rem
      var(--theme-shadow-color-strong, rgba(20, 35, 58, 0.1));
    padding: 0.6rem !important;
    gap: 0.55rem;
  }
  body.menu-open .public-menu {
    display: grid !important;
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    align-items: stretch;
    gap: 0.45rem;
    width: 100%;
    height: auto !important;
    max-height: none !important;
    border-width: initial !important;
  }
  body.menu-open .public-menu a {
    min-width: 0;
    min-height: 2.6rem;
    padding: 0.55rem 0.35rem;
    border-radius: 0.9rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.15;
    background: var(--theme-surface);
  }
  body.menu-open .admin-menu-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-width: 6.25rem;
    max-width: 100%;
    margin-left: auto;
    height: auto !important;
    max-height: none !important;
    border-width: 1px !important;
    border-color: #9fb5d2 !important;
    background: linear-gradient(
      180deg,
      var(--theme-accent-soft) 0%,
      #e1ebf8 100%
    ) !important;
    color: var(--accent) !important;
    font-weight: 800;
    box-shadow: 0 0.35rem 0.9rem rgba(11, 45, 92, 0.1) !important;
    padding: 0.6rem 0.95rem !important;
    border-radius: 0.95rem;
  }
  body.menu-open .admin-menu-link:before {
    content: "Administración";
    display: none;
  }
  body:not(.menu-open) .main-menu,
  body:not(.menu-open) .public-menu,
  body:not(.menu-open) .admin-menu-link {
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    box-shadow: none !important;
  }

  h1 {
    font-size: clamp(1.55rem, 7.5vw, 2.1rem) !important;
  }
  h2 {
    font-size: 1.05rem;
  }
  h3 {
    font-size: 0.95rem;
  }
  p,
  .small,
  small,
  .muted,
  th,
  td,
  .btn,
  button,
  input,
  select,
  textarea,
  .tabs a {
    font-size: 0.8rem;
  }
  .card {
    padding: 0.7rem;
    border-radius: 0.9rem;
  }

  /* Partidos públicos: más compactos y sin fuentes grandes. */
  .page-matches tr {
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.45rem;
    border-radius: 0.9rem;
    gap: 0.12rem 0.45rem;
  }
  .page-matches td {
    font-size: 0.8rem;
  }
  .page-matches td:nth-child(1),
  .page-matches td:nth-child(2),
  .page-matches td:nth-child(3) {
    font-size: 0.9rem;
  }
  .page-matches td:nth-child(5),
  .page-matches td:nth-child(6) {
    font-size: 1rem;
  }
  .page-matches td:nth-child(7) {
    font-size: 0.92rem;
    min-width: 3.35rem;
    padding: 0.34rem 0.35rem;
  }

  /* Detalle de puntos: tablas de partidos con Apuesta, Real y Pts siempre visibles. */
  .page-participant #pane-group-matches tr,
  .page-participant #pane-ko-matches tr {
    grid-template-columns: minmax(0, 1fr) auto auto auto !important;
    width: 100%;
  }
  .page-participant #pane-group-matches .match-name,
  .page-participant #pane-ko-matches .match-name {
    grid-column: 1/-1 !important;
    font-size: 1rem;
  }
  .page-participant #pane-group-matches .score-cell,
  .page-participant #pane-group-matches .result-cell,
  .page-participant #pane-group-matches .pts-cell,
  .page-participant #pane-ko-matches .score-cell,
  .page-participant #pane-ko-matches .result-cell,
  .page-participant #pane-ko-matches .pts-cell {
    display: block !important;
    min-width: 2.8rem;
    font-size: 1rem;
    padding: 0.3rem 0.36rem !important;
  }
  .page-participant #pane-ko-matches .actual-match-col {
    display: block !important;
    grid-column: 1/-1 !important;
    font-size: 1rem;
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.32rem 0.45rem !important;
  }
  .page-participant #pane-ko-matches .match-name {
    display: block !important;
    grid-column: 1/-1 !important;
    font-size: 1rem;
    background: var(--theme-surface);
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.32rem 0.45rem !important;
  }
  .page-participant #pane-ko-matches .match-name:before {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.8rem;
  }
  .page-participant #pane-ko-matches .actual-match-col:before {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.8rem;
  }

  /* Orden de equipos: recuperar Resultado real y mantenerlo legible. */
  .page-participant #pane-groups table,
  .page-participant #pane-groups thead,
  .page-participant #pane-groups tbody,
  .page-participant #pane-groups tr,
  .page-participant #pane-groups td {
    display: block;
    width: 100%;
  }
  .page-participant #pane-groups thead {
    display: none;
  }
  .page-participant #pane-groups tbody {
    display: grid;
    gap: 0.4rem;
    padding: 0.45rem;
    background: var(--theme-surface);
  }
  .page-participant #pane-groups tr {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr) 2.8rem;
    gap: 0.35rem;
    align-items: center;
    border: 1px solid var(--theme-row-border);
    border-radius: 0.8rem;
    padding: 0.42rem 0.45rem;
    background: var(--theme-surface);
  }
  .page-participant #pane-groups td {
    border: 0 !important;
    padding: 0 !important;
    font-size: 0.76rem;
    overflow-wrap: anywhere;
  }
  .page-participant #pane-groups td:nth-child(1) {
    grid-column: 1;
    width: auto;
    text-align: center;
    color: var(--muted);
  }
  .page-participant #pane-groups td:nth-child(2) {
    grid-column: 2;
    width: auto;
    font-weight: 900;
    color: var(--theme-heading);
  }
  .page-participant #pane-groups td:nth-child(3) {
    display: block !important;
    grid-column: 3;
    width: auto;
    color: var(--theme-strong);
  }
  .page-participant #pane-groups td:nth-child(2):before {
    content: "Apuesta";
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 900;
  }
  .page-participant #pane-groups td:nth-child(3):before {
    content: "Real";
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 900;
  }
  .page-participant #pane-groups td:nth-child(4) {
    grid-column: 4;
    width: auto;
    text-align: right !important;
    font-weight: 900;
    color: var(--accent);
  }
  .page-participant #pane-groups .subtotal-row {
    grid-template-columns: minmax(0, 1fr) auto;
    background: var(--theme-panel-head) !important;
    border-color: var(--theme-border-mid);
  }
  .page-participant #pane-groups .subtotal-row td {
    display: none !important;
  }
  .page-participant #pane-groups .subtotal-row td:first-child {
    display: block !important;
    grid-column: 1/2;
    text-align: left !important;
    font-weight: 900;
  }
  .page-participant #pane-groups .subtotal-row td:last-child {
    display: block !important;
    grid-column: 2/3;
    text-align: right !important;
    font-weight: 900;
    color: var(--accent);
  }

  /* Tablas de premios y detalle técnico: conservar Resultado real / Real junto a apuesta y puntos. */
  .page-participant #pane-awards tr,
  .page-participant #pane-score tr {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }
  .page-participant #pane-awards td,
  .page-participant #pane-score td {
    font-size: 0.9rem;
  }
  .page-participant #pane-awards td:nth-child(2),
  .page-participant #pane-score td:nth-child(2) {
    display: block !important;
    color: var(--theme-strong);
    font-size: 0.9rem;
    background: var(--theme-surface);
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    padding: 0.28rem 0.38rem !important;
  }
  .page-participant #pane-awards td:nth-child(3),
  .page-participant #pane-score td:nth-child(3) {
    display: block !important;
    color: var(--theme-strong);
    font-size: 0.9rem;
    background: var(--theme-surface-soft);
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    padding: 0.28rem 0.38rem !important;
  }
  .page-participant #pane-awards td:nth-child(2):before {
    content: "Real: ";
    font-weight: 900;
    color: var(--theme-muted-strong);
  }
  .page-participant #pane-score td:nth-child(2):before {
    content: "Real: ";
    font-weight: 900;
    color: var(--theme-muted-strong);
  }
  .page-participant #pane-awards td:nth-child(3):before {
    content: "Apuesta: ";
    font-weight: 900;
    color: var(--theme-muted-strong);
  }
  .page-participant #pane-score td:nth-child(3):before {
    content: "Apuesta: ";
    font-weight: 900;
    color: var(--theme-muted-strong);
  }

  /* Estadísticas: filas con etiquetas claras y ancho completo. */
  .page-stats .stat-full tr {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.35rem;
    padding: 0.5rem;
  }
  .page-stats .stat-full td {
    font-size: 0.76rem;
  }
  .page-stats .stat-full td:nth-child(1) {
    grid-column: 1/-1 !important;
    font-size: 0.8rem;
  }
  .page-stats .stat-full td:nth-child(2),
  .page-stats .stat-full td:nth-child(3),
  .page-stats .stat-full td:nth-child(4) {
    padding: 0.28rem 0.32rem !important;
    min-width: 0;
  }
  .page-stats .stat-full td:nth-child(5) {
    grid-column: 1/-1 !important;
    font-size: 0.72rem;
  }
}

@media (max-width: 420px) {
  .page-participant #pane-groups tr {
    grid-template-columns: 1.8rem minmax(0, 1fr) minmax(0, 1fr) 2.5rem;
    gap: 0.28rem;
  }
  .page-participant #pane-groups td {
    font-size: 1rem;
  }
  .page-participant #pane-group-matches tr,
  .page-participant #pane-ko-matches tr {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 420px) {
  body.menu-open .main-menu {
    padding: 0.5rem !important;
    gap: 0.45rem;
  }
  body.menu-open .public-menu {
    gap: 0.35rem;
  }
  body.menu-open .public-menu a {
    font-size: 0.74rem;
    min-height: 2.45rem;
    padding: 0.5rem 0.25rem;
    border-radius: 0.82rem;
  }
  body.menu-open .admin-menu-link {
    min-width: 5.6rem;
    padding: 0.55rem 0.8rem !important;
    font-size: 0.76rem;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  .standings-card .table-wrap {
    background: none;
    border: none;
    box-shadow: none;
  }
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  .standings-table td[data-label="Pos"] {
    position: absolute;
    top: calc(50% - 1.3rem);
    left: 0.5rem;
    color: var(--muted);
    font-size: 1.5rem;
    font-weight: 800;
  }
  .standings-table td[data-label="Equipo"],
  .standings-table td[data-label="Nombre"] {
    margin-left: 2.4rem;
  }
}

tr.clickable-row:hover td {
  background: transparent;
}

.nav > div:last-child a.active,
.public-menu a.active,
.nav .main-menu > a.admin-menu-link.active {
  box-shadow: none !important;
}
@media (max-width: 420px) {
  .page-participant #pane-group-matches tr:not(.subtotal-row),
  .page-participant #pane-ko-matches tr:not(.subtotal-row) {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .page-participant
    #pane-group-matches
    tr:not(.subtotal-row)
    > td[colspan].muted,
  .page-participant #pane-ko-matches tr:not(.subtotal-row) > td[colspan].muted {
    grid-column: 1 / -1 !important;
  }
  .page-participant .subtotal-row {
    display: none !important;
  }
}
@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  .page-participant
    #pane-group-matches
    tr:not(.subtotal-row)
    > td[colspan].muted,
  .page-participant #pane-ko-matches tr:not(.subtotal-row) > td[colspan].muted {
    grid-column: 1 / -1 !important;
    width: 100%;
  }

  .page-participant #pane-group-matches tr.subtotal-row,
  .page-participant #pane-ko-matches tr.subtotal-row {
    grid-template-columns: 1fr auto !important;
  }

  .page-participant #pane-group-matches tr.subtotal-row > td:first-child,
  .page-participant #pane-ko-matches tr.subtotal-row > td:first-child {
    grid-column: 1;
  }

  .page-participant #pane-group-matches tr.subtotal-row > td:last-child,
  .page-participant #pane-ko-matches tr.subtotal-row > td:last-child {
    grid-column: 2;
    text-align: right;
    justify-self: end;
  }
  .page-participant .subtotal-row {
    display: none !important;
  }
}
.page-participant #pane-ko-matches tbody tr:not(.subtotal-row):not(.zero-row) {
  box-shadow: 0 0 0 1px #b3dfce !important;
}
/* Mejora visual móvil del detalle de partidos: tarjetas más claras para Apuesta / Real. */
@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  .page-participant #pane-group-matches tbody,
  .page-participant #pane-ko-matches tbody {
    gap: 0.7rem !important;
  }

  .page-participant #pane-group-matches tr:not(.subtotal-row),
  .page-participant #pane-ko-matches tr:not(.subtotal-row) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.42rem !important;
    padding: 0.62rem !important;
    border: 1px solid #cfdbea !important;
    border-radius: 1rem !important;
    background: linear-gradient(
      180deg,
      var(--theme-surface) 0%,
      var(--theme-surface-bright) 100%
    ) !important;
    box-shadow: 0 0.35rem 1rem rgba(17, 35, 65, 0.06) !important;
  }

  .page-participant #pane-group-matches .col-num,
  .page-participant #pane-group-matches .col-date,
  .page-participant #pane-group-matches .col-group,
  .page-participant #pane-ko-matches .col-num,
  .page-participant #pane-ko-matches .col-date {
    display: none !important;
  }

  .page-participant #pane-group-matches .match-name,
  .page-participant #pane-ko-matches .match-name,
  .page-participant #pane-ko-matches .actual-match-col {
    display: block !important;
    grid-column: 1 / -1 !important;
    width: 100% !important;
    border-radius: 0.78rem !important;
    padding: 0 !important;
    line-height: 1.25 !important;
    border: none !important;
    /*box-shadow: inset .18rem 0 0 rgba(16, 82, 159, .28) !important;*/
    overflow-wrap: anywhere !important;
  }

  .page-participant #pane-group-matches .match-name,
  .page-participant #pane-ko-matches .match-name {
    margin-bottom: -0.16rem !important;
    background: var(--theme-surface) !important;
    color: #081a35 !important;
    font-size: 0.9rem !important;
    font-weight: 950 !important;
  }

  .page-participant #pane-ko-matches .actual-match-col {
    margin-top: -0.1rem !important;
    background: var(--theme-surface-alt) !important;
    color: #243954 !important;
    font-size: 0.84rem !important;
    font-weight: 650 !important;
    /*box-shadow: inset .18rem 0 0 rgba(71, 96, 128, .22) !important;*/
  }

  .page-participant #pane-group-matches .match-name:before,
  .page-participant #pane-ko-matches .actual-match-col:before {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 3.35rem !important;
    margin-right: 0.38rem !important;
    padding: 0.13rem 0.38rem !important;
    border-radius: 999px !important;
    font-size: 0.66rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    letter-spacing: 0.015em !important;
    text-transform: uppercase !important;
    vertical-align: 0.08rem !important;
  }

  .page-participant #pane-ko-matches .match-name.ko-real-cell:before,
  .page-participant #pane-ko-matches .match-name.ko-prediction-cell:before {
    display: block !important;
    min-width: 0 !important;
    margin: 0 0 0.18rem !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--theme-muted-strong) !important;
    font-size: 0.68rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: 0.02em !important;
    text-align: center !important;
    text-transform: uppercase !important;
    vertical-align: baseline !important;
  }
  .page-participant #pane-ko-matches .match-name.ko-real-cell {
    /*border: 1px solid var(--theme-blue-soft-border) !important;*/
    padding: 0.2rem !important;
    background-color: transparent !important;
  }
  .page-participant #pane-ko-matches .match-name.ko-prediction-cell {
    /*border: 1px solid var(--theme-blue-soft-border) !important;*/
    padding: 0.2rem !important;
    background-color: transparent !important;
  }
  .page-participant #pane-ko-matches .match-name.ko-real-cell:before {
    content: "Real" !important;
  }
  .page-participant #pane-ko-matches .match-name.ko-prediction-cell:before {
    content: "Apuesta" !important;
  }

  .page-participant #pane-ko-matches .actual-match-col:before {
    content: "Real" !important;
    color: #455a73 !important;
    background: #eef2f7 !important;
    border: 1px solid #d7e0eb !important;
  }

  .page-participant #pane-group-matches .score-cell,
  .page-participant #pane-group-matches .result-cell,
  .page-participant #pane-group-matches .pts-cell,
  .page-participant #pane-ko-matches .score-cell,
  .page-participant #pane-ko-matches .result-cell,
  .page-participant #pane-ko-matches .pts-cell {
    width: auto !important;
    min-width: 0 !important;
    padding: 0.48rem 0.32rem !important;
    text-align: center !important;
    border: 1px solid #d4dfec !important;
    border-radius: 0.78rem !important;
    background: #f9fbfe !important;
    color: #071a35 !important;
    font-size: 0.95rem !important;
    font-weight: 950 !important;
    line-height: 1.08 !important;
  }

  .page-participant #pane-group-matches .pts-cell,
  .page-participant #pane-ko-matches .pts-cell {
    background: #eef7ff !important;
    border-color: #c9dff5 !important;
    color: #0b2d5c !important;
  }

  .page-participant #pane-group-matches .score-cell:before,
  .page-participant #pane-group-matches .result-cell:before,
  .page-participant #pane-group-matches .pts-cell:before,
  .page-participant #pane-ko-matches .score-cell:before,
  .page-participant #pane-ko-matches .result-cell:before,
  .page-participant #pane-ko-matches .pts-cell:before {
    display: block !important;
    margin-bottom: 0.18rem !important;
    color: var(--theme-muted-strong) !important;
    font-size: 0.68rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.02em !important;
  }

  .page-participant
    #pane-group-matches
    tr:not(.subtotal-row)
    > td[colspan].muted,
  .page-participant #pane-ko-matches tr:not(.subtotal-row) > td[colspan].muted {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    padding: 0.75rem !important;
    border-radius: 0.85rem !important;
    background: var(--theme-surface-bright) !important;
    border: 1px dashed #cbd8e8 !important;
  }

  .page-participant .subtotal-row {
    display: none !important;
  }
}

/* Mejora móvil: Orden de equipos en grupos sin repetir etiquetas por fila.
   La cabecera móvil muestra una sola vez Pos. / Apuesta / Real / Pts. */
@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  .page-participant #pane-groups .accordion-item.card {
    overflow: hidden !important;
  }

  .page-participant #pane-groups .accordion-body.table-wrap {
    padding: 0.5rem !important;
    background: linear-gradient(
      180deg,
      var(--theme-surface-bright) 0%,
      var(--theme-surface) 100%
    ) !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .page-participant #pane-groups table,
  .page-participant #pane-groups thead,
  .page-participant #pane-groups tbody,
  .page-participant #pane-groups tr,
  .page-participant #pane-groups th,
  .page-participant #pane-groups td {
    display: block !important;
    width: 100% !important;
  }

  .page-participant #pane-groups thead {
    display: block !important;
    margin: 0 0 0.35rem !important;
  }

  .page-participant #pane-groups thead tr {
    display: grid !important;
    grid-template-columns: 2.15rem minmax(0, 1fr) minmax(0, 1fr) 2.95rem !important;
    gap: 0.4rem !important;
    align-items: center !important;
    padding: 0 0.48rem !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .page-participant #pane-groups thead th {
    border: 0 !important;
    padding: 0 !important;
    background-color: transparent !important;
    color: #607089 !important;
    font-size: 0.7rem !important;
    line-height: 1rem !important;
    height: 1rem !important;
    font-weight: 950 !important;
    letter-spacing: 0.055em !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
  }

  .page-participant #pane-groups thead th:nth-child(1),
  .page-participant #pane-groups thead th:nth-child(4) {
    text-align: center !important;
  }

  .page-participant #pane-groups tbody {
    display: grid !important;
    gap: 0.42rem !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) {
    display: grid !important;
    grid-template-columns: 2.15rem minmax(0, 1fr) minmax(0, 1fr) 2.95rem !important;
    gap: 0.4rem !important;
    align-items: stretch !important;
    min-height: 3.15rem !important;
    padding: 0.42rem 0.48rem !important;
    border: 1px solid var(--theme-blue-soft-bg) !important;
    border-radius: 0.9rem !important;
    background: var(--theme-surface) !important;
    box-shadow: 0 0.25rem 0.75rem rgba(20, 35, 58, 0.04) !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td {
    border: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(1) {
    grid-column: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.05rem !important;
    height: 2.05rem !important;
    align-self: center !important;
    border-radius: 999px !important;
    background: var(--theme-accent-soft2) !important;
    color: #2e5a93 !important;
    font-size: 0.82rem !important;
    font-weight: 950 !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(2),
  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(3) {
    display: flex !important;
    align-items: center !important;
    border-radius: 0.72rem !important;
    padding: 0.42rem 0.5rem !important;
    font-size: 0.86rem !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(2) {
    grid-column: 2 !important;
    background: transparent !important;
    color: var(--theme-active-text-dark) !important;
    font-weight: 950 !important;
  }

  .page-participant
    #pane-groups
    tbody
    tr:not(.subtotal-row)
    td:nth-child(2)
    strong {
    font-weight: 950 !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(3) {
    grid-column: 3 !important;
    background: transparent !important;
    color: #2a3851 !important;
    font-weight: 650 !important;
  }

  .page-participant
    #pane-groups
    tbody
    tr:not(.subtotal-row)
    td:nth-child(2)::before,
  .page-participant
    #pane-groups
    tbody
    tr:not(.subtotal-row)
    td:nth-child(3)::before {
    content: none !important;
    display: none !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(4) {
    grid-column: 4 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: stretch !important;
    min-width: 0 !important;
    border-radius: 0.72rem !important;
    background: #eaf8f2 !important;
    border: 1px solid #bee9d5 !important;
    color: #063f68 !important;
    text-align: center !important;
    font-size: 0.9rem !important;
    font-weight: 950 !important;
  }
  .page-participant
    #pane-groups
    tbody
    tr:not(.subtotal-row)
    td.puntos0:nth-child(4) {
    background: var(--theme-surface) !important;
    border: 1px solid var(--theme-blue-soft-bg) !important;
  }
  .page-participant #pane-groups tbody tr.subtotal-row {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .page-participant #pane-groups thead tr,
  .page-participant #pane-groups tbody tr:not(.subtotal-row) {
    grid-template-columns: 1.9rem minmax(0, 1fr) minmax(0, 1fr) 2.55rem !important;
    gap: 0rem !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) {
    padding: 0.38rem 0.4rem !important;
    min-height: 3rem !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(1) {
    width: 1.82rem !important;
    height: 1.82rem !important;
    font-size: 0.78rem !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(2),
  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(3) {
    padding: 0.38rem 0.42rem !important;
    font-size: 0.8rem !important;
  }

  .page-participant #pane-groups tbody tr:not(.subtotal-row) td:nth-child(4) {
    font-size: 0.86rem !important;
  }
}

/* Modo opcional: menú inferior estilo app móvil.
   Activar con config/settings: menu_mode = bottom_app. */
@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  body.menu-mode-bottom_app {
    padding-bottom: calc(4.9rem + env(safe-area-inset-bottom, 0px)) !important;
  }
  .ranking-table .clickable-row:hover td:first-child {
    box-shadow: none !important;
  }
  body.menu-mode-bottom_app .top {
    position: sticky !important;
    top: 0 !important;
    z-index: 250 !important;
  }

  body.menu-mode-bottom_app .nav {
    grid-template-columns: 1fr !important;
    min-height: 3.75rem !important;
    padding: 0.55rem 0.7rem !important;
  }

  body.menu-mode-bottom_app .brand {
    justify-content: center !important;
    min-width: 0 !important;
  }

  body.menu-mode-bottom_app .brand span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.menu-mode-bottom_app .menu-toggle,
  body.menu-mode-bottom_app .main-menu {
    display: none !important;
  }

  body.menu-mode-bottom_app main.wrap {
    padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .bottom-app-menu {
    position: fixed !important;
    left: 0rem !important;
    right: 0rem !important;
    bottom: calc(0rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 900 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
    padding: 0.5rem 0.45rem 1rem !important;
    border: 1px solid var(--theme-top-border) !important;
    border-radius: 1.35rem !important;
    border-top-left-radius: 0rem !important;
    border-top-right-radius: 0rem !important;
    border-bottom-left-radius: 0rem !important;
    border-bottom-right-radius: 0rem !important;

    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 0.75rem 2.2rem rgba(18, 34, 56, 0.22) !important;
    backdrop-filter: blur(16px) saturate(1.25) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.25) !important;
    touch-action: manipulation !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }

  .bottom-app-item {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.12rem !important;
    min-height: 3.2rem !important;
    padding: 0.36rem 0.25rem !important;
    border: 1px solid transparent !important;
    border-radius: 1rem !important;
    background: transparent !important;
    color: #45566f !important;
    font: inherit !important;
    font-size: 0.68rem !important;
    line-height: 1.05 !important;
    font-weight: 850 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    box-shadow: none;
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  .bottom-app-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.55rem !important;
    height: 1.25rem !important;
    font-size: 1.12rem !important;
    line-height: 1 !important;
  }

  .bottom-app-item.active {
    background: linear-gradient(180deg, #e9f8f2 0%, #dff2ff 100%) !important;
    border-color: var(--theme-success-soft-border) !important;
    color: var(--theme-focus-strong) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.6),
      0 0.28rem 0.85rem rgba(20, 60, 96, 0.08) !important;
  }

  .bottom-app-item:active {
    transform: translateY(1px) !important;
  }

  .bottom-more-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 880 !important;
    background: rgba(5, 18, 36, 0.28) !important;
    opacity: 0 !important;
    transition: opacity 0.18s ease !important;
  }

  body.bottom-more-open .bottom-more-backdrop {
    opacity: 1 !important;
  }

  .bottom-more-sheet {
    position: fixed !important;
    left: 0.9rem !important;
    right: 0.9rem !important;
    bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 910 !important;
    display: grid !important;
    gap: 0.55rem !important;
    padding: 0.65rem !important;
    border: 1px solid rgba(188, 203, 224, 0.9) !important;
    border-radius: 1.25rem !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 1rem 2.6rem rgba(13, 30, 52, 0.28) !important;
    transform: translateY(0.75rem) scale(0.98) !important;
    opacity: 0 !important;
    transition:
      transform 0.18s ease,
      opacity 0.18s ease !important;
  }

  body.bottom-more-open .bottom-more-sheet {
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
  }

  .bottom-more-handle {
    width: 2.6rem !important;
    height: 0.24rem !important;
    border-radius: 999px !important;
    background: #c9d5e5 !important;
    justify-self: center !important;
    margin: 0.05rem 0 0.15rem !important;
  }

  .bottom-more-title {
    color: var(--theme-active-text-dark) !important;
    font-size: 0.84rem !important;
    font-weight: 950 !important;
    padding: 0 0.1rem 0.5rem !important;
    text-align: center;
  }

  .bottom-more-sheet a {
    display: flex !important;
    align-items: center !important;
    gap: 0.55rem !important;
    min-height: 2.85rem !important;
    padding: 0.72rem 0.85rem !important;
    border: 1px solid #dbe5f1 !important;
    border-radius: 0.95rem !important;
    background: linear-gradient(
      180deg,
      var(--theme-surface) 0%,
      #f7faff 100%
    ) !important;
    color: #10213f !important;
    font-size: 0.92rem !important;
    font-weight: 900 !important;
    text-decoration: none !important;
  }

  .bottom-more-sheet a.active {
    background: #e8f8f1 !important;
    border-color: var(--theme-success-soft-border) !important;
    color: #073568 !important;
  }

  .bottom-more-sheet[hidden],
  .bottom-more-backdrop[hidden],
  body:not(.menu-mode-bottom_app) .bottom-app-menu,
  body:not(.menu-mode-bottom_app) .bottom-more-sheet,
  body:not(.menu-mode-bottom_app) .bottom-more-backdrop {
    display: none !important;
  }

  body.menu-mode-bottom_app .pwa-install-card {
    bottom: calc(5.35rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (min-width: 701px) and (min-height: 521px) {
  .bottom-app-menu,
  .bottom-more-sheet,
  .bottom-more-backdrop {
    display: none !important;
  }
}
@media (hover: none) and (pointer: coarse) {
  .clickable-row:hover {
    background-color: var(--theme-selected) !important;
    transform: none;
  }

  .clickable-row:active {
    background-color: var(--theme-selected) !important;
  }
}
html {
  background: var(--theme-surface);
}

@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  body {
    background:
      linear-gradient(
        var(--theme-surface) 0,
        var(--theme-surface) env(safe-area-inset-top)
      ),
      var(--page-bg, var(--theme-accent-soft));
  }

  .topbar,
  .site-header,
  header {
    background: var(--theme-surface);
  }

  .topbar {
    padding-top: env(safe-area-inset-top);
  }
  .team-label {
    margin-top: 0.3rem;
  }
}

/* v22: estado activo aplicable también a span no navegable */
.nav .current-menu-item.active,
.nav > div:last-child .current-menu-item.active,
.nav .main-menu > span.admin-menu-link.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--theme-surface) !important;
  opacity: 1;
  box-shadow: var(--theme-active-shadow);
}
.bottom-app-menu .current-menu-item.active,
.bottom-more-sheet .current-menu-item.active {
  pointer-events: none !important;
}

/* En participant.php, Clasificación está activo pero debe poder volver a la clasificación */
body.page-participant .bottom-app-menu .current-menu-item.active {
  pointer-events: auto !important;
  cursor: pointer;
}

/* v23: spans activos con el mismo aspecto que enlaces activos */
.public-menu .current-menu-item.active,
.nav .main-menu > span.admin-menu-link.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--theme-surface) !important;
  opacity: 1;
  box-shadow: var(--theme-active-shadow);
}
.bottom-more-sheet .current-menu-item.active {
  background: var(--theme-accent-soft2) !important;
  color: var(--theme-focus-strong) !important;
  border-color: #cfe0f4 !important;
}

/* v25: iconos blancos solo en menú superior de escritorio */
@media (min-width: 701px) and (min-height: 521px), (min-width: 951px) {
  .nav .public-menu a.active svg,
  .nav .public-menu .current-menu-item.active svg,
  .nav .main-menu > a.admin-menu-link.active svg,
  .nav .main-menu > span.admin-menu-link.active svg {
    stroke: var(--theme-surface) !important;
  }
  .nav .public-menu a.active .menu-icon,
  .nav .public-menu .current-menu-item.active .menu-icon,
  .nav .main-menu > a.admin-menu-link.active .menu-icon,
  .nav .main-menu > span.admin-menu-link.active .menu-icon {
    color: var(--theme-surface) !important;
  }
}

/* Administración: acciones rápidas y edición inline */
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.inline-actions form {
  margin: 0;
}
.participant-edit-form {
  margin: 0;
}
.participant-edit-form label {
  font-weight: 700;
  color: var(--text);
}
.participant-edit-form input {
  width: 100%;
  margin-top: 0.25rem;
}
.danger-action {
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: #b91c1c !important;
}
.danger-action:hover {
  background: var(--theme-error) !important;
  color: var(--theme-surface) !important;
  border-color: var(--theme-error) !important;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: rgba(15, 23, 42, 0.08);
  font-weight: 800;
}

/* Ajustes v10: clasificación admin y filtro de partidos */
.standings-table.admin-standings .points-visible {
  color: #607086 !important;
}
.standings-table.admin-standings .points-total {
  color: var(--accent) !important;
}
.matches-filter-bar input {
  background: var(--theme-surface);
  color: var(--theme-heading);
  border-color: #cfd8e6;
  border-radius: 14px;
  box-shadow: 0 8px 20px var(--theme-shadow-color, rgba(20, 35, 58, 0.08));
}
@media (max-width: 700px),
  (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  .standings-table.admin-standings td[data-label="Puntos visibles"] {
    color: #607086 !important;
  }
  .standings-table.admin-standings td[data-label="Puntos"] {
    color: var(--accent) !important;
  }
  .standings-table.admin-standings td[data-label="Equipo"],
  .standings-table.admin-standings td[data-label="Nombre"] {
    margin-right: 5.2rem;
  }
  .matches-filter-bar {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* v-landscape-fit: en teléfonos en horizontal se mantiene el comportamiento móvil,
   pero las pantallas tipo tarjeta no se estiran a todo el ancho del viewport. */
@media (min-width: 701px) and (max-width: 950px) and (max-height: 520px) and (hover: none) and (pointer: coarse) {
  body.page-participant main.wrap,
  body.page-ranking main.wrap,
  body.page-stats main.wrap,
  body.page-puntuacion main.wrap {
    width: min(100% - 1rem, 44rem) !important;
    max-width: 44rem !important;
    margin-inline: auto !important;
  }

  body.page-participant .participant-detail,
  body.page-ranking .grid,
  body.page-stats .stats-grid,
  body.page-puntuacion .scoring-layout,
  body.page-puntuacion .scoring-hero {
    max-width: 44rem !important;
    margin-inline: auto !important;
  }

  body.page-participant #pane-group-matches tr,
  body.page-participant #pane-ko-matches tr {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  body.page-participant #pane-group-matches td,
  body.page-participant #pane-ko-matches td {
    min-width: 0;
  }

  body.page-participant #pane-group-matches .match-name,
  body.page-participant #pane-ko-matches .match-name {
    min-width: 0;
  }

  body.page-participant #pane-group-matches .group-matchup,
  body.page-participant #pane-ko-matches .ko-matchup {
    min-width: 0;
    max-width: 100%;
  }
}

/* Fix móvil horizontal participant.php: evitar tablas más anchas que el viewport. */
@media (min-width: 701px) and (max-width: 950px) and (max-height: 520px) {
  body.page-participant main.wrap {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    overflow-x: hidden !important;
  }
  body.page-participant .participant-detail,
  body.page-participant .participant-detail > .tab-content,
  body.page-participant .participant-detail .tab-pane,
  body.page-participant .participant-detail .card.table-wrap {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  body.page-participant #pane-group-matches table,
  body.page-participant #pane-group-matches tbody,
  body.page-participant #pane-ko-matches table,
  body.page-participant #pane-ko-matches tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body.page-participant #pane-group-matches .group-match-row,
  body.page-participant #pane-ko-matches .ko-match-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  body.page-participant #pane-group-matches .group-match-row > td,
  body.page-participant #pane-ko-matches .ko-match-row > td,
  body.page-participant #pane-ko-matches .ko-real-cell,
  body.page-participant #pane-ko-matches .ko-prediction-cell {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Admin v20260609: respeta el menú lateral fijo y los botones de participantes */
body.page-admin .admin-menu {
  position: fixed;
  left: 0;
  top: var(--admin-top-offset, 4.05rem);
  bottom: 0;
  z-index: 4;
  width: var(--admin-sidebar-w, 18rem);
  display: block;
  margin: 0;
  padding: 0.9rem 0.85rem 1.2rem;
  overflow: auto;
  background: linear-gradient(180deg, #10213a, #172942);
  border-right: 1px solid #cbd6e5;
  box-shadow: 1rem 0 2rem rgba(20, 36, 60, 0.12);
}
body.page-admin .admin-menu:before {
  content: "Administración";
  display: block;
  margin: 0.15rem 0.35rem 0.9rem;
  color: var(--theme-surface);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
body.page-admin .admin-menu-group,
body.page-admin .admin-menu-group:first-child {
  margin: 0 0 0.9rem;
  padding: 0.55rem;
  border: 0;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
body.page-admin .admin-menu-group:first-child {
  background: rgba(255, 255, 255, 0.12);
}
body.page-admin .admin-menu-group h2,
body.page-admin .admin-menu-group:first-child h2 {
  margin: 0.15rem 0.45rem 0.5rem;
  color: var(--theme-surface-glass-soft);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
body.page-admin .admin-menu-group:first-child h2 {
  color: #a7f3d0;
}
body.page-admin .admin-menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.28rem;
}
body.page-admin .admin-menu-item {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 0.62rem;
  padding: 0.55rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  box-shadow: none;
  font-size: 0.83rem;
  line-height: 1.15;
  font-weight: 800;
}
body.page-admin .admin-menu-item:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--theme-surface);
}
body.page-admin .admin-menu-item.active {
  background: var(--theme-surface);
  border-color: var(--theme-surface);
  color: var(--accent);
  box-shadow: 0 0.55rem 1.25rem rgba(0, 0, 0, 0.12);
}
body.page-admin .admin-menu-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 1.05rem;
  color: currentColor;
}
body.page-admin .admin-menu-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}
body.page-admin main.wrap {
  width: auto;
  max-width: 76rem;
  margin-left: calc(var(--admin-sidebar-w, 18rem) + 1.5rem);
  margin-right: 1.5rem;
  padding-top: 1.2rem;
}
body.page-admin .participant-action-btn,
body.page-admin .participants-actions .btn.compact,
body.page-admin .participants-actions button.compact,
body.page-admin .participants-actions input[type="submit"].compact {
  padding: 0.38rem 0.48rem !important;
  border-radius: 0.65rem !important;
  font-size: 0.76rem !important;
  min-height: 1.9rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.28rem !important;
  line-height: 1 !important;
  font-weight: 900 !important;
}
body.page-admin .participants-delete-all {
  padding: 0.42rem 0.65rem !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  color: var(--danger) !important;
  background: rgba(255, 107, 107, 0.08) !important;
  border: 1px solid rgba(255, 107, 107, 0.42) !important;
}
body.page-admin .participant-action-btn.delete-action {
  color: var(--danger) !important;
  background: rgba(255, 107, 107, 0.08) !important;
  border: 1px solid rgba(255, 107, 107, 0.32) !important;
}
body.page-admin .participant-action-btn.delete-action:hover {
  background: var(--danger) !important;
  color: var(--theme-surface) !important;
}
body.page-admin .participant-action-btn.primary-action {
  background: var(--accent) !important;
  color: var(--theme-surface) !important;
}
@media (max-width: 860px) {
  body.page-admin .admin-menu {
    position: static;
    width: auto;
    display: grid;
    grid-template-columns: 1fr;
    padding: 0.75rem;
    margin: 0 0 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: none;
    max-height: none;
  }
  body.page-admin .admin-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.page-admin main.wrap {
    width: min(1180px, 94vw);
    margin: auto;
    padding-top: 1rem;
  }
}
@media (max-width: 640px) {
  body.page-admin .admin-menu-grid {
    grid-template-columns: 1fr;
  }
}

/* Tema claro: ajustes específicos para el menú admin lateral */
body.page-admin .admin-menu {
  background: linear-gradient(
    180deg,
    var(--theme-surface-soft) 0%,
    var(--theme-panel-head) 100%
  ) !important;
  border-right-color: var(--theme-border-mid) !important;
}
body.page-admin .admin-menu:before {
  color: #172033 !important;
}
body.page-admin .admin-menu-group {
  background: var(--theme-surface-glass-soft) !important;
  border-color: #dbe3ee !important;
}
body.page-admin .admin-menu-group h2 {
  color: var(--muted) !important;
}
body.page-admin .admin-menu-item {
  color: var(--theme-nav-color) !important;
}
body.page-admin .admin-menu-item:hover {
  background: var(--theme-accent-soft) !important;
  color: var(--accent) !important;
}
body.page-admin .admin-menu-item.active,
body.page-admin .admin-menu-home.active {
  background: var(--accent) !important;
  color: var(--theme-surface) !important;
  border-color: var(--accent) !important;
}
body.page-admin .admin-menu-home {
  background: var(--theme-surface);
  color: #172033;
  border-color: var(--theme-border-mid);
}

/* Tema claro: menú admin plegable en móvil */
@media (max-width: 860px) {
  body.page-admin .admin-menu-toggle {
    background: linear-gradient(
      180deg,
      var(--theme-surface),
      var(--theme-surface-alt)
    ) !important;
    color: #172033 !important;
    border-color: var(--theme-border-mid) !important;
  }
  body.page-admin .admin-menu-state:checked + .admin-menu-toggle + .admin-menu {
    background: var(--theme-surface-glass) !important;
  }
}

/* Tema claro: corrección definitiva toggle menú admin móvil/escritorio */
body.page-admin input.admin-menu-state {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  pointer-events: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}
body.page-admin .admin-menu-toggle {
  display: none !important;
}
@media (min-width: 861px) {
  body.page-admin .admin-menu-toggle {
    display: none !important;
  }
  body.page-admin .admin-menu {
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    top: var(--admin-top-offset, 4.05rem) !important;
    bottom: 0 !important;
    width: var(--admin-sidebar-w, 16.25rem) !important;
    max-height: none !important;
    overflow: auto !important;
  }
}
@media (max-width: 860px) {
  body.page-admin .admin-menu-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.65rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.15rem 0 0.7rem !important;
    padding: 0.64rem 0.78rem !important;
    border: 1px solid var(--theme-border-mid) !important;
    border-radius: 0.9rem !important;
    background: linear-gradient(
      180deg,
      var(--theme-surface),
      var(--theme-surface-alt)
    ) !important;
    color: #172033 !important;
    box-shadow: 0 0.45rem 1.1rem
      var(--theme-shadow-color, rgba(20, 35, 58, 0.08)) !important;
    font-weight: 950 !important;
    font-size: 0.82rem !important;
    line-height: 1.1 !important;
    cursor: pointer !important;
    user-select: none !important;
  }
  body.page-admin .admin-menu-toggle:after {
    content: "Abrir" !important;
    margin-left: auto !important;
    font-size: 0.68rem !important;
    font-weight: 900 !important;
    color: var(--muted) !important;
  }
  body.page-admin .admin-menu-toggle-bars {
    width: 1rem !important;
    display: inline-flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
    flex: 0 0 1rem !important;
  }
  body.page-admin .admin-menu-toggle-bars span {
    display: block !important;
    height: 0.12rem !important;
    border-radius: 999px !important;
    background: currentColor !important;
  }
  body.page-admin .admin-menu {
    display: none !important;
    position: static !important;
    width: auto !important;
    max-height: calc(100dvh - 8.25rem) !important;
    overflow: auto !important;
    grid-template-columns: 1fr !important;
    padding: 0.65rem !important;
    margin: 0 0 1rem !important;
    border: 1px solid var(--line) !important;
    border-radius: 1rem !important;
    box-shadow: none !important;
    background: var(--theme-surface-glass) !important;
  }
  body.page-admin .admin-menu-state:checked + .admin-menu-toggle {
    margin-bottom: 0.5rem !important;
    background: var(--theme-surface) !important;
    border-color: rgba(11, 45, 92, 0.25) !important;
  }
  body.page-admin .admin-menu-state:checked + .admin-menu-toggle:after {
    content: "Cerrar" !important;
  }
  body.page-admin .admin-menu-state:checked + .admin-menu-toggle + .admin-menu {
    display: grid !important;
  }
  body.page-admin main.wrap {
    width: min(1180px, 94vw) !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-top: 0.85rem !important;
  }
}
@media (max-width: 640px) {
  body.page-admin .admin-menu-toggle {
    position: sticky !important;
    top: 0.45rem !important;
    z-index: 8 !important;
  }
  body.page-admin .admin-menu-state:checked + .admin-menu-toggle + .admin-menu {
    grid-template-columns: 1fr !important;
  }
}
