:root {
  --bg: #14161a;
  --bg-elevated: #1b1e24;
  --bg-card: #20242b;
  --border: #3a3f47;
  --border-light: #4d545e;
  --text: #e8e6df;
  --text-dim: #8b8d92;

  /* Industrial palette: brass + rust on dark steel, instead of the old purple/pink gradient. */
  --accent: #b8860b;
  --accent-dark: #8a6508;
  --accent-2: #a0522d;
  --success: #5f8a4a;
  --danger: #a3443a;

  /* Topbar accent pair (added 2026-09-30, per the user's request: "añadir
     en el menú superior un poco más de color y diseño moderno") -- a
     vivid raspberry/teal pair layered on top of the brass/rust base so
     the top menu reads as more modern and colorful without changing the
     industrial palette everywhere else in the game. */
  --accent-pop: #e0455f;
  --accent-cool: #2dd4bf;

  /* Rarity colors (updated 2026-09-24, per the user's request: "gris N/
     azul R/ amarillo SR/ naranja SSR") -- kept in sync with
     data/seed.js > RARITY_TIERS and the item-icon background/glow colors
     used when generating art via ComfyUI. */
  --rarity-n: #9ca3af;
  --rarity-r: #4a90d9;
  --rarity-sr: #f0c419;
  --rarity-ssr: #f2762e;

  --font-display: 'Oswald', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--text);
  font-family: var(--font-body);
  /* Horizontal-scroll guarantee moved off html/body 2026-10-04, per the
     user's request: "el menu superior debe quedar fijo y siempre visible,
     aunque hagas scroll hacia abajo en la pagina". The guarantee itself is
     unchanged (added 2026-10-01: "que la pantalla se quede fixed al screen
     y no haya desplazamiento horizontal"), but CSS forces overflow-y to
     become "auto" on any element whose overflow-x is non-"visible" while
     overflow-y is left "visible" -- and an "auto" (rather than the default,
     propagated-to-viewport "visible") overflow on html/body breaks
     position: sticky for .topbar (confirmed with Playwright: the topbar
     scrolled away with the page despite `position: sticky; top: 0`). So
     html/body now keep their default overflow (nothing set here), and the
     horizontal clip lives on #view/.footer instead (see those rules) --
     they're .topbar's siblings under #app, not its ancestors, so clipping
     there can't re-break the sticky topbar. */
  width: 100%;
}

h1, h2, h3, .brand-name, .tabs a, button, .btn, .rarity-badge {
  font-family: var(--font-display);
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Topbar (recolored 2026-09-30, per the user's request: "añadir en el
   menú superior un poco más de color y diseño moderno") ------------------
   The rest of the game keeps the brass/rust industrial palette; the top
   menu specifically layers in --accent-pop (raspberry) and --accent-cool
   (teal) for a livelier, more modern header -- a colorful gradient edge,
   a glowing gradient brand mark + gradient brand text, pill-shaped tabs
   with a gradient active state, and each currency pill tinted to its own
   color. */
/* Restructured 2026-10-01 ("Quiero que arriba haya dos lineas. Una con
   hunkxeen + nivel y recursos. Otra linea debajo con las opciones de menu,
   fixed en una sola linea") into two always-stacked rows -- `.topbar` is
   now a plain `flex-direction: column`, no breakpoint involved at all.
   Row 1 is `.topbar-row1` (brand + wallet together, see index.html); row 2
   is `.tabs` on its own. This replaced an earlier version that only
   reordered things below a `max-width: 680px` media query -- on at least
   one real phone (probably a wide/landscape or "Desktop site" viewport)
   that breakpoint never matched, so the two-row layout never kicked in.
   Being unconditional now, it can't miss. */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px;
  background:
    radial-gradient(900px 120px at 0% 0%, rgba(224,69,95,0.16), transparent 60%),
    radial-gradient(700px 120px at 100% 0%, rgba(45,212,191,0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-elevated), var(--bg));
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--accent-pop), var(--accent) 50%, var(--accent-cool)) 1;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 20px -14px rgba(224,69,95,0.5);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Row 1: brand (left) + wallet (right), always on one line -- the wallet
   itself scrolls horizontally (see .wallet below) rather than wrapping or
   pushing the brand off, so this row never breaks in two no matter how
   narrow the screen is. */
.topbar-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Font-size bump, round 2 (2026-10-02, per the user's request: "Aumenta un
   poco más los textos de todo el juego, sobre todo los del menu... aumenta
   tambien todos los elementos de la barra superior y logo"). The brand
   mark/name, nav tabs, wallet pills, news button and level circle below
   all got a bigger bump than the general +1px pass applied to the rest of
   the UI (see the many other font-size tweaks throughout this file) --
   their circles (.news-btn/.level-circle) were widened 32px->34px and the
   brand mark's padding opened up slightly to keep the now-larger glyph/
   text from feeling cramped. .tabs/.wallet already scroll horizontally
   within their own row instead of wrapping (see the comments on each
   below), so a larger font here still keeps the topbar itself fixed to
   the screen width -- it can only ever make THAT internal scroll start
   slightly sooner on very narrow phones, never break out of the row or
   wrap it to a second line. */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; flex-shrink: 0; }
/* Font-size bump, round 3 (2026-10-03, per the user's request: "aumentar el
   tamaño de los elementos del menu superior..."). Later reverted -- see
   the round-4 shrink-to-fit note just below .tabs, which replaced both
   `.tabs`/`.wallet`'s internal horizontal scroll with a strict
   no-scroll/no-overflow layout, so the brand itself also had to come back
   down from this round's size (it's `flex-shrink: 0` -- see .brand above
   -- so whatever space it eats is space `.wallet` can't shrink into on a
   narrow phone). */
