/* ============================================================================
 *  Thrivium — tema visual (negro + violeta, motivo estrella TVT)
 * ========================================================================== */

:root {
  --bg:        #0a0910;
  --bg-2:      #0e0c15;
  --surface:   #14121d;
  --surface-2: #1b1826;
  --line:      #292336;
  --line-soft: #201c2c;

  --brand:      #8b7cf6;  /* violeta principal (idéntico al de los hosts) */
  --brand-2:    #6f52f0;
  --brand-deep: #5a3ee0;
  --brand-soft: #c4b8ff;
  --brand-glow: rgba(139, 124, 246, 0.35);

  --text:   #f3f1fb;
  --muted:  #9a94ac;
  --faint:  #66607a;

  --ok:     #58d38c;
  --warn:   #ffcb52;
  --danger: #f2617a;
  --danger-deep: #c8384f;

  --radius:   14px;
  --radius-s: 9px;
  --shadow:   0 18px 40px -18px rgba(0,0,0,0.8);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 78% -8%, rgba(139,124,246,0.16), transparent 60%),
    radial-gradient(800px 500px at 10% 110%, rgba(90,62,224,0.10), transparent 55%),
    var(--bg);
}

a { color: var(--brand-soft); text-decoration: none; }
a:hover { color: #fff; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; margin: 0; }

::selection { background: var(--brand-glow); color: #fff; }

/* ---- scrollbars ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2438; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3350; }

/* ---- marca / logo ---- */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand .mark { width: 46px; height: 46px; flex: 0 0 46px; object-fit: contain; border-radius: 10px; filter: drop-shadow(0 0 12px var(--brand-glow)); }
.brand .word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #fff;
}
.brand .word b { color: var(--brand); font-weight: 700; }

/* ---- botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease, opacity .15s;
  text-transform: none;
}
.btn:hover { border-color: #3a3350; background: #221d31; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 22px -10px var(--brand-glow);
}
.btn-primary:hover { background: linear-gradient(180deg, #9a8cff 0%, #6a4ee6 100%); }
.btn-danger { background: transparent; border-color: rgba(242,97,122,.4); color: var(--danger); }
.btn-danger:hover { background: rgba(242,97,122,.12); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: #fff; background: var(--surface); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---- pills / badges ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--line);
  color: var(--muted); background: var(--surface);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.live   { color: #cffee0; background: rgba(88,211,140,.10); border-color: rgba(88,211,140,.35); }
.pill.live .dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(88,211,140,.6); animation: pulse 1.8s infinite; }
.pill.offline { color: #b9b3c8; }
.pill.offline .dot { background: #4a4458; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 6px; font-weight: 700; }
.badge.admin { color: var(--brand-soft); background: rgba(139,124,246,.14); }
.badge.vip   { color: var(--warn); background: rgba(255,203,82,.13); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(88,211,140,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(88,211,140,0); }
  100% { box-shadow: 0 0 0 0 rgba(88,211,140,0); }
}

/* ---- cards ---- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

/* ---- inputs ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text);
  font-family: var(--font-body); font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

/* ---- tablas ---- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(139,124,246,.045); }

.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.center { text-align: center; }

/* ---- barra de cupos ---- */
.slots { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.slots > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-deep), var(--brand)); border-radius: 999px; transition: width .4s ease; }

/* ---- toasts ---- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.toast {
  min-width: 240px; max-width: 360px;
  padding: 12px 15px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13.5px; color: var(--text);
  animation: slidein .22s ease;
  border-left: 3px solid var(--brand);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- utilidades ---- */
.row { display: flex; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; align-items: center; }
.grid { display: grid; gap: 16px; }
.split { display: grid; gap: 18px; align-items: start; }
.split.a { grid-template-columns: 1.6fr 1fr; }
.split.b { grid-template-columns: 1fr 340px; }
@media (max-width: 1040px) { .split.a, .split.b { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; align-items: center; gap: 10px; }
.hidden { display: none !important; }
.empty { padding: 34px; text-align: center; color: var(--faint); font-size: 14px; }

/* ============================================================================
 *  Pulido visual + animaciones
 * ========================================================================== */

/* Logo (img con fallback al SVG) */
.logo-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo-fallback { display: block; width: 100%; height: 100%; }
.logo-fallback .mark, .logo-fallback svg { width: 100% !important; height: 100% !important; }

/* Transición al cambiar de vista en el panel */
.route-enter { animation: viewIn .30s cubic-bezier(.22,.61,.36,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Cards interactivas (dashboard y público) que "levantan" al pasar el mouse */
.cards .card, .hosts-grid .card, .host-card {
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.cards .card:hover, .hosts-grid .card:hover {
  transform: translateY(-3px);
  border-color: #33294d;
  box-shadow: 0 22px 46px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(139,124,246,.15);
}

/* Stat cards con acento */
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: linear-gradient(180deg, var(--brand), transparent); opacity: .8; }

/* Brillo que cruza el botón primario al pasar el mouse */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent);
  transform: skewX(-18deg); transition: left .55s ease;
}
.btn-primary:hover::after { left: 130%; }

/* Filas de jugadores / tablas: aparición suave */
tbody tr { transition: background .15s ease; }

/* Chips de jugador (público) con leve realce */
.chip { transition: border-color .15s ease, color .15s ease, transform .12s ease; }
.chip:hover { transform: translateY(-1px); }

/* Toast: barra de tiempo */
.toast { position: relative; overflow: hidden; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; opacity: .25; animation: toastbar 3.4s linear forwards; }
@keyframes toastbar { from { width: 100%; } to { width: 0; } }

/* Halo del hero: leve latido */
.hero .halo, #loginHalo { animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Respeto de accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation: none !important; transition: none !important; }
}

