/* =================================================================
   UNIVERSO MORION
   Interfaz tipo red social / web app - minimalista y animada
   ================================================================= */

:root {
  /* Superficies neutras (gris azulado muy oscuro) */
  --bg:          #0b141a;
  --bg-soft:     #0f1a21;
  --surface:     #111b21;
  --surface-2:   #202c33;
  --surface-3:   #2a3942;
  --glass:       #111b21;
  --border:      rgba(233,237,239,.09);
  --border-2:    rgba(233,237,239,.17);

  /* Texto */
  --text:        #e9edef;
  --text-2:      #aebac1;
  --text-3:      #8696a0;

  /* Acentos: el verde se reserva para acciones */
  --primary:     #00a884;
  --primary-2:   #25d366;
  --primary-3:   #5ee9b5;
  --primary-d:   #017561;
  --accent:      #53bdeb;
  --gold:        #f0b232;
  --green:       #00a884;
  --red:         #f15c6d;
  --orange:      #f0a132;

  /* Formas */
  --r-xs:   8px;
  --r-sm:   12px;
  --r:      14px;
  --r-lg:   18px;
  --r-full: 999px;

  /* Sombras discretas */
  --sh-1: 0 1px 2px rgba(0,0,0,.28);
  --sh-2: 0 2px 8px rgba(0,0,0,.32);
  --sh-3: 0 8px 26px rgba(0,0,0,.45);
  --sh-glow: 0 2px 8px rgba(0,0,0,.32);

  /* Movimiento */
  --e-out:    cubic-bezier(.22,1,.36,1);
  --e-spring: cubic-bezier(.34,1.56,.64,1);
  --t-fast:   .16s var(--e-out);
  --t:        .26s var(--e-out);
  --t-slow:   .42s var(--e-out);

  --nav-w:  244px;
  --tabbar: 66px;
  --font:   'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, Inter, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Iconos SVG de linea (flat design), usados en todo el sitio: menu, pestanas,
   alertas, chips, estadisticas... Heredan el tamano del font-size de su
   contenedor y el color con currentColor, asi hover/active los recolorean solos. */
.i { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.55;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}


a { color: var(--primary-2); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-3); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -.025em; }
h1 { font-size: clamp(1.45rem, 3.4vw, 1.95rem); }
h2 { font-size: clamp(1.12rem, 2.4vw, 1.35rem); }
h3 { font-size: 1.02rem; }

::selection { background: rgba(0,168,132,.35); }

/* Scrollbar discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); background-clip: content-box; }

/* =================================================================
   ANIMACIONES
   ================================================================= */