.brand-mark {
  background: linear-gradient(135deg, var(--accent-pop), var(--accent) 55%, var(--accent-cool));
  color: #1a0d10;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 3px 12px -3px rgba(224,69,95,0.55), 0 3px 14px -4px rgba(45,212,191,0.4);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-name {
  font-size: 13px;
  letter-spacing: 0.1px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .brand-name {
    background: linear-gradient(90deg, #f4e4c1, var(--accent-pop) 55%, var(--accent-cool));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

/* Row 2: nav tabs -- "No puede haber más de una línea" (per the 2026-10-01
   request), and NOW "que NO haya que deslizar para ver el resto" (per the
   2026-10-03, round-4 request below): the three previous font-size-bump
   rounds plus the fixed-width pill padding meant 6 tabs genuinely could
   not fit a narrow phone's width even scrolled, so a horizontal scroll
   (added round 3) was the only way to reach the rest -- which is exactly
   what this new request says is unwanted ("se ve demasiado grande... que
   NO haya que deslizar"). Fix: each tab is now `flex: 1 1 0` instead of a
   fixed-content pill, so the 6 of them always divide the row's full width
   exactly between them (plus the `gap`) -- there is no leftover width an
   internal scroll could ever need to reach, at ANY screen size, so the
   scroll/snap mechanism from round 3 is removed outright rather than just
   tuned. `overflow: hidden` + `text-overflow: ellipsis` on each tab is a
   safety net for an extreme-narrow phone where even a single word
   wouldn't fit at the minimum legible size -- it degrades to a clipped
   label instead of ever forcing a scrollbar back in. */
.tabs {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.tabs a {
  flex: 1 1 0;
  min-width: 0;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 2px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: clamp(8.5px, 2.28vw, 13px);
  font-weight: 600;
  letter-spacing: 0px;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.tabs a:hover { background: rgba(224,69,95,0.12); color: var(--text); border-color: rgba(224,69,95,0.4); transform: translateY(-1px); }
.tabs a.active {
  background: linear-gradient(90deg, var(--accent-pop), var(--accent) 60%, var(--accent-cool));
  color: #1a0d10;
  border-color: transparent;
  box-shadow: 0 3px 12px -3px rgba(224,69,95,0.6);
}

/* Wallet -- shares row 1 with the brand (see .topbar-row1 above) on every
   screen size now. Round 4 (2026-10-03, per the user's request: "que NO
   haya que deslizar para ver el resto") removed the horizontal scroll
   round 3 had added -- same reasoning as .tabs above: the level circle and
   News button stay a fixed small size (they're glyphs, not text that can
   usefully shrink further), but the 4 currency pills are now `flex: 1 1 0`
   so together with the fixed icons they always sum to exactly the row's
   available width, with nothing left over for a scroll to ever reach. */
.wallet {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 18px;
  flex-wrap: nowrap;
  /* `flex: 1 1 0` (added alongside round 4 above) -- without an explicit
     grow factor, this row (as a flex ITEM inside .topbar-row1, next to
     .brand) would size to its own children's hypothetical/min-content
     width instead of actually filling the space .topbar-row1 leaves for
     it after .brand -- and since those children are themselves `flex: 1 1
     0; min-width: 0` (so THEY don't force overflow), that min-content
     collapses toward nothing, starving every pill down to a sliver. This
     is what actually hands the wallet row its real share of row 1's
     width, which the 4 pills below then divide between themselves. */
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}
.wallet-item {
  flex: 1 1 0;
  min-width: 0;
  background: var(--bg-card);
  padding: 3px 1px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  font-size: clamp(7px, 2.5vw, 15px);
}
.wallet-item small { color: var(--text-dim); font-size: 0.85em; }
/* Each currency gets its own tinted border/glow so the wallet row itself
   reads as more colorful, not just a row of identical gray pills. */
.wallet-item--hunkyx { border-color: rgba(184,134,11,0.55); box-shadow: 0 0 0 1px rgba(184,134,11,0.12) inset, 0 0 10px -4px var(--accent); }
.wallet-item--energy { border-color: rgba(45,212,191,0.5); box-shadow: 0 0 0 1px rgba(45,212,191,0.12) inset, 0 0 10px -4px var(--accent-cool); }
.wallet-item--tickets { border-color: rgba(224,69,95,0.5); box-shadow: 0 0 0 1px rgba(224,69,95,0.12) inset, 0 0 10px -4px var(--accent-pop); }
.wallet-item--coins { border-color: rgba(160,82,45,0.55); box-shadow: 0 0 0 1px rgba(160,82,45,0.12) inset, 0 0 10px -4px var(--accent-2); }
/* Denx (added 2026-10-04, per the user's request: "el icono debe ser igual
   que la de los hunkyx, pero en azul"). Blue tint, parallel to the other
   wallet-item colors above. */
.wallet-item--denx { border-color: rgba(37,99,235,0.55); box-shadow: 0 0 0 1px rgba(37,99,235,0.12) inset, 0 0 10px -4px #2563eb; }
.denx-icon { fill: #3b82f6; vertical-align: -2px; margin-right: 1px; }

/* News button (added 2026-10-01, per the user's request: "un nuevo
   apartado de News, al que se podra acceder con un boton a la derecha de
   todas las monedas") -- sits at the end of .wallet, styled like a wallet
   pill so it reads as part of that row instead of a stray icon. */
.news-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}
.news-btn:hover { border-color: var(--accent-cool); transform: translateY(-1px); }
.news-btn.active { border-color: var(--accent-cool); box-shadow: 0 0 0 1px rgba(45,212,191,0.25) inset, 0 0 10px -4px var(--accent-cool); }

/* Regen countdown, shown under Energy/Battle Tickets (added 2026-09-25,
   per the user's request: "un contador debajo de la energia y otro en los
   tickets para saber cuanto queda para rellenar 1 -- indicar que es +1"). */
.wallet-item--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.3;
}
.wallet-regen {
  font-size: 0.8em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Below ~480px, the "/100" max suffix on Energy/Battle Tickets is the
   single biggest thing standing between the wallet row and actually
   fitting its real content (see the round-4 "no scroll" rewrite of
   .wallet/.wallet-item above) -- the regen countdown right underneath
   already tells the player they're not capped and when the next point
   lands, so dropping the "/max" here on the narrowest phones only loses
   redundant information, never the only copy of it. This is purely a
   display simplification (same spirit as "Collection"->"Den" elsewhere in
   this file) -- if a given device somehow doesn't match this breakpoint,
   the row still never needs to scroll (the flex-basis-0 layout above is
   unconditional), it would just truncate those two pills a little more
   with the existing ellipsis instead. */
@media (max-width: 480px) {
  .wallet-item--stacked small { display: none; }
}

/* --- Desktop/PC topbar (added 2026-10-03, per the user's request: "Para
   pantalla en pc no es necesario que hagas fixed a las dos lineas del
   menu, esto es solo para pantallas de movil y tablet. Lo que sí, la
   segunda línea centrala.") -- everything above this block (the
   equal-division `flex: 1 1 0` packing on `.tabs a`/`.wallet`/
   `.wallet-item` that guarantees zero scroll/wrap at any width) stays
   completely unconditional: it's the mobile/tablet-safe baseline this
   whole topbar is built on, and nothing here removes or weakens that
   guarantee for any device this query fails to match -- a screen this
   query misses on just keeps the same compact-but-safe layout it had
   before, never a broken one. On a screen wide enough that cramming was
   never actually necessary, this relaxes the stretch-to-fill packing
   into each pill/tab sizing to its own natural content width instead,
   and centers the tabs row (second line) as asked, since un-stretched
   tabs would otherwise just bunch up at the row's start. 1025px sits
   above the common tablet-landscape ceiling (~1024px for a landscape
   iPad), so real tablets -- explicitly asked to keep the mobile
   treatment -- stay on the layout above. */
@media (min-width: 1025px) {
  .wallet { flex: 0 1 auto; gap: 10px; }
  .wallet-item { flex: 0 0 auto; padding: 6px 14px; }
  .tabs { justify-content: center; gap: 12px; }
  .tabs a { flex: 0 0 auto; padding: 10px 24px; }

  /* Desktop-only text bump (added 2026-10-03, per the user's request:
     "SOLO para la vista de PC, las letras de menu superior deberian ser
     algo mas grandes" -- a modest increase on top of whatever size this
     same query already landed each element at above, scoped here so it
     can never leak into the mobile/tablet rules those selectors keep
     outside this query. */
  .tabs a { font-size: 15px; }
  .wallet-item { font-size: 17px; }
  .brand-name { font-size: 15px; }
  .brand-mark { font-size: 14px; }

  /* Desktop-only 50% shrink for Summon banners and Story cards (added
     2026-10-03, per the same message: "Los banners de summon, fichas de
     battle y de story, deberian ser 50% mas pequeños [...] Para movil y
     tablet mantener todo como está"). Both are unconstrained in width
     outside this query (a .banner-grid-card is `aspect-ratio: 1/1` inside
     a `1fr` grid column, `.story-card` fills `.story-list`'s own width)
     -- on mobile/tablet none of this applies, so those existing rules are
     untouched and still drive every screen below 1025px exactly as
     before. The Battle character-card half of this same request is
     further down this file, right after `.battle-side .char-card`'s own
     unconditional 92px rule -- see the comment there for why it couldn't
     live in this block too. */
  .banner-grid { max-width: 50%; margin: 0 auto; }
  .story-card { max-width: 50%; margin-left: auto; margin-right: auto; }
}

/* User level (added 2026-09-25, per the user's request: "el nivel total...
   deberia aparecer en el menu superior justo antes de los hunkyx, con un
   circulo como fondo" -- sum of every obtained character's Bond level).
   Became a clickable link to the new Home screen 2026-10-01 (see
   views/home.js) -- `cursor`/`text-decoration` added since it's now an
   `<a>` instead of a plain `<span>`, and `.active` mirrors `.news-btn`'s
   own active state for when Home is the current screen. */
.level-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4e4c1, var(--accent-pop) 55%, var(--accent-cool));
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 2px 10px -2px rgba(224,69,95,0.6);
  color: #1a0d10;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s;
}
.level-circle:hover { transform: translateY(-1px); }
.level-circle.active { box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 0 0 2px var(--accent-cool), 0 2px 12px -2px var(--accent-cool); }

.dev-user input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  width: 140px;
}

/* --- Main / views --------------------------------------------------- */
#view {
  flex: 1;
  padding: 20px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  /* Horizontal-scroll guarantee, moved here from html/body 2026-10-04 (see
     the comment on the html, body rule above) -- #view is .topbar's
     sibling, not its ancestor, so clipping overflow here can't interfere
     with the topbar's sticky positioning. */
  overflow-x: hidden;
}

.view-title {
  font-size: 23px;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.view-subtitle { color: var(--text-dim); font-size: 16px; margin: 0 0 20px; font-family: var(--font-body); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

/* --- Collection hero (added 2026-10-01, per the user's request that
   Collection become the home screen again, with "el personaje e imagen
   escogido por el usuario" shown front and center, above the rest of the
   collection grid -- see views/collection.js > heroSection()). Two columns
   on wide screens (portrait left, name/quote/actions right); stacks to one
   column on narrow ones via the shared mobile media query at the bottom of
   this file. */
.collection-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.collection-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent-pop) 16%, transparent), transparent 55%),
              radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--accent-cool) 14%, transparent), transparent 55%);
  pointer-events: none;
}
.hero-portrait-click { cursor: pointer; flex-shrink: 0; position: relative; z-index: 1; }
.hero-portrait-wrap .portrait {
  width: 220px;
  max-width: 40vw;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5);
  transition: transform 0.15s ease-out;
}
.hero-portrait-click:hover .hero-portrait-wrap .portrait { transform: translateY(-2px) scale(1.015); }
.hero-info { position: relative; z-index: 1; min-width: 0; }
.hero-name {
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 700;
  margin: 8px 0 0;
  letter-spacing: 0.5px;
}
.hero-sub { color: var(--text-dim); font-size: 15px; text-transform: uppercase; letter-spacing: 0.8px; margin-top: 2px; }
.hero-quote {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 18px;
  line-height: 1.45;
  margin: 14px 0 16px;
  max-width: 48ch;
  background: linear-gradient(90deg, var(--accent-pop), var(--accent-cool));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .hero-quote { color: var(--text); }
}
.hero-detail-btn { margin-top: 2px; }

/* --- Collection sort/group toolbar (added 2026-09-25, per the user's
   request: "quiero que añadas un filtro en el que poder ordenar a los
   personajes por Nivel/Rareza/Bond, o incluso organizarlos por tipo") --- */
.collection-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 14px; }
.toolbar-field { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.toolbar-field select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-family: var(--font-body);
  font-size: 14px;
  text-transform: none;
  letter-spacing: normal;
}
.collection-group-header {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin: 18px 0 10px;
}
.collection-group-header:first-child { margin-top: 0; }

/* --- Character card --------------------------------------------------- */
.char-card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  position: relative;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 3px 6px rgba(0,0,0,0.25);
}
.char-card:hover { transform: translateY(-3px); border-color: var(--border-light); }
.char-card.rarity-N { border-color: var(--rarity-n); }
.char-card.rarity-R { border-color: var(--rarity-r); }
.char-card.rarity-SR { border-color: var(--rarity-sr); box-shadow: 0 0 10px -4px var(--rarity-sr), 0 3px 6px rgba(0,0,0,0.25); }
.char-card.rarity-SSR { border-color: var(--rarity-ssr); box-shadow: 0 0 14px -3px var(--rarity-ssr), 0 3px 6px rgba(0,0,0,0.25); }

.char-card .rarity-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  color: #14161a;
}
.rarity-badge.rarity-N { background: var(--rarity-n); }
.rarity-badge.rarity-R { background: var(--rarity-r); }
.rarity-badge.rarity-SR { background: var(--rarity-sr); }
.rarity-badge.rarity-SSR { background: var(--rarity-ssr); }

.char-card .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  margin-top: 8px;
  text-align: center;
  letter-spacing: 0.3px;
}
.char-card .sub { color: var(--text-dim); font-size: 13px; text-align: center; text-transform: uppercase; letter-spacing: 0.5px; }
.char-card .level-pill {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 2px;
}
.char-card .bond-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.char-card .bond-bar-fill { height: 100%; background: var(--accent-2); }

/* XP bar (added 2026-09-25) -- same shape as .bond-bar just above, in the
   brass accent color instead of rust so the two read as distinct at a
   glance. */
.char-card .xp-block { margin-top: 6px; }
.char-card .xp-label {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.char-card .xp-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.char-card .xp-bar-fill { height: 100%; background: var(--accent); }

/* Character-sheet progress bars (added 2026-10-04, per the user's request:
   "en la ficha de personaje coloca una barra de progreso de color azul
   bajo el apartado de XP [...] igual para el bond, pero en este caso será
   de color rojo"). Distinct from .char-card's own compact .xp-bar/.bond-bar
   above (those live on the grid card, in the brass/rust theme colors) --
   these sit inside the detail modal's .stat-row list instead, right under
   the XP/Bond rows, explicitly blue and red as asked, rather than reusing
   the theme accent colors. */
.sheet-progress-row { padding: 2px 0 8px; }
.sheet-progress-label {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-bottom: 3px;
}
.sheet-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.sheet-progress-fill { height: 100%; border-radius: 3px; }
.sheet-progress-fill--xp { background: #3b82f6; } /* blue, per the user's request */
.sheet-progress-fill--bond { background: #dc3737; } /* red, per the user's request */

.char-card.selectable.selected { outline: 2px solid var(--success); outline-offset: 1px; }

/* Locked cards for not-yet-obtained characters on Den (added 2026-10-03,
   per the user's request: "deben aparecer bloqueados tambien las tarjetas
   de los personajes disponibles no obtenidos, blurred de forma que la
   imagen sea poco visible. Haciendo click en ellos un texto indicaría
   cómo obtenerlo" -- see collection.js > lockedCharacterCard()/
   openLockedInfo()). Reuses the normal .char-card shell (rarity border,
   badge, name) so a locked card still reads as "one of the roster", just
   dimmed -- only the portrait itself gets the heavy blur, so it stays
   recognizable as a card without giving away the art underneath. */
.locked-card { cursor: pointer; opacity: 0.82; filter: saturate(0.6); }
.locked-card:hover { opacity: 1; }
.locked-card .name { color: var(--text-dim); }
.locked-portrait-wrap { position: relative; }
.locked-portrait-wrap .portrait {
  filter: blur(7px) brightness(0.4) saturate(0.5);
  transform: scale(1.1); /* hides the blur's soft edge against the frame */
}
.locked-lock-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.85);
  pointer-events: none;
}

/* --- Portrait (SVG placeholder, and real CDN photo/video) -------------- */
/* 3:4 portrait frame, used by character cards, the detail modal, Summon
   banner cards and pull-result cards (see portrait.js > portraitImg()).
   object-fit: cover keeps real uploaded art from stretching once it swaps
   in for the placeholder (cdn.js > attachMedia()). */
.portrait,
video.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 5px;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset;
}
.modal .portrait { max-width: 220px; margin: 0 auto; }

