/* Pack battles. The first block is the kit every battle module uses (money
   figures, icons, seat avatars); the hall and builder follow it. The table
   lives in css/battle-table.css and the reveal in css/battle-reveal.css. */

/* ---- Kit ------------------------------------------------------------------ */
.bt-coins { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bt-icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.bt-avatar {
  --size: 40px;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: color-mix(in oklab, var(--avatar, var(--gold)) 26%, var(--black));
  box-shadow: inset 0 0 0 2px var(--avatar, var(--gold));
  overflow: hidden;
}
.bt-avatar img { width: 112%; height: 112%; object-fit: contain; }
.bt-avatar.pixel img { image-rendering: pixelated; }
.bt-avatar.is-open {
  background: var(--well); box-shadow: inset 0 0 0 1.5px var(--line-2); color: var(--faint);
}
.bt-avatar.is-open .bt-icon { width: 45%; height: 45%; }

/* ---- Hall and builder -------------------------------------------------------
   /battles is a quick-battle stage (the packs on the playmat) over the public
   tables as hairline rows. /battles/new is a shelf of products with paper
   labels (css/counter.css .shelf-chan) and a lineup tray, then the rules. The
   orange button is the one action per screen. Everything here is scoped to
   #view-battles so it never reaches the table or the reveal. */
#view-battles .hl-hall, #view-battles .hl-builder { position: relative; min-width: 0; }
#view-battles .hl-head { margin: 0 0 22px; }
#view-battles .hl-head .page-title { margin: 0 0 8px; }
#view-battles .hl-lede { margin: 0; max-width: 52ch; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
#view-battles button { font-family: var(--font); }

/* Words with an ink line under the chosen one (the house picker). */
#view-battles .hl-words {
  display: flex; gap: 22px;
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
#view-battles .hl-words::-webkit-scrollbar { display: none; }
#view-battles .hl-word {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 0 12px; border: 0; border-radius: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  scroll-snap-align: start; cursor: pointer; transition: color 0.15s ease;
}
/* Short words ("All") still get a thumb-sized target, reaching into the gap. */
#view-battles .hl-word::before { content: ""; position: absolute; inset: 0 -11px; }
#view-battles .hl-word:hover:not(:disabled) { color: var(--ink); }
#view-battles .hl-word:disabled { color: var(--faint); cursor: default; }
#view-battles .hl-word.on { color: var(--ink); }
#view-battles .hl-word.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink);
}
#view-battles .hl-sym { display: block; width: auto; height: 15px; max-width: 32px; object-fit: contain; opacity: 0.7; }
#view-battles .hl-word.on .hl-sym { opacity: 1; }

/* A square segmented control: a sunk track, a raised square. */
#view-battles .hl-seg {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: var(--r-sm); background: var(--well);
}
#view-battles .hl-seg button {
  flex: 1 1 0; min-width: 44px; min-height: 38px; padding: 6px 10px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
#view-battles .hl-seg button:hover { color: var(--ink); }
#view-battles .hl-seg button.on {
  background: var(--surface-3); color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
#view-battles .hl-seg.is-wide { display: flex; width: 100%; }
@media (max-width: 720px) { #view-battles .hl-seg button { min-height: 44px; } }
#view-battles .hl-seg.is-wide button { padding: 6px 4px; white-space: nowrap; font-size: 13.5px; }

/* Skeleton lines while something loads. */
#view-battles .hl-skel-line {
  display: inline-block; width: 56%; height: 12px; border-radius: 4px;
  background: var(--surface-2); vertical-align: middle;
  animation: hl-breathe 1.4s ease-in-out infinite;
}
#view-battles .hl-skel-line.wide { width: 82%; }
#view-battles .hl-skel-line.short { width: 48px; }
@keyframes hl-breathe { 50% { opacity: 0.45; } }

/* ---- Product art ------------------------------------------------------------ */
#view-battles .hl-art { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; }
#view-battles .hl-art img {
  display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain;
  -webkit-user-drag: none; user-select: none;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.5)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}
#view-battles .hl-art.is-fan { width: 100%; }
#view-battles .hl-art.is-fan > span { display: block; height: 92%; width: 38%; margin: 0 -8%; transform-origin: 50% 100%; }
#view-battles .hl-art.is-fan > span:nth-child(1) { transform: rotate(-10deg) translateY(3%); }
#view-battles .hl-art.is-fan > span:nth-child(2) { z-index: 1; height: 100%; }
#view-battles .hl-art.is-fan > span:nth-child(3) { transform: rotate(10deg) translateY(3%); }
#view-battles .hl-art.is-fan img { width: 100%; height: 100%; object-position: bottom center; }
#view-battles .hl-art.is-ghost { width: 46%; margin: auto; border-radius: 10px; background: var(--surface); }