@keyframes fade-up   { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade-in   { from { opacity: 0; } }
@keyframes pop-in    { from { opacity: 0; transform: scale(.94) translateY(10px); } }
@keyframes slide-up  { from { transform: translateY(100%); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes pulse-soft{ 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes shimmer   { to { background-position: 200% 0; } }

/* Entrada escalonada de la página */
.content > * { animation: fade-up .5s var(--e-out) backwards; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .10s; }
.content > *:nth-child(4) { animation-delay: .14s; }
.content > *:nth-child(5) { animation-delay: .18s; }
.content > *:nth-child(n+6) { animation-delay: .22s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =================================================================
   ESTRUCTURA
   ================================================================= */

.app { display: flex; min-height: 100dvh; }

/* ---------- Lateral (escritorio) ---------- */
.sidebar {
  width: var(--nav-w); flex: 0 0 var(--nav-w);
  position: sticky; top: 0; height: 100dvh;
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 60;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px 20px; color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-logo {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 13px; display: grid; place-items: center;
  font-size: 1.15rem;
  background: var(--primary);
  transition: transform var(--t) var(--e-spring);
}
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-txt strong { display: block; font-size: .98rem; line-height: 1.15; font-weight: 650; }
.brand-txt span { font-size: .66rem; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; }

.nav-group-title {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .13em;
  color: var(--text-3); padding: 16px 12px 6px; font-weight: 700;
}

.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: .9rem; font-weight: 550;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-link.active { color: var(--text); background: var(--surface-2); }
.nav-link.active::before {
  content: ''; position: absolute; left: -12px; top: 50%;
  width: 3px; height: 20px; margin-top: -10px;
  background: var(--primary); border-radius: 0 3px 3px 0;
  animation: fade-in .3s var(--e-out);
}
.nav-link .ico { font-size: 1.05rem; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto; min-width: 20px; text-align: center;
  background: var(--primary); color: #04231c;
  font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: var(--r-full);
}

.sidebar-foot { margin-top: auto; padding-top: 14px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.user-chip:hover { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
.user-chip .ident-txt { min-width: 0; }

/* El cajon deslizante y su velo solo existen en movil */
.drawer, .drawer-overlay { display: none; }

/* ---------- Contenido ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none; align-items: center; gap: 12px;
  padding: 10px 14px;
  position: sticky; top: 0; z-index: 70;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 1.1rem; cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.92); }

.content {
  padding: 26px 26px 60px;
  max-width: 1240px; width: 100%; margin: 0 auto;
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head .sub { color: var(--text-2); font-size: .9rem; margin-top: 3px; }
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .82rem; color: var(--text-3); margin-bottom: 6px;
  transition: gap var(--t-fast), color var(--t-fast);
}
.back-link:hover { gap: 9px; color: var(--text-2); }

/* ---------- Barra inferior (móvil) ---------- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar-inner { display: flex; height: var(--tabbar); }
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: .63rem; font-weight: 600;
  position: relative; transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.tab-item .ico { font-size: 1.2rem; transition: transform var(--t) var(--e-spring); }
.tab-item:active .ico { transform: scale(.85); }
.tab-item.active { color: var(--primary-2); }
.tab-item.active .ico { transform: translateY(-2px); }
.tab-item.active::after {
  content: ''; position: absolute; top: 4px;
  width: 34px; height: 34px; border-radius: 12px;
  background: rgba(0,168,132,.16);
  animation: pop-in .3s var(--e-spring);
}
.tab-dot {
  position: absolute; top: 9px; right: calc(50% - 16px);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}

/* Botón flotante */
.fab {
  display: none;
  position: fixed; right: 16px; z-index: 85;
  bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 18px;
  align-items: center; justify-content: center;
  background: var(--primary-2);
  color: #05130e; font-size: 1.5rem; border: none;
  box-shadow: var(--sh-3); cursor: pointer;
  transition: transform var(--t) var(--e-spring);
}
.fab:active { transform: scale(.9); }

/* =================================================================
   TARJETAS Y REJILLAS
   ================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}
.card.tight { padding: 14px; }
a.card:hover, .card.hoverable:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
}

.card-title {
  display: flex; align-items: center; gap: 9px;
  font-size: .95rem; font-weight: 650; margin-bottom: 15px;
}
.card-title .ico { font-size: 1.05rem; }
.card-title .more { margin-left: auto; font-size: .78rem; font-weight: 500; }

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.split  { grid-template-columns: minmax(0, 2fr) minmax(275px, 1fr); }
.split-r{ grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* =================================================================
   PANEL DE ACCESOS (inicio tipo app)
   ================================================================= */

.tiles {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}

.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 9px;
  padding: 17px 16px 16px;
  min-height: 124px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t), background var(--t);
}
.tile:hover {
  color: var(--text); transform: translateY(-3px);
  border-color: var(--border-2); box-shadow: var(--sh-2);
}
.tile:active { transform: scale(.97); }

.tile-ico {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; font-size: 4.4rem;
  background: rgba(0,168,132,.14); color: var(--primary-2);
  transition: transform var(--t) var(--e-spring);
}
.tile:hover .tile-ico { transform: scale(1.08) rotate(-5deg); }
.tile b { font-size: .95rem; font-weight: 650; line-height: 1.25; }
.tile span { font-size: .75rem; color: var(--text-3); line-height: 1.35; margin-top: -3px; }

.tile-num {
  position: absolute; top: 14px; right: 14px;
  min-width: 24px; padding: 2px 8px; border-radius: var(--r-full);
  background: var(--primary); color: #04231c;
  font-size: .74rem; font-weight: 750; text-align: center;
}

/* Baldosa grande destacada */
.tile-hero {
  grid-column: span 2;
  background: var(--surface-2);
  border-color: rgba(0,168,132,.34);
}
.tile-hero .tile-ico { background: var(--primary); color: #04231c; }
.tile-hero b { font-size: 1.08rem; }

/* Tira de estadísticas compacta */
.stat-strip {
  display: grid; gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat-mini {
  padding: 13px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  text-align: center;
}
.stat-mini b { display: block; font-size: 1.25rem; font-weight: 700; line-height: 1.15; }
.stat-mini span { font-size: .69rem; color: var(--text-3); }

@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 112px; padding: 14px 13px; }
  .tile-ico { width: 46px; height: 46px; font-size: 3.5rem; border-radius: 12px; }
  .tile b { font-size: .88rem; }
  .tile span { font-size: .7rem; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =================================================================
   IDENTIDAD SOCIAL  (nombre + @nick)
   ================================================================= */

.ident { display: inline-flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.ident:hover { color: var(--text); }
.ident:hover .ident-txt b { color: var(--primary-2); }
.ident-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ident-txt b {
  font-size: .89rem; font-weight: 620;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--t-fast);
}
.handle { font-size: .74rem; color: var(--text-3); white-space: nowrap; }
.ident-extra { font-size: .72rem; color: var(--text-3); }

.avatar {
  border-radius: 50%; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0;
}
.avatar-xs { width: 26px; height: 26px; }
.avatar-sm { width: 38px; height: 38px; }
.avatar-md { width: 52px; height: 52px; }
.avatar-lg { width: 88px; height: 88px; }
.avatar-xl { width: 124px; height: 124px; }

.avatar-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }

/* Fila compacta: miniatura + texto (juegos en tablas) */
.user-inline { display: inline-flex; align-items: center; gap: 9px; color: var(--text); min-width: 0; }
.user-inline:hover { color: var(--primary-2); }

/* =================================================================
   PERFIL SOCIAL
   ================================================================= */

.profile-cover {
  position: relative;
  height: clamp(140px, 24vw, 230px);
  border-radius: var(--r) var(--r) 0 0;
  overflow: hidden;
  background: var(--surface-2);
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(11,20,26,.82), rgba(11,20,26,.05) 62%);
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.profile-body { padding: 0 22px 20px; position: relative; z-index: 1; }
.profile-top {
  display: flex; align-items: flex-end; gap: 18px;
  margin-top: -50px; flex-wrap: wrap;
}
.profile-avatar {
  width: 108px; height: 108px; border-radius: 50%;
  object-fit: cover; background: var(--surface-2);
  border: 4px solid var(--surface);
  box-shadow: var(--sh-2);
  transition: transform var(--t) var(--e-spring);
}
.profile-avatar:hover { transform: scale(1.04); }
.profile-names { flex: 1; min-width: 190px; padding-bottom: 4px; }
.profile-names h1 { font-size: clamp(1.3rem, 3.5vw, 1.7rem); }
.profile-names .handle { font-size: .92rem; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 4px; }

.profile-stats {
  display: flex; gap: 26px; flex-wrap: wrap;
  padding: 16px 0 4px; border-top: 1px solid var(--border); margin-top: 16px;
}
.profile-stats > div { display: flex; flex-direction: column; }
.profile-stats b { font-size: 1.15rem; font-weight: 680; line-height: 1.1; }
.profile-stats span { font-size: .73rem; color: var(--text-3); }

/* =================================================================
   BOTONES
   ================================================================= */

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-full);
  border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text);
  font-size: .87rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast), background var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary); border-color: transparent; color: #04231c;
}
.btn-primary:hover { background: var(--primary-2); color: #04231c; }
.btn-accent  { background: var(--accent); border-color: transparent; color: #062330; }
.btn-accent:hover { background: #6ccbf0; color: #062330; }
.btn-danger  { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.34); color: var(--red); }
.btn-danger:hover  { background: rgba(251,113,133,.2); color: var(--red); }
.btn-success { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.34); color: var(--green); }
.btn-success:hover { background: rgba(52,211,153,.2); color: var(--green); }
.btn-ghost   { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm    { padding: 6px 13px; font-size: .78rem; }
.btn-lg    { padding: 13px 26px; font-size: .96rem; }
.btn-block { width: 100%; }
.btn-round { padding: 0; width: 36px; height: 36px; border-radius: 50%; }

/* =================================================================
   FORMULARIOS
   ================================================================= */

.form-group { margin-bottom: 15px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; }

label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
label .req { color: var(--red); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], input[type=search], input[type=color],
select, textarea {
  width: 100%; padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text); font-size: .9rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,168,132,.16);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=color] { padding: 4px; height: 44px; cursor: pointer; }
input[type=file] { padding: 9px 12px; font-size: .83rem; cursor: pointer; }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
select { cursor: pointer; appearance: none; padding-right: 34px;
  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 fill='%238696a0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
.hint { font-size: .75rem; color: var(--text-3); margin-top: 5px; }

.check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--bg-soft); border: 1px solid var(--border);
  cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.check:hover { border-color: var(--border-2); background: var(--surface-2); }
.check:has(input:checked) { border-color: rgba(0,168,132,.5); background: rgba(0,168,132,.09); }
.check input { margin-top: 2px; accent-color: var(--primary); width: 17px; height: 17px; flex: 0 0 17px; cursor: pointer; }
.check span { font-size: .85rem; }
.check small { display: block; color: var(--text-3); font-size: .73rem; margin-top: 2px; }

/* Buscador con autocompletado (select mejorado) */
.combo { position: relative; }
.combo-oculto { display: none !important; }
.combo-input { width: 100%; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='%238696a0' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l4 4'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
.combo-input.elegido {
  border-color: rgba(0,168,132,.55);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2300a884' stroke-width='2.4' d='M3 8.5l3.5 3.5L13 5'/%3E%3C/svg%3E");
}
.combo-list {
  display: none;
  margin-top: 7px;
  max-height: 262px; overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 5px;
  box-shadow: var(--sh-2);
  -webkit-overflow-scrolling: touch;
}
.combo.open .combo-list { display: block; animation: pop-in .18s var(--e-out); }
.combo-opt {
  padding: 10px 12px; border-radius: var(--r-xs);
  font-size: .87rem; color: var(--text-2); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--t-fast), color var(--t-fast);
}
.combo-opt:hover, .combo-opt.marcada {
  background: rgba(0,168,132,.15); color: var(--text);
}
.combo-vacio { padding: 13px; text-align: center; color: var(--text-3); font-size: .81rem; }

/* Búsqueda con lupa */
.search-box { position: relative; flex: 1; min-width: 160px; }
.search-box input { padding-left: 38px; }
.search-box::before {
  content: '🔍'; position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%); font-size: .85rem; opacity: .5; pointer-events: none;
}

/* Selector segmentado */
.segmented {
  display: inline-flex; gap: 3px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-full); overflow-x: auto; max-width: 100%;
}
.segmented button, .segmented a {
  padding: 7px 16px; border: none; background: transparent;
  color: var(--text-2); font-size: .82rem; font-weight: 600;
  border-radius: var(--r-full); cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button:hover, .segmented a:hover { color: var(--text); }
.segmented .active { background: var(--primary); color: #fff; box-shadow: var(--sh-1); }

/* Chips seleccionables (filtros) */
.chip-toggle { position: relative; cursor: pointer; }
.chip-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-toggle span {
  display: inline-block; padding: 7px 14px;
  border-radius: var(--r-full); font-size: .8rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: all var(--t-fast);
}
.chip-toggle:hover span { border-color: var(--border-2); color: var(--text); }
.chip-toggle input:checked + span {
  background: rgba(0,168,132,.18); border-color: var(--primary);
  color: var(--primary-3);
}
.chip-toggle input:focus-visible + span { box-shadow: 0 0 0 3px rgba(0,168,132,.25); }

/* Rango */
input[type=range] {
  width: 100%; height: 5px; border-radius: var(--r-full);
  background: var(--surface-3); appearance: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--surface);
  box-shadow: var(--sh-1); transition: transform var(--t-fast);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* =================================================================
   ETIQUETAS Y AVISOS
   ================================================================= */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .73rem; font-weight: 600; color: var(--text-2);
  transition: border-color var(--t-fast), color var(--t-fast);
}
a.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip-primary { background: rgba(0,168,132,.14); border-color: rgba(0,168,132,.32); color: var(--primary-3); }
.chip-accent  { background: rgba(45,212,191,.12); border-color: rgba(45,212,191,.3);  color: var(--accent); }
.chip-gold    { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.3);  color: var(--gold); }
.chip-green   { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.3);  color: var(--green); }
.chip-red     { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.3); color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px; border-radius: var(--r-sm);
  margin-bottom: 14px; font-size: .87rem;
  border: 1px solid; animation: fade-up .35s var(--e-out);
}
.alert-ok    { background: rgba(52,211,153,.10);  border-color: rgba(52,211,153,.3);  color: #a7f3d0; }
.alert-error { background: rgba(251,113,133,.10); border-color: rgba(251,113,133,.3); color: #fecdd3; }
.alert-info  { background: rgba(45,212,191,.09);  border-color: rgba(45,212,191,.28); color: #99f6e4; }
.alert-warn  { background: rgba(251,146,60,.10);  border-color: rgba(251,146,60,.3);  color: #fed7aa; }

/* Aviso flotante */
.toast {
  position: fixed; z-index: 500; left: 50%; transform: translateX(-50%);
  top: 18px; max-width: min(420px, calc(100vw - 32px));
  padding: 13px 18px; border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--border-2);
  box-shadow: var(--sh-3); font-size: .87rem; font-weight: 550;
  animation: pop-in .3s var(--e-spring);
}

/* =================================================================
   TABLAS
   ================================================================= */

.table-wrap {
  overflow-x: auto; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th {
  text-align: left; padding: 13px 15px;
  background: var(--bg-soft); color: var(--text-3);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; white-space: nowrap;
}
td { padding: 11px 15px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: rgba(0,168,132,.05); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-plain { background: transparent; }
.table-plain td { border-color: var(--border); }

/* =================================================================
   TARJETA DE JUEGO
   ================================================================= */

.game-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: var(--sh-2);
}
.game-thumb { position: relative; aspect-ratio: 4/3; background: var(--bg-soft); overflow: hidden; display: block; }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .55s var(--e-out); }
.game-card:hover .game-thumb img { transform: scale(1.07); }
.game-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.5), transparent 45%);
  opacity: 0; transition: opacity var(--t);
}
.game-card:hover .game-thumb::after { opacity: 1; }