/* Active-image picker, shown under the portrait in the Collection detail
   modal (added 2026-09-25, per the user's request: "añade para que debajo
   puedas seleccionar qué imagen de las que tenga desbloqueadas del
   personaje quiero dejar activa en la tarjeta del personaje [...] marcar
   con unos circulos rellenos para clickar/hacer tap en ellos"). One filled
   dot per unlocked image (default portrait + unlocked gallery scenes); the
   active one is larger and in the accent color. */
.image-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
}
.image-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  border: 1px solid rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.image-dot:hover { transform: scale(1.15); }
.image-dot.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  transform: scale(1.25);
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.25);
}

/* "★ Feature this character" button, in the Collection detail modal
   (added 2026-10-01) -- see views/collection.js > featureButton(). Plain
   secondary-button look when not featured; a filled gradient pill (same
   accent pair as the hero quote) once it is, so it reads as a clear toggle
   state rather than just another button. */
.feature-btn {
  display: block;
  width: 100%;
  margin: 10px 0 2px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
}
.feature-btn:hover { border-color: var(--accent); }
.feature-btn.featured {
  background: linear-gradient(90deg, var(--accent-pop), var(--accent-cool));
  border-color: transparent;
  color: #14161a;
}

/* --- Panels / cards ----------------------------------------------------- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px;
  margin-bottom: 18px;
}

/* --- Buttons ------------------------------------------------------- */
button, .btn {
  background: linear-gradient(180deg, #c99a2e, var(--accent) 60%, var(--accent-dark));
  color: #1a1408;
  border: 1px solid var(--accent-dark);
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 2px 3px rgba(0,0,0,0.3);
  transition: filter 0.1s, transform 0.05s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
/* `.btn.secondary` (added 2026-10-02, for the Shop's "Buy on Fanvue" <a>
   links -- see views/shop.js > renderHunkyxPackages) mirrors
   button.secondary above for the `.btn` fallback class used on non-<button>
   elements, so an outbound link looks like any other secondary button
   instead of inheriting the louder gold .btn gradient. */
.btn.secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  text-transform: none;
}
button.danger { background: var(--danger); color: var(--text); border-color: #7a332b; }

/* "CTA" button treatment (added 2026-10-01, per the user's request:
   "Botón más redondeado y con gama mas parecida a la del menú más moderno
   actual" for the Summon and Battle buttons) -- pill-shaped, a bit larger,
   and the same raspberry/gold/teal gradient already used by the topbar's
   active tab and the level-circle, instead of the older plain brass
   gradient every other button still uses. `.btn-cta.secondary` is the
   outline/quieter variant (used for Summon x10, next to the filled x1),
   tinted teal instead of just gray so it still reads as part of the same
   family. */
.btn-cta {
  border-radius: 999px;
  padding: 13px 26px;
  font-size: 16px;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--accent-pop), var(--accent) 60%, var(--accent-cool));
  color: #1a0d10;
  border: 1px solid transparent;
  box-shadow: 0 3px 14px -3px rgba(224,69,95,0.55), 0 1px 0 rgba(255,255,255,0.3) inset;
}
.btn-cta:hover { filter: brightness(1.08); }
.btn-cta.secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--accent-cool);
  box-shadow: 0 0 0 1px rgba(45,212,191,0.15) inset;
}

/* HunxBar's Summon x1/x10 actions (added 2026-10-03, per the user's
   request: "Aumenta también el tamaño de los botones de summon,
   centralos, y separalos un poco del ultimo banner"). A `.btn-cta`
   modifier (not a blanket `.btn-cta` size bump -- Battle's "Start
   battle" button uses the same base class and wasn't part of this
   request) plus a dedicated wrapper that centers the pair and adds
   breathing room above, where the wrapper used to be an inline
   `display:flex` style with no top margin at all. */
.summon-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}
/* Shrunk 2026-10-03 per the user's request: "Los botones de summon deben ser
   un poco más pequeños para que quepan en una sola línea" -- at narrow mobile
   widths (the smallest common phone width, 360px, has even less content
   width once the screen's side padding is subtracted) the previous
   padding/font-size (17px 38px / 19px) made "SUMMON X1" + "SUMMON X10"
   together wider than the available width, so .summon-actions wrapped them
   onto two lines. A first trim to 13px/22px/16px still wrapped at
   360-375px (verified with Playwright), so trimmed further here. Tested
   with Playwright at 360/375/390/414/768px: both buttons now share one row
   at every width, with no page-level horizontal scroll introduced, while
   staying well above the ~40px minimum comfortable tap-target height. */
.btn-summon {
  padding: 11px 16px;
  font-size: 14px;
}

/* --- Gacha view ------------------------------------------------------- */
/* The banner selector has gone through a few shapes: a flat click-to-select
   grid, then a 1:1 swipe carousel, now (2026-10-02) a static 3-row grid --
   see the .banner-grid-section/.banner-grid/.banner-grid-card block further
   down this file. */

.pull-results-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.pull-results-actions .sub { font-size: 14px; }
.pull-results { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* Each pull result appears in sequence (staggered via inline animation-delay,
   see gacha.js), sealed shut, and has to be clicked to reveal -- or revealed
   all at once with the "Open All" button. Built as a 3D flip card: only the
   back face sits in normal flow (so it defines the card's height from its
   real content), the front face is absolutely positioned to match it exactly
   -- a standard flip-card technique that avoids hardcoding a height. */
.pull-result-card {
  width: 130px;
  perspective: 900px;
  animation: pop-in 0.4s ease-out both;
}
.flip-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.34, 0.2, 0.22, 1);
  cursor: pointer;
}
.flip-inner.revealed { transform: rotateY(180deg); cursor: default; }

.flip-front, .flip-back {
  backface-visibility: hidden;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elevated));
  padding: 10px;
  text-align: center;
  overflow: hidden;
}
.flip-back { position: relative; transform: rotateY(180deg); }
.flip-back .item-icon { width: 44px; height: 44px; font-size: 28px; margin: 0 auto; }
.flip-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
/* N/R border colors added 2026-10-03, per the user's request: "elimina
   todo el texto anterior al lv [en Item Summon] [...] Para el caso de los
   summons de personajes, igual elimina el texto de la rareza, ya se
   indica con el color (bordea la tarjeta con el color que le corresponde,
   como haces con los ssr y sr)" -- before this, only SR/SSR flip-back
   cards got a rarity-colored border (N/R stayed on the neutral default
   border), so a plain-border card was ambiguous between "N" and "R" once
   the text label was removed. Extended to all four rarities so the
   border alone always identifies the rarity, same pattern already used
   on `.char-card`/`.inventory-item`/`.shop-item` elsewhere in the game. */
.pull-result-card.rarity-N .flip-back { border-color: var(--rarity-n); }
.pull-result-card.rarity-R .flip-back { border-color: var(--rarity-r); }
.pull-result-card.rarity-SSR .flip-back { border-color: var(--rarity-ssr); box-shadow: 0 0 14px -3px var(--rarity-ssr); }
.pull-result-card.rarity-SR .flip-back { border-color: var(--rarity-sr); }

.seal-icon { font-size: 28px; color: var(--accent); position: relative; text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.seal-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; position: relative; text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.seal-glow {
  position: absolute; inset: -30%;
  background: radial-gradient(circle, rgba(184,134,11,0.4), transparent 68%);
  animation: seal-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes seal-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* Real card-back art, if uploaded to the CDN (added 2026-09-30) -- see
   cdn.js > applyCardBack(). The glow/icon above stay on top as a tinted
   overlay (their own text-shadow keeps the icon/label legible over any
   artwork); this just swaps the flat placeholder gradient for the image. */
.flip-front.has-card-back { background-size: cover; background-position: center; }

/* Special pre-reveal glow for a high-rarity pull (added 2026-09-30, per
   the user's request: "una animación especial si aparece una carta de
   rareza SSR o mayor, haciendo que la carta brille incluso antes de darle
   la vuelta"). gacha.js adds `ssr-tease` to the card for any rarity in
   its TEASE_RARITIES set (SSR today) and removes it the instant the card
   is revealed, handing off to the existing `burst-ssr` flash below. The
   halo ring lives on `.pull-result-card` itself, not the flip faces
   (which clip with overflow:hidden), so it can glow past the card's
   edges. */
.pull-result-card.ssr-tease { position: relative; }
.pull-result-card.ssr-tease::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 12px;
  background: conic-gradient(from 0deg, transparent, var(--rarity-ssr), transparent 35%, transparent 65%, var(--rarity-ssr), transparent 100%);
  animation: ssr-halo-spin 2.2s linear infinite;
  filter: blur(5px);
  opacity: 0.85;
  z-index: -1;
  pointer-events: none;
}
@keyframes ssr-halo-spin {
  to { transform: rotate(360deg); }
}
.pull-result-card.ssr-tease .seal-glow {
  background: radial-gradient(circle, rgba(242,118,46,0.8), transparent 70%);
  animation: seal-pulse-ssr 1s ease-in-out infinite;
}
.pull-result-card.ssr-tease .seal-icon { color: var(--rarity-ssr); }
@keyframes seal-pulse-ssr {
  0%, 100% { opacity: 0.55; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.25); }
}

/* One-shot light sweep across the back face right as it's revealed. */
.shine-sweep {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.6) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: shine-sweep-move 0.9s ease-out 0.28s 1;
  pointer-events: none;
}
@keyframes shine-sweep-move {
  to { transform: translateX(130%); }
}

/* Extra burst of light on reveal, scaled by rarity. */
.pull-result-card.burst-ssr .flip-back { animation: burst-flash-ssr 0.9s ease-out 0.28s; }
.pull-result-card.burst-sr .flip-back { animation: burst-flash-sr 0.9s ease-out 0.28s; }
@keyframes burst-flash-ssr {
  0% { box-shadow: 0 0 0 0 var(--rarity-ssr); }
  35% { box-shadow: 0 0 46px 12px var(--rarity-ssr); }
  100% { box-shadow: 0 0 14px -3px var(--rarity-ssr); }
}
@keyframes burst-flash-sr {
  0% { box-shadow: 0 0 0 0 var(--rarity-sr); }
  35% { box-shadow: 0 0 28px 6px var(--rarity-sr); }
  100% { box-shadow: none; }
}