/* A lineup as a stack of wrappers and boxes, the last one in front. */
#view-battles .hl-stack {
  --h: 58px;
  position: relative; display: block; flex: none;
  width: calc(var(--h) * 0.95); height: var(--h);
}
#view-battles .hl-stack.is-empty { border-radius: var(--r-sm); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); width: calc(var(--h) * 0.66); margin-inline: auto; }
#view-battles .hl-stack > span {
  position: absolute; left: 50%; bottom: 0; height: 100%; width: 100%;
  display: flex; align-items: flex-end; justify-content: center;
  transform: translateX(-50%); transform-origin: 50% 100%;
}
#view-battles .hl-stack > span.is-pack { width: 62%; }
#view-battles .hl-stack > span.is-box { height: 74%; width: 92%; }
#view-battles .hl-stack img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55));
}
#view-battles .hl-stack.n2 > span:nth-child(1) { transform: translateX(-72%) rotate(-9deg); }
#view-battles .hl-stack.n2 > span:nth-child(2) { transform: translateX(-32%) rotate(5deg); }
#view-battles .hl-stack.n3 > span:nth-child(1) { transform: translateX(-84%) rotate(-12deg); }
#view-battles .hl-stack.n3 > span:nth-child(2) { transform: translateX(-50%) translateY(-3%); }
#view-battles .hl-stack.n3 > span:nth-child(3) { transform: translateX(-16%) rotate(11deg); }

/* ---- The quick-battle stage ------------------------------------------------- */
#view-battles .hl-quick { margin-bottom: 44px; }
#view-battles .hl-quick-inner { position: relative; }
#view-battles .hl-stage {
  position: relative; height: 214px; overflow: hidden;
  display: grid; place-items: center;
  border-radius: 18px; background: url("../../assets/textures/neoprene.png"), var(--mat);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 3px 4px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.3);
}
#view-battles .hl-stage::after {
  /* the playmat's stitched edge */
  content: ""; position: absolute; inset: 5px; z-index: 0; border: 1px dashed rgba(220, 220, 214, 0.22); border-radius: 14px; pointer-events: none;
}
#view-battles .hl-stage::before {
  /* the pack's pool of light on the table */
  content: ""; position: absolute; left: 50%; bottom: 8px; width: 62%; height: 28px;
  border-radius: 50%; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgb(var(--ambient) / 0.16), transparent);
  pointer-events: none;
}
#view-battles .hl-kicker {
  position: absolute; left: 16px; top: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
#view-battles .hl-change {
  position: absolute; right: 8px; top: 4px; z-index: 2;
  min-height: 44px; padding: 8px 8px; border: 0; background: none;
  color: var(--ink); font-size: 13px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--faint);
  cursor: pointer;
}
#view-battles .hl-change:hover, #view-battles .hl-change[aria-expanded="true"] { text-decoration-color: var(--ink); }
#view-battles .hl-arrow {
  position: absolute; top: 50%; z-index: 2;
  display: grid; place-items: center; width: 44px; height: 44px; margin-top: -22px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
#view-battles .hl-arrow:hover { background: var(--surface-2); color: var(--ink); }
#view-battles .hl-arrow:active { transform: scale(0.94); }
#view-battles .hl-arrow .bt-icon { width: 22px; height: 22px; }
#view-battles .hl-arrow.is-prev { left: 6px; }
#view-battles .hl-arrow.is-next { right: 6px; }
#view-battles .hl-arrow.is-next .bt-icon { transform: scaleX(-1); }
#view-battles .hl-pack {
  position: relative; display: flex; align-items: stretch; justify-content: center; width: 70%; height: 178px; margin-top: 8px;
  will-change: transform;
}
#view-battles .hl-pack-art {
  position: relative; height: 100%; max-width: 100%; display: flex; align-items: flex-end; justify-content: center;
  animation: hl-float 7s ease-in-out 1s infinite;
}
#view-battles .hl-pack-art .hl-art.is-pack { height: 100%; rotate: -4deg; }
/* Tight shadows: a long blur is clipped to the image box and shows as a hard-edged slab on the mat. */
#view-battles .hl-pack-art .hl-art.is-pack img {
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.55)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
#view-battles .hl-pack-art .hl-art.is-box { height: 88%; }
/* The battles mark on the stage: two wrappers clashing (css/pages/casino.css
   .cs-art-clash). The box sets the size; the shadow on the table is the stage's own. */
#view-battles .hl-pack-art .cs-art-clash { --s: 178px; max-width: 100%; }
#view-battles .hl-pack-art .cs-art-clash .cs-art-shadow { display: none; }
#view-battles .hl-pack-art .cs-art-clash .cs-clash-pack img {
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.55)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
#view-battles .hl-pack-art .hl-art.is-fan { height: 94%; width: 230px; max-width: 100%; }
/* A sweep of light across the wrapper, masked to its outline (fx.js sets
   --pack-mask). The band moves by transform on a sibling of the shadowed img. */