.pill-float {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px; border-radius: var(--r-full);
  background: rgba(0,0,0,.72);
  border: 1px solid rgba(233,237,239,.14);
  font-size: .72rem; font-weight: 700; color: var(--gold);
}
.pill-float.left { left: 10px; right: auto; color: var(--accent); }

.game-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-body h3 { font-size: .94rem; }
.game-body h3 a { color: var(--text); }
.game-card:hover .game-body h3 a { color: var(--primary-2); }
.game-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: .74rem; color: var(--text-3); margin-top: auto;
}
.game-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* Barra de encaje (recomendación grupal) */
.fit-bar { height: 5px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.fit-bar > div {
  height: 100%; border-radius: var(--r-full);
  background: var(--primary);
  transition: width .7s var(--e-out);
}

/* =================================================================
   ESTRELLAS
   ================================================================= */

.stars { display: inline-flex; gap: 1px; font-size: .95rem; color: var(--gold); letter-spacing: 1px; }
.stars .off { color: var(--surface-3); }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label {
  font-size: 1.85rem; line-height: 1; color: var(--surface-3);
  cursor: pointer; margin: 0;
  transition: color var(--t-fast), transform var(--t-fast) var(--e-spring);
}
.star-input input:checked ~ label,
.star-input label:hover, .star-input label:hover ~ label { color: var(--gold); }
.star-input label:hover { transform: scale(1.2) rotate(-6deg); }

/* =================================================================
   ESTADÍSTICAS
   ================================================================= */

.stat {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 17px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform var(--t), border-color var(--t);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-2); }
.stat-ico {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px;
  display: grid; place-items: center; font-size: 1.2rem;
  background: rgba(0,168,132,.14); color: var(--primary-2);
}
.stat b { display: block; font-size: 1.42rem; font-weight: 680; line-height: 1.15; }
.stat span { font-size: .75rem; color: var(--text-3); }