@keyframes pop-in {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.tag-dup { font-size: 12px; color: var(--accent-2); }
.tag-pity { font-size: 12px; color: var(--rarity-ssr); }

/* --- HunxBar banner grid (reworked 2026-10-02, replacing the swipe/
   scroll-snap carousel that used to live here, per the user's request:
   "quitemos el slide, mejor deja los banners fijos, pero agrupamos en 3
   filas de dos columnas. la primera fila FEATURED BANNER. la segunda fila
   STANDARD HUNKX BANNER. la tercera STANDARD ITEM BANNER" -- show every
   banner at once, statically, grouped into 3 labeled rows by category,
   each row a fixed 2-column grid so two banners fit side by side. No
   scroll-snap/arrows/dots/index state any more -- see gacha.js: clicking
   a card just sets state.selectedId directly and toggles `.active` on
   it.

   Redesigned again 2026-10-03, per the user's request: "los banners
   deberian tener relación 1:1 y ser más grandes [...] En el banner que
   aparezca solo la imagen y sobre ella el titulo. El texto de info y
   rates de summon debería aparecer en un pequeño popup sobre un botoncito
   de (i)". The card goes back to a forced 1:1 square (safe to do now,
   unlike the 2026-10-02 attempt that had to remove it -- see the kept
   note above for why -- because the card's visible face no longer holds
   any text content that could overflow a square: the subtitle/cost/pity
   lines that used to sit on the card moved into the new info popup
   below, see gacha.js > openBannerInfo()). The character portrait (or,
   for a banner with no photo, a gradient icon tile -- see
   .banner-art-fallback below) is stretched edge-to-edge as the card's
   full background via `position:absolute; inset:0`, with just the title
   floating over a bottom gradient scrim and a small circular (i) button
   over the top corner -- both added after the art in DOM order so they
   paint above it with no z-index needed. */
.banner-grid-section { margin: 0 0 16px; }
.banner-grid-section__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 8px;
}
.banner-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.banner-grid-card {
  position: relative;
  /* 4:3 instead of a square (changed 2026-10-04, per the user's request:
     "Manteniendo el tamaño, hagamos mejor que los banners de summon y de
     battle sean relacion 4:3") -- width is still whatever the 2-column
     .banner-grid gives each card (unchanged), only the HEIGHT now follows
     from that width at 4:3 instead of 1:1, so cards get shorter/wider
     instead of square. Shared by both Summon banners (gacha.js >
     bannerCard) and the Battle mode-select cards (battle.js > modeCard,
     .battle-mode-card reuses this exact class -- see its own comment
     further down), so one change covers both as asked. */
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.banner-grid-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 0 24px -8px var(--accent);
}
/* Portrait (or swapped-in real CDN photo) fills the square edge-to-edge,
   overriding the shared `.portrait` rule's own `width:100%; aspect-ratio:
   3/4` framing -- `object-fit: cover` crops instead of letterboxing, same
   as every other full-bleed use of a photo in this game. */
.banner-grid-card .portrait,
.banner-grid-card video.portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
}
/* Gradient icon tile for a banner with no real photo to show: an item
   banner (always just an emoji, never a character) or a character banner
   with no featured character (full-pool "Standard Summon" -- there's no
   single portrait that would represent it). */
.banner-art-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
}
.banner-art-fallback.banner-art-item {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 45%, var(--bg-elevated)), var(--bg-card));
}
.banner-art-fallback.banner-art-standard {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-cool) 40%, var(--bg-elevated)), var(--bg-card));
}
/* Grid cell wrapper (added 2026-10-03, per the user's follow-up: "En los
   summons, indica debajo el coste"). The card itself (.banner-grid-card)
   stays a strict 1:1 square with no text of its own besides the title --
   this wrapper just stacks that square plus a small cost caption
   underneath it, so .banner-grid's 2-column grid lays out cells (not bare
   cards) now. See gacha.js > bannerCardWithCost. */
.banner-grid-cell { display: flex; flex-direction: column; }
.banner-cost-caption {
  margin: 6px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.banner-grid-card h3 {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 22px 10px 10px;
  background: linear-gradient(transparent, rgba(8,8,10,0.9) 65%);
  font-size: 14px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
/* (i) info button (added 2026-10-03) -- opens gacha.js > openBannerInfo()
   with the description/featured character/full rates that used to sit
   directly on the card. `stopPropagation` in gacha.js keeps a tap here
   from also selecting the banner underneath it. */
.banner-info-btn {
  position: absolute;
  top: 7px; right: 7px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10,10,12,0.6);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
  /* z-index (added 2026-10-03, alongside the Boss card (i) button below)
     -- .battle-mode-sub's progress pill also sits at the top of the card
     and has its own z-index:1, so without this the pill (added to the DOM
     after this button) would paint over it. */
  z-index: 2;
}
.banner-info-btn:hover { background: rgba(10,10,12,0.8); border-color: rgba(255,255,255,0.7); }
.banner-info-modal { max-width: 360px; }
.banner-info-row { font-size: 14px; margin-top: 8px; line-height: 1.4; }

/* Per-character pull odds table (added 2026-10-03, see gacha.js >
   characterOddsTable()) -- a plain CSS list rather than a real <table>,
   consistent with every other popup in this file, with name left-aligned
   and the percentage right-aligned on the same line. */
.odds-table-title { margin-top: 14px; font-weight: 600; }
.odds-table { margin-top: 4px; max-height: 260px; overflow-y: auto; }
.odds-rarity-header {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  margin: 10px 0 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.odds-rarity-header:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.odds-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 3px 0;
}
.odds-row.featured { color: var(--accent); font-weight: 600; }
.odds-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.odds-pct { flex-shrink: 0; color: var(--text-dim); }
.odds-row.featured .odds-pct { color: var(--accent); }

/* --- Fullscreen pull-results popup (added 2026-10-01, per the user's
   request: "Las tarjetas summoneadas, deben aparecer en pop up con sus
   animaciones, ocupando la pantalla completa, maximo dos filas para
   summonx10. Al cerrarlo queda la pantalla con el resultado de tarjetas
   debajo como tenemos ahora"). `.pull-modal-backdrop` reuses
   `.modal-backdrop` for the fixed overlay + click-outside-closes, and
   `.splash-close` for the round X button -- only the box + grid-layout
   override below are new. The grid is forced to 5 columns so a x10 pull
   always reads as 2 rows, same cards/flip animations as before. ------- */
.pull-modal-backdrop { z-index: 110; }
.pull-modal-box {
  position: relative;
  width: 96vw;
  height: 92vh;
  max-width: 920px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  overflow-y: auto;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 30px rgba(0,0,0,0.5);
}
.pull-modal-box .pull-results {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  flex-wrap: unset;
}
.pull-modal-box .pull-result-card { width: 100%; }

/* --- Battle view ------------------------------------------------------- */
/* Rewritten 2026-10-03, per the user's request: "En battle, ubica el botón
   de lucha arriba. Los personajes aparecerán abajo. Una fila con el
   equipo activo seleccionado, y otra fila debajo en modo slide con todos
   los disponibles, ordenados por rareza y nivel" -- replaces the old
   side-by-side "team picker on the left, stage/fight/log on the right"
   layout (.battle-layout/.battle-main, both removed) with a single
   vertical stack (.battle-layout-v, see battle.js > renderBattle): stage
   picker + fight button (+ the log/result right under the button that
   produced it) on top, then "Your team" (.battle-team-row) and "All
   characters" (.battle-all-row) below. .battle-side is kept as a shared
   base class for both rows' card sizing (also still used standalone
   elsewhere -- .battle-side-title in particular is reused by home.js's
   chat panel and the equip screen's stats panel, so it stays general
   rather than being folded into the battle-specific classes below). */
.battle-layout-v { display: flex; flex-direction: column; }
.battle-top { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 8px; }
.battle-top .stage-picker { margin-bottom: 0; justify-content: center; }
.battle-top .btn-cta { width: 100%; max-width: 320px; }

.battle-side-title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin: 18px 0 8px;
}
.battle-side-title:first-child { margin-top: 0; }

.battle-side .char-card { width: 92px; padding: 6px; }
.battle-side .char-card .name { font-size: 13px; margin-top: 5px; }
.battle-side .char-card .sub { font-size: 11px; }
.battle-side .char-card .level-pill { font-size: 11px; }
.battle-side .char-card .rarity-badge { font-size: 10px; padding: 1px 4px; }
/* Cards not currently in the team sit darker so the active team reads at a
   glance; clicking one into the team brings it back to full brightness
   (the "selected" state is just the card's normal look). */
.battle-side .char-card.selectable.dimmed {
  filter: brightness(0.55) saturate(0.7);
  opacity: 0.85;
  transition: filter 0.15s, opacity 0.15s, transform 0.12s, border-color 0.12s;
}
.battle-side .char-card.selectable.dimmed:hover { filter: brightness(0.8) saturate(0.85); opacity: 1; }
.battle-side .char-card.selectable.selected { outline: 2px solid var(--success); outline-offset: 1px; }

/* "Your team" row -- always 4 slots, dashed placeholders padding out
   whatever's left unselected. Reuses .team-pick's existing wrap/gap. */
.team-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.battle-team-slot-empty {
  width: 92px;
  height: 148px; /* matches a .battle-side .char-card's rendered height */
  border: 2px dashed var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 26px;
  opacity: 0.5;
}

/* Desktop-only 50% shrink for Battle character cards (added 2026-10-03,
   per the user's request: "Los banners de summon, fichas de battle y de
   story, deberian ser 50% mas pequeños [...] Para movil y tablet
   mantener todo como está" -- the Summon-banner/Story-card halves of this
   same request are in the shared @media (min-width: 1025px) block near
   the top of this file). This block has to live HERE instead of up there:
   .battle-side .char-card/.battle-team-slot-empty above are unconditional
   (no media guard) and come LATER in the file than that early block, so
   on an equal-selector-specificity tie CSS cascade order -- not the media
   query -- decides, and the early block's override was silently losing to
   these base rules on every desktop width (confirmed via Playwright:
   char-cards stayed 92px at 1400px viewport until this was moved below
   them). Keeping the override textually after what it overrides avoids
   that trap. */
@media (min-width: 1025px) {
  .battle-side .char-card { width: 46px; padding: 3px; }
  .battle-side .char-card .name { font-size: 11px; margin-top: 4px; }
  .battle-side .char-card .sub { font-size: 9px; }
  .battle-side .char-card .level-pill { font-size: 9px; }
  .battle-side .char-card .rarity-badge { font-size: 8px; padding: 1px 3px; top: 3px; right: 3px; }
  .battle-team-slot-empty { width: 46px; height: 74px; font-size: 16px; }
}

/* "All characters" row -- every owned character, sorted by rarity then
   level, in a single horizontally-sliding strip ("modo slide") instead of
   wrapping, so there's no second scroll axis competing with the page's. */
.battle-all-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.battle-all-row .char-card { flex-shrink: 0; scroll-snap-align: start; }

.stage-picker { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* Custom stage combobox (replaced the native <select> 2026-10-04 -- see
   views/battle.js > stagePickerEl for the full "why" comment). */
.stage-picker-combo { position: relative; display: inline-block; }
.stage-picker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  min-width: 56px;
  justify-content: space-between;
}
.stage-picker-trigger:hover { border-color: var(--accent); }
.stage-picker-caret { color: var(--text-dim); font-size: 11px; }
/* Floating option list -- capped at 3 rows (each ~32px) with its own
   scrollbar, so only the current stage + 2 before it show by default
   ("el actual y dos anteriores") while every stage from 1 to maxStage
   stays reachable by scrolling inside it ("SI permitir hacer scroll"). */
