/* Componentes de la web con el sistema de diseño de la app (PIQ-485).
   Cada clase .pique-* es el equivalente de un widget de
   packages/presentation/lib/src/design_system/ y usa solo los tokens de
   tokens.css (generado). Si cambia un widget de la app, se cambia aquí en el
   mismo PR. Reglas de siempre: un solo lima relleno por pantalla (el botón
   principal), lo elegido en lima suave o gris, azul para lo del entrenador,
   cumple / corto / se pasa siempre con texto. */

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.pique {
  margin: 0;
  background: var(--pique-background);
  color: var(--pique-text);
  font-family: var(--pique-font-body);
  font-size: 15px;
  line-height: 1.45;
}
/* :where() deja la especificidad a cero: las clases .pique-* siempre mandan. */
:where(.pique) :where(h1, h2, h3) { margin: 0; font-family: var(--pique-font-display); font-stretch: var(--pique-wide); text-wrap: balance; }
:where(.pique) :where(p) { margin: 0; }
:where(.pique) [hidden] { display: none !important; }
:where(.pique) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.pique) :focus-visible { outline: 2px solid var(--pique-accent-text); outline-offset: 2px; border-radius: 10px; }
.pique-num { font-family: var(--pique-font-display); font-variant-numeric: tabular-nums; font-stretch: var(--pique-semi-wide); }
.pique-muted { color: var(--pique-text-muted); }
.pique-soft { color: var(--pique-text-soft); }

/* Iconos: <svg class="pique-icon"><use href="/piquefit/iconos.svg#i-groups"/></svg>,
   los mismos de PiqueIcons (Material outlined). */
.pique-icon { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; display: inline-block; vertical-align: -0.25em; }

/* --------------------------------------------- botones (FilledButton y cía.) */
.pique-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: var(--pique-radius-button);
  background: var(--pique-accent); color: var(--pique-on-accent);
  font-family: var(--pique-font-body); font-size: 16px; font-weight: 700; text-decoration: none;
  cursor: pointer; transition: filter .15s, transform .1s;
}
.pique-button:hover { filter: brightness(1.06); }
.pique-button:active { transform: scale(.98); }
.pique-button:disabled { background: var(--pique-surface-high); color: var(--pique-text-muted); cursor: default; filter: none; transform: none; }
.pique-button--large { min-height: 56px; font-size: 17px; }
.pique-button--block { width: 100%; }
.pique-button--outline { background: transparent; color: var(--pique-text); border: 1px solid var(--pique-border); }
.pique-button--outline:hover { background: var(--pique-surface-high); filter: none; }
.pique-button--tonal { background: var(--pique-surface-high); color: var(--pique-text); }
.pique-button--tonal:hover { background: var(--pique-surface-higher); filter: none; }
.pique-button--text { background: transparent; color: var(--pique-accent-text); padding: 0 10px; min-height: 44px; font-size: 15px; }
.pique-button--text:hover { background: var(--pique-accent-container); filter: none; }
.pique-button--danger { background: var(--pique-rival); color: var(--pique-on-rival); }
.pique-icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: transparent; color: var(--pique-text); cursor: pointer;
}
.pique-icon-button:hover { background: var(--pique-surface-high); }

