/* ==========================================================================
   The Oracle of Myths — hoja de estilos principal
   Estrategia: MOBILE-FIRST (la app es una APP web, pensada para celular).
   Base = móvil · @media (min-width: 768px) = escritorio.
   --------------------------------------------------------------------------
   Índice:
   1. Tokens de diseño
   2. Reset y base
   3. Barra superior (brand + avatar) y navegación
   4. Navegación inferior (bottom nav — solo móvil)
   5. Vistas y hero
   6. Catálogo (controles, grilla, tarjeta, paginación)
   7. Modal de carta (detalle + mercado)
   8. Comunidad (feature cards, avisos)
   9. Proyecto (stats)
   10. Cuenta: avatar, menú, modales login/registro, perfil, toast
   11. Utilidades y responsive de escritorio
   ========================================================================== */

/* ==========================================================================
   1. TOKENS DE DISEÑO
   ========================================================================== */
:root {
  /* Color */
  --bg: #0b0c10;
  --bg-elev: #12161c;
  --card-bg: rgba(21, 27, 34, 0.7);
  --border: #242e3a;
  --border-strong: #2f3c4c;
  --gold: #c5a059;
  --gold-strong: #8a6a2f;
  --cyan: #66fcf1;
  --text: #ffffff;
  --muted: #8a8f98;
  --danger: #e05555;
  --ok: #4cd964;
  --warn: #e0a030;

  /* Espaciado */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Tipografía */
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  /* Formas y elevación */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow-nav: 0 4px 20px rgba(0, 0, 0, 0.45);

  /* Medidas de layout */
  --nav-h: 60px;
  --bottom-nav-h: 64px;
  --content-max: 1000px;
  --touch-min: 44px; /* objetivo táctil mínimo recomendado */
}

/* ==========================================================================
   2. RESET Y BASE
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at top right, rgba(102, 252, 241, 0.06), transparent),
    radial-gradient(circle at bottom left, rgba(197, 160, 89, 0.06), transparent);
  color: var(--text);
  min-height: 100vh;
  /* El contenido no queda tapado por la bottom nav en móvil */
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ==========================================================================
   3. BARRA SUPERIOR (sticky) + NAVEGACIÓN
   ========================================================================== */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 12, 16, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-3);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-height: var(--touch-min);
}

.nav-brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-brand span span { color: var(--gold); }

/* Links de navegación — solo visibles en escritorio */
.nav-links {
  display: none;
  gap: var(--sp-1);
  margin-left: auto;
}

.nav-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--fs-sm);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  min-height: var(--touch-min);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-link.active { color: var(--gold); background: rgba(197, 160, 89, 0.1); }

/* Zona derecha: avatar de cuenta */
.nav-actions { margin-left: auto; display: flex; align-items: center; }

/* Avatar circular (login / perfil) */
.avatar-btn {
  width: 40px;
  height: 40px;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: linear-gradient(160deg, #1f2833, #151b22);
  color: var(--text);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s, transform 0.15s;
}

.avatar-btn:hover { border-color: var(--gold); }
.avatar-btn.logged { border-color: var(--gold); background: linear-gradient(135deg, rgba(197,160,89,0.25), rgba(102,252,241,0.12)); }

/* ==========================================================================
   4. NAVEGACIÓN INFERIOR (bottom nav) — patrón de app móvil
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: rgba(13, 15, 20, 0.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: color 0.15s;
}

.bottom-tab .tab-icon { font-size: 20px; line-height: 1; }
.bottom-tab.active { color: var(--gold); }

/* ==========================================================================
   5. VISTAS Y HERO
   ========================================================================== */
.view { display: none; }
.view.active { display: block; }

.app-shell { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-4) var(--sp-4) 48px; }