.stage-picker-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 96px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 20px -6px rgba(0,0,0,0.5);
  z-index: 50;
}
.stage-picker-list.open { display: block; }
.stage-picker-option {
  padding: 7px 14px;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
  white-space: nowrap;
}
.stage-picker-option:hover { background: var(--bg-card); }
.stage-picker-option.selected { background: var(--accent); color: #1a0d10; font-weight: 700; }

.battle-log {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  max-height: 340px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.6;
}
.battle-log .line { opacity: 0; animation: fade-in 0.25s forwards; }
@keyframes fade-in { to { opacity: 1; } }
/* Player character names colored by rarity; enemy names stay neutral;
   damage numbers in red; crits in gold. See game/battle.js > seg()/nameSeg()
   for how these classes get attached server-side. */
.battle-log .rarity-N { color: var(--rarity-n); font-weight: 700; }
.battle-log .rarity-R { color: var(--rarity-r); font-weight: 700; }
.battle-log .rarity-SR { color: var(--rarity-sr); font-weight: 700; }
.battle-log .rarity-SSR { color: var(--rarity-ssr); font-weight: 700; }
.battle-log .enemy-name { color: var(--text-dim); font-weight: 600; }
.battle-log .dmg { color: var(--danger); font-weight: 700; }
.battle-log .crit { color: var(--rarity-ssr); font-weight: 700; }
.battle-log .log-win { color: var(--success); font-weight: 700; }
.battle-log .log-loss { color: var(--danger); font-weight: 700; }

.battle-result {
  position: relative;
  overflow: hidden;
  margin-top: 12px;
  padding: 14px 18px;
  border-radius: 6px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.battle-result .result-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.battle-result.win { border-color: var(--rarity-ssr); }
.battle-result.win .result-label { color: var(--rarity-ssr); }
.battle-result.loss { border-color: var(--danger); animation: defeat-shake 0.5s ease-in-out; }
.battle-result.loss .result-label { color: var(--danger); }
.result-fx { position: absolute; inset: -50%; pointer-events: none; }
.result-fx-win { background: radial-gradient(circle, rgba(212,175,55,0.55), transparent 65%); animation: result-burst 1s ease-out both; }
.result-fx-loss { background: radial-gradient(circle, rgba(163,68,58,0.55), transparent 65%); animation: result-burst 0.8s ease-out both; }
@keyframes result-burst {
  from { opacity: 0; transform: scale(0.4); }
  40% { opacity: 1; }
  to { opacity: 0; transform: scale(1.4); }
}
@keyframes defeat-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.rewards-list { display: flex; gap: 14px; margin-top: 10px; font-size: 15px; color: var(--text-dim); flex-wrap: wrap; }

/* Battle animation (added 2026-09-26, rewritten 2026-09-30 into a
   full-screen popup per the user's request: "que cuando se da al boton de
   iniciar la batalla, aparezca como en pop up en pantalla casi completa,
   sobre el fondo del juego, una tarjeta de personaje contra una de
   enemigo (que se vean solo las imágenes)... moviendose golpeándose, y
   añade efectos cuando usan las habilidades. El boton de skip que sea
   visible fácilmente"). Appended straight to <body> by views/battle.js >
   playBattleAnimation, right after the fight resolves and before the
   existing text log/result. Enemy cards have no real art yet (the user
   said they'll add images later), so they reuse the same
   placeholder-portrait pipeline as characters with a neutral palette
   instead of a character's own color. */
.battle-anim-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(ellipse at center, rgba(20,21,24,0.82), rgba(8,9,10,0.96));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px 16px;
  animation: battle-anim-overlay-in 0.25s ease-out;
}
@keyframes battle-anim-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Skip button -- moved 2026-10-02 (per the user's screenshot: circled the
   button sitting fixed in the top-right corner, where it floated over the
   real topbar/wallet bleeding through the semi-transparent overlay behind
   it, and drew an arrow down into the empty space above the duel stage)
   out of `position: fixed` and into the overlay's own centered flex
   column -- it's the first child (see battle.js), so it now sits centered
   at the top, directly above .clash-stage, inside the overlay itself
   rather than overlapping the page behind it. Still large/easy to find,
   per the original "El boton de skip que sea visible fácilmente". */
.battle-anim-skip {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 10px 20px;
  background: linear-gradient(180deg, #d4af6a, var(--accent) 55%, var(--accent-dark));
  border: 1px solid var(--accent-dark);
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* The clash stage: only the two units currently trading blows are shown
   large here (see .clash-portrait-slot.active), facing off with a VS
   marker between them -- "una tarjeta de personaje contra una de
   enemigo". Deliberately no name/rarity text on these, just the
   artwork + a thin HP sliver, per "que se vean solo las imágenes". */
.clash-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 720px;
}
.clash-side { position: relative; flex: 1 1 0; display: flex; justify-content: center; height: min(38vh, 300px); }
.clash-side.enemy { justify-content: center; }
.clash-vs {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  letter-spacing: 2px;
}
.clash-portrait-slot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.clash-portrait-slot.active { opacity: 1; }
.clash-portrait-slot .portrait {
  height: min(34vh, 270px);
  width: auto;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
}
.clash-portrait-slot.rarity-R .portrait { box-shadow: 0 0 0 3px var(--rarity-r), 0 10px 30px rgba(0,0,0,0.55); }
.clash-portrait-slot.rarity-SR .portrait { box-shadow: 0 0 0 3px var(--rarity-sr), 0 10px 30px rgba(0,0,0,0.55); }
.clash-portrait-slot.rarity-SSR .portrait { box-shadow: 0 0 0 3px var(--rarity-ssr), 0 14px 34px rgba(0,0,0,0.6); }
.clash-hp-track { width: min(34vh, 270px); height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset; }
.clash-hp-fill { height: 100%; width: 100%; background: var(--success); transition: width 0.3s ease-out, background-color 0.3s; }
.clash-hp-fill.low { background: var(--danger); }
.clash-portrait-slot.ko { filter: grayscale(1); opacity: 0.3 !important; }

/* Lunge-and-strike: the attacker's whole slot shifts toward the middle of
   the stage and back ("moviendose"), the defender snaps back on impact
   ("golpeándose"). */
.clash-portrait-slot.player.lunge { animation: clash-lunge-player 0.38s ease-out; }
.clash-portrait-slot.enemy.lunge { animation: clash-lunge-enemy 0.38s ease-out; }
@keyframes clash-lunge-player {
  0% { transform: translateX(0) scale(1); }
  45% { transform: translateX(26px) scale(1.04); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes clash-lunge-enemy {
  0% { transform: translateX(0) scale(1); }
  45% { transform: translateX(-26px) scale(1.04); }
  100% { transform: translateX(0) scale(1); }
}
.clash-portrait-slot.impact .portrait { animation: clash-impact 0.32s ease-out; }
.clash-portrait-slot.impact::after {
  content: '';
  position: absolute;
  inset: -6px -6px 34px -6px;
  border-radius: 12px;
  background: rgba(163, 68, 58, 0.35);
  animation: clash-impact-flash 0.32s ease-out forwards;
  pointer-events: none;
}
@keyframes clash-impact {
  0%, 100% { transform: translateX(0); filter: brightness(1); }
  20% { transform: translateX(-10px); filter: brightness(1.5); }
  45% { transform: translateX(8px); }
  70% { transform: translateX(-4px); }
}
@keyframes clash-impact-flash {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Ability-use effect: a bright pulsing ring + a brief scale-up on whoever
   just triggered their skill, per "añade efectos cuando usan las
   habilidades". */
.clash-portrait-slot.skill-pulse .portrait { animation: clash-skill-scale 0.6s ease-out; }
.clash-portrait-slot.skill-pulse::before {
  content: '';
  position: absolute;
  inset: -16px -16px 26px -16px;
  border-radius: 16px;
  box-shadow: 0 0 0 4px var(--accent), 0 0 50px 16px var(--accent);
  animation: clash-skill-burst 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes clash-skill-scale {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes clash-skill-burst {
  0% { opacity: 0; transform: scale(0.85); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.25); }
}

.dmg-popup {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  color: var(--danger);
  text-shadow: 0 2px 4px rgba(0,0,0,0.7);
  pointer-events: none;
  animation: dmg-popup-float 0.7s ease-out forwards;
  z-index: 2;
}
.dmg-popup.crit { color: var(--rarity-ssr); font-size: 29px; }
@keyframes dmg-popup-float {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -30px); }
}

/* Roster strip: every unit on both teams, small, so the player can still
   track whole-team HP while the clash stage above only shows the two
   currently fighting. Image + a thin HP sliver only, no name/rarity text,
   same "solo las imágenes" spirit as the big portraits. */
.battle-anim-roster { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 640px; }
.roster-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.roster-card {
  width: 46px;
  transition: opacity 0.3s, filter 0.3s;
}
.roster-card .portrait { border-radius: 5px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.roster-card.rarity-R .portrait { box-shadow: 0 0 0 2px var(--rarity-r); }
.roster-card.rarity-SR .portrait { box-shadow: 0 0 0 2px var(--rarity-sr); }
.roster-card.rarity-SSR .portrait { box-shadow: 0 0 0 2px var(--rarity-ssr); }
.roster-hp-track { height: 4px; background: var(--border); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.roster-hp-fill { height: 100%; width: 100%; background: var(--success); transition: width 0.3s ease-out, background-color 0.3s; }
.roster-hp-fill.low { background: var(--danger); }
.roster-card.ko { opacity: 0.3; filter: grayscale(1); }

/* --- Gallery view ------------------------------------------------------- */
.gallery-char { margin-bottom: 26px; }
.gallery-char h3 { margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Thumbnail strip (shrunk 2026-09-25, per the user's request: "reduce la
   vista de las imagenes de cada personaje (al menos al 20% del actual), y
   que sea ampliable si se click/tap a su tamaño [original]"). Each scene
   used to render as its own ~160px+ card, close to full screen width on a
   narrow viewport -- now a small filmstrip (image 1 is always the
   character's default portrait, see gallery.js > portraitThumb()) that
   expands via the lightbox below when tapped. */
.gallery-scenes { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery-thumb {
  position: relative;
  width: 72px;
  height: 90px;
  flex: 0 0 auto;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
}
.gallery-thumb.locked { opacity: 0.55; cursor: default; }
.thumb-media { width: 100%; height: 100%; }
.thumb-media > * {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
}
.thumb-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 19px;
  background: rgba(0, 0, 0, 0.55);
  text-align: center;
  padding: 2px;
}
/* Always-visible short requirement label (added 2026-09-25) -- the full
   sentence is still on `title` (hover, desktop), but touch screens have no
   hover, so this small label ("Bond 4") is what makes the requirement
   readable on mobile/tablet without needing to tap-and-guess. */
.thumb-lock-label {
  font-size: 10px;
  line-height: 1.15;
  color: var(--text-dim);
  font-family: var(--font-body);
  letter-spacing: 0.2px;
}

/* --- Gallery lightbox (added 2026-09-25, enlarged to fill the screen
   2026-09-25 per the user's request: "que la imagen se vea a tamaño
   completo de pantalla, adaptado a la pantalla") --------------------------
   `.modal.lightbox-modal` (not just `.lightbox-modal`) so these overrides
   win over the base `.modal` rule (max-width: 480px, background/border/
   padding card look, etc., defined further down) regardless of source
   order -- same specificity would otherwise let whichever rule comes later
   in the file win. No card background/border here on purpose: the image
   itself should read as filling the screen, not sitting inside a panel. */
.modal.lightbox-modal {
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  max-width: 98vw;
  max-height: 98vh;
  width: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}
/* `float: right` (the base .modal-close rule) does nothing on a flex item,
   so pin it as an overlay instead -- consistent top-right "close" corner
   regardless of the (large, variable-aspect-ratio) image beneath it. A
   round dark backdrop keeps it visible over any image content now that
   the modal itself has no background of its own. */
.modal.lightbox-modal .modal-close {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 1;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.25);
}
/* `width`/`height` set to a fixed vw/vh box (not `auto`) on purpose --
   `object-fit: contain` then fits the actual image/video inside that box
   while preserving its aspect ratio, regardless of the source's own
   intrinsic size. This matters because a placeholder SVG portrait/scene
   (no real art uploaded yet) has no explicit width/height of its own, so
   browsers fall back to a small ~113x150px default "natural size" -- with
   `width/height: auto` the image would just render at that tiny default
   and never grow, even though max-width/max-height had plenty of room. A
   real uploaded photo doesn't have this problem (it has real natural
   pixel dimensions), but sizing the box explicitly makes both cases
   behave identically and reliably fill the screen. */
.lightbox-media {
  width: 98vw;
  height: 92vh;
  max-width: 98vw;
  max-height: 92vh;
  border-radius: 4px;
  object-fit: contain;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* --- Character detail modal --------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  /* Narrowed 2026-10-02 (was 20px) to give the widened .modal below a
     little more room on narrow phones. */
  padding: 12px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  /* Widened 2026-10-02 (was 480px), per the user's request to make the
     character sheet "un poco mas ancha" so the 7-slot equip row below
     (.equip-slots, now a single row instead of two columns) has more room
     before it needs to fall back to its own horizontal scroll. Only used by
     the character detail modal in practice (collection.js) -- the other two
     .modal usages (.lightbox-modal / .story-reader) set their own max-width
     and are unaffected. */
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 30px rgba(0,0,0,0.5);
}
.modal-close { float: right; background: none; color: var(--text-dim); padding: 4px 10px; box-shadow: none; border: 1px solid var(--border); }

/* Character-modal prev/next arrows (added 2026-10-03, per the user's
   request: "en la pantalla de personaje, debería haber flechas para pasar
   al siguiente personaje de la lista, o al anterior", illustrated with a
   screenshot showing them sitting outside the modal box, to its left and
   right). `position: fixed` takes them out of `.modal-backdrop`'s flex
   flow entirely, so they don't push or shrink `.modal` -- it stays
   exactly as centered as before; these just float independently at the
   viewport edges, vertically centered. collection.js appends them to
   `.modal-backdrop` AFTER `.modal` in DOM order, so on narrow phones --
   where they sit close enough to overlap the modal's rounded corner --
   they still paint on top of it and stay clickable. */
.modal-nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 101;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
.modal-nav-arrow:hover { background: var(--bg-card); }
.modal-nav-prev { left: 14px; }
.modal-nav-next { right: 14px; }
@media (max-width: 480px) {
  .modal-nav-arrow { width: 36px; height: 36px; font-size: 20px; }
  .modal-nav-prev { left: 4px; }
  .modal-nav-next { right: 4px; }
}

/* Startup announcement popup (added 2026-10-01, per the user's request:
   "saltara un popup (50% de tamano de la pantalla aprox)... Se debera
   poder cerrar con una X en la esquina, o clickando fuera de la imagen").
   `.splash-backdrop` reuses `.modal-backdrop` above for the fixed overlay
   + click-outside-closes behavior (see splash.js) -- only the box/image/
   close-button styling is new. */
.splash-box {
  position: relative;
  width: 50vw;
  max-width: 560px;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 30px rgba(0,0,0,0.5);
}
.splash-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: rgba(20,22,26,0.75);
  color: var(--text);
  border: 1px solid var(--border-light);
  box-shadow: none;
  cursor: pointer;
}
.splash-image {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  cursor: pointer;
}
/* Shown until the real image URL is set (splash.js > SPLASH_IMAGE_URL). */
.splash-image--placeholder {
  aspect-ratio: 16 / 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-pop), var(--accent-cool));
  color: #14161a;
}
.splash-placeholder-glyph { font-size: 44px; }
.splash-placeholder-text { font-size: 15px; font-weight: 600; letter-spacing: 0.3px; }

/* --- News view ------------------------------------------------------- */
.news-list { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.news-card h3 { margin: 0 0 4px; }
.news-date { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.news-card p { margin: 0; color: var(--text); font-size: 16px; line-height: 1.5; }

/* --- Home screen (added 2026-10-01, per the user's request: "al pulsar el
   icono donde aparece el nivel del usuario, te lleve a una pantalla donde
   está la imagen del personaje que elija el usuario [...] con una frase de
   bienvenida sensual [...] un resumen de las imagenes desbloqueadas/
   obtenibles, avance de la batalla, niveles maximos, etc"). See
   views/home.js.
   Reworked 2026-10-01 (later), per the user's follow-up: "el personaje
   elegido debe verse más grande, y que no aparezcan el resto de tarjetas.
   Solo añadir un boton que te lleve a den" -- the old `.home-picker`
   filmstrip is gone (Den has the same picker on every card already), so
   the hero image gets to be the star: 300px -> 420px max-width.
   Reworked AGAIN 2026-10-01 (later still), per: "El personaje se debe ver
   aun mas grande, que ocupe el 85% de la pantalla [...] sin tener que
   desplazar" -- tried as an 85vh (viewport HEIGHT) full-bleed-width block
   first, which the user then corrected: "has ampliado demasiado, ocupa
   el ancho total, te dije 85%" + confirmed directly ("El 85% del ANCHO
   de pantalla, no alto") that the 85% was always about WIDTH, not
   height. `.home-hero` is back to a normal, centered block (no negative
   margin, no forced vh height) capped at `max-width: 85%` of its
   container; the portrait keeps its natural 3:4 ratio (`height: auto`,
   same as everywhere else `.portrait` is used) instead of being cropped
   to fill a fixed box. That alone is what fixes "sin tener que
   desplazar" too -- an 85vh block left only 15% of the screen for the
   chat + stats below it, which is why they needed a scroll to reach;
   an 85%-WIDTH portrait at its natural aspect ratio is a much shorter
   block, leaving real room underneath. The name/phrase/change-button
   still sit in a gradient scrim over the image's bottom edge
   (Grindr/Tinder-profile style) since that part read well and keeps the
   block compact -- `.home-hero` just needs `position: relative` and no
   explicit height for the scrim's `position: absolute` to anchor to the
   image's own (now natural, not forced) rendered height. */
.home-hero {
  position: relative;
  max-width: 85%;
  margin: 8px auto 16px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
}
.home-hero-image-wrap { display: block; }
.home-hero-image-wrap .portrait {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  box-shadow: none;
}
.home-hero-scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 50px 16px 16px;
  background: linear-gradient(180deg, transparent, rgba(10,8,12,0.55) 45%, rgba(10,8,12,0.94));
  text-align: center;
}
.home-hero-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.home-change-btn { margin-top: 14px; }
.home-phrase {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  max-width: 46ch;
  margin: 6px auto 0;
  cursor: pointer;
  background: linear-gradient(90deg, var(--accent-pop), var(--accent-cool));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: opacity 0.15s;
}
.home-phrase:hover { opacity: 0.8; }
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .home-phrase { color: var(--text); }
}

.home-stats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 24px 0; }
.home-stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  min-width: 120px;
  text-align: center;
}
.home-stat-value { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--accent); }
.home-stat-label { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Daily fictional chat (added 2026-10-01, per the user's request: "Añade
   un chat ficticio, en el que aparezca una respuesta a la frase del
   personaje [...] hasta 3 respuestas de botón [...] se añade 10 de bond
   [...] se reinicia diariamente los intentos"). See views/home.js >
   DAY_CHAT_TREES/renderChat and game/chat.js for the daily-reset + bond
   logic.
   Restyled 2026-10-01 (later) into actual chat bubbles ("un aspecto
   visual más de chat tipo grindr [...] debajo del mensaje enviado debe
   aparecer en pequeño '+10 BOND'") -- `.home-chat-transcript` stacks one
   bubble per line already "said" today (the character's opening line,
   then each spent reply + the line it unlocked), `--in`/`--out` mirror
   left/right-aligned incoming/outgoing messages the way any chat app
   does, and `.home-chat-bond-tag` is the small reward label under each
   sent reply. */
.home-chat {
  max-width: 460px;
  margin: 24px auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px;
}
.home-chat .battle-side-title { margin: 0 0 12px; text-align: center; }
.home-chat-transcript { display: flex; flex-direction: column; margin-bottom: 14px; }
.home-chat-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.home-chat-msg--in {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  font-style: italic;
  color: var(--text-dim);
}
.home-chat-msg--out {
  align-self: flex-end;
  background: linear-gradient(90deg, var(--accent-pop), var(--accent) 60%, var(--accent-cool));
  color: #1a0d10;
  border-bottom-right-radius: 4px;
  font-weight: 600;
}
.home-chat-bond-tag {
  align-self: flex-end;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--accent-cool);
  margin: -4px 4px 8px;
}
.home-chat-reply { width: 100%; }
.home-chat-hint { font-size: 13px; color: var(--text-dim); margin-top: 8px; text-align: center; }
.home-chat-done { font-size: 15px; color: var(--text-dim); font-style: italic; text-align: center; }

.modal h2 { text-transform: uppercase; letter-spacing: 0.5px; }
.stat-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.skill-block { margin-top: 12px; padding: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 5px; }
.skill-block b { display: block; font-size: 15px; }
.skill-block p { margin: 4px 0 0; font-size: 14px; color: var(--text-dim); }
/* Moved from the bottom of the character detail modal (after the skill
   blocks) to right under the portrait/name (2026-10-03), per the user's
   request to show it "bajo la imagen". Kept deliberately compact -- small,
   dimmed, italic, tight line-height -- so a 1-2 sentence lore line never
   pushes the stats/equipment section further down than it used to. */
/* white-space: pre-line (added 2026-10-03, alongside the hkxguys.com lore
   rewrite) -- `lore` strings now carry embedded `\n`s for the 3-line
   age/height/weight/profession -- preference -- personality format, and
   without this the browser collapses them into one run-on line. */
.lore-block { margin: 2px 0 14px; font-style: italic; color: var(--text-dim); font-size: 14px; line-height: 1.35; white-space: pre-line; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }

.footer {
  text-align: center;
  padding: 14px;
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  /* Horizontal-scroll guarantee, moved here from html/body 2026-10-04 --
     same reasoning as #view above. */
  overflow-x: hidden;
}

.notice {
  background: rgba(184, 134, 11, 0.12);
  border: 1px solid var(--accent);
  padding: 10px 14px;
  border-radius: 5px;
  font-size: 15px;
  margin-bottom: 16px;
}
.notice.error { background: rgba(163, 68, 58, 0.15); border-color: var(--danger); }

/* --- Story view ------------------------------------------------------- */
.story-list { display: flex; flex-direction: column; gap: 16px; }
.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}
.story-card h3 { margin: 0 0 2px; text-transform: uppercase; letter-spacing: 0.5px; }
/* Character thumbnail cap (added 2026-10-03, per the user's request: "las
   imagenes de personajes deben ser un poco más pequeñas 50% del actual",
   with a screenshot showing Dustin's real uploaded photo rendering at
   near-full card width). The real bug: views/story.js used to set
   `img.style.width = '48px'` directly on the placeholder element, but
   cdn.js > attachMedia() swaps the placeholder out for a brand-new <img>
   once real CDN art loads -- it only carries over the className, not any
   inline style -- so the moment Dustin's actual photo was uploaded, this
   inline-style hack silently stopped applying and the image fell back to
   the base `.portrait { width: 100% }` rule, ballooning to the card's
   full width. Fixed at the CSS layer instead (same scoped-descendant-class
   pattern already used everywhere else real art needs a non-default size
   -- see `.banner-grid-card .portrait`, `.modal .portrait`, etc. -- so it
   can't go stale again on a future swap), and `max-width` always wins over
   the base rule's `width: 100%` without needing `!important`. 50% keeps it
   a reasonably sized thumbnail next to the name/progress text instead of
   either the tiny original 48px icon or the accidental full-bleed photo. */
.story-card .portrait,
.story-card video.portrait {
  max-width: 50%;
  flex-shrink: 0;
}
.story-chapter-list { display: flex; flex-direction: column; gap: 4px; }
.story-chapter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 4px;
}
.story-chapter-row.read { color: var(--text); }
.story-chapter-row.read:hover { background: var(--bg-elevated); }
.story-chapter-row.locked { color: var(--text-dim); opacity: 0.7; }
.modal.story-reader {
  max-width: 560px;
  background-size: cover;
  background-position: center;
  animation: story-modal-in 0.4s ease-out both;
}
@keyframes story-modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.story-modal-backdrop { opacity: 0; animation: fade-in 0.25s ease-out forwards; }
.modal.story-reader[style*="background-image"] {
  background-color: rgba(16, 14, 10, 0.78);
  background-blend-mode: multiply;
}
.story-body { font-size: 16px; line-height: 1.7; color: var(--text); white-space: pre-wrap; }
/* Each sentence fades in on its own, one after another -- see story.js >
   splitIntoLines(). Reuses the same fade-in keyframe as the battle log. */
.story-body .story-line { opacity: 0; animation: fade-in 0.5s ease forwards; }

/* --- Inventory / equipment view ----------------------------------------- */
.equip-character-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.equip-character-row .char-card { width: 84px; padding: 6px; cursor: pointer; }
.equip-character-row .char-card .name { font-size: 13px; margin-top: 5px; }
.equip-character-row .char-card.selected { outline: 2px solid var(--accent); outline-offset: 1px; }

.equip-screen { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }
.equip-layout { display: flex; align-items: center; justify-content: center; width: 100%; }
.equip-portrait-wrap { text-align: center; }
.equip-portrait-wrap .portrait { max-width: 170px; margin: 0 auto; }

/* Single row of all 7 slots (changed 2026-10-02 from two side-by-side 4/3
   columns, per the user's request: "coloca los items en fila de forma que
   quepan todos [...] que no sean mas pequeños" -- their screenshot showed
   the two-column layout looking cramped on a narrow phone). Rather than
   shrinking the 68px slots to force-fit the row, the row scrolls
   horizontally on its own if the widened .modal (see above) still isn't
   wide enough -- same "scroll strip on the component itself" pattern
   already used elsewhere (see the html,body overflow-x comment near the
   top of this file). */
.equip-slots {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 2px 8px;
}
.equip-slot {
  position: relative;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.equip-slot:hover { border-color: var(--border-light); }
.equip-slot .slot-plus { font-size: 18px; color: var(--text-dim); }
.equip-slot .slot-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; line-height: 1.2; padding: 0 2px; }
.equip-slot.filled { border-style: solid; border-color: var(--accent); padding: 4px; }
/* Filled slot shows ONLY the item's art -- no rarity badge/border, no level
   badge (changed 2026-10-02, per the user's request: "los items [...]
   deberia aparecer unicamente la imagen [...] sin rareza tampoco,
   conservando el 1:1" -- name/stats/level/rarity all live in the hover/tap
   popup instead, see tooltip.js). */
.equip-slot.filled .item-icon { width: 100%; height: 100%; font-size: 26px; }
.equip-slot.armed { border-color: var(--success); box-shadow: 0 0 0 2px var(--success) inset; }

.equip-all-btn { margin-top: 4px; }

/* Character stats panel (added 2026-09-25, per the user's request: "en
   esta pantalla deberian verse a la derecha las estadisticas del
   personaje, y el añadido total del equipamiento equipado con +XX en
   verde"). Sits as a 4th flex child alongside the slots/portrait -- wraps
   below them on narrow screens, same as the rest of .equip-layout. */
.equip-stats-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 150px;
}
.equip-stats-panel .battle-side-title { margin: 0 0 8px; }
.stat-row { display: flex; align-items: baseline; gap: 6px; font-size: 15px; padding: 3px 0; }
/* Widened 2026-09-25 (was 34px, sized for "HP"/"ATK"/"DEF"/"SPD") -- the
   renamed stats (Arousal/Dominance/Tightness/Rhythm, see dom.js >
   STAT_LABEL) need room for up to 9 characters ("DOMINANCE"). */
.stat-label { color: var(--text-dim); width: 74px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; }
.stat-value { font-weight: 700; }
.stat-bonus { color: var(--success); font-weight: 700; font-size: 14px; }

.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 10px; }
.inventory-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
}
.inventory-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.inventory-item.rarity-N { border-color: var(--rarity-n); }
.inventory-item.rarity-R { border-color: var(--rarity-r); }
.inventory-item.rarity-SR { border-color: var(--rarity-sr); }
.inventory-item.rarity-SSR { border-color: var(--rarity-ssr); box-shadow: 0 0 10px -4px var(--rarity-ssr); }
.inventory-item .rarity-badge { position: absolute; top: 6px; left: 6px; font-size: 10px; padding: 1px 4px; }
/* Icon fills the whole card -- only the item's art shows (added
   2026-09-25); name/stats/quantity moved into the hover/tap popup. */