/* ---- Íconos SVG ---- */
.ico { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }
.btn .ico, .badge .ico { vertical-align: -0.16em; }
.badge { display: inline-flex; align-items: center; gap: 4px; }
.nav a .ic { display: inline-flex; align-items: center; justify-content: center; }
.nav a .ic .ico { vertical-align: 0; }
h3.spread .ico { flex: 0 0 auto; }

/* Puntito de estado de host en el nav */
.ndot { width: 9px; height: 9px; border-radius: 50%; background: #4a4458; display: inline-block; }
.ndot.on { background: var(--ok); box-shadow: 0 0 7px rgba(88,211,140,.75); }

/* Buscador con lupa */
.search-wrap { position: relative; }
.search-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-wrap input { padding-left: 38px; }

/* Avatares (Discord) */
.av-img { border-radius: 9px; object-fit: cover; flex: 0 0 auto; display: block; }
.av { border-radius: 9px; background: linear-gradient(180deg, var(--brand), var(--brand-deep)); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 13px; flex: 0 0 auto; }
.who .av-img { width: 36px; height: 36px; }

/* ============================================================================
 *  Identidad Thrivium — acentos por perfil, motivo de cancha, tratamiento VIP
 *  (sistema aditivo: cada contenedor con .acc-* redefine --accent y derivados)
 * ========================================================================== */

/* Acento por defecto (violeta de marca). Cualquier página puede aplicarlo. */
:root {
  --accent: #8b7cf6; --accent-2: #5a3ee0; --accent-soft: #c4b8ff; --accent-glow: rgba(139,124,246,.4);
}
.acc-violet  { --accent:#8b7cf6; --accent-2:#5a3ee0; --accent-soft:#c4b8ff; --accent-glow:rgba(139,124,246,.42); }
.acc-blue    { --accent:#4f9dff; --accent-2:#2f6fe0; --accent-soft:#bcd8ff; --accent-glow:rgba(79,157,255,.42); }
.acc-green   { --accent:#3ecf8e; --accent-2:#1f9e68; --accent-soft:#b5f2d8; --accent-glow:rgba(62,207,142,.42); }
.acc-pink    { --accent:#f2617a; --accent-2:#c8384f; --accent-soft:#ffc2cf; --accent-glow:rgba(242,97,122,.42); }
.acc-orange  { --accent:#ff9f45; --accent-2:#e0730f; --accent-soft:#ffd9b0; --accent-glow:rgba(255,159,69,.42); }
/* Premium (solo VIP) */
.acc-gold    { --accent:#ffce5c; --accent-2:#d99a1f; --accent-soft:#ffe9b0; --accent-glow:rgba(255,203,82,.5); }
.acc-aqua    { --accent:#2dd4bf; --accent-2:#0f9e8e; --accent-soft:#b6f5ec; --accent-glow:rgba(45,212,191,.42); }
.acc-crimson { --accent:#ff4d6d; --accent-2:#c81e42; --accent-soft:#ffc0cc; --accent-glow:rgba(255,77,109,.44); }
.acc-holo    { --accent:#b06bff; --accent-2:#6a4ee6; --accent-soft:#e3d2ff; --accent-glow:rgba(176,107,255,.44); }

/* Motivo de cancha de Haxball: línea central + círculo central, muy sutil.
   Se pone sobre banners / hero para dar identidad sin ruido. */
.pitch {
  position: relative; overflow: hidden;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 52px, color-mix(in srgb, var(--accent) 26%, transparent) 53px, transparent 55px),
    linear-gradient(90deg, transparent calc(50% - 1px), color-mix(in srgb, var(--accent) 20%, transparent) calc(50% - 1px), color-mix(in srgb, var(--accent) 20%, transparent) calc(50% + 1px), transparent calc(50% + 1px));
  background-repeat: no-repeat;
  background-position: center;
}
/* Puntos de esquina/porterías: destello del acento en las esquinas. */
.pitch::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(340px 200px at 100% 0%, var(--accent-glow), transparent 70%),
    radial-gradient(300px 200px at 0% 120%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  opacity: .9;
}

/* Insignia VIP (dorada, con textura). */
.vip-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #2a2000;
  background: linear-gradient(180deg, #ffe487 0%, #f4b53a 55%, #e29a1e 100%);
  box-shadow: 0 4px 14px -4px rgba(255,203,82,.6), inset 0 1px 0 rgba(255,255,255,.5);
}
.vip-badge .ico { color: #6a4a00; }

/* Marco/brillo dorado para el perfil de un VIP. */
.is-vip { position: relative; }
.gold-ring { box-shadow: 0 0 0 2px rgba(255,203,82,.65), 0 0 26px -4px rgba(255,203,82,.5); }
@keyframes shine-sweep { 0% { transform: translateX(-120%) skewX(-18deg); } 100% { transform: translateX(320%) skewX(-18deg); } }
.shine { position: relative; overflow: hidden; }
.shine::after {
  content: ""; position: absolute; top: 0; left: 0; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  animation: shine-sweep 4.5s ease-in-out 1.2s infinite;
}

/* Etiqueta / tag chico reutilizable. */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-soft); padding: 3px 9px; border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ============================================================================
 *  Componentes públicos compartidos (home / host / perfil / comparar)
 *  Las páginas que ya los definían localmente los pisan (mismo valor).
 * ========================================================================== */
.user-chip { display: inline-flex; align-items: center; gap: 9px; padding: 4px 13px 4px 4px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; text-decoration: none; transition: border-color .15s, background .15s; }
.user-chip:hover { border-color: var(--brand); background: var(--surface-2); }
.user-chip .av-img, .user-chip .av { width: 28px; height: 28px; }
.user-chip .nm { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
#session { display: inline-flex; align-items: center; gap: 8px; }

.rank-list { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; transition: background .15s; }
.rank-row:hover { background: rgba(255,255,255,.02); }
.rank-row.vip { background: linear-gradient(90deg, rgba(255,203,82,.10), transparent 70%); }
.rank-list .rank-row:not(:last-child) { border-bottom: 1px solid var(--line-soft); }
.rk-num { font-family: var(--font-display); font-weight: 800; font-size: 17px; width: 40px; height: 40px; flex: 0 0 40px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft); }
.rank-row.top1 .rk-num { background: linear-gradient(180deg,#ffd75e,#d99a1f); color:#3a2a00; border-color: transparent; box-shadow: 0 6px 16px -6px rgba(255,203,82,.6); }
.rank-row.top2 .rk-num { background: linear-gradient(180deg,#e6ebf5,#9aa3b8); color:#22242c; border-color: transparent; }
.rank-row.top3 .rk-num { background: linear-gradient(180deg,#e7a877,#b06a34); color:#2a1400; border-color: transparent; }
.rk-av { width: 38px; height: 38px; border-radius: 11px; }
.rk-av-ph { background: var(--surface-2); border: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: center; color: var(--faint); font-weight: 700; font-size: 15px; }
.rk-main { flex: 1; min-width: 0; }
.rk-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.rk-name a { color: inherit; text-decoration: none; }
.rk-name a:hover { color: var(--brand-soft); }
.rk-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.rk-val { text-align: right; font-family: var(--font-display); }
.rk-val b { font-size: 22px; color: #fff; }
.rk-val .lbl { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.rk-gem { color: var(--warn); display: inline-flex; }

/* Dropdown de resultados de búsqueda */
.results { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin-top: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); display: none; }
.results.open { display: block; }
.res-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; text-decoration: none; color: var(--text); }
.res-item:hover { background: var(--surface-2); }
.res-item .av-img, .res-item .av { width: 26px; height: 26px; }
.res-item .rn { font-weight: 600; font-size: 14px; }

/* Feed de partidos */
.matches { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-soft); }
.m-score { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff; white-space: nowrap; }
.m-score .r { color: #ff8a9e; } .m-score .b { color: #7fbaff; } .m-score .sep { color: var(--faint); margin: 0 4px; }
.m-mid { flex: 1; min-width: 0; }
.m-host { font-size: 13px; color: var(--muted); font-weight: 600; }
.m-scorers { font-size: 12px; color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-scorers a { color: var(--brand-soft); text-decoration: none; }
a.mrow { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
a.mrow:hover { border-color: var(--brand-soft); background: var(--surface-2); transform: translateY(-1px); }
.m-time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---- Responsive global (afecta a todas las páginas por igual) ---- */
img, svg, video { max-width: 100%; }
@media (max-width: 720px) {
  html, body { font-size: 14.5px; }
  .card-pad { padding: 16px; }
  #toasts { right: 10px; left: 10px; bottom: 10px; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 460px) {
  .btn { padding: 9px 13px; }
  .row { gap: 8px; }
}