/* ---------------------------------------------------- PiqueCard y StatTile */
.pique-card { background: var(--pique-surface); border-radius: var(--pique-radius-card); padding: 16px; min-width: 0; }
a.pique-card, button.pique-card { display: block; color: inherit; text-decoration: none; border: 0; text-align: left; width: 100%; cursor: pointer; }
a.pique-card:hover, button.pique-card:hover { background: var(--pique-surface-high); }
.pique-card--outlined { border: 1px solid var(--pique-line); }
.pique-stat { background: var(--pique-surface); border-radius: 18px; padding: 14px; display: grid; gap: 2px; min-width: 0; }
.pique-stat__value { font-family: var(--pique-font-display); font-weight: 800; font-stretch: var(--pique-wide); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pique-stat__value--accent { color: var(--pique-accent-text); }
.pique-stat__label { color: var(--pique-text-muted); font-size: 14px; }

/* --------------------------------------------------------- PillLabel (tonos) */
.pique-pill {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--pique-surface-high); color: var(--pique-text-soft);
  font-size: 14px; font-weight: 600; line-height: 1.1;
}
.pique-pill--small { padding: 4px 9px; font-size: 12px; }
.pique-pill--accent { background: var(--pique-accent-container); color: var(--pique-accent-text); font-weight: 700; }
.pique-pill--strong { background: var(--pique-accent); color: var(--pique-on-accent); font-weight: 700; }
.pique-pill--mobility { background: var(--pique-mobility-container); color: var(--pique-mobility); font-weight: 700; }
.pique-pill--rival { background: var(--pique-rival-container); color: var(--pique-rival); font-weight: 700; }
.pique-pill--pending { background: var(--pique-pending-container); color: var(--pique-pending); font-weight: 700; }

/* ------------------------------------------- Chips de filtro (ChipThemeData) */
.pique-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pique-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid transparent; cursor: pointer;
  background: var(--pique-surface-high); color: var(--pique-text-soft); font-size: 14px; font-weight: 600;
}
.pique-chip[aria-pressed="true"], .pique-chip.is-selected {
  background: var(--pique-accent-container); color: var(--pique-accent-text); border-color: var(--pique-accent-text); font-weight: 700;
}

/* --------------------------------------------------- PiqueSegmentedControl */
.pique-segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--pique-radius-field); background: var(--pique-surface); }
.pique-segmented > button {
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 11px; cursor: pointer;
  background: transparent; color: var(--pique-text-soft); font-size: 15px; font-weight: 600;
}
.pique-segmented > button[aria-pressed="true"] { background: var(--pique-surface-higher); color: var(--pique-text); }

/* ---------------------------------------------- Campos (InputDecorationTheme) */
.pique-label { display: block; font-size: 13px; font-weight: 700; color: var(--pique-text-soft); margin-bottom: 6px; }
.pique-field {
  width: 100%; min-height: 52px; padding: 14px 16px; border-radius: var(--pique-radius-field);
  background: var(--pique-surface-high); color: var(--pique-text); border: 1px solid var(--pique-border);
  font: 400 16px var(--pique-font-body);
}
.pique-field::placeholder { color: var(--pique-text-muted); }
.pique-field:focus { outline: none; border: 2px solid var(--pique-accent-text); padding: 13px 15px; }
.pique-field--code { font-family: var(--pique-font-display); font-stretch: var(--pique-semi-wide); font-weight: 700; font-size: 28px; letter-spacing: .5em; text-align: center; padding-left: calc(16px + .5em); }
.pique-error { color: var(--pique-rival); font-size: 14px; font-weight: 600; }

/* ------------------------------------------------------------- PiqueAvatar */
.pique-avatar {
  --size: 40px; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; overflow: hidden;
  font-family: var(--pique-font-display); font-weight: 800; font-stretch: var(--pique-semi-wide); font-size: calc(var(--size) * .4);
  background: var(--pique-avatar-4-bg); color: var(--pique-avatar-4-fg);
}
.pique-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pique-avatar--0 { background: var(--pique-avatar-0-bg); color: var(--pique-avatar-0-fg); }
.pique-avatar--1 { background: var(--pique-avatar-1-bg); color: var(--pique-avatar-1-fg); }
.pique-avatar--2 { background: var(--pique-avatar-2-bg); color: var(--pique-avatar-2-fg); }
.pique-avatar--3 { background: var(--pique-avatar-3-bg); color: var(--pique-avatar-3-fg); }
.pique-avatar--4 { background: var(--pique-avatar-4-bg); color: var(--pique-avatar-4-fg); }
.pique-avatar--small { --size: 32px; }
.pique-avatar--large { --size: 56px; }