#view-battles .hl-glint {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden;
  pointer-events: none; mix-blend-mode: overlay; rotate: -4deg;
  -webkit-mask: var(--pack-mask, none); mask: var(--pack-mask, none);
  opacity: 0;
}
#view-battles .hl-pack-art:has(.is-pack) .hl-glint { opacity: 1; }
#view-battles .hl-glint::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 300%;
  background: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.6) 48.5%, rgba(255, 255, 255, 0.3) 51.5%, transparent 60%);
  transform: translateX(-73.333%);
  animation: hl-glint 7s ease-in-out 0.8s infinite;
}
@keyframes hl-glint { 0% { transform: translateX(-73.333%); } 26%, 100% { transform: translateX(40%); } }
@keyframes hl-float { 50% { translate: 0 -6px; } }
/* The entrance: the pack drops onto the table and settles. */
#view-battles .hl-stage.is-entering .hl-pack { animation: hl-settle 0.95s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; }
#view-battles .hl-stage.is-entering .hl-stage-shadow { animation: hl-fade 0.8s ease both; }
@keyframes hl-settle {
  0% { opacity: 0; transform: translateY(46px) rotate(-7deg) scale(0.88); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes hl-fade { from { opacity: 0; } }
#view-battles .hl-quick.is-new .hl-quick-body > * { animation: hl-fade 0.5s ease both; }

#view-battles .hl-quick-body { padding: 18px 2px 4px; }
#view-battles .hl-quick-name {
  margin: 0; font-size: 21px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em;
  font-variation-settings: "opsz" 96; text-wrap: balance;
}
#view-battles .hl-quick-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  margin: 6px 0 0; font-size: 13px; color: var(--muted);
}
#view-battles .hl-quick-meta .hl-sym { height: 14px; opacity: 0.85; }
#view-battles .hl-quick-meta .hl-sym + span { margin-left: -4px; }
#view-battles .hl-quick-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 14px 0 12px;
}
#view-battles .hl-field { display: grid; gap: 6px; }
#view-battles .hl-field > span, #view-battles .hl-entry > span { font-size: 13px; font-weight: 500; color: var(--muted); }
#view-battles .hl-field .hl-seg button { min-width: 46px; }
#view-battles .hl-entry { display: grid; gap: 4px; justify-items: end; text-align: right; }
#view-battles .hl-entry-fig { font-size: 22px; font-weight: 650; line-height: 1.1; letter-spacing: -0.01em; min-height: 26px; }
#view-battles .hl-entry-fig .hl-skel-line { width: 84px; height: 18px; }
#view-battles .hl-quick-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#view-battles .hl-quick-actions .solid { min-width: 0; }
#view-battles .hl-build { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
#view-battles .hl-note {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 0;
  font-size: 13px; line-height: 1.4; color: var(--muted);
}
#view-battles .hl-note .bt-icon { width: 16px; height: 16px; color: var(--ink-2); }
#view-battles .hl-msg {
  margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink); font-size: 14px; line-height: 1.45;
}
#view-battles .hl-msg[hidden], #view-battles .hl-tray-note[hidden] { display: none; }

/* The product picker under the stage: sets as words, that set's products as a
   shelf of flat tiles. */
#view-battles .hl-picker { padding: 4px 0 6px; }
#view-battles .hl-picker[hidden] { display: none; }
#view-battles .hl-picker-sets { margin-bottom: 14px; }
#view-battles .hl-picker-shelf {
  display: flex; gap: 8px;
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 6px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter); scrollbar-width: none;
}
#view-battles .hl-picker-shelf::-webkit-scrollbar { display: none; }
#view-battles .hl-mini {
  flex: none; display: grid; grid-template-rows: 92px auto auto; gap: 8px;
  width: 132px; padding: 12px 10px 10px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--ink-2); text-align: left; cursor: pointer; scroll-snap-align: start;
  transition: color 0.15s ease;
}
#view-battles .hl-mini:hover { color: var(--ink); }
#view-battles .hl-mini.on { border-bottom-color: var(--ink); color: var(--ink); }
#view-battles .hl-mini-art { display: block; height: 92px; transition: transform 0.2s var(--ease-out); }
#view-battles .hl-mini:active .hl-mini-art { transform: scale(0.95); }
#view-battles .hl-mini-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  min-height: 2.5em; font-size: 13px; font-weight: 600; line-height: 1.25;
}
#view-battles .hl-mini-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 13px; }
#view-battles .hl-mini-foot small { color: var(--muted); font-size: 12px; white-space: nowrap; }
#view-battles .hl-picker-empty { margin: 0; padding: 14px 0; color: var(--muted); font-size: 14px; }