.hero {
  text-align: center;
  padding: var(--sp-6) var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.hero h2 { font-size: var(--fs-xl); letter-spacing: 0.5px; }
.hero h2 span { color: var(--gold); }
.hero p { color: var(--muted); font-size: var(--fs-sm); margin-top: 10px; max-width: 560px; margin-left: auto; margin-right: auto; line-height: 1.6; }

.coming-soon {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
  padding: 48px var(--sp-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  line-height: 1.8;
}

.coming-soon .icon { font-size: 40px; display: block; margin-bottom: var(--sp-3); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
  padding: var(--sp-5) var(--sp-4) calc(var(--bottom-nav-h) + var(--sp-5));
}

/* ==========================================================================
   6. CATÁLOGO (toolbar, grilla de colección, filtros, tags)
   ========================================================================== */
/* Toolbar: búsqueda + botón filtros + toggle de vista */
.catalog-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.search-row { display: flex; gap: var(--sp-2); }

#q {
  flex: 1;
  min-width: 0;
  min-height: var(--touch-min);
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: var(--fs-md);
  outline: none;
}

.btn-filters {
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 0 14px;
  cursor: pointer;
}

.btn-filters:active { border-color: var(--gold); }

.filters-badge {
  background: var(--gold);
  color: #1a1406;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.status { flex: 1; color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Selector de ordenamiento (compacto, junto al toggle de vista) */
.sort-select {
  max-width: 120px;
  min-height: 36px;
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  outline: none;
  cursor: pointer;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle button {
  width: 40px;
  height: 36px;
  background: #1f2833;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.view-toggle button.active { background: rgba(197, 160, 89, 0.15); color: var(--gold); }

/* Barra de etiquetas (tags) — chips deslizables */
.tag-bar {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: var(--sp-1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tag-bar::-webkit-scrollbar { display: none; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #1f2833;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  min-height: 32px;
  flex-shrink: 0;
}

.tag-chip .tag-count { font-size: 10px; opacity: 0.7; }
.tag-chip.active { background: rgba(102, 252, 241, 0.12); border-color: var(--cyan); color: var(--cyan); }
.tag-chip.add { border-style: dashed; }

/* Chips de filtros activos (con X para quitar) */
.active-filters {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid rgba(197, 160, 89, 0.4);
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}

.filter-chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
}

/* Grilla de colección (miniaturas tipo app) */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.grid-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.grid-card:hover { border-color: var(--gold); }
.grid-card:active { border-color: var(--cyan); }

.grid-card .art {
  width: 100%;
  aspect-ratio: 63 / 88;
  border-radius: 0;
  font-size: 40px;
  position: relative;
}

.grid-card .art img { width: 100%; height: 100%; object-fit: cover; }
.grid-card .art .badge-incomplete { position: absolute; top: 6px; left: 6px; margin: 0; font-size: 9px; }

.grid-card .gcard-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.grid-card .gcard-name {
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Edición entre paréntesis (sutil) para cartas incompletas */
.grid-card .gcard-edition {
  font-weight: normal;
  font-size: 10px;
  color: var(--muted);
}

.grid-card .gcard-meta { font-size: 10px; color: var(--gold); }
.grid-card .gcard-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.grid-card .mini-tag { font-size: 9px; background: rgba(102, 252, 241, 0.1); color: var(--cyan); border-radius: 4px; padding: 1px 5px; }

/* Vista lista (tarjetas horizontales) */
.grid.list-view { grid-template-columns: 1fr; }
.grid.list-view .grid-card { flex-direction: row; }
.grid.list-view .grid-card .art { width: 56px; aspect-ratio: 63 / 88; flex-shrink: 0; font-size: 24px; border-radius: 8px 0 0 8px; }
.grid.list-view .gcard-body { padding: 10px; justify-content: center; }

/* Paginación */
.pager { display: flex; justify-content: center; gap: 10px; margin-top: var(--sp-6); }

.pager button {
  min-height: var(--touch-min);
  background: #1f2833;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.pager button:disabled { opacity: 0.4; cursor: default; }

.badge-incomplete {
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--warn);
  background: rgba(224, 160, 48, 0.12);
  border: 1px solid rgba(224, 160, 48, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

/* ===== Panel de filtros (modal) ===== */
.filters-modal .modal-panel { max-width: 480px; }

.filters-body {
  padding: var(--sp-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-group { display: flex; flex-direction: column; gap: var(--sp-2); }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.chip-opt {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #1f2833;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip-opt.active { background: rgba(197, 160, 89, 0.15); border-color: var(--gold); color: var(--gold); }
.chip-opt .opt-count { font-size: 10px; opacity: 0.7; }

.filters-body input[type="text"],
.filters-body select {
  min-height: var(--touch-min);
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--fs-md);
  padding: 10px 12px;
  outline: none;
}

.range-row { display: flex; align-items: center; gap: var(--sp-2); }
.range-row select { flex: 1; }
.range-row span { color: var(--muted); font-size: 12px; }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.checks label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: #ddd;
  min-height: 36px;
  cursor: pointer;
}
.checks input { width: 18px; height: 18px; accent-color: var(--gold); }

.filters-footer {
  display: flex;
  gap: 10px;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
}
.filters-footer .btn { flex: 1; }

/* Editor de etiquetas en el detalle de carta */
.tag-editor { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.tag-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 10px; }
.tag-chips .tag-chip.owned { background: rgba(102, 252, 241, 0.1); border-color: var(--cyan); color: var(--cyan); }
.tag-input-row input {
  width: 100%;
  min-height: var(--touch-min);
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--fs-md);
  padding: 10px 14px;
  outline: none;
}
.tag-note { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-2); line-height: 1.5; }

/* ==========================================================================
   7. MODAL DE CARTA (detalle + mercado)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  overflow-y: auto;
}

.modal-overlay.open { display: flex; }

/* En móvil el modal es una hoja que sube desde abajo (patrón app) */
.modal-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.22s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.modal-title { flex: 1; min-width: 0; font-size: 17px; font-weight: bold; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  width: var(--touch-min);
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-tabs { display: flex; border-bottom: 1px solid var(--border); }

.modal-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: bold;
  cursor: pointer;
  min-height: var(--touch-min);
  border-bottom: 2px solid transparent;
}

.modal-tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.modal-body { padding: var(--sp-4); overflow-y: auto; }

.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

/* Caja de imagen de carta */
.card-image-box {
  background: linear-gradient(160deg, #1f2833, #151b22);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  overflow: hidden;
  position: relative;
}

.card-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: linear-gradient(160deg, #1f2833, #151b22);
}

.card-image-icon { font-size: 48px; }
.card-image-caption { font-size: var(--fs-xs); color: var(--muted); }

/* Lista de campos apilada */
.card-field-list { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.card-field-list > div { display: flex; gap: var(--sp-2); font-size: var(--fs-sm); line-height: 18px; }
.card-field-list dt { flex-shrink: 0; width: 96px; color: var(--muted); font-weight: bold; }
.card-field-list dd { margin: 0; color: #ddd; word-break: break-word; }
.card-field-row-split { display: flex; gap: var(--sp-6); }
.card-field-row-split > div { display: flex; gap: var(--sp-2); }
.card-field-row-split dt { width: auto; }

/* Pestaña mercado */
.price-box {
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: var(--sp-3);
  text-align: center;
  margin-bottom: var(--sp-4);
}

.price-value { font-size: 22px; font-weight: bold; color: var(--cyan); }
.price-source { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); }
.price-empty { color: var(--muted); font-size: var(--fs-sm); }

.variation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.variation-item:last-child { border-bottom: none; }
.variation-edition { font-weight: bold; }
.variation-meta { color: var(--muted); font-size: var(--fs-xs); }
.variation-price { color: var(--cyan); font-weight: bold; font-size: var(--fs-sm); white-space: nowrap; }
.variation-price-empty { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }

.section-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: bold;
  margin-bottom: var(--sp-2);
  letter-spacing: 0.5px;
}

/* ==========================================================================
   8. COMUNIDAD (feature cards, avisos)
   ========================================================================== */
.announcement {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.08), rgba(102, 252, 241, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-6);
  font-size: var(--fs-sm);
  color: #ddd;
  line-height: 1.6;
}

.announcement strong { color: var(--gold); }

.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  transition: border-color 0.15s, transform 0.15s;
}

.feature-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.feature-icon { font-size: 30px; margin-bottom: var(--sp-3); }
.feature-card h3 { font-size: var(--fs-lg); margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }

.feature-status {
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: var(--sp-3);
  letter-spacing: 0.3px;
}

.feature-status.ready { color: var(--ok); background: rgba(76, 217, 100, 0.1); border: 1px solid rgba(76, 217, 100, 0.3); }
.feature-status.planned { color: var(--gold); background: rgba(197, 160, 89, 0.1); border: 1px solid rgba(197, 160, 89, 0.3); }

/* ==========================================================================
   9. PROYECTO (stats)
   ========================================================================== */
.stats-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-6); }

.stat-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  text-align: center;
}

.stat-value { font-size: 22px; font-weight: bold; color: var(--cyan); }
.stat-label { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); text-transform: uppercase; letter-spacing: 0.5px; }

/* ==========================================================================
   10. CUENTA: avatar, menú, modales login/registro, perfil, toast
   ========================================================================== */
/* Menú desplegable de cuenta (sheet en móvil, dropdown en desktop) */
.account-menu {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: var(--sp-2);
  padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 0.2s ease-out;
}

.account-menu.open { display: block; }

.account-menu-header {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2);
}

.account-menu-identity { display: flex; align-items: center; gap: var(--sp-3); }
.account-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.3), rgba(102, 252, 241, 0.15));
  border: 2px solid var(--gold);
  color: var(--text);
  font-weight: bold;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-menu-identity .who { min-width: 0; }