.inventory-item .item-icon { width: 100%; height: 100%; font-size: 24px; }

/* Item stat-bonus summary text (added 2026-09-24, per "los items deben dar
   caracteristicas adicionales") -- used on Shop, Inventory and Summon
   (Item Summon reveal) cards. */
.item-stats { font-size: 13px; color: var(--success); font-weight: 600; margin-top: 2px; }

/* Item icon: glyph/emoji placeholder by default, swapped for real CDN art
   (added 2026-09-24) via cdn.js > applyItemIcon -- items/<slug>.png on
   Bunny. .has-art hides the glyph text once the background-image loads so
   there's never a double-render. */
.item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  line-height: 1;
}
/* The glyph is a child span (added 2026-09-25) that applyItemIcon() removes
   outright once real art loads -- see cdn.js for why color:transparent
   alone isn't enough for emoji glyphs. */
.item-icon-glyph { display: inline-block; }

/* Small corner badge for an item instance's level (added 2026-09-25). Sits
   opposite the rarity badge on equip slots / inventory cards. */
.level-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(20,22,26,0.85);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

/* Item stats popup (added 2026-09-25) -- see tooltip.js. Shown on hover
   (desktop) or tap (mobile/tablet) instead of always-visible text on the
   card itself, so equip slots and inventory cards can show just the item's
   art. */