/* The face-off around the pack: you in one corner, the bots in the other. */
#view-battles .hl-you, #view-battles .hl-bots {
  position: absolute; bottom: 12px; z-index: 2; display: inline-flex; align-items: center;
}
#view-battles .hl-you { left: 16px; }
#view-battles .hl-bots { right: 16px; flex-direction: row-reverse; }
#view-battles .hl-duel { --size: 34px; box-shadow: inset 0 0 0 2px var(--avatar, var(--gold)), 0 0 0 3px var(--black); }
#view-battles .hl-duel.is-open { box-shadow: inset 0 0 0 1.5px var(--line-2), 0 0 0 3px var(--black); }
#view-battles .hl-bots .hl-duel + .hl-duel { margin-right: -9px; }

/* ---- Tables ------------------------------------------------------------------ */
#view-battles .hl-tables { display: grid; gap: 36px; margin-bottom: 40px; }
#view-battles .hl-sec { min-width: 0; }
#view-battles .hl-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 6px; }
#view-battles .hl-sec-head h2 {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -0.02em;
}
#view-battles .hl-sec-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#view-battles .hl-dot {
  position: relative; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
}
#view-battles .hl-dot.is-off { background: var(--faint); }

#view-battles .hl-rows { display: grid; }
#view-battles .hl-row {
  position: relative;
  display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  margin: 0 -10px; padding: 14px 10px;
  border-radius: var(--r-sm); color: inherit; text-decoration: none;
  transition: background 0.15s ease;
}
#view-battles .hl-row + .hl-row::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line);
}
#view-battles .hl-sec-head + .hl-rows > .hl-row:first-child::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line);
}
#view-battles a.hl-row:hover { background: var(--surface); }
#view-battles a.hl-row:active { background: var(--surface-2); }
#view-battles a.hl-row:active .hl-stack { transform: scale(0.96); }
#view-battles .hl-row .hl-stack { --h: 60px; margin-inline: auto; transition: transform 0.2s var(--ease-out); }
#view-battles .hl-row-main { display: grid; gap: 5px; min-width: 0; }
#view-battles .hl-row-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font-size: 15px; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em;
}
#view-battles .hl-row-rules {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px;
  font-size: 13px; line-height: 1.3; color: var(--muted);
}
#view-battles .hl-row-rules::first-letter { text-transform: uppercase; }
#view-battles .hl-flag { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-2); }
#view-battles .hl-flag .bt-icon { width: 13px; height: 13px; }
#view-battles .hl-row-side {
  display: grid; justify-items: end; gap: 6px; text-align: right;
  font-size: 15px;
}
#view-battles .hl-row-side small { font-size: 12px; color: var(--muted); white-space: nowrap; }
#view-battles .hl-faces { display: inline-flex; align-items: center; }
#view-battles .hl-row-main > .hl-faces, #view-battles .hl-winner { margin-top: 3px; }
#view-battles .hl-face { --size: 26px; }
#view-battles .hl-faces > .hl-face + .hl-face { margin-left: -5px; }
#view-battles .hl-faces > .hl-face { box-shadow: inset 0 0 0 2px var(--avatar, var(--gold)), 0 0 0 2px var(--black); }
#view-battles .hl-faces > .hl-face.is-open { box-shadow: inset 0 0 0 1.5px var(--line-2), 0 0 0 2px var(--black); }
#view-battles .hl-vs { margin: 0 6px 0 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
#view-battles .hl-seated { margin-left: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#view-battles .hl-row-main > .hl-faces:has(+ .hl-seated) { display: inline-flex; }
#view-battles .hl-row.is-open .hl-row-main { grid-template-columns: auto 1fr; }
#view-battles .hl-row.is-open .hl-row-title, #view-battles .hl-row.is-open .hl-row-rules { grid-column: 1 / -1; }
#view-battles .hl-row.is-open .hl-seated { margin-left: 8px; align-self: center; margin-top: 3px; }
#view-battles .hl-take {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--r-sm); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 13.5px; font-weight: 650; color: var(--ink); white-space: nowrap;
  transition: box-shadow 0.15s ease;
}
#view-battles a.hl-row:hover .hl-take { box-shadow: inset 0 0 0 1px var(--ink-2); }
#view-battles .hl-take.is-mine { color: var(--ink-2); }
#view-battles .hl-live-tag { color: var(--ink-2) !important; font-variant-numeric: tabular-nums; }
#view-battles .hl-progress {
  display: block; height: 2px; margin-top: 6px; border-radius: 1px; background: var(--line-2); overflow: hidden; max-width: 220px;
}
#view-battles .hl-progress i {
  display: block; height: 100%; background: var(--ok); transform-origin: left center;
  transition: transform 0.8s var(--ease-out);
}
#view-battles .hl-winner { display: flex; align-items: center; gap: 8px; min-width: 0; }
#view-battles .hl-faces.is-winners { position: relative; }
#view-battles .hl-crown {
  position: absolute; left: 13px; top: -11px; transform: translateX(-50%);
  color: var(--ink); line-height: 0;
}
#view-battles .hl-crown .bt-icon { width: 13px; height: 13px; fill: var(--ink); }
#view-battles .hl-winner-copy { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-2); }
#view-battles .hl-row.is-skel { grid-template-columns: 62px minmax(0, 1fr) 60px; }
#view-battles .hl-row.is-skel .hl-row-main { gap: 10px; }
#view-battles .hl-empty {
  margin: 0; padding: 14px 0; border-top: 1px solid var(--line);
  font-size: 14px; line-height: 1.5; color: var(--muted);
}
#view-battles .hl-empty a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--faint); }
#view-battles .hl-quiet {
  display: flex; align-items: center; gap: 16px; padding: 18px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 14px; line-height: 1.5; color: var(--muted);
}
#view-battles .hl-quiet p { margin: 0; flex: 1; }
#view-battles .hl-quiet b { color: var(--ink); font-weight: 650; }
#view-battles .hl-quiet-seats { display: inline-flex; flex: none; }
#view-battles .hl-quiet-seats .bt-avatar { --size: 36px; }
#view-battles .hl-quiet-seats .bt-avatar + .bt-avatar { margin-left: -8px; }

