/* --------------------------------------------------------------------------
   Pádel El Encuentro · Tema oscuro con resplandor verde (app instalable)
   Fase 1 del rediseño. Solo visual: misma estructura, mismos ids y la
   misma lógica. Se carga después de todas las hojas para sobrescribirlas.
   El marcador para TV/vMix (#scoreboardView) conserva su estilo propio.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/archivo-black-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800 900;
  font-display: swap;
  src: url("/fonts/inter-800.woff2") format("woff2");
}

/* Todo el tema es solo para pantalla: los reportes impresos no cambian. */
@media screen {
  :root {
    color-scheme: dark;
    --bg: #0b0d09;
    --panel: rgba(255, 255, 255, .05);
    --panel-2: rgba(255, 255, 255, .035);
    --card: rgba(255, 255, 255, .05);
    --card-strong: rgba(255, 255, 255, .08);
    --text: #f3f5ee;
    --muted: #a9ada2;
    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .18);
    --primary: #98d900;
    --primary-dark: #b6f02a;
    --paper: #161911;
    --shadow: 0 18px 46px rgba(0, 0, 0, .35);
    --ee-surface: #141710;
    --ee-surface-2: #1b1f16;
    --ee-glass: rgba(255, 255, 255, .05);
    --ee-glass-strong: rgba(255, 255, 255, .08);
    --ee-glow: rgba(152, 217, 0, .20);
    --ee-display: "Archivo Black", "Arial Black", Inter, system-ui, sans-serif;
    --ee-body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  }

  html,
  body {
    color: var(--text);
    background-color: var(--bg);
    font-family: var(--ee-body);
  }

  body {
    min-height: 100vh;
    background:
      radial-gradient(ellipse 60rem 34rem at 50% -8rem, var(--ee-glow), transparent 70%),
      radial-gradient(circle at 100% 40%, rgba(152, 217, 0, .07), transparent 28rem),
      var(--bg);
    background-attachment: fixed;
  }

  body::before {
    opacity: .5;
    background-image: radial-gradient(rgba(255, 255, 255, .07) .7px, transparent .7px);
  }

  ::selection { color: #11120f; background: var(--primary); }

  a { color: var(--primary); }

  h1, h2, h3,
  .card h2,
  .card h3 { color: var(--text); }

  /* Barra superior ------------------------------------------------------- */
  .topbar {
    color: var(--text);
    background: rgba(14, 16, 12, .94);
    border-color: var(--line);
    box-shadow: 0 10px 34px rgba(0, 0, 0, .35);
    backdrop-filter: blur(18px) saturate(1.2);
  }
  .brand-copy { border-left-color: var(--line); }
  .brand-copy small { color: var(--primary); }
  .brand-copy strong { color: var(--text); }
  .brand-custom-name { color:var(--text);font-size:.88rem;font-weight:800;line-height:1.25;overflow-wrap:anywhere; }
  .topnav { grid-template-columns: repeat(2, minmax(0, 1fr)); background: rgba(255, 255, 255, .05); border-color: var(--line); }
  @media (min-width: 720px) {
    .topnav { grid-template-columns: repeat(4, auto); }
  }
  .topnav a { color: var(--muted); }
  .topnav a:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
  .topnav a.active { color: #11120f; background: var(--primary); box-shadow: 0 6px 18px rgba(152, 217, 0, .28); }
  .session-identity { color: var(--muted); }

  /* Tarjetas ------------------------------------------------------------- */
  .card {
    color: var(--text);
    background: var(--ee-glass);
    border-color: var(--line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px rgba(0, 0, 0, .25);
  }
  .card-description { color: var(--muted); }

  /* Botones y formularios ----------------------------------------------- */
  button {
    color: var(--text);
    background: rgba(255, 255, 255, .06);
    border-color: var(--line);
  }
  button:hover:not(:disabled) { background: rgba(255, 255, 255, .11); border-color: var(--line-strong); }
  button.primary { color: #11120f; background: var(--primary); border-color: transparent; }
  button.primary:hover:not(:disabled) { background: #a8ec10; border-color: transparent; }
  button.secondary { color: var(--primary); background: rgba(152, 217, 0, .10); border-color: rgba(152, 217, 0, .30); }
  button.secondary:hover:not(:disabled) { background: rgba(152, 217, 0, .16); border-color: rgba(152, 217, 0, .45); }
  button.danger { color: #ffb4a8; background: rgba(255, 94, 77, .10); border-color: rgba(255, 94, 77, .32); }
  button.ghost { color: var(--text); background: transparent; }

  input,
  select,
  textarea {
    color: var(--text);
    background: rgba(0, 0, 0, .28);
    border-color: var(--line-strong);
  }
  input::placeholder,
  textarea::placeholder { color: rgba(243, 245, 238, .42); }
  input:focus,
  select:focus,
  textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(152, 217, 0, .18); }
  select option { color: var(--text); background: #161911; }
  label { color: var(--muted); }

  dialog {
    color: var(--text);
    background: var(--ee-surface);
    border: 1px solid var(--line);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  }
  dialog::backdrop { background: rgba(5, 6, 4, .72); backdrop-filter: blur(4px); }

  .toast {
    color: var(--text);
    background: var(--ee-surface-2);
    border: 1px solid rgba(152, 217, 0, .35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  }

  /* Títulos con la tipografía de la marca */
  .tournament-hero h1,
  .hero-title,
  .view-title,
  .card h2 {
    font-family: var(--ee-display);
    font-weight: 400;
    letter-spacing: -.02em;
  }

  /* Componentes compartidos -------------------------------------------- */
  .eyebrow { color: var(--primary); }
  .card-description,
  .hint,
  .field-label { color: var(--muted); }

  .muted-block,
  .live-score-placeholder,
  .empty,
  .empty-scoreboard,
  .list-item,
  .link-boxes div,
  .court-match-summary,
  .court-status,
  .operations-summary > div,
  .category-format-note,
  .player-membership-row {
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    border-color: var(--line);
  }
  .list-item strong,
  .operations-summary strong { color: var(--text); }
  .link-boxes code { color: var(--primary); background: rgba(0, 0, 0, .3); }

  .badge { color: var(--muted); background: rgba(255, 255, 255, .08); }
  .badge.pending { color: var(--muted); background: rgba(255, 255, 255, .08); }
  .badge.live { color: #11120f; background: var(--primary); }
  .badge.completed,
  .badge.bye { color: var(--text); background: rgba(255, 255, 255, .12); }
  .badge.needs-review { color: #ffd772; background: rgba(255, 196, 0, .12); border-color: rgba(255, 196, 0, .35); }

  .fixture-readiness { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--line); border-left-color: rgba(255, 255, 255, .25); }
  .fixture-readiness.ok { color: #d4f58a; background: rgba(152, 217, 0, .08); border-color: rgba(152, 217, 0, .28); border-left-color: var(--primary); }
  .fixture-readiness.warning { color: #ffd772; background: rgba(255, 196, 0, .08); border-color: rgba(255, 196, 0, .30); border-left-color: #ffc400; }

  /* Llaves: tarjetas de partido oscuras con la pareja ganadora en verde */
  .fixture-shell { background: var(--ee-glass); border: 1px solid var(--line); box-shadow: none; }
  .match-card { color: var(--text); background: #171a13; border-color: rgba(255, 255, 255, .10); box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
  .match-team { color: #dfe3d8; background: rgba(255, 255, 255, .05); border-color: transparent; }
  .match-team.pending-slot { color: var(--muted); background: rgba(255, 255, 255, .03); }
  .match-team.winner { color: var(--text); background: rgba(152, 217, 0, .16); border-color: rgba(152, 217, 0, .40); }
  .match-team .code { color: var(--primary); }
  .versus,
  .match-footer { color: var(--muted); }
  .automatic-bye { background: rgba(255, 255, 255, .03) !important; }

  /* Admin ---------------------------------------------------------------- */
  .admin-view { --admin-ink: #f3f5ee; --admin-muted: #a9ada2; }
  .admin-tabs { background: rgba(255, 255, 255, .04); border-color: var(--line); box-shadow: none; }
  @media (min-width: 1200px) {
    .admin-tabs { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  }
  .topnav a,
  .admin-tabs button { color: var(--muted); background: transparent; border-color: transparent; }
  .topnav a:hover,
  .admin-tabs button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .07); }
  .topnav a.active,
  .topnav a.active:hover,
  .admin-tabs button.active,
  .admin-tabs button.active:hover:not(:disabled) {
    color: var(--text);
    background: rgba(152, 217, 0, .12);
    border-color: rgba(152, 217, 0, .30);
    box-shadow: inset 0 -3px 0 var(--primary);
  }
  .admin-tabs button.active .admin-tab-number { color: var(--primary); background: rgba(152, 217, 0, .12); border-color: rgba(152, 217, 0, .30); }
  .admin-card-main,
  .admin-card-side { background: var(--ee-glass); }
  .admin-view .scoring-mode-panel,
  .admin-view .serve-change-panel { background: rgba(255, 255, 255, .04); border-color: var(--line); }
  .admin-match-actions summary { color: var(--primary); background: rgba(152, 217, 0, .08); border-color: rgba(152, 217, 0, .25); }
  .admin-view #tab-fixture .hint { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--line); }
  #newTournamentName,
  #settingTournamentName { color: var(--text); background: rgba(0, 0, 0, .28); }

  .court-dialog { color: var(--text); background: var(--ee-surface); border-color: var(--line); }
  .court-dialog::backdrop { background: rgba(5, 6, 4, .72); }

  /* Portal de jugadores -------------------------------------------------- */
  .player-portal-hero > div > p:last-child,
  .player-category-info span,
  .player-registration-category,
  .player-registration-meta,
  .player-empty-state span,
  .player-partner-result span,
  .player-invitation-meta > span,
  .player-payment-summary span,
  .player-payment-description,
  .player-next-action-step,
  .player-next-action-description,
  .admin-registration-stats span,
  .admin-registration-meta span,
  .admin-registration-review-note > span,
  .admin-registration-category,
  .admin-registration-member small,
  .admin-registration-contact { color: var(--muted); }

  .player-portal-message,
  .player-registration-item,
  .player-partner-result,
  .player-invitation-item,
  .player-payment-item,
  .player-next-action-card,
  .admin-registration-item,
  .admin-registration-message,
  .admin-registration-progress-note,
  .finance-metric,
  .finance-category-card {
    color: var(--text);
    background: var(--ee-glass);
    border-color: var(--line);
  }
  .player-next-action-card { background: linear-gradient(145deg, rgba(152, 217, 0, .08), rgba(255, 255, 255, .03)); border-color: rgba(152, 217, 0, .25); }

  .player-category-info > div,
  .player-payment-summary > div,
  .player-payment-receipt-info,
  .admin-registration-stats > .admin-registration-stat,
  .admin-registration-member,
  .admin-registration-receipt,
  .finance-category-values > div {
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    border-color: var(--line);
  }
  .admin-registration-meta > div,
  .player-email-security:not([hidden]),
  .player-partner-mode,
  .player-empty-state,
  .admin-registration-no-receipt,
  .finance-meta span,
  .finance-empty { border-color: var(--line-strong); }

  .player-auth-switch { background: rgba(255, 255, 255, .05); border-color: var(--line); }
  .player-auth-switch button { color: var(--muted); background: transparent; border-color: transparent; }
  .player-auth-switch button.active { color: #11120f; background: var(--primary); box-shadow: 0 4px 14px rgba(152, 217, 0, .25); }
  .player-link-button { color: var(--primary); }
  .player-link-button:hover { color: #c4f55a; }
  .player-phone-prefix { color: var(--muted); background: rgba(255, 255, 255, .06); border-color: var(--line-strong); }

  .player-next-action-progress { background: rgba(255, 255, 255, .10); }
  .player-next-action-progress > span { background: var(--primary); }

  /* Estados (chips): neutro, aprobado, rechazado, en revisión */
  .player-status,
  .player-next-action-badge,
  .player-next-action-category,
  .admin-registration-status { color: #d3d7cd; background: rgba(255, 255, 255, .09); }
  .player-status-approved,
  .player-invitation-status-accepted,
  .player-payment-status-approved,
  .player-payment-status-waived,
  .player-next-action-card[data-state="COMPLETE"] .player-next-action-badge,
  .admin-registration-status.status-approved,
  .admin-registration-status.status-waived { color: #d4f58a; background: rgba(152, 217, 0, .15); }
  .player-status-rejected,
  .player-status-cancelled,
  .player-invitation-status-rejected,
  .player-invitation-status-cancelled,
  .player-invitation-status-expired,
  .player-payment-status-rejected,
  .player-next-action-card[data-state="PAYMENT_REJECTED"] .player-next-action-badge,
  .admin-registration-status.status-rejected { color: #ffb4a8; background: rgba(255, 94, 77, .15); }
  .player-payment-status-submitted,
  .player-next-action-card[data-state="PAYMENT_REVIEW"] .player-next-action-badge,
  .admin-registration-status.status-submitted,
  .admin-registration-status.status-pending_partner { color: #ffd772; background: rgba(255, 196, 0, .14); }
  .admin-registration-status.status-pair_ready { color: #a9d2ff; background: rgba(90, 170, 255, .15); }
  .admin-registration-status.status-payment_pending { color: #d4c1ff; background: rgba(180, 140, 255, .15); }

  .player-portal-message[data-type="success"],
  .admin-registration-message[data-type="success"],
  .player-email-security[data-status="verified"],
  .admin-registration-closed { color: #d4f58a; background: rgba(152, 217, 0, .08); border-color: rgba(152, 217, 0, .30); }
  .player-portal-message[data-type="error"],
  .admin-registration-message[data-type="error"] { color: #ffb4a8; background: rgba(255, 94, 77, .08); border-color: rgba(255, 94, 77, .32); }
  .player-email-security[data-status="pending"],
  .player-payment-warning,
  .admin-registration-review-note { color: #ffd772; background: rgba(255, 196, 0, .08); border-color: rgba(255, 196, 0, .30); }
  .player-phone-error,
  .player-field-error { color: #ff9a8a; }

  .admin-view .list { background: rgba(255, 255, 255, .03); border-color: var(--line); }
  .player-list-item { background: transparent; }

  /* Resto de superficies claras heredadas ------------------------------- */
  .topbar { background: rgba(14, 16, 12, .94); }
  /* La barra de secciones queda fija al hacer scroll: fondo sólido para que
     el contenido no se vea por debajo. */
  .admin-section-nav {
    background: rgba(14, 16, 12, .94);
    border-color: var(--line);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .40);
    backdrop-filter: blur(18px) saturate(1.2);
  }
  .admin-tab-number { color: var(--muted); background: rgba(255, 255, 255, .06); border-color: var(--line); }
  .admin-view .list-item { color: var(--text); background: transparent; border-bottom-color: var(--line); }
  .admin-view .list-item:hover { background: rgba(255, 255, 255, .04); }
  .admin-view .pair-item strong { color: var(--primary); }
  .admin-view .link-boxes div { background: rgba(255, 255, 255, .04); border-color: var(--line); }
  .admin-view .link-boxes code { color: var(--primary); background: transparent; }
  .admin-auth-card { color: var(--text); background: var(--ee-glass); border-color: var(--line); }
  .admin-board .admin-actions-body { background: var(--ee-surface-2); border-color: var(--line); }

  .warning { color: #ffd772; background: rgba(255, 196, 0, .08); }
  .toast.error { color: #ffb4a8; border-color: rgba(255, 94, 77, .45); }
  .match-ready-to-finish { color: #d4f58a; }

  .match-card.automatic-bye,
  .zone-round-placeholder,
  .qualification-empty,
  .phase-heading,
  .standings-table th,
  .player-no-membership,
  .pair-player-column,
  .player-membership,
  .score-more-options,
  .scoring-rules-help,
  .player-autocomplete-option.is-disabled,
  .player-autocomplete-option:disabled,
  .court-dialog textarea,
  .tournament-dates-dialog input[readonly],
  .advantage-mode,
  .serve-change-panel,
  .admin-view .serve-change-panel {
    color: var(--text);
    background: rgba(255, 255, 255, .04);
    border-color: var(--line);
  }
  .standings-card,
  .zone-match-node .match-card,
  .qualification-panel,
  .player-context-card,
  .phase9-option-section,
  .phase9-history,
  .tournament-card {
    color: var(--text);
    background: var(--ee-glass);
    border-color: var(--line);
  }
  .player-autocomplete-results,
  .tournament-more-menu,
  .fixture-more-options-content {
    color: var(--text);
    background: var(--ee-surface-2);
    border-color: var(--line-strong);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  }
  .player-autocomplete-clear:hover,
  .player-autocomplete-clear:focus-visible { background: rgba(255, 255, 255, .08); }
  .final-identity { color: var(--text); background: rgba(20, 23, 16, .92); }
  .playoff-preview-card .match-team.pending-slot { background: rgba(255, 255, 255, .03); }

  .standings-table tr.qualified td { background: rgba(152, 217, 0, .08); }
  .standings-table tr.qualified td:first-child,
  .qualification-chip span,
  .player-membership-category,
  .player-availability.is-free,
  .scoring-rule-item.is-selected strong { color: var(--primary); }
  .qualification-chip,
  .advantage-mode.active,
  .scoring-rule-item.is-selected,
  .player-membership.is-current,
  .serve-setup-panel,
  .admin-view .serve-setup-panel { background: rgba(152, 217, 0, .08); border-color: rgba(152, 217, 0, .28); }
  .best-loser-table caption,
  .player-membership-partner,
  .phase9-history-item span,
  .scoring-rules-help > summary { color: var(--muted); }
  .player-category-count { color: var(--muted); background: rgba(255, 255, 255, .07); }
  .player-availability.is-busy { color: #ffbf8a; background: rgba(255, 140, 50, .12); }

  /* Marcador en el panel de admin (el de TV no se toca) */
  .serve-indicator { color: #d4f58a; background: rgba(152, 217, 0, .10); }
  .serve-indicator strong,
  .serve-setup-copy strong { color: var(--text); }
  button.secondary.serve-player-choice { color: var(--text); background: rgba(255, 255, 255, .05); }
  button.secondary.serve-player-choice:hover:not(:disabled) { background: rgba(152, 217, 0, .12); }
  .serve-choice-code { color: var(--primary); background: rgba(152, 217, 0, .12); }
  .tie-break-launch,
  .tie-break-admin-panel,
  .admin-view .scoring-mode-panel.star-active,
  .score-paused-notice,
  .star-point-progress,
  .star-point-progress.is-active { color: #ffe39a; background: rgba(255, 196, 0, .08); border-color: rgba(255, 196, 0, .28); }
  .score-paused-notice strong,
  .star-point-progress > strong { color: #ffd772; }
  .phase9-danger-zone { background: rgba(255, 94, 77, .06); border-color: rgba(255, 94, 77, .28); }
  .score-status-badge { color: #d3d7cd; background: rgba(255, 255, 255, .09); }
  .score-status-badge.status-in_progress { color: #d4f58a; background: rgba(152, 217, 0, .14); }
  .score-status-badge.status-paused,
  .live-mode-badge { color: #ffd772; background: rgba(255, 196, 0, .14); }
  .score-status-badge.status-finalized { color: var(--text); background: rgba(255, 255, 255, .12); }

  .tournament-card p { color: var(--muted); }
  .draft-badge,
  .tournament-status { color: #ffc46b; }
  .tournament-status.is-public { color: #c4f55a; }
  .tournament-status.is-private { color: #c2c9d2; }
  .data-origin-badge { color: #ffc46b; }

  /* Opciones de pago e invitaciones por correo -------------------------- */
  .player-payment-method-option { color: var(--text); background: rgba(255, 255, 255, .05); border-color: var(--line); }
  .player-payment-method-option:hover:not(:disabled) { background: rgba(255, 255, 255, .09); }
  .player-payment-method-option.is-active,
  .player-payment-method-option.is-active:hover:not(:disabled) { color: #11120f; background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 14px rgba(152, 217, 0, .25); }
  .player-payment-bank > div { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
  .player-payment-bank dt,
  .player-payment-whatsapp small { color: var(--muted); }
  .player-payment-bank dd { color: var(--text); }
  .player-payment-whatsapp-link { color: #b9f5cf; background: rgba(37, 211, 102, .12); border-color: rgba(37, 211, 102, .45); }
  .player-payment-cash-note { color: #d4f58a; background: rgba(152, 217, 0, .08); border-color: rgba(152, 217, 0, .30); }
  .admin-payment-options-group,
  .admin-invitation-history li { border-color: var(--line); background: rgba(255, 255, 255, .03); }
  .admin-payment-options-group legend { color: var(--text); }
  .admin-payment-options-error,
  .admin-invitation-status[data-type="error"],
  #adminPaymentOptionsStatus[data-type="error"] { color: #ff9a8a; }
  .admin-invitation-status[data-type="success"],
  #adminPaymentOptionsStatus[data-type="success"] { color: #d4f58a; }
  .admin-payment-options-form input[aria-invalid="true"] { border-color: #ff9a8a; }
  .admin-registration-method { color: #d3d7cd; background: rgba(255, 255, 255, .09); border-color: var(--line); }
  .admin-registration-method.method-cash { color: #d4f58a; background: rgba(152, 217, 0, .15); border-color: rgba(152, 217, 0, .35); }
  .admin-invitation-recipients { color: #d4f58a; background: rgba(152, 217, 0, .15); border-color: rgba(152, 217, 0, .35); }
  .admin-invitation-warning { color: #ffd772; background: rgba(255, 196, 0, .08); border-color: rgba(255, 196, 0, .30); }
  .admin-invitation-form textarea { color: var(--text); background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
  .admin-invitation-flyer-preview img { background: rgba(255, 255, 255, .04); border-color: var(--line); }
  .admin-invitation-history-status { color: #d4f58a; }
  .admin-invitation-history-status[data-status="sending"] { color: #ffd772; }

  /* App instalable ------------------------------------------------------- */
  .pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    color: #11120f;
    font-weight: 800;
    white-space: nowrap;
    background: var(--primary);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(152, 217, 0, .28);
  }
  .pwa-install-btn:hover:not(:disabled) { background: #a8ec10; }
  .pwa-install-btn[hidden] { display: none; }
  .pwa-install-btn svg { width: 16px; height: 16px; }

  .pwa-ios-dialog {
    width: min(420px, calc(100% - 32px));
    padding: 24px;
    border-radius: 22px;
  }
  .pwa-ios-dialog h2 {
    margin: 0 0 6px;
    font-family: var(--ee-display);
    font-size: 1.35rem;
    font-weight: 400;
    text-transform: uppercase;
  }
  .pwa-ios-dialog p { margin: 0 0 16px; color: var(--muted); }
  .pwa-ios-dialog ol { display: grid; gap: 12px; margin: 0 0 20px; padding: 0; list-style: none; counter-reset: pwa-step; }
  .pwa-ios-dialog li {
    display: flex;
    align-items: center;
    gap: 12px;
    counter-increment: pwa-step;
  }
  .pwa-ios-dialog li::before {
    display: grid;
    flex: 0 0 30px;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #11120f;
    font-weight: 900;
    background: var(--primary);
    border-radius: 50%;
    content: counter(pwa-step);
  }
  .pwa-ios-dialog button { width: 100%; }
  .pwa-ios-dialog li span { min-width: 0; }
  .pwa-share-icon {
    display: inline-block;
    width: 1.6em;
    height: 1.6em;
    margin: 0 2px;
    padding: 2px;
    color: var(--primary);
    vertical-align: -0.45em;
    background: rgba(152, 217, 0, .12);
    border: 1px solid rgba(152, 217, 0, .35);
    border-radius: 6px;
  }

  .player-registration-partner small { color: var(--primary); }
  .player-registration-partner strong { color: var(--text); }

  .pwa-update-toast,
  .pwa-offline-banner {
    position: fixed;
    left: 50%;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 10px 12px 10px 16px;
    color: var(--text);
    font-weight: 600;
    background: rgba(20, 23, 16, .94);
    border: 1px solid rgba(152, 217, 0, .35);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
    backdrop-filter: blur(14px);
    transform: translateX(-50%);
  }
  .pwa-update-toast { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .pwa-update-toast button { padding: 8px 12px; }
  .pwa-offline-banner {
    top: calc(10px + env(safe-area-inset-top, 0px));
    padding: 8px 14px;
    font-size: .85rem;
    border-color: rgba(255, 196, 0, .45);
  }
  .pwa-offline-banner::before {
    width: 8px;
    height: 8px;
    background: #ffc400;
    border-radius: 50%;
    content: "";
  }
  .pwa-update-toast[hidden],
  .pwa-offline-banner[hidden] { display: none; }

  /* Navegación (fase 2) --------------------------------------------------
     Público: Inicio, Fixture, En vivo y Mi torneo + «Inscribirme». En
     celular la navegación es una barra inferior fija. En el admin se oculta
     la navegación pública y se muestra «Panel del organizador». */
  .topbar { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .brand { flex: 0 1 auto; }
  .topnav {
    display: flex;
    gap: 4px;
    margin-inline: auto;
    padding: 5px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 16px;
  }
  .topnav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    color: var(--muted);
    border-radius: 12px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .topnav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
  .topnav a.active,
  .topnav a.active:hover {
    color: var(--text);
    background: rgba(152, 217, 0, .14);
    box-shadow: inset 0 -3px 0 var(--primary);
  }
  .topnav a.active svg { color: var(--primary); }
  .register-cta {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 22px;
    color: #11120f;
    background: var(--primary);
    border-radius: 999px;
    font-family: var(--ee-display);
    font-size: .82rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 0 26px rgba(152, 217, 0, .45);
  }
  .register-cta:hover { color: #11120f; background: #a8ec10; }
  .register-cta.active { box-shadow: 0 0 0 2px #11120f, 0 0 0 4px var(--primary); }
  .pwa-install-btn { color: var(--text); background: transparent; border: 1px solid var(--line-strong); box-shadow: none; }
  .pwa-install-btn:hover:not(:disabled) { color: #11120f; }
  .admin-panel-badge {
    display: none;
    padding: 6px 10px;
    color: #11120f;
    background: var(--primary);
    border-radius: 8px;
    font-family: var(--ee-display);
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .session-controls { flex-wrap: wrap; margin-left: auto; }
  .admin-header-link { color: var(--primary); font-size: .85rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
  .admin-header-link:hover { color: var(--primary-dark); }

  /* Admin con sesión navegando el sitio: solo el regreso al panel. */
  body:not([data-route="admin"]) .session-controls > :not(.admin-return-link) { display: none; }
  body[data-route="admin"] .admin-return-link { display: none; }
  body[data-route="admin"] .topnav,
  body[data-route="admin"] .register-cta { display: none; }
  body[data-route="admin"] .admin-panel-badge { display: inline-block; }

  /* Secciones de la vista pública según la ruta. */
  #publicView[data-section="home"] [data-public-sections]:not([data-public-sections~="home"]),
  #publicView[data-section="fixture"] [data-public-sections]:not([data-public-sections~="fixture"]),
  #publicView[data-section="live"] [data-public-sections]:not([data-public-sections~="live"]) { display: none; }
  .public-live-row { margin-top: 18px; }
  #publicView[data-section="fixture"] .fixture-shell { margin-top: 0; }
  .public-category-picker { display: grid; gap: 6px; max-width: 420px; margin-bottom: 16px; }
  .hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
  .hero-actions .hero-action { width: auto; margin: 0; }
  .hero-actions .hero-action:not(.hero-action-primary) { color: var(--text); background: transparent; border: 1px solid var(--line-strong); box-shadow: none; }
  .hero-actions .hero-action:not(.hero-action-primary):hover { border-color: var(--primary); }
  .hero-action-primary,
  .hero-action-primary:hover { color: #11120f; background: var(--primary); border-color: transparent; }

  .player-admin-access {
    margin: 18px 0 0;
    padding-top: 14px;
    text-align: center;
    border-top: 1px solid var(--line);
  }
  .player-admin-access a,
  .admin-back-link { color: var(--muted); font-size: .85rem; font-weight: 600; }
  .player-admin-access a:hover,
  .admin-back-link:hover { color: var(--primary); }
  .admin-back-link { display: inline-block; margin-top: 12px; }

  @media (max-width: 899px) {
    /* backdrop-filter en la barra superior haría que la barra inferior fija
       se ubique dentro de ella: en celular la barra superior va sólida. */
    .topbar { flex-wrap: nowrap; gap: 8px; background: #0e100c; backdrop-filter: none; }
    .brand { width: auto; margin-right: auto; }
    .register-cta { min-height: 44px; padding: 0 16px; font-size: .72rem; }
    .pwa-install-btn { padding: 8px 10px; font-size: .74rem; }
    body[data-route="admin"] .topbar { flex-wrap: wrap; }
    .topnav {
      position: fixed;
      left: 12px;
      right: 12px;
      bottom: calc(12px + env(safe-area-inset-bottom, 0px));
      z-index: 120;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      width: auto;
      margin: 0;
      padding: 6px;
      background: rgba(17, 18, 15, .96);
      border-radius: 22px;
      box-shadow: 0 -8px 30px rgba(0, 0, 0, .45);
      backdrop-filter: blur(18px) saturate(1.2);
    }
    .topnav a {
      flex-direction: column;
      justify-content: center;
      gap: 4px;
      min-height: 56px;
      padding: 0 4px;
      border-radius: 16px;
      font-size: .64rem;
    }
    .topnav a svg { width: 22px; height: 22px; flex-basis: 22px; }
    .topnav a.active,
    .topnav a.active:hover { color: var(--primary); box-shadow: none; }
    body:not([data-route="admin"]) .app-shell { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
    body.bracket-view-open .topnav { visibility: hidden; }
  }
  @media (max-width: 559px) {
    .admin-return-long { display: none; }
    .topbar { flex-wrap: wrap; }
    .topbar .brand { width: 100%; min-width: 0; }
    .topbar .brand-copy { display: grid; flex: 1; min-width: 0; }
    .topbar .brand-copy strong { max-width: none; white-space: normal; overflow-wrap: anywhere; }
    .topbar .brand img { flex: 0 0 88px; width: 88px; }
    .topbar .session-controls { margin-left: auto; }
  }

  /* En la app instalada se respeta la zona segura del notch */
  @media (display-mode: standalone) {
    .app-shell { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  }
}

/* Elegibilidad de jugadores y categorías */
.player-sex-completion {
  border: 1px solid color-mix(in srgb, var(--accent, #d7ff3f) 55%, transparent);
}
.player-sex-completion form { margin-top: 1rem; }
.player-sex-completion .button-row { align-items: end; }
.player-sex-completion select { min-width: min(100%, 18rem); }
.admin-registration-sex {
  display: inline-flex;
  width: fit-content;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: rgba(70, 160, 110, .14);
  font-size: .76rem;
  font-weight: 700;
}
.admin-registration-sex.is-pending,
.admin-registration-eligibility-alert.is-pending { background: rgba(240, 180, 40, .15); }
.admin-registration-eligibility-alert {
  display: inline-flex;
  width: fit-content;
  margin-top: .35rem;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: rgba(220, 65, 65, .15);
  color: var(--danger, #b42318);
  font-size: .76rem;
  font-weight: 800;
}
.category-sex-hint { display: block; margin-top: .35rem; }

