/* ============================================================
   GALERÍA DE LOS SANTOS
   Sistema visual alineado con Wikitólica: papel claro, tinta marrón,
   acento cuero, tipografía del sistema y prosa con serif.
   ============================================================ */

:root {
  /* Tokens de Wikitólica */
  --paper: #fefdfa;
  --surface: #ffffff;
  --surface-2: #f8f5f0;
  --ink: #2b2118;
  --ink-2: #524639;
  --ink-3: #6e6152;
  --line: #e9e1d4;
  --line-strong: #dbd0c0;
  --accent: #8a4b1c;
  --accent-strong: #6a3812;
  --tint: #fbf7f1;
  --tint-2: #f3e9dc;
  --accent-line: #e2cfb6;
  --mark: #f5e6d0;
  --danger: #b3261e;

  --font-serif: "Iowan Old Style", "Sitka Text", Charter, "Bitstream Charter", Cambria, "Noto Serif", "Droid Serif", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --shadow-sm: 0 1px 2px rgba(43, 33, 24, 0.06), 0 1px 3px rgba(43, 33, 24, 0.06);
  --shadow: 0 8px 28px rgba(43, 33, 24, 0.14), 0 2px 6px rgba(43, 33, 24, 0.06);
  --dur: 0.2s;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --wide: 1320px;
  --top-h: 66px;

  /* Rarezas: pigmentos legibles sobre papel */
  --r0: #8c7a64;
  --r1: #2f7d6b;
  --r2: #3556a8;
  --r3: #b8860b;
  --r4: #b3261e;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
/* Con un diálogo abierto, el fondo no se desplaza ni enseña su barra */
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
[hidden] { display: none !important; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a:focus-visible { border-radius: 4px; }

/* ---------- Cabecera ---------- */

/* Fija en escritorio: la columna de la vitrina y las pestañas se pegan debajo */
.top { position: sticky; top: 0; z-index: 8; height: var(--top-h); border-bottom: 1px solid var(--line); background: rgba(254, 253, 250, 0.96); backdrop-filter: blur(8px); }
.top__inner {
  max-width: var(--wide);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.brand__mark { width: 32px; height: 41px; flex: none; color: var(--accent); }
.brand__text { min-width: 0; }
.brand__name { display: block; margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; color: var(--ink); white-space: nowrap; }
.brand__sub { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.top__meta { display: flex; align-items: center; gap: 0.5rem; flex: none; }
/* Volver a la portada de Wikitólica: siempre visible (en móvil, solo la flecha) */
.chip--back { background: transparent; color: var(--ink-2); padding-inline: 0.55rem 0.8rem; gap: 0.25rem; text-decoration: none; }
.chip--back svg { width: 16px; height: 16px; }
a.chip--back:hover { background: var(--surface-2); color: var(--accent); }
.noscript { max-width: 640px; margin: 2rem auto; padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); font-family: var(--font-serif); line-height: 1.6; color: var(--ink-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 34px;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 0;
  background: var(--tint-2);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 650;
  white-space: nowrap;
}
button.chip:hover { background: var(--mark); }
.chip svg { width: 16px; height: 16px; }
.chip--quiet { background: var(--surface-2); color: var(--ink-2); }

.iconbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: background-color var(--dur), border-color var(--dur);
}
.iconbtn:hover { background: var(--tint); border-color: var(--accent-line); }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- Estructura ---------- */

.layout {
  max-width: var(--wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 1.5rem;
  --pad: 1.25rem;
  padding: var(--pad);
  align-items: start;
}
body.is-solo .layout { grid-template-columns: minmax(0, 460px); justify-content: center; align-content: center; min-height: calc(100dvh - var(--top-h)); }
body.is-solo .niche { height: clamp(240px, 42vh, 380px); }
body.is-solo .counter__value { font-size: clamp(2.8rem, 2rem + 3vh, 4rem); }

/* Transición al abrir la galería: cada pieza viaja a su nueva posición */
.showcase { view-transition-name: showcase; }
#task { view-transition-name: task; }
#wing { view-transition-name: wing; }
::view-transition-group(*) { animation-duration: 0.55s; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
::view-transition-new(wing) { animation: wingIn 0.6s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both; }
::view-transition-old(wing) { display: none; }

/* ---------- Columna de la vitrina ---------- */

/* Si no cabe, se desplaza por dentro con una barra fina, independiente del panel derecho */
.stage {
  overscroll-behavior: contain;
  position: sticky;
  /* Mismo margen que la página: así no se mueve ni un píxel al desplazar el panel derecho (arriba ni abajo) */
  top: calc(var(--top-h) + var(--pad));
  max-height: calc(100dvh - var(--top-h) - 2 * var(--pad));
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  display: grid;
  gap: 0.75rem;
  align-content: start;
}
.stage:hover { scrollbar-color: var(--line-strong) transparent; }

.showcase {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 1rem 1.1rem 1.1rem;
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.counter { text-align: center; display: grid; justify-items: center; gap: 0.15rem; }
.counter__value { font-size: clamp(2.2rem, 1.2rem + 3.2vh, 3.4rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1; color: var(--ink); }
.counter__unit { font-size: 0.8125rem; color: var(--ink-3); }
.counter__rate { margin-top: 0.35rem; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--tint-2); color: var(--accent); font-size: 0.8125rem; font-weight: 650; }

/* Hornacina con el busto */
.niche {
  position: relative;
  width: min(100%, 290px);
  height: clamp(150px, 25vh, 290px);
  border-radius: 999px 999px var(--radius-lg) var(--radius-lg);
  background:
    radial-gradient(70% 55% at 50% 30%, #fff8ec 0%, rgba(255, 248, 236, 0) 70%),
    linear-gradient(180deg, #f1e4d1 0%, #e6d3ba 100%);
  box-shadow: inset 0 0 0 1px var(--accent-line), inset 0 -30px 40px -20px rgba(106, 56, 18, 0.18);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 5%;
}
.niche::before {
  content: '';
  position: absolute;
  inset: 8px 8px auto;
  height: 52%;
  border-radius: 999px 999px 0 0;
  border: 1px solid rgba(138, 75, 28, 0.18);
  border-bottom: 0;
  pointer-events: none;
}
.bust {
  position: relative;
  height: 86%;
  width: auto;
  aspect-ratio: 200 / 250;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 45% 45% 6px 6px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.08s ease-out, filter var(--dur);
}
.bust__art { width: 100%; height: 100%; filter: drop-shadow(0 10px 12px rgba(60, 35, 15, 0.28)); }
.bust:hover { filter: brightness(1.03); }
.bust.is-pressed { transform: scale(0.965) translateY(2px); }
.bust[disabled] { cursor: not-allowed; filter: grayscale(0.6) brightness(0.55); }
.bust:focus-visible { outline-offset: 4px; }

.hint { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: 0.95rem; color: var(--ink-3); text-align: center; text-wrap: balance; }
.hint { min-height: 1.45em; }
/* Bonificación activa: flota sobre la hornacina para no mover nada al aparecer o desaparecer */
.boost { position: absolute; z-index: 5; top: 7%; left: 50%; translate: -50% 0; margin: 0; display: grid; justify-items: center; gap: 3px; pointer-events: none; }
.boost small { font-size: inherit; }
.boost span { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.6875rem; font-weight: 700; line-height: 1.35; white-space: nowrap; box-shadow: 0 3px 8px -3px rgba(179, 38, 30, 0.6); }

.floaters { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.floater {
  position: absolute;
  font-weight: 750;
  font-size: 1.05rem;
  color: var(--accent);
  translate: -50% -50%;
  animation: floatUp 0.9s var(--ease-out) forwards;
  white-space: nowrap;
  text-shadow: 0 1px 0 #fff, 0 0 6px #fff;
}
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(var(--rise, -64px)); } }

/* Visitante ilustre: siempre dentro de la hornacina */
.visitor-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.visitor {
  position: absolute;
  width: 58px; height: 58px;
  translate: -50% -50%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  pointer-events: auto;
  filter: drop-shadow(0 6px 10px rgba(60, 35, 15, 0.3));
  animation: visitorIn 0.5s var(--ease-out), bob 2.6s ease-in-out 0.5s infinite;
}
.visitor svg { width: 100%; height: 100%; overflow: visible; }
.visitor__tag { position: absolute; top: calc(100% + 4px); left: 50%; translate: -50% 0; padding: 0.05rem 0.45rem; border-radius: 999px; background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm); color: var(--accent-strong); font-size: 0.6875rem; font-weight: 700; white-space: nowrap; pointer-events: none; }
.visitor:hover { scale: 1.07; }
.visitor__ring { transition: stroke-dashoffset 0.25s linear; }
@keyframes visitorIn { from { opacity: 0; scale: 0.5; } to { opacity: 1; scale: 1; } }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* Tarjetas de la columna */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 0.9rem 1rem; }
.task__head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.2rem; }
.task__label { font-size: 0.8125rem; font-weight: 650; color: var(--accent); }
.task__num { font-size: 0.75rem; color: var(--ink-3); }
.task__text { margin: 0 0 0.55rem; font-size: 1rem; font-weight: 650; line-height: 1.3; text-wrap: balance; }
.task__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.5rem; min-height: 34px; }
.task__reward { font-size: 0.8125rem; color: var(--ink-3); }
.task.is-done { border-color: var(--accent); background: var(--tint); }

.hito__row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.45rem; font-size: 0.8125rem; }
.hito__label { color: var(--ink-3); }
.hito__value { font-weight: 650; color: var(--ink-2); }

.bar { height: 6px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.bar--thin { height: 4px; }
.bar__fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.25s linear; }

/* ---------- Ala derecha: pestañas y panel ---------- */

.wing { min-width: 0; }
.wing.is-opening { animation: wingIn 0.6s var(--ease-out); }
@keyframes wingIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tabs {
  position: sticky;
  top: var(--top-h);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem 0 0.75rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur);
}
.tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { background: var(--tint-2); color: var(--accent); }
.tab[aria-selected='true'] { background: var(--accent); color: #fff; }
.tab__dot { position: absolute; top: 5px; left: calc(0.95rem + 14px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--paper); }
.tab[aria-selected='true'] .tab__dot { box-shadow: 0 0 0 2px var(--accent); }
.tab[aria-selected='true'] .tab__count { box-shadow: 0 0 0 2px var(--accent); }
/* Con una sola sección no hace falta barra de pestañas */
.tabs:has(> .tab:only-child) { display: none; }
.tab__count { position: absolute; top: 0; left: calc(0.95rem + 3px); min-width: 18px; height: 18px; padding: 0 5px; box-shadow: 0 0 0 2px var(--paper); border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.6875rem; font-weight: 750; display: inline-grid; place-items: center; }

.panel { padding: 1.25rem 0 3rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-content: start; }
.panel > section { min-width: 0; }
.panel:focus { outline: none; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; margin: 0 0 0.85rem; }
.section-head h2 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.section-head p { margin: 0; color: var(--ink-3); font-size: 0.875rem; }
.lede { margin: -0.35rem 0 1rem; max-width: 62ch; font-family: var(--font-serif); font-size: 1.0625rem; line-height: 1.6; color: var(--ink-2); }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 0.9375rem;
  line-height: 1.1;
  text-decoration: none;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur), transform 0.08s;
}
.btn:active:not([disabled]) { transform: translateY(1px); }
/* Al quedarse sin renombre el botón se apaga despacio y con un pequeño retraso:
   al comprar rápido el bajón es momentáneo y no da tiempo a que parpadee a blanco.
   Al volver a estar disponible recupera el color enseguida. */
