/* ---------- Estadísticas de Solo/Dúo y Flexible ---------- */

@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes ring-fill { from { stroke-dashoffset: 100; } }
@keyframes draw-line { from { stroke-dashoffset: 1; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* Las tarjetas de rango del perfil se pueden tocar */
.queue-card { cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s; }
.queue-card:hover { transform: translateY(-2px); border-color: var(--brand-line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); }
.queue-card:active { transform: scale(0.98); }
.queue-card.qs-source { opacity: 0; }
.queue-title-end { display: inline-flex; align-items: center; gap: 8px; }
.queue-hint { display: inline-flex; align-items: center; gap: 4px; color: var(--dim-fg); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; transition: color 0.2s; }
.queue-arrow { display: inline-block; transition: transform 0.2s ease; }
.queue-card:hover .queue-hint, .queue-card:focus-visible .queue-hint { color: var(--brand-light); }
.queue-card:hover .queue-arrow { transform: translateX(3px); }

/* La ventana: tapa la página (no el encabezado) */
body.qs-open { overflow: hidden; }
.qs { position: fixed; inset: var(--qs-top, 0px) 0 0 0; z-index: 18; }
.qs-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 5, 0.66); backdrop-filter: blur(6px); }
.qs-panel {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  transform-origin: 0 0;
}
.qs-ghost { position: fixed; z-index: 40; margin: 0; pointer-events: none; transform-origin: 0 0; }

.qs-bar { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--border); }
.qs-tabs { position: relative; display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); }
.qs-tabs button {
  position: relative;
  z-index: 1;
  padding: 7px 18px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted-fg);
  font: 700 14px var(--font);
  cursor: pointer;
  transition: color 0.25s;
}
.qs-tabs button:hover { color: var(--fg); }
.qs-tabs button[aria-selected='true'] { color: var(--brand-ink); }
.qs-ink {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 8px;
  background: var(--brand);
  box-shadow: 0 0 18px rgba(0, 215, 194, 0.35);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.1, 1), width 0.4s cubic-bezier(0.2, 0.9, 0.1, 1);
}
.qs-who { margin-left: auto; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-who span { color: var(--dim-fg); font-weight: 500; }
.qs-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: none;
  color: var(--muted-fg);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.25s ease;
}
.qs-close:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); transform: rotate(90deg); }
.qs-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.qs-content { padding: 18px; }
.qs-small { font-size: 12px; }

/* Cada parte entra deslizándose, una detrás de otra (--base: espera a que la ventana termine de abrirse) */
@keyframes qs-in { from { opacity: 0.3; transform: translateY(10px); } }
@keyframes qs-in-soft { from { opacity: 0.45; transform: translateY(4px) scale(0.98); } }
/* El encabezado solo se aclara (sin moverse): el emblema que vuela calcula dónde termina */
@keyframes qs-fade-soft { from { opacity: 0.3; } }
.qs-sec { animation: qs-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--base, 0ms) + var(--d, 0) * 50ms); }

.qs-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 14px;
  padding: 18px 26px 18px 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: radial-gradient(560px 240px at 8% 50%, color-mix(in srgb, var(--tier) 22%, transparent), transparent 70%), var(--card-2);
  animation-name: qs-fade-soft;
}
.qs-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.06) 50%, transparent 65%) 0 0 / 250% 100% no-repeat;
  animation: shimmer 1.6s ease 0.5s backwards;
  background-position: -100% 0;
  pointer-events: none;
}
.qs-emblem { display: grid; place-items: center; flex: none; width: 128px; height: 128px; overflow: hidden; }
.qs-emblem-img { width: 128px; height: 128px; object-fit: cover; transform: scale(2.2); }
.qs-crest { width: 76px; height: 76px; opacity: 0.6; }
.qs-hero-main { min-width: 0; }
.qs-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-fg); }
.qs-hero h2 { margin: 2px 0 6px; font-size: 36px; font-weight: 800; line-height: 1.05; }
.qs-lp { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.qs-lp-bar { width: 190px; height: 6px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.qs-lp-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--tier);
  box-shadow: 0 0 12px var(--tier);
  transform-origin: left;
  animation: grow-x 1s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 350ms);
}
.qs-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; margin-top: 12px; }
.qs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  animation: qs-in-soft 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 100ms + var(--i, 0) * 60ms);
}
.qs-chip-crest { width: 20px; height: 20px; }
.qs-hero-wr { margin-left: auto; text-align: right; }
.qs-big { font-size: 42px; font-weight: 700; line-height: 1; margin-bottom: 4px; }