.item-tooltip {
  position: absolute;
  /* Was z-index: 50 -- lower than .modal-backdrop's z-index: 100, so any
     tooltip shown for an item inside the character detail modal (the
     7-slot Equipment row) rendered BEHIND the modal itself, invisible
     except for a sliver peeking out past its edge (reported 2026-10-03
     with a screenshot circling exactly that). A tooltip is meant to float
     above whatever it's describing, in any context it's used from, so
     this is raised above every other overlay in the game (.modal-backdrop
     100, .pull-modal-backdrop 110, the battle animation overlay 200)
     instead of just edging past .modal-backdrop specifically. */
  z-index: 250;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.45);
  min-width: 140px;
  max-width: 220px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s;
}
.item-tooltip.visible { opacity: 1; visibility: visible; }
.item-tooltip .tip-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.item-tooltip .rarity-badge { position: static; margin-bottom: 4px; }
.item-tooltip .tip-stats { font-size: 13px; color: var(--success); font-weight: 600; }
.item-tooltip .tip-slot { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 3px; }
/* Item description text (added 2026-09-26, fixing the "boosters never
   appear anywhere to use" bug) -- boosters have no stat_summary/slot_type,
   so this is the only place their effect text (e.g. "+50 XP") shows up. */
.item-tooltip .tip-desc { font-size: 13px; color: var(--text); margin-top: 4px; line-height: 1.35; }

/* Booster quantity badge (added 2026-09-26) -- same corner-badge treatment
   as .level-badge, opposite corner from the rarity badge, showing "x3" for
   a quantity-based stack instead of a leveled item's "Lv3". */
.quantity-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(20,22,26,0.85);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

/* Boosters section (added 2026-09-26, fixing the "boosters never appear
   anywhere to use" bug -- originally views/inventory.js, moved into the
   Shop 2026-10-01 along with the new Sell section below when the
   standalone Inventory screen was removed). Same card grid as equippable
   items, kept as its own section so it's visible even before a character
   is selected (Combat Elixir doesn't need one). */
.booster-section { width: 100%; max-width: 720px; margin-top: 18px; }
.booster-hint { font-size: 13px; color: var(--text-dim); margin: -4px 0 8px; }

/* "Sell" price badge (added 2026-10-01, Shop sell feature) -- same
   corner-badge treatment as .level-badge/.quantity-badge, but centered
   along the bottom edge of an .inventory-item card instead of a corner,
   showing the half-price refund a click on that card will give back. */
.sell-price {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,22,26,0.85);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

/* --- Click-to-expand item detail popup (added 2026-10-02) -- see
   itemPopup.js. Reuses .modal-backdrop/.modal (the character detail modal's
   overlay + click-outside-to-close); this modifier just keeps it small and
   centered instead of the full card layout. */
.item-popup-modal { max-width: 300px; text-align: center; }
.item-popup-icon-wrap { width: 96px; height: 96px; margin: 0 auto 8px; }
.item-popup-icon-wrap .item-icon { width: 100%; height: 100%; font-size: 40px; border-radius: 8px; }
.item-popup-name { margin: 2px 0; }
.item-popup-price { font-size: 16px; font-weight: 700; margin-top: 6px; }
.item-popup-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.item-popup-actions .row { display: flex; gap: 8px; }
.item-popup-actions .row button { flex: 1; }
.sell-confirm-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