.btn[disabled] {
  cursor: not-allowed;
  transition: background-color 0.5s ease 0.12s, border-color 0.5s ease 0.12s, color 0.5s ease 0.12s, transform 0.08s;
}
.btn--small { min-height: 34px; padding: 0.3rem 0.85rem; font-size: 0.875rem; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not([disabled]) { background: var(--accent-strong); color: #fff; }
.btn--primary[disabled] { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }
.btn--soft { background: var(--tint-2); color: var(--accent); }
.btn--soft:hover:not([disabled]) { background: var(--mark); }
.btn--soft[disabled] { background: var(--surface-2); color: var(--ink-3); }
.btn--ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn--ghost:hover:not([disabled]) { border-color: var(--accent-line); background: var(--tint); }
.btn--danger { background: var(--surface); color: var(--danger); border-color: #ecc9c4; }
.btn--danger:hover { background: #fdf1ef; }
.btn--gold { background: linear-gradient(180deg, #f2d98b, #d4a840); color: #3d2a08; border-color: #b8860b; }
.btn--gold:hover:not([disabled]) { background: linear-gradient(180deg, #f7e3a3, #ddb350); }
.btn--gold[disabled] { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 0.25rem 0.8rem; min-height: 30px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- Mejoras ---------- */

.section-note { color: var(--ink-3); font-size: 0.875rem; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.upgrades { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 0.5rem; }
.upgrade {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  padding: 0.55rem 0.75rem 0.55rem 0.55rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--dur), background-color var(--dur), transform 0.12s var(--ease-out), box-shadow var(--dur);
}
.upgrade__icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }
.upgrade--click .upgrade__icon { color: #2f7d6b; }
.upgrade--global .upgrade__icon { color: #b8860b; }
.upgrade--album .upgrade__icon { color: #3556a8; }
.upgrade--visit .upgrade__icon { color: #b3261e; }
.upgrade__body { min-width: 0; display: grid; }
.upgrade__name { font-weight: 650; font-size: 0.875rem; line-height: 1.2; text-wrap: balance; }
.upgrade__desc { font-size: 0.75rem; color: var(--ink-3); line-height: 1.3; }
.upgrade__cost { font-weight: 700; font-size: 0.8125rem; color: var(--ink-3); padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.upgrade.is-ready { border-color: var(--accent-line); background: var(--tint); }
.upgrade.is-ready .upgrade__icon { background: var(--surface); box-shadow: var(--shadow-sm); }
.upgrade.is-ready .upgrade__cost { background: var(--accent); color: #fff; }
.upgrade__cost.is-soon { background: var(--tint-2); color: var(--accent); }
.upgrade:not(.is-ready) { cursor: default; }
.upgrade:not(.is-ready) .upgrade__name { color: var(--ink-2); }

/* ---------- Salas ---------- */

.salas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 236px), 1fr)); gap: 0.75rem; }
.sala {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.55rem;
  padding: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.sala__head { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; }
.sala__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--tint-2); color: var(--accent); }
.sala__icon .ico { width: 24px; height: 24px; }
.sala__titles { min-width: 0; display: grid; justify-items: start; gap: 0.2rem; }
.sala__name { margin: 0; font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 0.5rem; border-radius: 999px; background: var(--tint-2); color: var(--accent); font-size: 0.6875rem; font-weight: 700; white-space: nowrap; }
.sala__count { font-size: 2rem; font-weight: 750; letter-spacing: -0.045em; line-height: 1; min-width: 2ch; text-align: right; }
.sala__meta { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-size: 0.875rem; color: var(--ink-2); font-weight: 600; min-height: 1.3em; }
.sala__meta > span:first-child:not(.sala__flavor) { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sala__meta:has(.sala__flavor) { flex-wrap: wrap; gap: 0.15rem 0.5rem; }
.sala__share { flex: none; margin-left: auto; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.sala__flavor { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--ink-3); }
.sala__ms { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.6rem; font-size: 0.75rem; color: var(--ink-3); }
.sala__ms .bar { height: 5px; }
.sala__buy { align-self: end; justify-content: space-between; width: 100%; min-height: 42px; border-radius: var(--radius-lg); padding-inline: 0.9rem; }
.sala__buy { white-space: nowrap; }
.sala__buy b { font-weight: 750; }
/* Apagado en tono cálido en vez de casi blanco: el salto desde el marrón es más suave */
.sala__buy.btn--primary[disabled] { background: var(--tint-2); color: var(--ink-3); border-color: var(--accent-line); }
.sala__yield { color: var(--accent); font-weight: 650; }
.sala__price { display: inline-flex; align-items: baseline; gap: 0.5rem; }
.sala__eta { font-size: 0.75rem; font-weight: 600; opacity: 0.85; }
.sala__eta:empty { display: none; }
.sala--next { background: var(--surface-2); border-style: dashed; border-color: var(--line-strong); }
.sala--next .sala__icon { background: var(--surface); color: var(--ink-3); }
.sala--next .sala__count { color: var(--line-strong); }
.sala.is-bought { animation: bought 0.35s var(--ease-out); }
@keyframes bought { 40% { box-shadow: 0 0 0 3px var(--accent-line); } }
.sala--locked {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px dashed var(--line-strong);
  background: transparent;
  font-weight: 650;
  color: var(--ink-3);
  min-height: 110px;
}
.sala--locked .sala__icon { background: var(--surface-2); color: var(--line-strong); }
.sala--locked small { display: block; font-weight: 500; font-size: 0.8125rem; margin-top: 2px; }

.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; min-height: 34px; }
.toggle-line { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.875rem; color: var(--ink-2); }
.toggle-line input { accent-color: var(--accent); width: 17px; height: 17px; }

/* ---------- Álbum ---------- */

.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 0.75rem; }
.pack { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); }
.pack--gold { background: linear-gradient(135deg, #fffaf0, #fbefd2); border-color: #ead39a; }
.pack__art { width: 84px; height: 64px; }
.pack__art.is-full { animation: nudge 3s ease-in-out infinite; }
@keyframes nudge { 0%, 84%, 100% { transform: none; } 88% { transform: rotate(-5deg); } 92% { transform: rotate(4deg); } 96% { transform: rotate(-2deg); } }
.pack h3 { margin: 0; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.pack p { margin: 0.15rem 0 0.65rem; min-height: 2.8em; color: var(--ink-3); font-size: 0.8125rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pack__btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.pedestals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 0.6rem; }
.pedestal { display: grid; grid-template-columns: 50px 1fr; gap: 0.7rem; align-items: center; padding: 0.6rem; text-align: left; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); min-height: 82px; transition: border-color var(--dur); }
.pedestal:hover { border-color: var(--accent-line); }
.pedestal .frame { width: 50px; }
.pedestal__name { display: block; font-weight: 650; font-size: 0.875rem; line-height: 1.2; }
.pedestal__fx { display: block; font-size: 0.75rem; color: var(--accent); margin-top: 3px; font-weight: 600; }
.pedestal__share { display: block; margin-top: 2px; font-size: 0.6875rem; color: var(--ink-3); }
.pedestal__fx.is-off { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.notice { margin: 0; padding: 0.75rem 1rem; border-radius: var(--radius-lg); background: #fdf1ef; border: 1px solid #ecc9c4; color: var(--ink-2); font-size: 0.875rem; line-height: 1.45; }
.notice b { color: var(--danger); }
.pedestal--empty { grid-template-columns: 1fr; text-align: center; color: var(--ink-3); font-size: 0.8125rem; border-style: dashed; border-color: var(--line-strong); background: transparent; }

.steps { display: flex; gap: 4px; }
.steps i { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.steps i.is-on { background: var(--accent); box-shadow: none; }
.steps i.is-part { background: linear-gradient(90deg, var(--accent-line) var(--p, 0%), var(--surface-2) var(--p, 0%)); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stat { padding: 0.25rem 1rem 0.25rem 0; border-right: 1px solid var(--line); margin-right: 1rem; }
.stat:last-child { border-right: 0; }
.stat__value { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; }
.stat__label { font-size: 0.8125rem; color: var(--ink-3); }
.odds { margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.odds span { font-size: 0.75rem; font-weight: 650; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.odds span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.35rem; background: var(--rc); }
.note { margin: 0.6rem 0 0; font-size: 0.8125rem; color: var(--ink-3); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.filters select, .filters input[type='search'] { min-height: 40px; padding: 0.35rem 0.75rem; border-radius: var(--radius-lg); border: 1px solid var(--accent-line); background: var(--surface); color: var(--ink); font-size: 0.9375rem; }
.filters input[type='search'] { flex: 1 1 180px; }

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 1.1rem 0.75rem; }
.piece { display: grid; gap: 0.5rem; align-content: start; padding: 0; border: 0; background: none; text-align: center; content-visibility: auto; contain-intrinsic-size: 92px 165px; }
.piece__name { font-size: 0.75rem; font-weight: 600; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; hyphens: auto; }
.piece__tag { font-size: 0.6875rem; font-weight: 700; color: var(--danger); }
.piece:hover .frame { transform: translateY(-3px); }
.piece--empty { cursor: default; }
.piece--empty .piece__name { color: var(--ink-3); font-weight: 500; }
.piece--empty:hover .frame { transform: none; }

/* Marcos: material según la rareza */
.frame {
  --rc: var(--r0);
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  padding: 5px;
  border-radius: 3px;
  background: linear-gradient(145deg, #a98463, #6b4a30 55%, #8d6847);
  box-shadow: 0 5px 12px -6px rgba(43, 33, 24, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s var(--ease-out);
}
.frame > svg { width: 100%; height: 100%; border-radius: 1px; box-shadow: 0 0 0 1px #e9cf86, 0 0 0 2px rgba(0, 0, 0, 0.25); }
.frame[data-r='1'] { --rc: var(--r1); background: linear-gradient(145deg, #6fae9b, #2f6b5c 55%, #4f8f7d); }
.frame[data-r='2'] { --rc: var(--r2); background: linear-gradient(145deg, #6f8ad6, #2b4690 55%, #4d68b5); }
.frame[data-r='3'] { --rc: var(--r3); background: linear-gradient(145deg, #f6e19a, #b8860b 45%, #e9c766 70%, #9c7008); }
.frame[data-r='4'] { --rc: var(--r4); background: linear-gradient(145deg, #e8735e, #8e1d16 50%, #c9422f); box-shadow: 0 5px 12px -6px rgba(43, 33, 24, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 0 0 3px #e9cf86; }
.frame--empty { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font-size: 0.875rem; font-weight: 650; color: var(--line-strong); }
.frame__stars { position: absolute; left: 50%; bottom: -8px; translate: -50% 0; padding: 1px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: #b8860b; font-size: 0.625rem; line-height: 1.3; letter-spacing: 0.04em; white-space: nowrap; }
.frame__ped { position: absolute; z-index: 1; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(43, 33, 24, 0.35); }
.frame__ped svg { width: 12px; height: 12px; fill: currentColor; }
.load-more { justify-self: center; margin-top: 1rem; }

/* ---------- Distinciones ---------- */

.logro-groups { display: grid; gap: 1.5rem; }
.logro-group h3 { margin: 0 0 0.6rem; font-size: 1rem; font-weight: 700; display: flex; gap: 0.5rem; align-items: baseline; }
.logro-group h3 small { font-weight: 500; color: var(--ink-3); font-size: 0.8125rem; }
.logros { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.5rem; }
.logro { display: grid; grid-template-columns: 34px 1fr; gap: 0.65rem; align-items: center; padding: 0.6rem 0.75rem; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.logro__icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--line-strong); }
.logro__icon svg { width: 18px; height: 18px; }
.logro.is-on .logro__icon { background: var(--accent); color: #fff; }
.logro__text { display: grid; gap: 1px; min-width: 0; }
.logro__name { font-weight: 650; font-size: 0.875rem; line-height: 1.2; }
.logro__prog { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; margin-top: 0.3rem; }
.logro__val { font-size: 0.6875rem; color: var(--ink-3); white-space: nowrap; }
.logro__desc { font-size: 0.75rem; color: var(--ink-3); line-height: 1.3; }
.logro:not(.is-on) .logro__name { color: var(--ink-3); }
.logro.is-ready .logro__name { color: var(--ink); }
button.logro { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: border-color var(--dur), box-shadow var(--dur), transform 0.08s; }
.logro.is-ready { border-color: var(--accent); background: var(--tint); }
.logro.is-ready .logro__icon { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-line); animation: logroGlow 2.4s ease-in-out infinite; }
button.logro:hover { box-shadow: var(--shadow-sm); }
button.logro:active { transform: translateY(1px); }
button.logro:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logro__claim { margin-top: 0.3rem; font-size: 0.75rem; font-weight: 650; color: var(--accent); }
@keyframes logroGlow { 50% { box-shadow: 0 0 0 7px transparent; } }
.logro-pending { padding: 0.9rem; border-radius: var(--radius-lg); border: 1px solid var(--accent-line); background: var(--surface); }
.logro-pending__head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.logro-pending__head h3 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; gap: 0.5rem; align-items: baseline; }
.logro-pending__head h3 small { font-weight: 500; color: var(--ink-3); font-size: 0.8125rem; }

/* ---------- Patronato ---------- */

.edition { display: grid; gap: 0.9rem; padding: 1.35rem; border-radius: var(--radius-xl); background: var(--tint); border: 1px solid var(--accent-line); }
.edition h3 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.edition p { margin: 0; color: var(--ink-2); font-family: var(--font-serif); font-size: 1.0625rem; line-height: 1.6; max-width: 62ch; }
.edition .meta { font-family: var(--font-sans); font-size: 0.875rem; color: var(--ink-3); min-height: 2.9em; }
.edition__gain { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.04em; line-height: 1; color: var(--accent); }
.edition__gain small { font-size: 0.9375rem; font-weight: 600; color: var(--ink-2); margin-left: 0.35rem; letter-spacing: 0; }
.keep-reset { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; font-size: 0.875rem; color: var(--ink-2); }
.keep-reset b { display: block; color: var(--ink); font-weight: 700; margin-bottom: 0.1rem; }

.patrons { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.6rem; }
.patron { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.9rem 1rem; border-radius: var(--radius-xl); border: 1px solid var(--line); background: var(--surface); }
.patron h4 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.patron h4 span { font-weight: 600; font-size: 0.75rem; color: var(--ink-3); }
.patron p { margin: 0; font-size: 0.875rem; color: var(--ink-2); line-height: 1.4; }
.patron .steps { margin: 0.15rem 0 0.2rem; }
.patron .btn { align-self: flex-start; margin-top: auto; }
.patron.is-max { background: var(--surface-2); }
.patron__fx { margin: 0.1rem 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.1rem 0.6rem; font-size: 0.8125rem; }
.patron__fx dt { color: var(--ink-3); }
.patron__fx dd { margin: 0; color: var(--ink); font-weight: 600; }
.patron__fx .is-next { color: var(--accent); }
.patron.is-ready { border-color: var(--accent-line); background: var(--tint); }

/* ---------- Exposiciones ---------- */

.expos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 0.6rem; }
.expo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem 1rem; align-items: start; padding: 1rem 1.1rem; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); }
.expo h4 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.expo p { margin: 0; font-size: 0.875rem; color: var(--ink-2); }
.expo__body { display: grid; gap: 0.3rem; }
.expo__tiers { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.expo__tiers--2 { grid-template-columns: repeat(2, 1fr); }
.tier { padding: 0.5rem 0.6rem; border-radius: var(--radius-lg); background: var(--surface-2); font-size: 0.75rem; color: var(--ink-3); line-height: 1.35; }
.tier b { display: block; color: var(--ink-2); font-size: 0.8125rem; }
.tier.is-on { background: var(--tint-2); color: var(--accent-strong); }
.tier.is-on b { color: var(--accent); }
.expo.is-active { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.expo__prog { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; }
.expo__val { font-size: 0.8125rem; font-weight: 650; color: var(--danger); white-space: nowrap; }

/* ---------- Diálogos ---------- */

dialog { padding: 0; border: 0; background: none; color: inherit; max-width: min(94vw, 540px); width: 100%; }
dialog::backdrop { background: rgba(20, 14, 8, 0.5); }
dialog.sheet[open] { animation: dlgIn 0.25s var(--ease-out); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.sheet__inner { background: var(--surface); border-radius: var(--radius-xl); padding: 1.5rem; box-shadow: var(--shadow); max-height: 88dvh; overflow: auto; }
.sheet__title { margin: 0 0 0.75rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.sheet__body { font-size: 0.9375rem; color: var(--ink-2); }
.sheet__body p { margin: 0 0 0.75rem; max-width: 62ch; }
.prose { font-family: var(--font-serif); font-size: 1.0625rem; line-height: 1.65; color: var(--ink); }
.prose > p:first-child::first-letter { float: left; font-size: 3.2em; line-height: 0.85; font-weight: 700; color: var(--accent); margin: 0.06em 0.08em 0 0; }
.prose strong { color: var(--accent); }
.sheet__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }
/* En diálogos largos los botones quedan siempre a la vista */
.sheet__actions { position: sticky; bottom: -1.5rem; z-index: 2; margin: 1.25rem -1.5rem -1.5rem; padding: 0.85rem 1.5rem 1.5rem; background: var(--surface); }
.sheet__inner.is-long .sheet__actions { border-top: 1px solid var(--line); }
.big-gain { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.04em; color: var(--accent); line-height: 1.1; margin: 0.15rem 0 0.75rem; }

.detail { display: grid; grid-template-columns: 170px 1fr; gap: 1.25rem; align-items: start; }
.detail .frame { width: 170px; }
.detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.9rem; font-size: 0.875rem; }
.detail dt { color: var(--ink-3); }
.detail dd { margin: 0; color: var(--ink); }
.sheet__inner { position: relative; }
.detail__nav { position: absolute; top: 1.3rem; right: 1.25rem; display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap; }
.sheet__inner:has(.detail__nav) .sheet__title { padding-right: 8.5rem; }
.detail__nav .iconbtn { width: 34px; height: 34px; }
.detail__nav .iconbtn svg { width: 16px; height: 16px; stroke-width: 2.2; stroke-linejoin: round; }
.detail__gain { display: block; margin-top: 0.15rem; font-size: 0.8125rem; color: var(--ink-3); }
.detail__gain.is-up { color: var(--r1); font-weight: 650; }
.detail__link { display: inline-flex; margin-top: 0.9rem; font-weight: 650; font-size: 0.875rem; }
.detail__note { margin: 0.4rem 0 0; font-size: 0.8125rem; line-height: 1.45; color: var(--ink-3); max-width: 46ch; }
.catalog__read { display: block; margin-top: 0.15rem; font-size: 0.8125rem; color: var(--ink-3); }
.stars { color: #b8860b; letter-spacing: 0.06em; }
.rarity-text { font-weight: 700; color: var(--rc); }

.slot-pick { display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.slot-pick button { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.5rem; text-align: left; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.875rem; }
.slot-pick button:hover { border-color: var(--accent); background: var(--tint); }
.slot-pick .frame { width: 44px; }
.slot-pick__delta { font-size: 0.75rem; font-weight: 700; white-space: nowrap; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); }
.slot-pick__delta.is-up { background: #e3f1ec; color: var(--r1); }
.slot-pick__delta.is-down { background: #f8e6e4; color: var(--danger); }

.stats-list { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem; margin: 0 0 1rem; font-size: 0.9375rem; }
@media (min-width: 560px) { .stats-list { grid-template-columns: 1fr auto 1fr auto; column-gap: 1.25rem; font-size: 0.875rem; } }
.stats-list dt { color: var(--ink-3); }
.stats-list dd { margin: 0; color: var(--ink); font-weight: 650; text-align: right; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); color: var(--ink); }
.settings-row input[type='checkbox'] { accent-color: var(--accent); width: 20px; height: 20px; }
.keys-help { font-size: 0.8125rem; color: var(--ink-3); line-height: 1.8; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 0.4em; border-radius: 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); font: 600 0.75rem/1.5 var(--font-sans); color: var(--ink-2); text-align: center; }
.field-error { margin: 0.35rem 0 0; font-size: 0.8125rem; font-weight: 600; color: var(--danger); }
.save-box { width: 100%; min-height: 90px; margin-top: 0.5rem; font-family: ui-monospace, monospace; font-size: 0.75rem; border: 1px solid var(--accent-line); border-radius: var(--radius-lg); padding: 0.5rem; background: var(--surface); }

/* ---------- Apertura de sobres ---------- */

.opening { max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; margin: 0; overflow: hidden; }
.opening::backdrop { background: transparent; }
.op {
  --rc: #c9a25a;
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: radial-gradient(70% 60% at 50% 42%, #3b2a1c 0%, #1c130b 70%, #0f0a05 100%);
  user-select: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: opIn 0.35s ease-out;
}
@keyframes opIn { from { opacity: 0; } }
.op[data-r='0'] { --rc: #d8c3a2; }
.op[data-r='1'] { --rc: #63c2a8; }
.op[data-r='2'] { --rc: #7f9cff; }
.op[data-r='3'] { --rc: #ffcf4d; }
.op[data-r='4'] { --rc: #ff6a4d; }

.op__rays {
  position: fixed;
  width: 170vmax; height: 170vmax;
  left: 50%; top: 42%;
  translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 30%, transparent) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 55%);
  mask: radial-gradient(circle, #000 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.6s;
  animation: spin 24s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { rotate: 360deg; } }
.op__glow {
  position: fixed;
  width: 60vmin; height: 60vmin;
  left: 50%; top: 42%;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 70%, transparent) 0%, transparent 65%);
  opacity: 0.15;
  transition: opacity 0.5s, scale 0.6s var(--ease-out);
  pointer-events: none;
}
.op__flash { position: fixed; inset: 0; background: var(--rc); opacity: 0; pointer-events: none; }
.op__particles { position: fixed; z-index: 3; left: 50%; top: 42%; width: 0; height: 0; pointer-events: none; }
.op__particles i {
  position: absolute;
  width: var(--s, 6px); height: var(--s, 6px);
  margin: calc(var(--s, 6px) / -2);
  border-radius: 50%;
  background: var(--c, var(--rc));
  box-shadow: 0 0 8px var(--c, var(--rc));
  opacity: 0;
  animation: burst var(--d, 1.3s) cubic-bezier(0.12, 0.8, 0.3, 1) var(--delay, 0s) forwards;
}
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.3); }
}

.op__scene { position: relative; z-index: 2; display: grid; justify-items: center; gap: clamp(0.8rem, 2.4dvh, 1.4rem); width: min(92vw, 420px); margin: auto; padding: clamp(2.6rem, 6dvh, 3.5rem) 0 clamp(1.5rem, 5dvh, 3rem); }
.op__hold { position: relative; width: min(62vw, 240px, 31dvh); aspect-ratio: 4 / 5.6; perspective: 1200px; }

/* Sobre */
.env { position: absolute; left: -14%; right: -14%; bottom: -2%; height: 62%; z-index: 3; animation: envFloat 2.4s ease-in-out infinite; }
@keyframes envFloat { 50% { transform: translateY(-6px); } }
.env__back, .env__front, .env__flap { position: absolute; inset: 0; border-radius: 8px; }
.env__back { background: linear-gradient(180deg, #e9dcc5, #d8c6a6); box-shadow: 0 30px 50px -20px rgba(0, 0, 0, 0.7); }
.env__front {
  z-index: 3;
  background:
    linear-gradient(32deg, transparent 49.6%, rgba(106, 56, 18, 0.22) 50%, transparent 50.6%) left bottom / 50% 100% no-repeat,
    linear-gradient(-32deg, transparent 49.6%, rgba(106, 56, 18, 0.22) 50%, transparent 50.6%) right bottom / 50% 100% no-repeat,
    linear-gradient(180deg, #f6ecd9, #e8d8bb);
  clip-path: polygon(0 18%, 50% 58%, 100% 18%, 100% 100%, 0 100%);
}
.env__flap {
  z-index: 4;
  height: 64%;
  bottom: auto;
  transform-origin: top center;
  background: linear-gradient(180deg, #efe1c7, #dcc8a6);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform 0.55s cubic-bezier(0.5, 0, 0.3, 1), opacity 0.3s 0.3s;
}
.env__seal { position: absolute; z-index: 6; left: 50%; top: 56%; width: 58px; height: 58px; translate: -50% -50%; }
.env__seal span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d24b3a, #8e1d16 70%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 4px rgba(0, 0, 0, 0.12);
  transition: transform 0.5s cubic-bezier(0.3, 0, 0.3, 1), opacity 0.5s;
}
.env__seal span:nth-child(1) { clip-path: polygon(0 0, 55% 0, 42% 50%, 52% 100%, 0 100%); }
.env__seal span:nth-child(2) { clip-path: polygon(55% 0, 100% 0, 100% 100%, 52% 100%, 42% 50%); }
.env__seal svg { position: absolute; inset: 14px; width: 30px; height: 30px; color: #f3c8b8; z-index: 2; transition: opacity 0.2s; }
.op--gold .env__back { background: linear-gradient(180deg, #f0d78f, #c99a2e); }
.op--gold .env__front {
  background:
    linear-gradient(32deg, transparent 49.6%, rgba(92, 60, 5, 0.3) 50%, transparent 50.6%) left bottom / 50% 100% no-repeat,
    linear-gradient(-32deg, transparent 49.6%, rgba(92, 60, 5, 0.3) 50%, transparent 50.6%) right bottom / 50% 100% no-repeat,
    linear-gradient(180deg, #fbe7a6, #dcae45);
}
.op--gold .env__flap { background: linear-gradient(180deg, #f8e19a, #d5a53c); }

/* Carta */
.flip { position: absolute; inset: 0; z-index: 2; transform-style: preserve-3d; transform: translateY(22%) scale(0.76); opacity: 0; transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.15), opacity 0.2s; }
.op.is-cracked .flip { opacity: 1; }
.flip__face { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.flip__back {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 26%, rgba(233, 207, 134, 0.35) 26.5% 27.5%, transparent 28%),
    repeating-linear-gradient(45deg, rgba(233, 207, 134, 0.12) 0 2px, transparent 2px 12px),
    repeating-linear-gradient(-45deg, rgba(233, 207, 134, 0.12) 0 2px, transparent 2px 12px),
    linear-gradient(160deg, #8a4b1c, #4e2a0e);
  box-shadow: inset 0 0 0 6px #6a3812, inset 0 0 0 8px #e9cf86;
  display: grid;
  place-items: center;
}
.flip__back svg { width: 34%; height: auto; color: #e9cf86; }
.flip__front { transform: rotateY(180deg); display: grid; grid-template-rows: 1fr auto; gap: 4px; background: var(--surface); padding: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); }
.flip__front .frame { width: 100%; aspect-ratio: auto; height: 100%; min-height: 0; padding: 7px; box-shadow: none; }
.flip__plate { color: var(--ink); text-align: center; font-size: 0.75rem; font-weight: 700; line-height: 1.2; padding: 2px 4px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fases */
.op[data-phase='tease'] .op__glow { opacity: 0.45; }
.op[data-phase='shake'] .env { animation: shake 0.42s ease-in-out infinite; }
.op[data-phase='shake'] .op__glow { opacity: 0.75; scale: 1.15; }
@keyframes shake {
  0%, 100% { transform: rotate(0) translateX(0); }
  20% { transform: rotate(-3deg) translateX(-5px); }
  40% { transform: rotate(3deg) translateX(5px); }
  60% { transform: rotate(-2deg) translateX(-3px); }
  80% { transform: rotate(2deg) translateX(3px); }
}
.op.is-cracked .env__seal span:nth-child(1) { transform: translate(-60px, 40px) rotate(-70deg); opacity: 0; }
.op.is-cracked .env__seal span:nth-child(2) { transform: translate(60px, 50px) rotate(80deg); opacity: 0; }
.op.is-cracked .env__seal svg { opacity: 0; }
.op.is-cracked .env__flap { transform: scaleY(-1); transform-origin: top center; opacity: 0.85; }
.op.is-cracked .env { animation: none; }
.op.is-rising .flip { z-index: 4; transform: translateY(-14%) scale(1); }
.op.is-rising .env { transition: transform 0.7s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.6s 0.1s, visibility 0s 0.7s; transform: translateY(120%) rotate(4deg); opacity: 0; visibility: hidden; }
/* El sobre y la carta no capturan clics: los recoge la escena (y los botones quedan libres) */
.env, .flip { pointer-events: none; }
/* Al terminar, el sobre caído sale del todo: si no, su caja bajo la pantalla crea una barra de desplazamiento */
.op.is-done .env { display: none; }
.op.is-done .flip { pointer-events: auto; cursor: pointer; }
/* Nada de filter en elementos 3D: aplana la carta y enseña el reverso */
.op.is-done .flip:hover .flip__front { box-shadow: 0 0 0 2px var(--rc), 0 0 26px -4px var(--rc); }
.mini.is-shown { cursor: pointer; }
.op.is-flipped .flip { transform: translateY(-6%) rotateY(180deg) scale(1.06); transition-duration: 0.75s; }
.op.is-flipped .op__rays { opacity: 1; }
.op.is-flipped .op__glow { opacity: 0.9; scale: 1.5; }
.op.is-flash .op__flash { animation: flash 0.7s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

.op__banner {
  position: absolute;
  top: -2.6rem;
  left: 50%;
  translate: -50% 0;
  z-index: 6;
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  background: var(--rc);
  color: #1c130b;
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
  opacity: 0;
  box-shadow: 0 10px 30px -8px var(--rc);
}
.op.is-banner .op__banner { animation: stamp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes stamp { from { opacity: 0; transform: scale(2.2) rotate(-6deg); } to { opacity: 1; transform: scale(1) rotate(-2deg); } }

.op__label { width: 100%; text-align: center; opacity: 0; transform: translateY(14px); transition: opacity 0.45s, transform 0.45s var(--ease-out); }
.op.is-done .op__label { opacity: 1; transform: none; }
.op__status { margin: 0; font-size: 0.8125rem; font-weight: 700; color: var(--rc); }
.op__name { margin: 0.2rem 0 0; font-size: clamp(1.4rem, 1rem + 2vw, 1.9rem); font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
.op__meta { margin: 0.35rem 0 0; font-size: 0.875rem; color: rgba(255, 255, 255, 0.72); }
.op__stars { margin-top: 0.45rem; display: flex; justify-content: center; gap: 4px; font-size: 1.15rem; color: rgba(255, 255, 255, 0.25); }
.op__stars b { color: #ffcf4d; font-weight: 400; }
.op__stars b.is-new { animation: starPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) 0.2s both; }
@keyframes starPop { from { transform: scale(2.4); opacity: 0; } }
.op__link { display: inline-block; margin-top: 0.5rem; color: #f3d9b8; font-size: 0.8125rem; font-weight: 600; }
.op__link:hover { color: #fff; }

.op__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; opacity: 0; transition: opacity 0.4s 0.15s; pointer-events: none; }
.op.is-done .op__actions { opacity: 1; pointer-events: auto; }
.op .btn--ghost { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.22); }
.op .btn--ghost:hover:not([disabled]) { background: rgba(255, 255, 255, 0.16); }
.op__hint { position: absolute; z-index: 2; bottom: max(1.5rem, env(safe-area-inset-bottom)); left: 0; right: 0; margin: 0; text-align: center; font-size: 0.875rem; color: rgba(255, 255, 255, 0.6); transition: opacity 0.3s; }
.op.is-done .op__hint { opacity: 0; }

/* Pantalla baja en horizontal: carta a la izquierda, ficha y botones a la derecha, todo a la vista sin desplazarse */
@media (max-height: 500px) and (orientation: landscape) {
  .op__scene:not(.op__scene--grid) { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; align-items: center; justify-items: start; column-gap: 2.25rem; row-gap: 0.75rem; width: min(94vw, 680px); padding: 1.25rem 0; }
  .op__scene:not(.op__scene--grid) .op__hold { grid-row: 1 / span 2; width: min(34vw, 200px, 62dvh); }
  .op__scene:not(.op__scene--grid) .op__label { text-align: left; align-self: end; }
  .op__scene:not(.op__scene--grid) .op__stars { justify-content: flex-start; }
  .op__scene:not(.op__scene--grid) .op__actions { justify-content: flex-start; align-self: start; }
  .op__scene:not(.op__scene--grid) .op__name { font-size: 1.4rem; }
  .op__scene--grid .op__grid { max-height: 52dvh; }
}

/* Muchas cartas a la vez */
.op__scene--grid { width: min(94vw, 780px); }
.op__grid { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 0.9rem 0.75rem; width: 100%; max-height: 58dvh; overflow-y: auto; overflow-x: hidden; padding: 0.75rem 0.5rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; }
.op__scene--grid .op__actions { justify-content: center; }
.mini { flex: 0 0 88px; perspective: 700px; display: grid; align-content: start; gap: 0.3rem; text-align: center; }
.mini__card { position: relative; aspect-ratio: 4 / 5; transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.2); }
.mini__card .flip__face { border-radius: 6px; }
.mini__card .flip__front { padding: 0; background: none; box-shadow: none; display: block; }
.mini__card .flip__front .frame { padding: 4px; height: 100%; }
.mini.is-shown .mini__card { transform: rotateY(180deg); }
.mini__name { font-size: 0.6875rem; font-weight: 650; line-height: 1.15; color: rgba(255, 255, 255, 0.85); opacity: 0; transition: opacity 0.3s 0.3s; }
.mini__tag { font-size: 0.625rem; font-weight: 800; color: #ffcf4d; min-height: 0.8em; opacity: 0; transition: opacity 0.3s 0.3s; }
.mini.is-shown .mini__name, .mini.is-shown .mini__tag { opacity: 1; }
.mini[data-r='3'] { --glow: #ffcf4d; }
.mini[data-r='4'] { --glow: #ff6a4d; }
.mini[data-r='3'].is-shown .flip__front, .mini[data-r='4'].is-shown .flip__front { box-shadow: 0 0 14px 2px var(--glow); }
.mini.is-shown:hover .flip__front { box-shadow: 0 0 0 2px #fff, 0 0 16px 2px var(--glow, rgba(255, 255, 255, 0.4)); }
.op__summary { margin: 0; font-size: 0.9375rem; color: rgba(255, 255, 255, 0.85); text-align: center; }

/* ---------- Avisos ---------- */

.toasts { position: fixed; z-index: 50; right: 1.25rem; bottom: max(1.25rem, env(safe-area-inset-bottom)); display: grid; gap: 0.5rem; width: min(92vw, 380px); pointer-events: none; }
/* Los avisos van en la capa superior (popover) para verse también sobre los diálogos y la apertura de sobres */
.toasts[popover] { inset: auto 1.25rem max(1.25rem, env(safe-area-inset-bottom)) auto; margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible; height: auto; }
.toasts[popover]:not(:popover-open) { display: none; }
.toast { display: flex; gap: 0.7rem; align-items: center; padding: 0.7rem 0.9rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 0.875rem; color: var(--ink-2); animation: toastIn 0.3s var(--ease-out); }
.toast b { color: var(--ink); font-weight: 700; }
.toast__icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--tint-2); color: var(--accent); }
.toast__icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast--hot .toast__icon { background: var(--danger); color: #fff; }
.toast--gold .toast__icon { background: #f2d98b; color: #5c3c05; }
.toast.is-leaving { animation: toastOut 0.25s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }



/* ---------- Vitrina: cifras, racha y objetivos ---------- */

.counter__pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin-top: 0.4rem; }
.stat-pill { padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--tint-2); color: var(--accent); font-size: 0.8125rem; font-weight: 650; white-space: nowrap; }
.stat-pill--quiet { background: var(--surface-2); color: var(--ink-2); }

.combo {
  position: absolute;
  z-index: 5;
  bottom: 8px;
  left: 8px;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 0.25rem 0.6rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.combo__label { font-size: 0.75rem; font-weight: 750; color: var(--accent); white-space: nowrap; }
.combo__track { width: 64px; height: 4px; border-radius: 999px; background: var(--tint-2); overflow: hidden; }
.combo__fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.15s; }
.combo.is-full { background: var(--accent); }
.combo.is-full .combo__label { color: #fff; }
.combo.is-full .combo__track { background: rgba(255, 255, 255, 0.3); }
.combo.is-full .combo__fill { background: #ffd58a; }

.showcase.is-boosted .niche { animation: boosted 1.4s ease-in-out infinite; }
@keyframes boosted {
  50% { box-shadow: inset 0 0 0 1px var(--accent-line), inset 0 -30px 40px -20px rgba(106, 56, 18, 0.18), 0 0 0 4px rgba(179, 38, 30, 0.18), 0 0 28px rgba(255, 170, 90, 0.55); }
}

.spark {
  position: absolute;
  width: 6px; height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3c4, #d4a840 70%);
  pointer-events: none;
  animation: spark 0.6s ease-out forwards;
}
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }

.goals { padding: 0.85rem 0.9rem 0.6rem; }
.goals__title { margin: 0 0 0.35rem; font-size: 0.8125rem; font-weight: 700; color: var(--accent); }
.goals__list { display: grid; }
.goal {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  padding: 0.35rem 0.2rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
  border-radius: 0;
}
.goal:first-child { border-top: 0; }
.goal__icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }
.goal__icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.goal__icon svg[fill='currentColor'] { fill: currentColor; stroke: none; }
.goal__text { display: grid; gap: 0.3rem; min-width: 0; }
.goal__row { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8125rem; }
.goal__label { flex: 1 1 auto; min-width: 0; font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal__value { flex: none; color: var(--ink-3); white-space: nowrap; }
.goal.is-ready .goal__icon { background: var(--accent); color: #fff; }
.goal.is-ready .goal__value { color: var(--accent); font-weight: 650; }

/* ---------- Álbum: resumen y series ---------- */

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem 1.5rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--surface);
}
.catalog__main { display: grid; gap: 0.3rem; align-content: center; }
.catalog__num { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.04em; line-height: 1; }
.catalog__num small { font-size: 1rem; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.catalog__label { font-size: 0.8125rem; color: var(--ink-3); }
.catalog__main .bar { margin-top: 0.4rem; height: 8px; }
.catalog__side { display: grid; grid-template-columns: 1fr 1fr; align-content: center; }
.catalog__rar { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 0.4rem; }
.rar { display: grid; gap: 1px; padding: 0.45rem 0.6rem; border-radius: var(--radius-lg); background: var(--surface-2); border-top: 3px solid var(--rc); }
.rar__name { font-size: 0.75rem; font-weight: 700; color: var(--rc); }
.rar__count { font-size: 1rem; font-weight: 750; letter-spacing: -0.02em; }
.rar__odds { font-size: 0.6875rem; color: var(--ink-3); }

.series { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 0.6rem; }
.serie { display: grid; gap: 0.5rem; padding: 0.8rem; border-radius: var(--radius-xl); border: 1px solid var(--line); background: var(--surface); }
.serie.is-ready { border-color: var(--accent); background: var(--tint); }
.serie.is-done { background: var(--surface-2); }
.serie__top { display: grid; grid-template-columns: 30px 1fr auto; gap: 0.5rem; align-items: center; }
.serie__icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--tint-2); color: var(--accent); }
.serie__icon .ico { width: 17px; height: 17px; }
.serie__name { font-weight: 700; font-size: 0.9375rem; }
.serie__lvl { font-size: 0.6875rem; font-weight: 700; color: var(--ink-3); white-space: nowrap; padding: 0.1rem 0.4rem; border-radius: 999px; background: var(--surface-2); }
.serie__count { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.serie__count small { font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.serie__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.35rem 0.5rem; font-size: 0.6875rem; color: var(--ink-3); }
.serie__foot > * { white-space: nowrap; }
.serie__foot .btn { margin-left: auto; }
.serie__foot .btn { min-height: 30px; padding: 0.2rem 0.7rem; font-size: 0.8125rem; }

/* En pantallas táctiles el estado hover se queda pegado: se anula */
@media (hover: none) {
  .tab:hover:not([aria-selected='true']) { background: transparent; color: var(--ink-2); }
  .btn--ghost:hover:not([disabled]) { background: var(--surface); border-color: var(--line); }
  .piece:hover .frame { transform: none; }
  .sala:hover { border-color: var(--line); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1140px) and (min-width: 761px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0.15rem; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 0 0.55rem; font-size: 0.8125rem; gap: 0.3rem; flex: none; }
  .tab__dot { left: calc(0.55rem + 11px); }
  .tab__count { left: calc(0.55rem + 1px); }
  .tab svg { width: 16px; height: 16px; }
  /* Con seis pestañas no caben con icono: solo texto, para que Legados no quede fuera de la vista */
  .tabs:has(.tab:nth-child(6)) .tab { padding-inline: 0.35rem; font-size: 0.75rem; letter-spacing: -0.01em; gap: 0; }
  .tabs:has(.tab:nth-child(6)) .tab > span:first-child { display: none; }
  .tabs:has(.tab:nth-child(6)) .tab__dot { left: auto; right: 1px; top: 3px; }
  .tabs:has(.tab:nth-child(6)) .tab__count { left: auto; right: -4px; top: -6px; }
}

@media (max-width: 900px) {
  /* Con poco ancho, el chip de la edición (informativo) deja sitio al nombre y al botón de Wikitólica */
  .chip--quiet { display: none; }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 1rem; --pad: 1rem; }
}

/* Escritorio bajo: busto y contador lado a lado para que la columna quepa sin desplazarse */
@media (min-width: 761px) and (max-height: 920px) {
  body:not(.is-solo) .showcase {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: 'niche counter' 'niche hint';
    grid-template-rows: 1fr auto;
    align-items: center;
    justify-items: start;
    gap: 0.2rem 1rem;
    padding: 0.8rem 0.9rem;
  }
  body:not(.is-solo) .counter { grid-area: counter; justify-items: start; text-align: left; }
  body:not(.is-solo) .counter__value { font-size: 2.2rem; }
  body:not(.is-solo) .counter__pills { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  body:not(.is-solo) .niche { grid-area: niche; width: 128px; height: 168px; }
  body:not(.is-solo) .hint { grid-area: hint; text-align: left; align-self: start; font-size: 0.8125rem; }
  body:not(.is-solo) .combo { left: 50%; translate: -50% 0; justify-items: center; bottom: 5px; }
  body:not(.is-solo) .combo__track { width: 48px; }
  body:not(.is-solo) .visitor { width: 48px; height: 48px; }
}

@media (max-width: 760px) {
  /* La cabecera se va con el scroll; lo que queda pegado arriba es la vitrina */
  .top { position: static; height: auto; backdrop-filter: none; background: var(--paper); }
  .top__inner { height: auto; padding: max(0.6rem, env(safe-area-inset-top)) 1rem 0.6rem; }
  .brand__mark { width: 27px; height: 35px; }
  .brand__name { font-size: 1.2rem; }
  .brand__sub { display: none; }
  .chip--quiet { display: none; }
  .layout, body.is-solo .layout { grid-template-columns: minmax(0, 1fr); padding: 0.75rem; gap: 0.75rem; }
  .stage { position: static; max-height: none; overflow: visible; }
  body:not(.is-solo) .stage { display: contents; }
  .niche { height: clamp(170px, 30vh, 250px); }
  body.is-solo .niche { height: clamp(220px, 42vh, 340px); }
  .tabs {
    position: fixed;
    top: auto; bottom: 0; left: 0; right: 0;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0;
    padding: 0.35rem 0.25rem max(0.35rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: rgba(254, 253, 250, 0.97);
    backdrop-filter: blur(8px);
  }
  .tab { flex: 1; max-width: 104px; flex-direction: column; height: auto; gap: 0.15rem; padding: 0.4rem 0.2rem; font-size: 0.6875rem; border-radius: var(--radius-lg); min-width: 0; }
  .tab__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab svg { width: 20px; height: 20px; }
  /* Con seis pestañas (Legados) el texto se ajusta para que quepan enteras */
  .tabs:has(.tab:nth-child(6)) .tab { padding-inline: 0.05rem; font-size: 0.625rem; letter-spacing: -0.015em; }
  .tab__dot { top: 6px; left: auto; right: calc(50% - 16px); }
  .tab__count { top: 2px; left: auto; right: calc(50% - 24px); }
  .panel { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); gap: 1.6rem; }
  .toasts, .toasts[popover] { inset: auto auto calc(4.6rem + env(safe-area-inset-bottom)) 50%; translate: -50% 0; }
  .op__actions { gap: 0.4rem; }
  .op__actions .btn { padding: 0.4rem 0.8rem; font-size: 0.875rem; min-height: 40px; }
  .op__grid { gap: 0.75rem 0.5rem; max-height: 60dvh; }
  .mini { flex-basis: calc((100% - 1.5rem) / 4); max-width: 84px; }
  /* Vitrina compacta y fija arriba: se puede exhibir desde cualquier pestaña */
  body:not(.is-solo) .showcase {
    position: sticky;
    top: 0;
    z-index: 7;
    margin: -0.75rem -0.75rem 0;
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-areas: 'niche counter' 'niche hint';
    grid-template-rows: 1fr auto;
    align-items: center;
    justify-items: start;
    gap: 0.15rem 0.85rem;
    padding: max(0.55rem, env(safe-area-inset-top)) 1rem 0.55rem;
    border-radius: 0;
    border-width: 0 0 1px;
    box-shadow: 0 8px 18px -14px rgba(43, 33, 24, 0.45);
  }
  body:not(.is-solo) .counter { grid-area: counter; justify-items: start; text-align: left; align-self: center; gap: 0; }
  body:not(.is-solo) .counter__value { font-size: 1.85rem; }
  body:not(.is-solo) .counter__unit { font-size: 0.75rem; }
  body:not(.is-solo) .counter__pills { justify-content: flex-start; gap: 0.25rem; margin-top: 0.3rem; }
  body:not(.is-solo) .stat-pill { padding: 0.12rem 0.55rem; font-size: 0.75rem; }
  body:not(.is-solo) .niche { grid-area: niche; width: 84px; height: 108px; padding-bottom: 4%; }
  body:not(.is-solo) .niche::before { inset: 5px 5px auto; }
  body:not(.is-solo) .hint { grid-area: hint; text-align: left; align-self: start; font-size: 0.75rem; }
  body:not(.is-solo) .boost { top: 4px; gap: 2px; }
  body:not(.is-solo) .boost span { padding: 0.05rem 0.4rem; font-size: 0.625rem; }
  body:not(.is-solo) .boost small { display: none; }
  body:not(.is-solo) .combo { bottom: 3px; left: 50%; translate: -50% 0; justify-items: center; padding: 0.1rem 0.4rem 0.2rem; }
  body:not(.is-solo) .combo__label { font-size: 0.6875rem; }
  body:not(.is-solo) .combo__track { width: 40px; height: 3px; }
  body:not(.is-solo) .visitor { width: 40px; height: 40px; }
  body:not(.is-solo) .visitor__tag { display: none; }
  body:not(.is-solo) .floater { font-size: 0.8125rem; --rise: -40px; }
  body:not(.is-solo) .counter__pills { flex-direction: column; align-items: flex-start; }
  .wing { scroll-margin-top: 132px; }
  .task { padding: 0.75rem 0.9rem; }
  .task__text { font-size: 0.9375rem; }
  /* Objetivos: tira deslizable en vez de lista */
  .goals { padding: 0; border: 0; background: none; margin-inline: -0.75rem; }
  .goals__title { padding-inline: 0.75rem; margin-bottom: 0.4rem; }
  .goals__list { display: flex; gap: 0.5rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 0.75rem; padding: 0 0.75rem 2px; scrollbar-width: none; }
  .goals__list::-webkit-scrollbar { display: none; }
  .goal { flex: 1 0 min(76%, 260px); scroll-snap-align: start; padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .goal:first-child { border-top: 1px solid var(--line); }
  .goal.is-ready { border-color: var(--accent-line); background: var(--tint); }
  .goal__row { flex-direction: column; gap: 0; }
  .goal__value { margin-left: 0; max-width: 100%; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; }
  .goal__text { gap: 0.25rem; }
  .catalog { grid-template-columns: 1fr; padding: 0.9rem; }
  .pedestals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .pedestal { grid-template-columns: 40px minmax(0, 1fr); gap: 0.55rem; padding: 0.5rem; min-height: 72px; }
  .pedestal .frame { width: 40px; padding: 3px; }
  .pedestal__name { font-size: 0.8125rem; }
  .pedestal__fx { font-size: 0.6875rem; }
  .pedestal--empty { grid-template-columns: 1fr; font-size: 0.75rem; }
  .series { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .serie { padding: 0.7rem; gap: 0.4rem; }
  .serie__foot .btn { min-height: 36px; }
  .packs { grid-template-columns: 1fr; gap: 0.5rem; }
  .pack { gap: 0.8rem; padding: 0.8rem 0.9rem; }
  .pack__art { width: 64px; height: 50px; }
  .pack h3 { font-size: 1rem; }
  .pack p { margin-bottom: 0.5rem; }
  .catalog__rar { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .sala { padding: 0.8rem; }
  .upgrades {
    grid-template-columns: none;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-inline: -0.75rem;
    padding: 0 0.75rem 0.25rem;
    scroll-padding-inline: 0.75rem;
  }
  .upgrades::-webkit-scrollbar { display: none; }
  .upgrade { scroll-snap-align: start; }
  .section-head .section-note { display: none; }
  .sala__count { font-size: 1.7rem; }
  .detail { grid-template-columns: 1fr; justify-items: center; }
  .detail__nav { position: static; justify-content: space-between; margin: -0.25rem 0 0.75rem; }
  .sheet__inner:has(.detail__nav) .sheet__title { padding-right: 0; }
  .detail dl { width: 100%; }
  .keep-reset { grid-template-columns: 1fr; }
  .logros { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; align-items: start; }
  .logro { grid-template-columns: 28px minmax(0, 1fr); gap: 0.5rem; padding: 0.5rem 0.55rem; align-items: start; }
  .logro__icon { width: 28px; height: 28px; }
  .logro__icon svg { width: 15px; height: 15px; }
  .logro__name { font-size: 0.8125rem; }
  .logro.is-on .logro__desc { display: none; }
  .logro.is-on { align-items: center; }
  .logro__prog { grid-template-columns: 1fr; gap: 0.15rem; }
  .edition { padding: 1rem; gap: 0.75rem; }
  .edition h3 { font-size: 1.3rem; }
  .edition p { font-size: 1rem; }
  .edition__gain { font-size: 2rem; }
  .expo { padding: 0.85rem 0.9rem; }
  .expo__tiers { gap: 0.35rem; }
  .tier { padding: 0.4rem 0.45rem; font-size: 0.6875rem; }
  .tier b { font-size: 0.75rem; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 0.9rem 0.5rem; }
  .filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .filters input[type='search'] { grid-column: 1 / -1; order: -1; }
  .filters select { min-width: 0; padding-inline: 0.5rem; font-size: 0.8125rem; }
  .piece__name { font-size: 0.6875rem; }
  .stat { margin-right: 0.6rem; padding-right: 0.6rem; }
  .stat__value { font-size: 1.3rem; }
}

/* Móvil en horizontal: poca altura, así que la vitrina fija se reduce a una franja y las pestañas a una línea */
@media (max-width: 760px) and (max-height: 500px) {
  body:not(.is-solo) .showcase { grid-template-columns: 52px auto minmax(0, 1fr); grid-template-areas: 'niche counter hint'; grid-template-rows: auto; gap: 0 0.9rem; padding: 0.3rem 1rem; }
  body:not(.is-solo) .niche { width: 52px; height: 66px; }
  body:not(.is-solo) .counter__value { font-size: 1.4rem; }
  body:not(.is-solo) .counter__pills { flex-direction: row; margin-top: 0.15rem; }
  body:not(.is-solo) .hint { align-self: center; }
  body:not(.is-solo) .combo { bottom: 1px; padding: 0 0.3rem; }
  body:not(.is-solo) .combo__label { font-size: 0.5625rem; }
  body:not(.is-solo) .combo__track { display: none; }
  body:not(.is-solo) .boost { top: 1px; }
  body:not(.is-solo) .boost span { font-size: 0.5625rem; padding: 0 0.3rem; }
  body:not(.is-solo) .visitor { width: 30px; height: 30px; }
  .wing { scroll-margin-top: 84px; }
  .tabs { padding-block: 0.2rem max(0.2rem, env(safe-area-inset-bottom)); }
  .tab { flex-direction: row; gap: 0.35rem; padding: 0.35rem 0.5rem; min-height: 36px; font-size: 0.75rem; max-width: 150px; }
  .tabs:has(.tab:nth-child(6)) .tab { padding-inline: 0.5rem; font-size: 0.75rem; letter-spacing: normal; }
  .tab svg { width: 18px; height: 18px; }
  .tab__dot { top: 4px; right: auto; left: 18px; }
  .tab__count { top: 0; right: auto; left: 14px; }
  .panel { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom)); }
}
/* Móviles: con laureles y legados en la cabecera el nombre no cabe en una línea; pasa a dos en vez de cortarse */
@media (max-width: 520px) {
  .brand { gap: 0.5rem; }
  .brand__mark { width: 24px; height: 31px; }
  .brand__name { white-space: normal; font-size: 1.05rem; line-height: 1.1; }
  .top__meta { gap: 0.35rem; }
  .top__meta .chip { padding-inline: 0.6rem; }
  .chip--back { padding-inline: 0.45rem; }
  .chip--back .chip__text { display: none; }
}
/* Móviles estrechos: la cabecera en dos filas, el nombre entero arriba y debajo el botón de Wikitólica y los contadores */
@media (max-width: 420px) {
  .top__inner { flex-wrap: wrap; row-gap: 0.45rem; }
  .brand__name { white-space: nowrap; font-size: 1.15rem; }
  .top__meta { width: 100%; }
  .chip--back { margin-right: auto; padding-inline: 0.45rem 0.7rem; }
  .chip--back .chip__text { display: inline; }
}
/* Escritorio con muy poca altura (móvil grande en horizontal): la cabecera no se queda fija */
@media (min-width: 761px) and (max-height: 500px) {
  :root { --top-h: 0px; }
  .top { position: static; height: auto; }
  .top__inner { height: auto; padding-block: 0.5rem; }
}

/* Móviles estrechos (320–360 px) */
@media (max-width: 360px) {
  .tab { padding-inline: 0.05rem; font-size: 0.59rem; letter-spacing: -0.01em; }
  .tabs:has(.tab:nth-child(6)) .tab { font-size: 0.5625rem; letter-spacing: -0.02em; }
  .serie { padding: 0.55rem; }
  .serie__top { gap: 0.35rem; grid-template-columns: 26px 1fr auto; }
  .serie__icon { width: 26px; height: 26px; }
  .logros { grid-template-columns: 1fr; }
  .stat-pill { font-size: 0.6875rem; }
}

@media (pointer: coarse) {
  .btn--small { min-height: 40px; }
  .task__foot { min-height: 40px; }
  .seg button { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .logro.is-ready .logro__icon { animation: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
.op__tip { margin: 0.35rem 0 0; font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); }
