/*
 * AhoraAjedrez — Design System v1.0
 * Archivo: /wp-content/themes/ahora-theme/ahora-design-system.css
 * Cargado via /wp-content/themes/ahora-theme/functions.php
 *
 * ESTRUCTURA:
 *  1. Google Fonts
 *  2. Variables CSS (dark base + light override)
 *  3. Reset global
 *  4. Tipografía
 *  5. Botones
 *  6. Cards
 *  7. Badges / etiquetas
 *  8. Tablas / rankings
 *  9. Sidebar
 * 10. Navbar
 * 11. Stat cards
 * 12. Formularios
 * 13. Utilidades
 */

/* ============================================================
   1. GOOGLE FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');


/* ============================================================
   2. VARIABLES CSS
   Dark mode es la base. Light mode se activa con
   [data-theme="light"] en <html> (toggle futuro).
   ============================================================ */
:root {
  /* Fondos */
  --bg-main:    #111113;
  --bg-soft:    #18181b;
  --bg-card:    #1c1c1f;
  --bg-hover:   #222226;

  /* Texto */
  --text-primary:   #f5f5f7;
  --text-secondary: #d8d8e0;
  --text-muted:     #b0b0bc;

  /* Acento — amber */
  --accent:       #C8922A;
  --accent-light: #E8B054;
  --accent-dark:  #7A6028;

  /* Bordes */
  --bg-card-hover:  rgba(201,162,39,.12);
  --border-accent:   rgba(201,162,39,.35);
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);

  /* Semánticos */
  --success: #22c55e;
  --danger:  #ef4444;
  --info:    #3b82f6;
  --warning: #f59e0b;

  /* Tipografía */
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Radios */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Transiciones */
  --transition: 0.15s ease;
}

/* Light mode — activar con JS: document.documentElement.setAttribute('data-theme','light') */
[data-theme="light"] {
  --bg-main:    #F7F7F5;
  --bg-soft:    #EFEFED;
  --bg-card:    #ffffff;
  --bg-hover:   #F0F0EE;

  --text-primary:   #111113;
  --text-secondary: #52525b;
  --text-muted:     #6b7280;

  --accent:       #B07820;
  --accent-light: #C8922A;
  --accent-dark:  #7A6028;

  --bg-card-hover:  rgba(176,120,32,.1);
  --border-accent:   rgba(176,120,32,.3);
  --border:        rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
}


/* ============================================================
   3. RESET GLOBAL
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--accent-light);
}

img {
  max-width: 100%;
}


/* ============================================================
   4. TIPOGRAFÍA
   ============================================================ */

/* Escala */
h1, .h1 { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
h2, .h2 { font-size: 18px; font-weight: 500; line-height: 1.4; }
h3, .h3 { font-size: 16px; font-weight: 500; line-height: 1.4; }
h4, .h4 { font-size: 14px; font-weight: 500; line-height: 1.5; }

h1, h2, h3, h4 {
  color: var(--text-primary);
  margin-top: 0;
}

/* Eyebrow / label */
.label-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Texto secundario */
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }

/* Números ELO y estadísticas */
.elo,
.rk-elo,
.stat-number,
[class*="elo-"] {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Número ELO principal (en perfil de jugador) */
.elo-main {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--accent);
}

/* Display grande (héroe, #1 mundial) */
.display-number {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}


/* ============================================================
   5. BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  color: var(--text-primary);
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
  text-decoration: none;
}

/* Primario — acento amber */
.btn-primary {
  background: var(--accent);
  color: #111;
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--accent-light);
  border-color: transparent;
  color: #111;
}

/* Secundario — neutro oscuro */
.btn-secondary {
  background: var(--bg-soft);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Ghost — sin fondo */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* Tamaño pequeño — dentro de tablas */
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* Tamaño grande — CTAs principales */
.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}