/* ------------------------------------------- PiqueGroup y PiqueGroupItem */
.pique-group { background: var(--pique-surface); border-radius: var(--pique-radius-card); overflow: hidden; }
.pique-group__item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; color: inherit; text-decoration: none; }
.pique-group__item + .pique-group__item { border-top: 1px solid var(--pique-line); }
a.pique-group__item:hover, button.pique-group__item:hover { background: var(--pique-surface-high); }
.pique-group__text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pique-group__title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pique-group__subtitle { font-size: 13px; color: var(--pique-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------- SectionHeader y PiqueKicker */
.pique-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pique-section-header h2 { font-size: 20px; font-weight: 800; }
.pique-kicker--accent { color: var(--pique-accent-text); }
.pique-kicker--muted { color: var(--pique-text-muted); }
.pique-kicker--coach { color: var(--pique-mobility); }

/* ---------------------------------------------------------- PiqueEmptyState */
.pique-empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 24px; }
.pique-empty .pique-icon { width: 36px; height: 36px; color: var(--pique-accent-text); }
.pique-empty h3 { font-size: 22px; font-weight: 800; }
.pique-empty p { color: var(--pique-text-muted); max-width: 36em; }

/* --------------------------------------------------------- PiqueConfirmDialog */
.pique-dialog { border: 0; padding: 24px; border-radius: var(--pique-radius-dialog); background: var(--pique-surface); color: var(--pique-text); max-width: min(440px, calc(100vw - 32px)); }
.pique-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.pique-dialog h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.pique-dialog p { color: var(--pique-text-soft); }
.pique-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* --------------------------------------------------------------- SnackBar */
.pique-snackbar { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: var(--pique-radius-field);
  background: var(--pique-surface-higher); color: var(--pique-text); font-weight: 500; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); }

/* ---------------------------------------------------- Menú (PopupMenuTheme) */
.pique-menu { background: var(--pique-surface-high); border-radius: var(--pique-radius-button); padding: 6px; min-width: 220px;
  border: 1px solid color-mix(in srgb, var(--pique-text) 12%, transparent); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7); }
.pique-menu > a, .pique-menu > button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--pique-text); font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: left; }
.pique-menu > a:hover, .pique-menu > button:hover { background: var(--pique-surface-higher); }
.pique-menu hr { border: 0; border-top: 1px solid var(--pique-line); margin: 6px 4px; }

/* ------------------------------------------------- PiqueCheckbox con texto */
.pique-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.pique-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--pique-accent); flex: none; }

/* ------------------------------------------------------------ Movimiento
   El de la app (PiqueMotion): 150, 250 y 500 ms, entra frenando y sale
   acelerando, sin rebotes; sus tiempos y curvas están en tokens.css. Lo que depende de qué ha cambiado entre dos
   pintados está en entrenador/movimiento.js. */