/* How battles work: a quiet disclosure at the end. */
#view-battles .hl-how { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#view-battles .hl-how summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 12px 0; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 650;
}
#view-battles .hl-how summary::-webkit-details-marker { display: none; }
#view-battles .hl-how summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin-right: 4px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  rotate: 45deg; translate: 0 -2px; transition: rotate 0.16s ease, translate 0.16s ease;
}
#view-battles .hl-how[open] summary::after { rotate: 225deg; translate: 0 2px; }
#view-battles .hl-how ul { display: grid; gap: 8px; margin: 0; padding: 0 0 18px 18px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
#view-battles .hl-how li::marker { color: var(--faint); }

/* ---- The builder ---------------------------------------------------------- */
#view-battles .hl-builder { padding-bottom: 96px; }
#view-battles .hl-builder[data-step="rules"] { padding-bottom: 150px; }
#view-battles .hl-back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -10px 0 4px -6px; padding: 0 6px;
  border-radius: var(--r-sm); color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none;
}
#view-battles .hl-back:hover { color: var(--ink); }
#view-battles .hl-back .bt-icon { width: 18px; height: 18px; }
#view-battles .hl-steps { margin-bottom: 16px; }
#view-battles .hl-builder .hl-head { margin-bottom: 14px; }
#view-battles .hl-step-n { margin-left: 2px; color: var(--muted); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
#view-battles .hl-shelf-tools { display: grid; gap: 12px; margin-bottom: 14px; }
#view-battles .hl-search { position: relative; display: block; }
#view-battles .hl-search .bt-icon { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
#view-battles .hl-search .search { width: 100%; padding: 10px 14px 10px 40px; font-size: 16px; }
#view-battles .hl-search.is-skel { height: 44px; border-radius: var(--r-sm); background: var(--surface); }
#view-battles .hl-sets {
  display: flex; gap: 8px;
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 2px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter); scrollbar-width: none;
}
#view-battles .hl-sets::-webkit-scrollbar { display: none; }
#view-battles .hl-set {
  flex: none; display: grid; align-content: start; gap: 5px;
  width: 146px; min-height: 52px; padding: 8px 4px 9px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--ink-2); text-align: left; cursor: pointer; scroll-snap-align: start;
  transition: color 0.15s ease;
}
#view-battles .hl-set:hover { color: var(--ink); }
#view-battles .hl-set.on { border-bottom-color: var(--ink); color: var(--ink); }
#view-battles .hl-set-sym { display: flex; align-items: center; gap: 8px; min-width: 0; height: 20px; }
#view-battles .hl-set-sym img { flex: none; height: 18px; width: auto; max-width: 38px; object-fit: contain; }
#view-battles .hl-set-sym.is-all .bt-icon { width: 18px; height: 18px; color: var(--ink-2); }
#view-battles .hl-set b {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 600; line-height: 1.25;
}
#view-battles .hl-set small { font-size: 12px; color: var(--muted); white-space: nowrap; }
#view-battles .hl-set small .bt-coins { font-weight: 600; }
#view-battles .hl-types { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); border-bottom: 1px solid var(--line); }
#view-battles .hl-types .hl-words { margin: 0; padding: 0; border: 0; flex: 1; min-width: 0; margin-bottom: -1px; }
#view-battles .hl-count { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* The shelf: products stand on a board and each has its paper label in the metal channel, like the packs page. */
#view-battles .hl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 0; row-gap: 26px; margin-top: 18px; }
#view-battles .hl-grid-empty, #view-battles .hl-more { grid-column: 1 / -1; }
#view-battles .hl-more { display: flex; justify-content: center; padding: 12px 0 4px; }
#view-battles .hl-prod { position: relative; min-width: 0; }
#view-battles .hl-prod-hit {
  display: grid; grid-template-rows: 132px auto; gap: 0;
  width: 100%; height: 100%; padding: 0;
  border: 0; background: none;
  color: var(--ink); text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#view-battles .hl-prod-hit:focus-visible { outline: 0; }