/* Posiciones */
.rank-pos {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 750; font-size: .8rem;
  background: var(--surface-3); color: var(--text-2);
}
.rank-pos.p1 { background: var(--gold);   color: #3d2a04; }
.rank-pos.p2 { background: #b9c6cd; color: #14202a; }
.rank-pos.p3 { background: #a9673a; color: #1c0f06; }

/* =================================================================
   INSIGNIAS
   ================================================================= */

.badge-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-align: center; width: 88px;
}
.badge-img {
  width: 62px; height: 62px; border-radius: 50%;
  object-fit: cover; background: var(--surface-2);
  border: 3px solid var(--gold);
  display: grid; place-items: center; font-size: 1.6rem;
  transition: transform var(--t) var(--e-spring);
}
.badge-item:hover .badge-img { transform: scale(1.1) rotate(-6deg); }
.badge-item small { font-size: .71rem; color: var(--text-2); line-height: 1.25; }

/* =================================================================
   LISTAS / FEED / COMENTARIOS
   ================================================================= */

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-grow { flex: 1; min-width: 0; }
a.row { color: inherit; }
a.row:hover { color: inherit; }
a.row:hover .row-grow b { color: var(--primary-2); }
.row time, .row .meta { font-size: .73rem; color: var(--text-3); display: block; }

.feed-ico {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 12px;
  display: grid; place-items: center; font-size: .95rem;
  background: var(--surface-2);
}

.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-head time { font-size: .72rem; color: var(--text-3); }
.comment-text {
  font-size: .88rem; color: var(--text-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* =================================================================
   MODALES  (hoja inferior en móvil)
   ================================================================= */

.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.66);
  display: none; align-items: center; justify-content: center;
  padding: 18px; overflow-y: auto;
  animation: fade-in .2s var(--e-out);
}
.modal.open { display: flex; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); box-shadow: var(--sh-3);
  width: 100%; max-width: 600px; max-height: 90dvh;
  display: flex; flex-direction: column;
  animation: pop-in .3s var(--e-spring);
}
.modal-box.wide { max-width: 880px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.08rem; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 15px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
.modal-close {
  background: none; border: none; color: var(--text-3);
  font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 2px 6px;
  border-radius: 50%; transition: color var(--t-fast), background var(--t-fast);
}
.modal-close:hover { color: var(--red); background: var(--surface-2); }

/* Resultados de BGG */
.bgg-result {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-soft);
  cursor: pointer; margin-bottom: 8px;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.bgg-result:hover { border-color: var(--primary); background: var(--surface-2); transform: translateX(3px); }
.bgg-result img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; flex: 0 0 46px; background: var(--surface-3); }
.bgg-result-info { flex: 1; min-width: 0; }
.bgg-result-info strong { display: block; font-size: .88rem; }
.bgg-result-info span { font-size: .75rem; color: var(--text-3); }

/* =================================================================
   AUTENTICACIÓN
   ================================================================= */

.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-box {
  width: 100%; max-width: 410px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 34px 30px;
  box-shadow: var(--sh-3);
  animation: pop-in .45s var(--e-spring);
}
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo .orb {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 21px;
  display: grid; place-items: center; font-size: 1.9rem;
  background: var(--primary);
}
.auth-logo h1 { font-size: 1.35rem; }
.auth-logo p { color: var(--text-3); font-size: .84rem; margin-top: 2px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--text-2); }