.qs-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.qs-w5 { grid-column: span 5; }
.qs-w7 { grid-column: span 7; }
.qs-w12 { grid-column: 1 / -1; }
.qs-card { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card-2); }
.qs-stack { display: flex; flex-direction: column; gap: 14px; }
.qs-sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-fg);
}
.qs-sec-title .muted { color: var(--dim-fg); letter-spacing: 0.02em; text-transform: none; font-weight: 600; }
.qs-sec-title .mono { font-size: 15px; letter-spacing: 0; }
.qs-empty { text-align: center; padding: 34px 16px; }
.qs-empty p { margin: 6px 0 0; }
.sk {
  display: block;
  height: 10px;
  margin: 3px 0;
  border-radius: 6px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.05) 30%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.05) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-tall { height: 18px; }
.sk-w40 { width: 40%; }
.sk-w50 { width: 50%; }
.sk-w60 { width: 60%; }
.sk-w70 { width: 70%; }
.sk-w80 { width: 80%; }
.sk-w90 { width: 90%; }
.sk-ring { flex: none; width: 116px; height: 116px; margin: 0; border-radius: 50%; }
.sk-square { width: 100%; height: auto; aspect-ratio: 1; margin: 0; border-radius: 8px; }
.sk-chart { height: 190px; margin: 0 0 10px; border-radius: 10px; }
.sk-icon { width: 38px; height: 38px; margin: 0; border-radius: 9px; }
.sk-icon.sk-small { width: 24px; height: 24px; }
.sk-bar { height: 6px; margin: 0; }
.sk-crest { width: 46px; height: 46px; margin: 0 auto 6px; border-radius: 50%; }
.qs-loading .qs-recent-info { flex: 1; }
.qs-loading .qs-tile, .qs-loading .qs-champ, .qs-loading .qs-season, .qs-loading .qs-multi-item { animation: none; }
.qs-loading .qs-season { align-items: stretch; }
.qs-loading .qs-multi-item { align-items: stretch; }
/* Cuando llegan los datos ocupan el lugar del esqueleto: sin volver a aparecer, solo un fundido corto */
.qs-swap { animation: qs-in-soft 0.25s ease backwards; }
.qs-swap .qs-sec, .qs-swap .qs-tile, .qs-swap .qs-champ, .qs-swap .qs-season, .qs-swap .qs-game { animation: none; }
/* Las imágenes tienen fondo mientras bajan */
.qs-game-img, .qs-champ-img { background: rgba(255, 255, 255, 0.06); }

/* Últimas partidas: anillo de victorias y los campeones de cada partida */
.qs-recent-top { display: flex; align-items: center; gap: 18px; }
.qs-ring { position: relative; flex: none; width: 116px; height: 116px; }
.qs-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.qs-ring circle { fill: none; stroke-width: 11; }
.qs-ring-track { stroke: rgba(255, 90, 100, 0.45); }
.qs-ring-fill {
  stroke: var(--brand);
  stroke-dasharray: 100;
  animation: ring-fill 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 250ms);
}
.qs-ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.qs-ring-text b { font: 700 25px var(--mono); }
.qs-ring-text > span { font-size: 11px; color: var(--muted-fg); }
.qs-recent-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qs-wl { font-size: 15px; font-weight: 600; }
.qs-kda { font-size: 19px; font-weight: 700; }
.qs-strip { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; margin-top: 16px; }
.qs-game {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  animation: qs-in-soft 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 120ms + var(--i, 0) * 15ms);
  transition: transform 0.15s ease;
}
.qs-game-img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border: 2px solid; border-radius: 8px; }
.qs-game.win .qs-game-img { border-color: var(--win); }
.qs-game.loss .qs-game-img { border-color: var(--loss); }
.qs-game.remake .qs-game-img { border-color: var(--dim-fg); filter: grayscale(1); opacity: 0.6; }
.qs-game::after { content: ''; position: absolute; left: 30%; right: 30%; bottom: -5px; height: 3px; border-radius: 3px; }
.qs-game.win::after { background: var(--win); }
.qs-game.loss::after { background: var(--loss); }
.qs-game:hover { z-index: 1; transform: translateY(-3px) scale(1.08); }