#view-battles .hl-prod-hit:focus-visible .hl-prod-art { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 4px; }
#view-battles .hl-prod-art { position: relative; display: block; height: 132px; padding: 4px 10px 12px; transition: transform 0.25s var(--ease-out); }
#view-battles .hl-prod-art::before { /* its shadow on the shelf */
  content: ""; position: absolute; left: 20%; right: 20%; bottom: 3px; height: 12px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}
#view-battles .hl-prod.is-pack .hl-prod-art { padding-inline: 22%; }
#view-battles .hl-prod .hl-art img { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.5)); }
#view-battles .hl-prod-hit:active .hl-prod-art { transform: scale(0.96); transition-duration: 0.08s; }
@media (hover: hover) {
  #view-battles .hl-prod-hit:hover .hl-prod-art { transform: translateY(-3px); }
}
#view-battles .hl-prod .shelf-chan { padding-bottom: 7px; }
#view-battles .hl-prod.is-in .shelf-chan { box-shadow: inset 0 0 0 2px var(--ink); }
#view-battles .hl-prod-label { gap: 1px; min-height: 84px; padding: 6px 9px 6px; }
#view-battles .hl-prod-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font-size: 13.5px; font-weight: 700; line-height: 1.15; font-stretch: 75%; font-variation-settings: "opsz" 12, "wdth" 75;
}
#view-battles .hl-prod-set { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--print-2); font-stretch: 85%; font-variation-settings: "opsz" 12, "wdth" 85; }
#view-battles .hl-prod-label .shelf-row { align-items: flex-end; }
#view-battles .hl-prod-label .shelf-row small { font-size: 12.5px; color: var(--print-2); white-space: nowrap; }
#view-battles .hl-prod-label .shelf-price { font-size: 26px; }
#view-battles .hl-prod.is-skel .hl-prod-hit { cursor: default; gap: 10px; grid-template-rows: 132px auto auto; }
#view-battles .hl-prod.is-skel .hl-prod-art { border-radius: 6px; background: var(--surface); }
#view-battles .hl-qty {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  display: inline-flex; align-items: center;
  border-radius: var(--r-sm); background: var(--wall-dark);
  box-shadow: 0 0 0 1px var(--line-2), 0 3px 8px rgba(0, 0, 0, 0.5);
}
#view-battles .hl-qty[hidden] { display: none; }
#view-battles .hl-qty button {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); cursor: pointer;
}
#view-battles .hl-qty button:hover { background: var(--surface-2); }
#view-battles .hl-qty button:active { transform: scale(0.9); }
#view-battles .hl-qty .bt-icon { width: 16px; height: 16px; }
#view-battles .hl-qty b { min-width: 18px; text-align: center; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
#view-battles .hl-prod .hl-qty { animation: hl-pop 0.3s var(--ease-spring); }
@keyframes hl-pop { from { transform: scale(0.8); opacity: 0; } }

/* The lineup tray floats above the tab bar. */
#view-battles .hl-tray {
  position: fixed; z-index: 28;
  left: 10px; right: 10px; bottom: calc(var(--tabbar) + 10px);
  animation: hl-tray-in 0.45s var(--ease-out) both;
}
@keyframes hl-tray-in { from { opacity: 0; transform: translateY(18px); } }
#view-battles .hl-tray-inner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--wall-dark);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.7);
}
#view-battles .hl-tray-stack {
  display: grid; place-items: center; width: 54px; height: 54px; padding: 0;
  border: 0; border-radius: var(--r-sm); background: none; cursor: pointer;
}
#view-battles .hl-tray-stack .hl-stack { --h: 44px; }
#view-battles .hl-tray-stack .hl-stack.is-empty { background: none; box-shadow: inset 0 0 0 1px var(--line-2); border: 0; }
#view-battles .hl-tray-copy { display: grid; gap: 2px; min-width: 0; }
#view-battles .hl-tray-count { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
#view-battles .hl-tray-count b { display: inline-block; color: var(--ink-2); font-size: 13px; font-weight: 600; transform-origin: left center; }
#view-battles .hl-tray-count > span { overflow: hidden; text-overflow: ellipsis; }
#view-battles .hl-tray-entry { font-size: 13px; color: var(--muted); white-space: nowrap; line-height: 1.2; }
#view-battles .hl-tray-entry .bt-coins { font-size: 18px; letter-spacing: -0.01em; }
#view-battles .hl-tray-entry small { font-size: 13px; color: var(--muted); }
#view-battles .hl-tray-copy .hl-tray-count:only-child { flex-direction: column; gap: 0; }
#view-battles .hl-tray-actions { display: flex; gap: 8px; }
#view-battles .hl-tray-actions .solid, #view-battles .hl-tray-actions .ghost { white-space: nowrap; padding-inline: 14px; }
#view-battles .hl-tray-actions .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#view-battles .hl-tray-actions .ghost .bt-icon { width: 18px; height: 18px; }
#view-battles .hl-tray-inner.is-rules { grid-template-columns: auto minmax(0, 1fr); }
#view-battles .hl-tray-inner.is-rules .hl-tray-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; margin-top: 6px; }
#view-battles .hl-tray-note { grid-column: 1 / -1; margin: 4px 2px 2px; font-size: 13px; line-height: 1.4; color: var(--ink-2); }