/* =================================================================
   ESTADOS
   ================================================================= */

.empty-state { text-align: center; padding: 42px 18px; color: var(--text-3); }
.empty-state .ico { font-size: 2.4rem; display: block; margin-bottom: 10px; opacity: .5; }
.empty-state p { font-size: .88rem; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%; display: inline-block;
  border: 2.5px solid var(--surface-3); border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.progress > div {
  height: 100%; border-radius: var(--r-full);
  background: var(--primary);
  transition: width .7s var(--e-out);
}

/* =================================================================
   UTILIDADES
   ================================================================= */

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .82rem; }
.tiny  { font-size: .73rem; }
.center { text-align: center; }
.right  { text-align: right; }
.bold   { font-weight: 650; }
.flex { display: flex; }
.col  { flex-direction: column; }
.between { justify-content: space-between; }
.center-y { align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.gap-4{gap:4px}.gap-6{gap:6px}.gap-8{gap:8px}.gap-10{gap:10px}
.gap-14{gap:14px}.gap-18{gap:18px}.gap-24{gap:24px}
.mt-6{margin-top:6px}.mt-10{margin-top:10px}.mt-14{margin-top:14px}
.mt-18{margin-top:18px}.mt-24{margin-top:24px}
.mb-6{margin-bottom:6px}.mb-10{margin-bottom:10px}.mb-14{margin-bottom:14px}
.mb-18{margin-bottom:18px}.mb-24{margin-bottom:24px}
.w-full { width: 100%; }
.hidden { display: none !important; }
.text-gold{color:var(--gold)} .text-green{color:var(--green)}
.text-red{color:var(--red)} .text-accent{color:var(--accent)}
.text-primary{color:var(--primary-2)}
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.scroll-x { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.scroll-x > * { scroll-snap-align: start; flex: 0 0 auto; }

/* =================================================================
   RESPONSIVE
   ================================================================= */

@media (max-width: 1080px) {
  .split, .split-r { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .content { padding: 20px 18px 40px; }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar  { display: flex; }
  .tabbar  { display: block; }
  .fab     { display: flex; }

  .content {
    padding: 16px 14px calc(var(--tabbar) + 34px + env(safe-area-inset-bottom));
  }

  /* Menú lateral deslizante */
  .drawer {
    position: fixed; inset: 0 auto 0 0; z-index: 100;
    width: min(280px, 84vw);
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 18px 12px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 3px;
    transform: translateX(-100%);
    transition: transform .3s var(--e-out);
  }
  .drawer.open { transform: translateX(0); }
  .drawer-overlay {
    display: block;
    position: fixed; inset: 0; z-index: 95;
    background: rgba(0,0,0,.6);
    opacity: 0; pointer-events: none; transition: opacity var(--t);
  }
  .drawer-overlay.show { opacity: 1; pointer-events: auto; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head > .flex, .page-head > .btn { width: 100%; }
  .page-head .btn { justify-content: center; }

  /* Modal como hoja inferior */
  .modal { align-items: flex-end; padding: 0; }
  .modal-box {
    max-width: 100%; max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: none;
    animation: slide-up .32s var(--e-out);
  }
  .modal-box::before {
    content: ''; display: block;
    width: 38px; height: 4px; border-radius: var(--r-full);
    background: var(--surface-3); margin: 9px auto 0;
  }
  .modal-foot { padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }

  .profile-top { margin-top: -38px; }
  .profile-avatar { width: 88px; height: 88px; }
  .profile-actions { width: 100%; }
  .profile-actions .btn { flex: 1; }
  .profile-stats { gap: 18px; }
}

@media (max-width: 560px) {
  .card { padding: 15px; border-radius: var(--r-sm); }
  .grid { gap: 12px; }
  .cols-4 { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .cols-3 { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .stat { padding: 13px; }
  .stat b { font-size: 1.2rem; }
  .stat-ico { width: 36px; height: 36px; flex-basis: 36px; font-size: 1.05rem; }
  .profile-body { padding: 0 15px 16px; }
  table { font-size: .8rem; }
  th, td { padding: 9px 11px; }
  .auth-box { padding: 26px 20px; }
  .badge-item { width: 74px; }
  .badge-img { width: 54px; height: 54px; }
  .game-body { padding: 11px 12px 13px; }
  .game-body h3 { font-size: .87rem; }
}

/* ---------- Aviso de sin conexion (PWA) ---------- */
.conn-banner {
  position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top));
  transform: translate(-50%, -140%);
  z-index: 200; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-full);
  background: var(--orange); color: #241505;
  font-size: .8rem; font-weight: 650; text-align: center;
  box-shadow: var(--sh-3);
  transition: transform var(--t) var(--e-spring);
  pointer-events: none;
}
.conn-banner.show { transform: translate(-50%, 0); }