.account-menu-identity .who strong { display: block; font-size: var(--fs-md); }
.account-menu-identity .who small { color: var(--muted); font-size: var(--fs-xs); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: var(--touch-min);
  background: none;
  border: none;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 10px var(--sp-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.account-menu-item:hover { background: rgba(255, 255, 255, 0.05); }
.account-menu-item.danger { color: var(--danger); }

/* Fondo oscuro que tapa la app al abrir el menú de cuenta */
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 105;
}

.scrim.open { display: block; }

/* Formularios de autenticación */
.auth-modal .modal-panel { max-width: 420px; }

.auth-intro {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 var(--sp-1);
}

.auth-intro strong { color: var(--text); }

/* Input del código OTP: grande y centrado (táctil amigable) */
.otp-input {
  text-align: center;
  font-size: 26px !important;
  font-weight: bold;
  letter-spacing: 12px;
  font-variant-numeric: tabular-nums;
  caret-color: var(--gold);
}

.resend-timer {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: normal;
}

.auth-form .btn-ghost { margin-top: var(--sp-1); }

.auth-form { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4); }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: bold; }

.field input {
  min-height: var(--touch-min);
  background: #1f2833;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: var(--fs-md);
  outline: none;
}

.field input:focus { border-color: var(--cyan); }

.field .field-error { color: var(--danger); font-size: var(--fs-xs); display: none; }
.field.invalid input { border-color: var(--danger); }
.field.invalid .field-error { display: block; }