#view-battles .hl-fly, .hl-fly {
  position: fixed; z-index: 45; margin: 0; object-fit: contain; pointer-events: none;
  transform-origin: 50% 50%; will-change: transform, opacity;
}

/* Rules. */
#view-battles .hl-rules-layout { display: grid; gap: 34px; }
#view-battles .hl-lineup { min-width: 0; }
#view-battles .hl-lineup-stage {
  display: grid; place-items: center; height: 188px; margin-bottom: 18px;
}
#view-battles .hl-lineup-stage .hl-stack { --h: 148px; }
#view-battles .hl-lineup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
#view-battles .hl-lineup-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
#view-battles .hl-lineup-head .link-btn { background: none; border: 0; padding: 8px 0; font-size: 14px; cursor: pointer; }
#view-battles .hl-lineup-list { margin: 0; padding: 0; list-style: none; }
#view-battles .hl-lineup-list li {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
#view-battles .hl-lineup-art { display: block; height: 56px; }
#view-battles .hl-lineup-art .hl-art img { filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.5)); }
#view-battles .hl-lineup-copy { display: grid; gap: 1px; min-width: 0; font-size: 14px; }
#view-battles .hl-lineup-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
#view-battles .hl-lineup-copy small { font-size: 12px; color: var(--muted); }
#view-battles .hl-qty.is-inline { position: static; box-shadow: inset 0 0 0 1px var(--line-2); background: transparent; }
#view-battles .hl-lineup-total {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
#view-battles .hl-lineup-total .bt-coins { font-size: 15px; }
#view-battles .hl-rules { min-width: 0; order: -1; }
#view-battles .hl-rules-layout > .hl-lineup { padding-top: 6px; border-top: 1px solid var(--line); }
#view-battles .hl-rules-layout > .hl-lineup .hl-lineup-stage { height: 150px; margin-top: 18px; }
#view-battles .hl-rules-layout > .hl-lineup .hl-lineup-stage .hl-stack { --h: 116px; }
#view-battles .hl-rule { margin: 0 0 26px; padding: 0; border: 0; min-width: 0; }
#view-battles .hl-rule legend { margin: 0 0 10px; padding: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
#view-battles .hl-rule-note { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
#view-battles .hl-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#view-battles .hl-mode {
  display: grid; align-content: start; gap: 4px; min-height: 92px; padding: 12px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: none;
  color: var(--ink-2); text-align: left; cursor: pointer;
  transition: border-color 0.15s ease;
}
#view-battles .hl-mode:hover { border-color: var(--ink-2); }
#view-battles .hl-mode.on { box-shadow: inset 0 0 0 1px var(--ink); border-color: var(--ink); color: var(--ink); }
#view-battles .hl-mode b { font-size: 15px; font-weight: 650; color: var(--ink); }
#view-battles .hl-mode small { font-size: 12px; line-height: 1.35; color: var(--muted); }
#view-battles .hl-mode.on small { color: var(--ink-2); }
#view-battles .hl-switches .toggle-row:first-of-type { border-top: 0; padding-top: 4px; }
#view-battles .hl-switches .toggle-row b { font-size: 15px; }
#view-battles .hl-switches .toggle-row small { font-size: 13px; }
#view-battles .hl-switches .toggle-row > .switch { flex: none; }