/* Gráfico */
.qs-trend { display: flex; flex-direction: column; }
.qs-trend p { margin: 8px 0 0; }
.qs-chart { display: block; width: 100%; height: auto; overflow: visible; }
.qs-zero { stroke: rgba(255, 255, 255, 0.14); stroke-dasharray: 4 6; }
.qs-line {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 1;
  animation: draw-line 1.4s cubic-bezier(0.45, 0, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 320ms);
}
.qs-area { animation: fade-in 0.9s ease backwards; animation-delay: calc(var(--base, 0ms) + 900ms); }
.qs-dot {
  stroke: var(--card-2);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 380ms + var(--i, 0) * 60ms);
  transition: transform 0.15s;
}
.qs-dot:hover { transform: scale(1.5); }
.qs-dot.win { fill: var(--win); }
.qs-dot.loss { fill: var(--loss); }

/* Gráfico de LP (como el de OP.GG) */
.qs-lp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.qs-lp-head > b { font-size: 15px; }
.qs-lp-now { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.qs-lp-now b { text-transform: uppercase; letter-spacing: 0.02em; }
.qs-lp-now .mono { color: var(--muted-fg); font-weight: 600; }
.qs-lp-now-crest { width: 26px; height: 26px; }
.qs-lpchart { position: relative; cursor: crosshair; }
.qs-lpchart[data-match] { cursor: pointer; }
.qs-lp-tier { stroke-width: 1.5; stroke-dasharray: 8 6; opacity: 0.8; }
.qs-lp-div { stroke-width: 1; stroke-dasharray: 2 5; opacity: 0.4; }
.qs-lp-label { font: 600 11px var(--mono); opacity: 0.75; }
.qs-lp-line {
  fill: none;
  stroke: #5b8def;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  filter: drop-shadow(0 0 6px rgba(91, 141, 239, 0.5));
  animation: draw-line 1.6s cubic-bezier(0.45, 0, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 320ms);
}
.qs-lp-area { animation: fade-in 0.9s ease backwards; animation-delay: calc(var(--base, 0ms) + 1100ms); }
.qs-lp-real {
  fill: #fff;
  stroke: #5b8def;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 1500ms);
}
.qs-lp-guide { stroke: rgba(255, 255, 255, 0.3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity 0.15s; }
.qs-lp-cursor { fill: #5b8def; stroke: #fff; stroke-width: 2; opacity: 0; transition: opacity 0.15s; }
.qs-lpchart.hover .qs-lp-guide, .qs-lpchart.hover .qs-lp-cursor { opacity: 1; }
.qs-lp-tip {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px 8px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(18, 18, 18, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}
.qs-lp-tip[hidden] { display: none; }
.qs-lp-tip-champ { width: 34px; height: 34px; border-radius: 8px; }

/* Promedios */
.qs-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.qs-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  animation: qs-in-soft 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 120ms + var(--i, 0) * 20ms);
  transition: border-color 0.2s, transform 0.2s ease;
}
.qs-tile:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.qs-tile-label { font-size: 12px; color: var(--muted-fg); }
.qs-tile-value { font: 700 23px var(--mono); }
.qs-tile-sub { font-size: 12px; color: var(--dim-fg); }

/* Campeones y líneas */
.qs-champs { display: flex; flex-direction: column; gap: 2px; }
.qs-champ {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(110px, 160px) 86px 84px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  animation: qs-in-soft 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 150ms + var(--i, 0) * 25ms);
  transition: background 0.15s, transform 0.15s ease;
}
.qs-champ:hover { background: rgba(255, 255, 255, 0.04); transform: translateX(3px); }
.qs-champ-img { width: 38px; height: 38px; border-radius: 9px; }
.qs-champ-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.qs-champ-name b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.qs-champ-name span, .qs-champ-kda, .qs-champ-cs { font-size: 12px; }
.qs-champ-wr { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.qs-champ-kda, .qs-champ-cs { text-align: right; }
.qs-meter { flex: 1; height: 6px; overflow: hidden; border-radius: 99px; background: rgba(255, 90, 100, 0.3); }
.qs-meter span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--brand);
  transform-origin: left;
  animation: grow-x 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 480ms + var(--i, 0) * 45ms);
}
.qs-meter.share { background: rgba(255, 255, 255, 0.07); }
.qs-meter.share span { background: var(--brand-light); }
.qs-roles { display: flex; flex-direction: column; gap: 10px; }
.qs-role { display: grid; grid-template-columns: 26px 96px minmax(0, 1fr) 40px; align-items: center; gap: 10px; font-size: 13px; }
.qs-role img { width: 24px; height: 24px; opacity: 0.9; }
.qs-role-name { display: flex; flex-direction: column; line-height: 1.2; }
.qs-role-name span { font-size: 11px; }
.qs-role > .mono { text-align: right; }