@keyframes pique-sube { from { opacity: 0; transform: translateY(12px); } }
@keyframes pique-aparece { from { opacity: 0; } }
@keyframes pique-abre { from { opacity: 0; transform: scale(.96); } }
@keyframes pique-aviso { from { opacity: 0; transform: translate(-50%, 12px); } }
@keyframes pique-dibuja { from { stroke-dashoffset: 1; } }
@keyframes pique-crece { from { transform: scaleY(0); } }
@keyframes pique-realce { from { background-color: var(--pique-accent-container); } }
@media (prefers-reduced-motion: no-preference) {
  .pique-dialog[open] { animation: pique-sube var(--pique-motion-normal) var(--pique-ease-enter); }
  .pique-dialog[open]::backdrop { animation: pique-aparece var(--pique-motion-normal) var(--pique-ease-enter); }
  .pique-menu { animation: pique-abre var(--pique-motion-fast) var(--pique-ease-enter); transform-origin: top right; }
  .pique-snackbar:not([hidden]) { animation: pique-aviso var(--pique-motion-normal) var(--pique-ease-enter); }
  .pique-empty .pique-icon { animation: pique-abre var(--pique-motion-slow) var(--pique-ease-enter); }
  .pique-cargando { animation: pique-aparece var(--pique-motion-fast) var(--pique-ease-enter) 150ms backwards; }
}
/* El selector: la pastilla se desliza hasta la opción elegida. */
.pique-segmented { position: relative; }
.pique-segmented > button { position: relative; z-index: 1; transition: color var(--pique-motion-fast); }
.pique-segmented__pastilla { position: absolute; z-index: 0; border-radius: 11px; background: var(--pique-surface-higher); transform-origin: left center; pointer-events: none; }
.pique-segmented--mueve > button[aria-pressed="true"] { background: transparent; }
/* Lo que carga: la forma de lo que viene, quieta (PiqueLoading). */
.pique-cargando { display: grid; gap: 12px; padding: 4px 0; }
.pique-cargando > i { display: block; border-radius: var(--pique-radius-field); background: var(--pique-surface-high); }
.pique-cargando > i:nth-child(2) { opacity: .7; }
.pique-cargando > i:nth-child(3) { opacity: .45; }
.pique-cargando > i:nth-child(n+4) { opacity: .25; }
.pique-cargando--filas > i { height: 56px; }
.pique-cargando--tarjetas > i { height: 132px; border-radius: var(--pique-radius-card, 20px); }
.pique-cargando--burbujas > i { height: 44px; width: min(60%, 420px); border-radius: 16px; }
.pique-cargando--burbujas > i:nth-child(even) { justify-self: end; width: min(45%, 320px); }
/* La espera con la forma de su página (PIQ-614): las cajas reales de la página
   con «huesos» donde irá el texto. Las formas, en netlify/lib/entrenador/esperas.js.
   Entra tras 150 ms (una carga rápida no la enseña) y, si la espera pasa de un
   segundo, late despacio. Sin estilos en línea: los anchos son clases. */