.btn {
  min-height: var(--touch-min);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: bold;
  cursor: pointer;
  padding: 12px 18px;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #1a1406;
  width: 100%;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border-strong);
  width: 100%;
}

.auth-switch {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: var(--sp-2);
}

.auth-switch button {
  background: none;
  border: none;
  color: var(--gold);
  font-weight: bold;
  cursor: pointer;
  font-size: var(--fs-sm);
  padding: 4px;
  min-height: var(--touch-min);
}

.auth-note {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
  padding: 0 var(--sp-4) var(--sp-4);
  line-height: 1.6;
}

/* Perfil de jugador (mock) */
.profile-box { text-align: center; padding: var(--sp-4); }
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto var(--sp-3);
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.3), rgba(102, 252, 241, 0.15));
  border: 2px solid var(--gold);
  color: var(--text);
  font-weight: bold;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-box h3 { font-size: var(--fs-lg); }
.profile-box .profile-email { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }

.profile-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); margin-top: var(--sp-3); }
.profile-stat { background: #1f2833; border-radius: var(--radius-sm); padding: var(--sp-3); }
.profile-stat .v { font-size: 18px; font-weight: bold; color: var(--cyan); }
.profile-stat .l { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }

/* Toast de feedback */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-h) + var(--sp-4) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  background: #1f2833;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  z-index: 130;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-nav);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   11. ESCRITORIO (>= 768px)
   ========================================================================== */
@media (min-width: 768px) {
  body { padding-bottom: 0; }

  /* Nav superior con links; bottom nav desaparece */
  .nav-links { display: flex; }
  .nav-actions { margin-left: 0; }
  .bottom-nav { display: none; }

  .app-shell { padding: var(--sp-6) var(--sp-5) 60px; }

  /* Catálogo: grilla de colección más amplia en escritorio */
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--sp-3); }
  .grid.list-view { grid-template-columns: 1fr; }

  /* Toolbar del catálogo en una sola fila */
  .catalog-toolbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
  #q { min-width: 220px; }
  .btn-filters { margin-left: auto; }
  .toolbar-row { width: 100%; }

  /* Modal centrado tipo ventana */
  .modal-overlay { align-items: flex-start; padding: 48px var(--sp-4); }
  .modal-panel { border-radius: var(--radius-lg); max-width: 640px; }

  /* Menú de cuenta como dropdown bajo el avatar */
  .account-menu {
    position: absolute;
    top: calc(var(--nav-h) - 6px);
    right: calc(50% - min(500px, 50vw));
    left: auto;
    bottom: auto;
    width: 280px;
    border-radius: var(--radius-md);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    box-shadow: var(--shadow-nav);
  }

  /* Comunidad: grid de 2-3 columnas */
  .feature-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }

  /* Stats en una fila */
  .stats-row { grid-template-columns: repeat(4, 1fr); }

  footer { padding-bottom: var(--sp-5); }
  .toast { bottom: var(--sp-6); }

  .hero h2 { font-size: var(--fs-2xl); }
}

/* Pantallas muy pequeñas: no saturar la barra superior */
@media (max-width: 380px) {
  .nav-brand { font-size: 13px; }
  .nav-brand .logo { width: 28px; height: 28px; font-size: 14px; }
}