/* ---- Larger screens --------------------------------------------------------- */
@media (min-width: 560px) {
  #view-battles .hl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 721px) {
  #view-battles .hl-tray { left: 50%; right: auto; width: min(760px, calc(100% - 2 * var(--gutter))); transform: translateX(-50%); bottom: 20px; animation-name: hl-tray-in-wide; }
  @keyframes hl-tray-in-wide { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }
  #view-battles .hl-tray-inner, #view-battles .hl-tray-inner.is-rules { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 10px 10px 12px; }
  #view-battles .hl-tray-inner.is-rules .hl-tray-actions { grid-column: auto; display: flex; margin-top: 0; }
  #view-battles .hl-tray-stack { width: 60px; height: 60px; }
  #view-battles .hl-tray-stack .hl-stack { --h: 50px; }
  #view-battles .hl-builder[data-step="rules"] { padding-bottom: 110px; }
  #view-battles .hl-sets, #view-battles .hl-picker-shelf {
    margin: 0; padding: 0 0 2px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  }
  #view-battles .hl-words { margin: 0; padding: 0; }
  #view-battles .hl-types { margin: 0; padding: 0; }
}
@media (min-width: 861px) {
  #view-battles .hl-quick-inner { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); column-gap: 20px; }
  #view-battles .hl-stage { height: 440px; }
  #view-battles .hl-stage::before { bottom: 22px; height: 40px; }
  #view-battles .hl-pack { height: 350px; width: 76%; margin-top: 16px; }
  #view-battles .hl-pack-art .cs-art-clash { --s: 350px; }
  #view-battles .hl-pack-art .hl-art.is-fan { width: 360px; }
  #view-battles .hl-kicker { left: 22px; top: 20px; }
  #view-battles .hl-you { left: 22px; bottom: 20px; }
  #view-battles .hl-bots { right: 22px; bottom: 20px; }
  #view-battles .hl-duel { --size: 44px; }
  #view-battles .hl-change { right: 14px; top: 12px; }
  #view-battles .hl-arrow.is-prev { left: 14px; }
  #view-battles .hl-arrow.is-next { right: 14px; }
  #view-battles .hl-quick-body { display: flex; flex-direction: column; justify-content: center; padding: 40px 28px 40px 36px; }
  #view-battles .hl-quick-name { font-size: clamp(30px, 3vw, 40px); font-weight: 800; line-height: 1; letter-spacing: -0.035em; }
  #view-battles .hl-quick-meta { margin-top: 12px; font-size: 14px; }
  #view-battles .hl-quick-row { margin: 34px 0 20px; }
  #view-battles .hl-entry-fig { font-size: 28px; }
  #view-battles .hl-picker { padding: 18px 0 0; }
  #view-battles .hl-picker-shelf { margin: 0; padding: 0 0 6px; }
  #view-battles .hl-mini { width: 150px; grid-template-rows: 110px auto auto; }
  #view-battles .hl-mini-art { height: 110px; }
  #view-battles .hl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 32px; }
  #view-battles .hl-prod-hit { grid-template-rows: 176px auto; }
  #view-battles .hl-prod-art { height: 176px; }
}
@media (min-width: 961px) {
  #view-battles .hl-tables { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 48px; row-gap: 44px; }
  #view-battles .hl-sec.is-done, #view-battles .hl-quiet { grid-column: 1 / -1; }
  #view-battles .hl-sec.is-done .hl-rows { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 48px; }
  #view-battles .hl-sec.is-done .hl-rows > .hl-row:nth-child(2)::before {
    content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line);
  }
  #view-battles .hl-rules-layout { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 64px; align-items: start; }
  #view-battles .hl-lineup { position: sticky; top: 88px; }
  #view-battles .hl-rules { order: 0; }
  #view-battles .hl-rules-layout > .hl-lineup { padding-top: 0; border-top: 0; }
  #view-battles .hl-rules-layout > .hl-lineup .hl-lineup-stage { height: 220px; margin-top: 0; }
  #view-battles .hl-rules-layout > .hl-lineup .hl-lineup-stage .hl-stack { --h: 170px; }
  #view-battles .hl-rules { max-width: 620px; }
  #view-battles .hl-how { max-width: none; }
}
@media (min-width: 1100px) {
  #view-battles .hl-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  #view-battles .hl-quick-actions { grid-template-columns: 1fr; }
  #view-battles .hl-modes { grid-template-columns: 1fr; }
  #view-battles .hl-mode { min-height: 0; }
}

/* ---- Motion off --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #view-battles .hl-pack-art, #view-battles .hl-glint::after,
  #view-battles .hl-stage.is-entering .hl-pack, #view-battles .hl-skel-line, #view-battles .hl-tray,
  #view-battles .hl-prod .hl-qty { animation: none; }
  #view-battles .hl-prod-art, #view-battles .hl-progress i { transition: none; }
}
body.no-motion #view-battles .hl-pack-art, body.no-motion #view-battles .hl-glint::after,
body.no-motion #view-battles .hl-stage.is-entering .hl-pack,
body.no-motion #view-battles .hl-skel-line, body.no-motion #view-battles .hl-tray,
body.no-motion #view-battles .hl-prod .hl-qty { animation: none; }
body.no-motion #view-battles .hl-prod-art, body.no-motion #view-battles .hl-progress i { transition: none; }