.pique-espera { grid-column: 1 / -1; min-width: 0; }
.pique-espera .pique-group__item, .pique-espera .ent-tabla__fila { pointer-events: none; }
.pique-hueso { display: block; flex: 0 1 auto; min-width: 0; height: 12px; width: 100%; max-width: 100%; border-radius: 6px; background: var(--pique-surface-high); }
/* Sobre una tarjeta el hueso sube un tono, para que se siga viendo. */
.pique-card .pique-hueso, .pique-group .pique-hueso, .pique-stat .pique-hueso, .pique-espera__sobre .pique-hueso { background: var(--pique-surface-higher); }
.pique-espera__marco { border: 1px solid var(--pique-line); }
.pique-espera__corta { min-height: 44px; justify-content: space-between; }
.pique-hueso--kicker { height: 10px; }
.pique-hueso--titulo { height: 14px; }
.pique-hueso--h2 { height: 20px; border-radius: 8px; }
.pique-hueso--h1 { height: 26px; border-radius: 8px; }
.pique-hueso--cifra { height: 26px; width: 64px; border-radius: 8px; margin-bottom: 8px; }
.pique-hueso--circulo, .pique-hueso--circulo-p, .pique-hueso--circulo-g, .pique-hueso--cuadro, .pique-hueso--cuadro-p, .pique-hueso--icono, .pique-hueso--casilla { flex: none; }
.pique-hueso--circulo { width: 40px; height: 40px; border-radius: 50%; }
.pique-hueso--circulo-p { width: 32px; height: 32px; border-radius: 50%; }
.pique-hueso--circulo-g { width: 56px; height: 56px; border-radius: 50%; }
.pique-hueso--cuadro { width: 40px; height: 40px; border-radius: 12px; }
.pique-hueso--cuadro-p { width: 32px; height: 32px; border-radius: 10px; }
.pique-hueso--icono { width: 20px; height: 20px; border-radius: 6px; }
.pique-hueso--casilla { width: 20px; height: 20px; border-radius: 6px; }
.pique-hueso--pastilla { width: 84px; height: 28px; border-radius: 999px; }
.pique-hueso--pastilla-p { width: 80px; height: 20px; border-radius: 999px; }
.pique-hueso--chip { height: 36px; border-radius: 999px; }
.pique-hueso--boton { height: 48px; border-radius: var(--pique-radius-button); }
.pique-hueso--campo { height: 44px; border-radius: var(--pique-radius-field); }
.pique-hueso--escena { height: 100%; border-radius: 0; }
.pique-hueso--campo-p { height: 40px; border-radius: var(--pique-radius-field); }
.pique-hueso--campo-alto { height: 96px; border-radius: var(--pique-radius-field); }
.pique-hueso--segmentado { height: 48px; border-radius: 14px; }
.pique-hueso--barra { height: 6px; border-radius: 3px; }
.pique-hueso--semana { width: 84px; height: 18px; }
.pique-hueso--tendencia { width: 38px; height: 22px; border-radius: 4px; }
.pique-hueso--foto { height: auto; aspect-ratio: 3 / 4; border-radius: 14px; }
.pique-hueso--dia { width: 180px; height: 12px; margin: 8px auto; }
.pique-hueso--cifras { height: 64px; border-radius: 12px; margin-top: 6px; }
.pique-hueso--celda { width: 60px; height: 38px; border-radius: 10px; }
.pique-hueso--celda-doble { width: 112px; height: 38px; border-radius: 10px; }
.pique-hueso--ancho { width: 100%; }
.pique-hueso--a30 { width: 30%; } .pique-hueso--a40 { width: 40%; } .pique-hueso--a50 { width: 50%; } .pique-hueso--a60 { width: 60%; }
.pique-hueso--a70 { width: 70%; } .pique-hueso--a80 { width: 80%; } .pique-hueso--a90 { width: 90%; }
.pique-hueso--p20 { width: 20px; } .pique-hueso--p40 { width: 40px; } .pique-hueso--p60 { width: 60px; } .pique-hueso--p70 { width: 70px; }
.pique-hueso--p80 { width: 80px; } .pique-hueso--p90 { width: 90px; } .pique-hueso--p100 { width: 100px; } .pique-hueso--p120 { width: 120px; }
.pique-hueso--p140 { width: 140px; } .pique-hueso--p160 { width: 160px; } .pique-hueso--p200 { width: 200px; } .pique-hueso--p220 { width: 220px; }
.pique-hueso--p260 { width: 260px; } .pique-hueso--p280 { width: 280px; } .pique-hueso--p320 { width: 320px; }
/* Cómo se colocan los huesos dentro de una caja. */
.pique-espera__lineas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; align-content: center; justify-items: start; min-width: 0; }
.pique-espera__fila { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pique-espera__fila > .pique-group__text, .pique-espera__crece { flex: 1; min-width: 0; }
.pique-espera__pila { display: grid; gap: 16px; align-content: start; }
.pique-espera__pagina { display: grid; gap: 20px; align-content: start; }
.pique-espera__tarjeta { display: grid; gap: 16px; align-content: start; }
.pique-espera__rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.pique-espera__mengua > :nth-child(2) { opacity: .8; }
.pique-espera__mengua > :nth-child(3) { opacity: .6; }
.pique-espera__mengua > :nth-child(4) { opacity: .42; }
.pique-espera__mengua > :nth-child(n+5) { opacity: .28; }
@keyframes pique-late { to { opacity: .45; } }
@media (prefers-reduced-motion: no-preference) {
  .pique-espera { animation: pique-aparece var(--pique-motion-fast) var(--pique-ease-enter) 150ms backwards, pique-late 1400ms ease-in-out 1s infinite alternate; }
}
.pique-hueso--grafica { height: 140px; border-radius: 12px; }
.pique-espera__renglon { padding: 14px 16px; border-top: 1px solid var(--pique-line); }
.pique-espera__renglon:first-child { border-top: 0; }