.qs-multi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qs-multi-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.qs-multi-item b { font-size: 21px; }
.qs-multi-item > span { font-size: 11px; color: var(--muted-fg); }
.qs-multi-item.zero { opacity: 0.4; }
.qs-multi-item.triple:not(.zero) { color: var(--rare); }
.qs-multi-item.quadra:not(.zero) { color: var(--epic); border-color: rgba(180, 100, 255, 0.4); }
.qs-multi-item.penta:not(.zero) { color: var(--legendary); border-color: rgba(255, 128, 0, 0.45); background: rgba(255, 128, 0, 0.08); box-shadow: 0 0 18px rgba(255, 128, 0, 0.15); }

.qs-best { display: block; width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s, transform 0.2s ease; }
.qs-best:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.qs-best-row { display: flex; align-items: center; gap: 12px; }
.qs-go { margin-left: auto; color: var(--brand-light); font-size: 18px; transition: transform 0.2s ease; }
.qs-best:hover .qs-go { transform: translateX(4px); }

/* Temporadas */
.qs-seasons { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.qs-season {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: radial-gradient(130px 80px at 50% 0%, color-mix(in srgb, var(--tier) 18%, transparent), transparent), rgba(255, 255, 255, 0.02);
  text-align: center;
  animation: qs-in-soft 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--base, 0ms) + 180ms + var(--i, 0) * 30ms);
  transition: transform 0.2s ease, border-color 0.2s;
}
.qs-season:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tier) 55%, transparent); }
.qs-season.now { border-color: var(--brand-line); }
.qs-season-crest { width: 46px; height: 46px; margin-bottom: 4px; }
.qs-season-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-fg); }
.qs-now { padding: 1px 6px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-light); letter-spacing: 0.02em; }
.qs-season b { font-size: 15px; }
.qs-season-peak { margin-top: 4px; font-size: 11px; color: var(--dim-fg); }

@media (max-width: 860px) {
  .qs-w5, .qs-w7 { grid-column: 1 / -1; }
  .qs-hero { flex-wrap: wrap; gap: 14px; }
  .qs-hero-wr { margin-left: 0; text-align: left; }
  .qs-emblem, .qs-emblem-img { width: 96px; height: 96px; }
  .qs-hero h2 { font-size: 28px; }
  .qs-who { display: none; }
  .qs-close { margin-left: auto; }
  .qs-champ { grid-template-columns: 38px minmax(0, 1fr) minmax(90px, 1fr); }
  .qs-champ-kda, .qs-champ-cs { display: none; }
}