/* ============================================================
   6. CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.card:hover {
  border-color: var(--border-strong);
}

/* Card con acento lateral */
.card-accent {
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* Card destacada (podio #1) */
.card-featured {
  background: var(--bg-soft);
  border-color: var(--accent);
}

/* Grid de cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}


/* ============================================================
   7. BADGES / ETIQUETAS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.6;
  white-space: nowrap;
}

/* Títulos FIDE */
.badge-gm { background: #1a1a1a; color: var(--accent); border: 1px solid #333; }
.badge-im { background: #1a1a1a; color: #a1a1aa; border: 1px solid #333; }
.badge-fm { background: #1f1a10; color: #d4a44c; border: 1px solid #3a2e10; }
.badge-cm { background: #111a1a; color: #6ba3a3; border: 1px solid #1a2e2e; }
.badge-wgm { background: #1a1016; color: #d48ca0; border: 1px solid #2e1020; }

/* Estados */
.badge-live {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.25);
}
.badge-live::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse-dot 1.5s infinite;
}
.badge-active  { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-upcoming { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-tag    { background: var(--bg-soft); color: var(--text-secondary); border: 1px solid var(--border); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Light mode overrides para badges */
[data-theme="light"] .badge-gm { background: #1a1a1a; color: var(--accent-light); border-color: #333; }
[data-theme="light"] .badge-im { background: #1a1a1a; color: #999; border-color: #333; }


/* ============================================================
   8. TABLAS / RANKINGS
   ============================================================ */

/* Tabla base */
.rk-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.rk-table thead th {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.rk-table tbody td {
  padding: 10px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.rk-table tbody td:first-child {
  border-left: 1px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.rk-table tbody td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.rk-table tbody tr:hover td {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Clases específicas de ranking */
.rk-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  padding: 10px 14px;
  transition: border-color var(--transition), background var(--transition);
}
.rk-row:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

/* Número de posición */
.rk-pos {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}
.rk-pos-1 { color: var(--accent); font-weight: 500; }
.rk-pos-2 { color: #a1a1aa; font-weight: 500; }
.rk-pos-3 { color: #d4a44c; font-weight: 500; }

/* ELO en tabla */
.rk-elo {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
}

/* Nombre de jugador */
.rk-player-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.rk-player-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Tabla simple (país, filtros) */
table.ahora-table {
  width: 100%;
  border-collapse: collapse;
}
table.ahora-table th {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.ahora-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-primary);
}
table.ahora-table tbody tr:hover td {
  background: var(--bg-hover);
}
table.ahora-table a {
  color: var(--text-primary);
}
table.ahora-table a:hover {
  color: var(--accent);
}


/* ============================================================
   9. SIDEBAR
   ============================================================ */
.sidebar-nav-section {
  padding: 12px 10px 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin: 1px 6px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
}
.sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-nav-item.active {
  background: var(--bg-soft);
  color: var(--text-primary);
  font-weight: 500;
}
.sidebar-nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}
.sidebar-nav-item.active .nav-icon {
  opacity: 1;
}


/* ============================================================
  10. NAVBAR
   ============================================================ */
.site-header,
.navbar-ahora {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  height: 52px;
}

/* Search pill */
.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  transition: border-color var(--transition);
}
.search-pill:focus-within {
  border-color: var(--border-strong);
}
.search-pill input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  min-width: 180px;
}
.search-pill input::placeholder {
  color: var(--text-muted);
}


/* ============================================================
  11. STAT CARDS (dashboard, perfil, país)
   ============================================================ */
.stat-card {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-value.accent {
  color: var(--accent);
}

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}


/* ============================================================
  12. FORMULARIOS (filtros, búsqueda)
   ============================================================ */
input[type="text"],
input[type="search"],
input[type="email"],
select,
textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  transition: border-color var(--transition);
  outline: none;
  width: 100%;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2371717a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Labels de filtro */
.filter-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}


/* ============================================================
  13. UTILIDADES
   ============================================================ */

/* Divisores */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Bandera + nombre inline */
.flag-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Posición ranking destacada */
.rank-display {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.rank-display.gold { color: var(--accent); }

/* Animación dot "en vivo" standalone */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-dot 1.5s infinite;
}

/* Espaciado */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

/* Ocultar en mobile */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .stat-grid   { grid-template-columns: repeat(2, 1fr); }
  .card-grid   { grid-template-columns: 1fr; }
}
/* Icons */
.ahora-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  color: inherit;
}

/* ============================================================
  14. SCROLLBAR GLOBAL
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: 3px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.22);
}
[data-theme="light"] * {
  scrollbar-color: rgba(0,0,0,.15) transparent;
}
[data-theme="light"] *::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.15);
}
[data-theme="light"] *::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,.25);
}}
.pais-card:hover {
  border-color: var(--border-accent) !important;
  background: var(--bg-card-hover) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.hub-card:hover {
  border-color: var(--border-accent) !important;
  background: var(--bg-card-hover) !important;
}

/* Fix z-index para sweep en pais-card */
.pais-card { isolation: isolate; }
.pais-card .pc-head,
.pais-card .pc-metricas,
.pais-card .pc-btn { position: relative; z-index: 1; }

/* ══ Responsive global — ranking-tabla en móvil ══════════════ */
@media (max-width: 680px) {
    .ranking-tabla { font-size: 12px; }
    .ranking-tabla thead th,
    .ranking-tabla tbody td { padding: 7px 6px; white-space: normal; word-break: break-word; }
    /* Ocultar columnas menos importantes en móvil */
    .ranking-tabla .col-hide-mobile { display: none; }
    /* Evitar scroll horizontal */
    .ranking-tabla { table-layout: fixed; }
    .ranking-tabla td:first-child { width: 28px; }
    .ranking-tabla td:last-child { width: 60px; }
}

/* ══ Sistema rk-row global (plugin mis-rankings + AJAX rankings) ══ */
.rk-list { display: flex; flex-direction: column; }
.rk-row {
    display: grid;
    grid-template-columns: 48px 1fr 100px 200px;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    transition: background var(--transition);
}
.rk-row:last-child { border-bottom: none; }
.rk-row:nth-child(even) { background: var(--bg-soft); }
.rk-row:hover { background: var(--bg-hover) !important; }
.rk-zone-pos { font-size: 13px; font-weight: 500; color: var(--text-muted); text-align: center; font-family: var(--font-mono); line-height: 1; }
.rk-pos-gold   { color: var(--accent); }
.rk-pos-silver { color: var(--text-secondary); }
.rk-pos-bronze { color: var(--text-secondary); opacity: 0.7; }
.rk-zone-player { min-width: 0; }
.rk-player-main { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; flex-wrap: wrap; }
.rk-flag-link { text-decoration: none; font-size: 16px; flex-shrink: 0; line-height: 1; }
.rk-player-name { font-weight: 500; font-size: 15px; color: var(--text-primary); text-decoration: none; transition: color var(--transition); letter-spacing: -0.01em; }
.rk-player-name:hover { color: var(--accent); }
.rk-title-badge { display: inline-block; font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: var(--radius-sm); flex-shrink: 0; background: var(--bg-hover); color: var(--accent); border: 1px solid var(--border); font-family: var(--font-sans); vertical-align: middle; }
.rk-player-sub { font-size: 11px; color: var(--text-muted); display: block; }
.rk-zone-elo { text-align: center; }
.rk-elo-val { font-family: var(--font-mono); font-weight: 400; font-size: 18px; line-height: 1; letter-spacing: -0.01em; color: var(--text-secondary); }
.rk-elo-lbl { font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 3px; font-family: var(--font-sans); }
.rk-elo-elite { color: var(--accent); font-weight: 500; }
.rk-elo-gm    { color: var(--accent); opacity: 0.85; }
.rk-elo-im    { color: var(--text-primary); }
.rk-elo-mid   { color: var(--text-secondary); }
.rk-elo-low   { color: var(--text-muted); font-size: 16px; }
.rk-zone-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.rk-btn-profile { background: var(--bg-soft); color: var(--text-primary); border: 1px solid var(--border); font-weight: 500; padding: 6px 12px; border-radius: var(--radius-md); font-size: 12px; text-decoration: none; white-space: nowrap; transition: all var(--transition); display: inline-block; font-family: var(--font-sans); }
.rk-btn-profile:hover { border-color: var(--accent); color: var(--accent); }
.rk-btn-prepare { background: transparent; color: var(--text-muted); border: 1px solid var(--border); font-weight: 400; padding: 6px 12px; border-radius: var(--radius-md); font-size: 12px; text-decoration: none; white-space: nowrap; transition: all var(--transition); display: inline-block; font-family: var(--font-sans); }
.rk-btn-prepare:hover { border-color: var(--accent); color: var(--accent); }
.rk-btn-like { background: transparent; border: none; cursor: pointer; padding: 3px; display: flex; align-items: center; gap: 2px; flex-shrink: 0; color: var(--text-muted); transition: color var(--transition); }
.rk-btn-like:hover { color: var(--accent); }
.rk-btn-like svg { fill: currentColor; }
@media (max-width: 680px) {
    .rk-row { grid-template-columns: 36px 1fr 60px; grid-template-rows: auto auto; grid-template-areas: "pos player elo" "pos actions actions"; padding: 10px; gap: 4px 10px; }
    .rk-zone-pos     { grid-area: pos; align-self: center; }
    .rk-zone-player  { grid-area: player; }
    .rk-zone-elo     { grid-area: elo; text-align: right; }
    .rk-zone-actions { grid-area: actions; justify-content: flex-start; margin-top: 4px; }
    .rk-elo-val { font-size: 15px; }
    .rk-elo-lbl { display: none; }
    .rk-btn-profile, .rk-btn-prepare { font-size: 11px; padding: 5px 9px; }
    .rk-player-name { font-size: 13px; }
}
/* ============================================================
   AhoraAjedrez — Design System v1.1
   ============================================================ */
:root {
  --aa-overlay-bg:   rgba(0,0,0,.65);
  --aa-shadow-lg:    0 20px 60px rgba(0,0,0,.4);
  --aa-shadow-sm:    0 2px 8px rgba(0,0,0,.2);
  --aa-gap-xs:       4px;
  --aa-gap-sm:       8px;
  --aa-gap-md:       12px;
  --aa-gap-lg:       20px;
  --aa-gap-xl:       32px;
}
.aa-tabs{display:flex;gap:0;border-bottom:1px solid var(--border);overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.aa-tabs::-webkit-scrollbar{display:none}
.aa-tab{display:inline-flex;align-items:center;gap:6px;padding:10px 16px;font-size:13px;font-weight:500;font-family:var(--font-sans);color:var(--text-muted);text-decoration:none;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap;cursor:pointer;background:none;border-top:none;border-left:none;border-right:none;transition:color var(--transition),border-color var(--transition)}
.aa-tab:hover{color:var(--text-primary);border-bottom-color:var(--border-accent);text-decoration:none}
.aa-tab.is-active,.aa-tab[aria-selected="true"]{color:var(--accent);border-bottom-color:var(--accent);font-weight:600}
.aa-tab.is-disabled{opacity:.35;pointer-events:none}
.aa-tab__icon{width:14px;height:14px;flex-shrink:0;color:currentColor}
.aa-tab__badge{font-size:10px;font-weight:700;padding:1px 5px;border-radius:10px;background:var(--bg-card);border:1px solid var(--border);color:var(--text-muted);line-height:1.4}
.aa-tab.is-active .aa-tab__badge{background:rgba(201,162,39,.12);border-color:var(--border-accent);color:var(--accent)}
.aa-tabs--pills{border-bottom:none;gap:4px;flex-wrap:wrap}
.aa-tabs--pills .aa-tab{border:1px solid var(--border);border-radius:var(--radius-md);margin-bottom:0;background:var(--bg-card)}
.aa-tabs--pills .aa-tab:hover{border-color:var(--border-accent);background:var(--bg-card-hover)}
.aa-tabs--pills .aa-tab.is-active{background:var(--accent);border-color:var(--accent);color:#111}
.aa-tab-panel{display:none}
.aa-tab-panel.is-active{display:block}
.aa-modal-overlay{position:fixed;inset:0;background:var(--aa-overlay-bg);z-index:2000;display:flex;align-items:center;justify-content:center;padding:16px;opacity:0;pointer-events:none;transition:opacity .2s ease}
.aa-modal-overlay.is-active{opacity:1;pointer-events:all}
.aa-modal{background:var(--bg-card);border:1px solid var(--border-strong,rgba(255,255,255,.15));border-radius:var(--radius-lg);box-shadow:var(--aa-shadow-lg);width:100%;max-width:520px;max-height:90vh;display:flex;flex-direction:column;animation:aa-modal-in .2s ease;position:relative}
@keyframes aa-modal-in{from{transform:translateY(12px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}
.aa-modal--sm{max-width:360px}
.aa-modal--lg{max-width:720px}
.aa-modal__header{display:flex;align-items:center;justify-content:space-between;padding:18px 20px 14px;border-bottom:1px solid var(--border);flex-shrink:0}
.aa-modal__title{font-size:15px;font-weight:600;color:var(--text-primary);margin:0}
.aa-modal__close{width:28px;height:28px;display:flex;align-items:center;justify-content:center;border-radius:var(--radius-sm);background:transparent;border:none;color:var(--text-muted);cursor:pointer;transition:background var(--transition),color var(--transition);flex-shrink:0}
.aa-modal__close:hover{background:var(--bg-hover);color:var(--text-primary)}
.aa-modal__body{padding:18px 20px;overflow-y:auto;flex:1;color:var(--text-secondary);font-size:14px;line-height:1.65}
.aa-modal__footer{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:14px 20px 18px;border-top:1px solid var(--border);flex-shrink:0}
.aa-metric{display:flex;flex-direction:column;gap:3px;padding:14px 16px;background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-md)}
.aa-metric__icon{color:var(--accent);opacity:.7;margin-bottom:2px}
.aa-metric__icon svg{width:16px;height:16px;color:currentColor}
.aa-metric__value{font-family:var(--font-mono);font-size:24px;font-weight:500;color:var(--text-primary);line-height:1;letter-spacing:-.02em}
.aa-metric__value--accent{color:var(--accent)}
.aa-metric__value--success{color:var(--success)}
.aa-metric__value--danger{color:var(--danger)}
.aa-metric__label{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--text-muted)}
.aa-metric__aux{font-size:11px;color:var(--text-muted);margin-top:1px}
.aa-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px}
.aa-section{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.aa-section__text{flex:1;min-width:0}
.aa-section__title{font-size:15px;font-weight:600;color:var(--text-primary);margin:0 0 2px;line-height:1.3}
.aa-section__subtitle{font-size:12px;color:var(--text-muted);margin:0}
.aa-section__actions{display:flex;align-items:center;gap:6px;flex-shrink:0}
.aa-section--divided{padding-bottom:14px;border-bottom:1px solid var(--border);margin-bottom:20px}
.aa-section__eyebrow{font-size:10px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--accent);margin-bottom:4px;display:block}
.aa-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 14px;background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-md);margin-bottom:14px}
.aa-toolbar--flush{background:transparent;border:none;padding:0}
.aa-toolbar__left{display:flex;align-items:center;gap:8px;flex:1;flex-wrap:wrap}
.aa-toolbar__right{display:flex;align-items:center;gap:6px;flex-shrink:0;margin-left:auto}
.aa-toolbar__sep{width:1px;height:20px;background:var(--border);flex-shrink:0}
.aa-grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.aa-grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.aa-grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.aa-grid-auto{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
.aa-grid-auto-sm{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px}
.aa-grid-2.aa-gap-sm,.aa-grid-3.aa-gap-sm,.aa-grid-4.aa-gap-sm{gap:8px}
.aa-grid-2.aa-gap-lg,.aa-grid-3.aa-gap-lg,.aa-grid-4.aa-gap-lg{gap:20px}
.aa-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;text-align:center;color:var(--text-muted);gap:10px}
.aa-empty__icon{width:40px;height:40px;opacity:.3;color:var(--text-muted)}
.aa-empty__icon svg{width:100%;height:100%;color:currentColor}
.aa-empty__title{font-size:14px;font-weight:500;color:var(--text-secondary);margin:0}
.aa-empty__desc{font-size:13px;color:var(--text-muted);margin:0;line-height:1.6}
.aa-empty__action{margin-top:6px}
.aa-loading{display:flex;align-items:center;justify-content:center;gap:10px;padding:32px 20px;color:var(--text-muted);font-size:13px}
.aa-loading__spinner{width:18px;height:18px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:aa-spin .7s linear infinite;flex-shrink:0}
@keyframes aa-spin{to{transform:rotate(360deg)}}
.aa-skeleton{background:linear-gradient(90deg,var(--bg-card) 25%,var(--bg-hover) 50%,var(--bg-card) 75%);background-size:200% 100%;animation:aa-skeleton 1.4s ease infinite;border-radius:var(--radius-sm)}
@keyframes aa-skeleton{0%{background-position:200% 0}100%{background-position:-200% 0}}
.aa-skeleton--text{height:13px;margin:6px 0}
.aa-skeleton--title{height:20px;margin:8px 0;width:60%}
.aa-skeleton--card{height:80px;border-radius:var(--radius-md)}
.aa-message{display:flex;align-items:flex-start;gap:10px;padding:12px 14px;border-radius:var(--radius-md);font-size:13px;line-height:1.6;border:1px solid}
.aa-message__icon{flex-shrink:0;margin-top:1px}
.aa-message__icon svg{width:16px;height:16px;color:currentColor}
.aa-message__body{flex:1}
.aa-message__title{font-weight:600;margin-bottom:2px;display:block}
.aa-message--info{background:rgba(59,130,246,.08);border-color:rgba(59,130,246,.25);color:#60a5fa}
.aa-message--success{background:rgba(34,197,94,.08);border-color:rgba(34,197,94,.25);color:#4ade80}
.aa-message--warning{background:rgba(245,158,11,.08);border-color:rgba(245,158,11,.25);color:var(--accent)}
.aa-message--error{background:rgba(239,68,68,.08);border-color:rgba(239,68,68,.25);color:#f87171}
@media(max-width:900px){.aa-grid-4{grid-template-columns:repeat(2,1fr)}.aa-grid-3{grid-template-columns:repeat(2,1fr)}}
@media(max-width:540px){.aa-grid-4,.aa-grid-3,.aa-grid-2{grid-template-columns:1fr}.aa-metrics{grid-template-columns:repeat(2,1fr)}.aa-modal-overlay{align-items:flex-end;padding:0}.aa-modal{max-width:100%;border-radius:var(--radius-lg) var(--radius-lg) 0 0;max-height:85vh}}

/* ============================================================
   AhoraAjedrez — Design System v1.4
   aa-hero, aa-podium + migraciones seguras aa-metric
   ============================================================ */

/* ── AA-HERO ─────────────────────────────────────────────────
   Hero oficial del sistema. Cubre: país, club, miembro, jugador.
   ─────────────────────────────────────────────────────────── */
.aa-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  margin-bottom: 14px;
}
.aa-hero__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.aa-hero__media {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.aa-hero__media img {
  display: block;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.aa-hero__body {
  flex: 1;
  min-width: 0;
}
.aa-hero__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.aa-hero__subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 3px;
}
.aa-hero__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin: 3px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.aa-hero__meta a { color: var(--text-muted); text-decoration: underline; }
.aa-hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.aa-hero__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Modificador: país / comunidad */
.aa-hero--country .aa-hero__media {
  font-size: 44px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  min-width: 56px;
}

/* Modificador: club */
.aa-hero--club .aa-hero__media img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
}
.aa-hero--club .aa-hero__media-ph {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

/* Modificador: miembro */
.aa-hero--member .aa-hero__media img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}
.aa-hero--member .aa-hero__media-ph {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

/* Modificador: jugador FIDE */
.aa-hero--player .aa-hero__media img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.aa-hero--player .aa-hero__title {
  font-size: 25px;
  font-weight: 800;
}

/* Responsive */
@media (max-width: 540px) {
  .aa-hero { padding: 14px 14px 12px; }
  .aa-hero--player .aa-hero__media img { width: 80px; height: 80px; }
  .aa-hero__title { font-size: 18px; }
  .aa-hero__stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── AA-PODIUM ───────────────────────────────────────────────
   Podio oficial. Sin emojis. Sin colores hardcodeados.
   Cubre: rankings FIDE, país, España, comunidad, club, miembros.
   ─────────────────────────────────────────────────────────── */
.aa-podium {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  gap: 8px;
  align-items: end;
  margin-bottom: 20px;
}
.aa-podium__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 12px 12px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: border-color var(--transition);
}
.aa-podium__card:hover { border-color: var(--border-strong); }

/* Barra de color superior por posición */
.aa-podium__card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--border);
}
.aa-podium__card--1 {
  border-color: var(--border-accent);
  background: rgba(201,162,39,.04);
  padding-top: 20px;
}
.aa-podium__card--1::before { background: var(--accent); }
.aa-podium__card--2::before { background: rgba(180,180,188,.4); }
.aa-podium__card--3::before { background: rgba(180,140,80,.35); }

/* Posición numérica */
.aa-podium__pos {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: .05em;
}
.aa-podium__card--1 .aa-podium__pos { color: var(--accent); font-size: 13px; }
.aa-podium__card--2 .aa-podium__pos { color: var(--text-secondary); }
.aa-podium__card--3 .aa-podium__pos { color: var(--text-secondary); opacity: .7; }

/* Badge de título FIDE */
.aa-podium__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(201,162,39,.12);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  letter-spacing: .04em;
}

/* Nombre */
.aa-podium__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.3;
  transition: color var(--transition);
  display: block;
}
.aa-podium__name:hover { color: var(--accent-light); text-decoration: none; }

/* Valor principal (ELO, puntos...) */
.aa-podium__value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
}
.aa-podium__card--1 .aa-podium__value {
  font-size: 22px;
  color: var(--accent);
  font-weight: 600;
}

/* Etiqueta del valor */
.aa-podium__label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

/* Acciones opcionales */
.aa-podium__actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Responsive */
@media (max-width: 480px) {
  .aa-podium { grid-template-columns: 1fr; align-items: stretch; }
  .aa-podium__card--1 { order: -1; }
}

/* ============================================================
   AhoraAjedrez — AA-NAV-IMPERIO
   Navegación jerárquica Club → Comunidad → España → Mundo.
   Reutiliza el mismo estilo pill que .club-back / .ca-back.
   Integrada en la fila de acciones del hero (arriba) y repetida
   como bloque final antes del footer (abajo, con comparadores).
   ============================================================ */
.aa-nav-imperio{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.aa-nav-imperio__item{display:inline-flex;align-items:center;gap:5px;font-size:12px;color:var(--text-muted);text-decoration:none;padding:4px 10px;border:1px solid var(--border);border-radius:var(--radius-md);transition:all var(--transition);white-space:nowrap}
.aa-nav-imperio__item:hover{color:var(--text-primary);border-color:var(--border-strong);text-decoration:none;background:var(--bg-hover)}