/* --- Resource purchase popup (added 2026-10-04, per the user's request:
   "añade un simbolo '+' al lado del recurso que tambien sirva para comprar
   mas directamente desde ahí [...] escalando el precio segun la cantidad
   marcada con una barra que se puede mover") -- see resourcePurchase.js.
   Reuses .modal-backdrop/.modal/.item-popup-modal (the same compact,
   centered popup as the Buy/Sell item popups) with its own amount/price
   readouts and a themed <input type="range"> slider. ---------------------- */
.resource-buy-amount { font-size: 20px; font-weight: 700; margin-top: 10px; }
.resource-buy-price { font-size: 15px; color: var(--text-dim); margin-top: 2px; }
.resource-buy-slider {
  display: block;
  width: 100%;
  margin: 14px 0 4px;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}
.resource-buy-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-cool);
  border: 2px solid var(--bg-elevated);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.resource-buy-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-cool);
  border: 2px solid var(--bg-elevated);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.resource-buy-slider::-moz-range-track { background: var(--border); border-radius: 3px; height: 6px; }

/* "+" buy button next to Energy/Battle Tickets in the topbar (added
   2026-10-04, same request as above) -- an absolutely-positioned corner
   badge on the pill, NOT a normal inline flex child. The wallet row
   (.wallet/.wallet-item, see the "no horizontal scroll" comments further
   up this file) is already tuned down to the pixel to guarantee it never
   scrolls or wraps on the narrowest phones; giving this real inline width
   would eat back into that budget. This way the pill's own flex sizing and
   its ellipsis-truncated number are completely untouched -- the badge just
   floats on top of the pill's corner. */
/* `overflow: visible` overrides the base .wallet-item's `overflow: hidden`
   (used elsewhere purely as the ellipsis-truncation fallback) -- without it
   the "+" badge below, which deliberately sits HALF OUTSIDE this pill's own
   box (top:-6px;right:-6px), would get clipped off and never show up at
   all. Safe to drop here specifically: the flex-basis-0 sizing that
   guarantees no horizontal scroll (see .wallet/.wallet-item comments above)
   is what actually keeps these two pills' short, fixed-format "⚡ 100/100"
   content from overflowing, not this clip -- ellipsis was always just a
   defensive fallback. */
.wallet-item--energy, .wallet-item--tickets { position: relative; overflow: visible; }
.wallet-buy-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--bg-elevated);
  color: #0b0e12;
  font-size: 12px;
  line-height: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  z-index: 2;
  transition: transform 0.12s;
}
.wallet-buy-btn:hover { transform: scale(1.12); }
.wallet-buy-btn--energy { background: var(--accent-cool); }
.wallet-buy-btn--tickets { background: var(--accent-pop); }

/* --- Shop view ------------------------------------------------------- */
.shop-section { margin-bottom: 26px; }
.shop-section h3 {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.shop-item {
  position: relative;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.shop-item.rarity-N { border-color: var(--rarity-n); }
.shop-item.rarity-R { border-color: var(--rarity-r); }
.shop-item.rarity-SR { border-color: var(--rarity-sr); }
.shop-item.rarity-SSR { border-color: var(--rarity-ssr); box-shadow: 0 0 10px -4px var(--rarity-ssr); }
.shop-item .item-icon { width: 42px; height: 42px; font-size: 26px; margin-top: 4px; }
.shop-item .item-name { font-weight: 600; font-size: 15px; }
.shop-item .item-desc { font-size: 13px; color: var(--text-dim); min-height: 28px; }
.shop-item .item-price { font-size: 15px; font-weight: 700; margin-top: 2px; }
.shop-item .item-price.hunkyx { color: var(--accent); }
.shop-item .item-price.coins { color: var(--text); }

/* Icon-only buy-catalog cards (added 2026-10-02, per the user's request:
   "los items, tanto en tienda como equipo, debería aparecer unicamente la
   imagen [...] conservando el 1:1" -- rarity/name/desc/price all moved into
   the click-triggered popup, see itemPopup.js) -- a smaller square tile
   instead of .shop-item's default name/desc/price card. Only the Hunkyx
   real-money packages (.hunkyx-package-card) keep the old always-visible
   card layout, since those aren't catalog items with a popup. */
.shop-grid.icon-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.shop-item.icon-only {
  padding: 0;
  aspect-ratio: 1;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
}
.shop-item.icon-only:hover { border-color: var(--accent); transform: translateY(-2px); }
.shop-item.icon-only .item-icon { width: 100%; height: 100%; font-size: 30px; margin: 0; border-radius: 6px; }
.shop-item button { margin-top: 6px; width: 100%; }

/* --- Mobile layout (added 2026-10-01, per the user's request: "en la
   barra superior donde están la moneda y nivel del usuario quiero que
   aparezca arriba del todo en la versión de móvil. Además el logo también
   debe aparecer en la parte superior contra la barra y el menú de opciones
   justo debajo a ser posible en una línea"). First (and only) breakpoint
   in this stylesheet -- nothing was mobile-specific before this. Reorders
   .topbar's existing children with flexbox `order` only (DOM order in
   index.html is untouched): wallet/level first, the brand/logo directly
   under it, then the nav tabs, and the dev-only user switcher last, out of
   the way.
   **Updated 2026-10-01** (per the user's request: "Coloca los menus en dos
   lineas si es necesario, que la pantalla se quede fixed al screen y no
   haya desplazamiento horizontal") -- the tabs row used to be a single
   horizontally-scrollable strip (overflow-x: auto); now it wraps onto a
   second line instead when it doesn't fit, and nothing here scrolls
   sideways at all (see the page-wide overflow-x: hidden rule near the top
   of this file). With the standalone Inventory tab removed the same day,
   six tabs now comfortably fit on two centered rows at phone width.
   **Updated 2026-10-01 again** (per the user's request: "Hxeen debe
   aparecer arriba del todo. Debajo el nivel y monedas, todo ajustado a una
   linea") -- flipped back the other way, gated behind this same
   `max-width: 680px` breakpoint.
   **Updated 2026-10-01 a third time**, and the topbar rules moved OUT of
   this media query entirely -- on a real phone the previous version never
   actually triggered (its effective viewport was wider than 680px, likely
   from a "Desktop site" toggle or similar), so the two-row/single-line
   topbar behavior the user kept asking for just never applied. It's now
   unconditional (see `.topbar`/`.topbar-row1`/`.tabs`/`.wallet` near the
   top of this file) so it can't miss regardless of a device's effective
   width. What's left here is genuinely mobile-only sizing. */
@media (max-width: 680px) {
  /* Collection hero stacks to one column, portrait above info, on narrow
     screens -- see .collection-hero above. */
  .collection-hero { flex-direction: column; text-align: center; }
  .hero-portrait-wrap .portrait { width: 70vw; max-width: 260px; }
  .hero-quote { max-width: 100%; margin-left: auto; margin-right: auto; }

  /* 50vw is too cramped to actually see the image on a phone -- widen the
     startup popup (splash.js) on narrow screens. */
  .splash-box { width: 85vw; }

  .pull-modal-box { width: 98vw; height: 94vh; padding: 14px; }
  .pull-modal-box .pull-results { gap: 6px; }
  .pull-modal-box .flip-front,
  .pull-modal-box .flip-back { padding: 5px; }
  .pull-modal-box .seal-icon { font-size: 18px; }
  .pull-modal-box .seal-label { font-size: 9px; }
  .pull-modal-box .flip-back .item-icon { width: 32px; height: 32px; font-size: 20px; }
}

/* --- Battle mode selector + Boss mode (added 2026-10-03, per the user's
   "Próxima sesión" request). .battle-mode-card reuses .banner-grid-card's
   shape (square art tile, title overlaid at the bottom) -- see the
   .banner-grid-card block above -- with a small top-left pill for the
   cost/lock/piece-progress subtitle, which that base class doesn't have a
   slot for. */
.battle-mode-art { font-size: 54px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 40%, var(--bg-elevated)), var(--bg-card)); }
.battle-mode-sub {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 8, 10, 0.72);
  font-size: 11px;
  text-align: center;
  z-index: 1;
}
/* Makes room on the right for the Boss card's new (i) info button (added
   2026-10-03, per the user's request: "en battle, en las fichas de los
   bosses, añadir un (i) para indicar el drop de fichas del personaje que
   corresponda") -- without this, the pill's own right:8px would run
   under the round button sitting at top:7px/right:7px. `.boss-card` (see
   battle.js > bossCard) is its own extra class so this scoping doesn't
   also shrink the Pub/Boss mode-selector cards above, which share
   .battle-mode-card/.battle-mode-sub but have no info button of their own. */
.boss-card .battle-mode-sub { right: 38px; }
.boss-card-locked { cursor: pointer; opacity: 0.6; filter: grayscale(0.4); }
.boss-card-locked .portrait { filter: blur(2px); }

/* --- Pair Bond cards (added 2026-10-03, per the user's bond-pair request)
   -- a compact header with both characters' tiny portraits side by side,
   reusing .gallery-char/.gallery-scenes/.gallery-thumb for the rest so a
   pair's scene strip looks exactly like a single character's. */
.pair-bond-card { margin-top: 10px; }
.pair-bond-heading { display: flex; align-items: center; }
.pair-bond-mini-portrait { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; border: 1px solid var(--border); }
.pair-bond-mini-portrait .portrait { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto; border-radius: 0; border: none; box-shadow: none; }
.pair-bond-plus { margin: 0 6px; color: var(--text-dim); font-weight: 700; }

/* Clickable home map (added 2026-10-05) -- see views/homeMap.js. Zones are
   %-positioned over a fixed-ratio box so they track the art at any size. */
.home-map-wrap { margin: 0 auto 20px; max-width: 720px; } /* capped so it isn't screen-sized on desktop */
.home-map {
  position: relative;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #1d2a22 center / cover no-repeat;
  touch-action: manipulation;
}
.home-map-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; }
.home-map.has-map-art .home-map-placeholder { display: none; }
.home-map-zone {
  position: absolute;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  box-sizing: border-box;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.home-map-zone:hover, .home-map-zone:focus-visible {
  background: rgba(184,134,11,0.18);
  box-shadow: 0 0 0 2px var(--accent), 0 0 22px -4px var(--accent);
  transform: scale(1.03);
  outline: none;
}
.home-map-label {
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(10,12,16,0.78);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.home-map-pulse {
  position: absolute;
  top: 8px; right: 8px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: home-map-pulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes home-map-pulse {
  0% { box-shadow: 0 0 0 0 rgba(184,134,11,0.7); }
  100% { box-shadow: 0 0 0 12px rgba(184,134,11,0); }
}
.home-map-zone.editing { cursor: move; outline: 2px dashed var(--accent); background: rgba(184,134,11,0.12); touch-action: none; }
.home-map-grip {
  position: absolute; right: -6px; bottom: -6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #1a0d10;
  cursor: nwse-resize; touch-action: none;
}
.home-map-readout {
  width: 100%; box-sizing: border-box; margin-top: 6px;
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-family: monospace; font-size: 11px; padding: 8px;
}
@media (max-width: 480px) { .home-map-label { font-size: 10px; padding: 1px 6px; } }
