/* VALBLOX Create Battle (battle-create.html), on top of styles.css and cases.css. ase.gg's way of picking cases
   (pattern and layout only), in VALBLOX's own dress: chamfered plates, the case's colourway glow, frost for focus and
   the picked state, the gold primary for Create Battle.
     - the top row: Back, the title, Create Battle with the seat's cost in a recessed well (as case.html's Open)
     - one settings row: Players (a dropdown) and the Crazy / Fast / Private chips left, the modes right
     - the rounds: a tall Add cases card, a card per chosen case (art, name, cost, stepper), faded empty cards after,
       --bc-cols a row (battle-create.js reads it to fill the row)
     - the case picker (a valblox.modal: vb-modal.css's frame) and its cards with the risk bar
   A case card's art and name are one real button (.bc-view) stretched over the card under its stepper or + price
   button: a click anywhere else on the card opens the case's drops (case-drops.css). */

.bc { container: bc / inline-size; display: flex; flex-direction: column; gap: 22px; }

/* ---------------------------------------------------------------- the top row */
.bc-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px 22px; min-height: 52px; }
.bc-back .ic { width: 18px; height: 18px; }
.bc-head__t { justify-self: start; min-width: 0; }
.bc-act { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 0; }
.bc-go { height: 52px; padding: 0 9px 5px 24px; gap: 14px; font-size: 17px; letter-spacing: 1.3px; --c: 12px; --n: 5px; }
.bc-go__pay {   /* the well: dark, cut in (shadowed top wall, lit lower lip), chamfered like the button (case.html's Open) */
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 1px 10px; text-shadow: none;
  background: linear-gradient(180deg, #1E1810 0%, #2B2216 100%);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, .45), inset 0 -1px 0 rgba(253, 228, 196, .32);
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}
.bc-go__pay img { width: 20px; height: 21px; }
.bc-go__pay .num { font-size: 17px; color: var(--gold); }
.bc-act .merr { max-width: 420px; margin-top: 0; text-align: right; }

/* ---------------------------------------------------------------- the settings row */
.bc-set { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.bc-set__l { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.bc-set__r { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; min-width: 0; margin-left: auto; }
.bc-fmt { position: relative; width: 164px; padding-right: 10px; cursor: pointer; }
.bc-fmt__lbl { flex: none; font-size: 12px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; padding-bottom: 1px; }
.bc-fmt select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 26px;
  font-weight: 700; font-size: 16px; color: var(--lilac-light);
}
.bc-fmt select option { background: var(--dropdown); color: var(--white); }
.bc-fmt__chev { position: absolute; right: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; pointer-events: none; color: var(--lilac); }
.bc-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.bc-chip { min-height: 44px; gap: 8px; padding: 0 11px 1px 8px; }
.bc-chip .ctog__ic { width: 24px; height: 24px; }
.bc-chip .ctog__ic .ic { width: 18px; height: 18px; }
.bc-chip .ctog__txt { flex: none; }
.bc-chip[aria-disabled="true"] { cursor: default; }
.bc-chip[aria-disabled="true"] > :not(.ctog__txt), .bc-chip[aria-disabled="true"] .ctog__txt span { opacity: .45; }
/* Borrow (case-open.css .vborrow): the small chip left of Fast, as tall as the chips */
.bc-chips .vborrow__chip { height: 44px; }
.bc-modes { width: 396px; }
.bc-modes .btn { height: 44px; }
.bc-hint { text-align: right; }

/* ---------------------------------------------------------------- the rounds */
.bc-cases__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; }
.bc-nums { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; }
.bc-nums div { display: flex; align-items: center; gap: 8px; }
.bc-nums dt { font-family: "Skranji", sans-serif; font-size: 14px; letter-spacing: .4px; color: var(--muted); }
.bc-nums dd { margin: 0; display: flex; align-items: center; gap: 6px; font-family: "Skranji", sans-serif; font-weight: 700; font-size: 16px; color: var(--white); }
.bc-nums dd img { width: 16px; height: 17px; }
.bc-nums__pot .num { color: var(--gold); }
.bc-cases__hint { margin-top: 12px; }

.bc-row {
  --bc-cols: 6; --bc-add: 1;
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--bc-cols), minmax(0, 1fr)); gap: 14px;
}
@container bc (width < 1000px) { .bc-row { --bc-cols: 5; } }
@container bc (width < 820px) { .bc-row { --bc-cols: 4; } }
@container bc (width < 640px) { .bc-row { --bc-cols: 3; } }
@container bc (width < 460px) { .bc-row { --bc-cols: 2; --bc-add: 2; gap: 12px 10px; } }

/* a case card (the rounds row and the picker) */
.bc-card { position: relative; isolation: isolate; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 12px 10px 14px; text-align: center; }
.bc-card > .plate {
  --c: 14px; --n: 5px; --bt: rgba(var(--hi), .24); --bb: rgba(var(--lo), .56);
  --face: radial-gradient(64% 46% at 50% 36%, rgba(var(--cw-rgb), .18) 0%, rgba(var(--cw-rgb), 0) 100%), linear-gradient(180deg, var(--card-b) 0%, var(--card) 100%);
  transition: filter .25s ease-out;
}
.bc-card__art { width: 84%; aspect-ratio: 1; display: grid; place-items: center; pointer-events: none; }
.bc-card__art img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s cubic-bezier(.22, 1, .36, 1), filter .25s ease-out; }
.bc-card__name {
  max-width: 100%; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
  font-size: 15px; line-height: 20px; letter-spacing: .8px; color: var(--white); text-transform: uppercase;
}
.bc-card__cost { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; pointer-events: none; font-size: 13px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.bc-card__cost img { width: 16px; height: 17px; }
.bc-card__cost .num { font-size: 15px; color: var(--gold); }
.bc-card__amt { display: inline-flex; align-items: baseline; gap: 5px; }   /* Borrow: the full price struck through, then the cost */
.bc-go__pay .vb-was { font-size: 14px !important; }
.bc-card .pstep { position: relative; z-index: 2; margin-top: 12px; }
.bc-card .pstep__n { color: var(--lilac-lighter); }
@media (prefers-reduced-motion: no-preference) { .bc-card.is-new { animation: bc-in .22s ease-out backwards; } }
@keyframes bc-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }

/* the drops button: the card's art and name, stretched over the card (its stepper and + price sit above it) */
.bc-view { position: absolute; inset: 0; z-index: 1; padding: 0; border: 0; background: none; cursor: pointer; }
.bc-view__hint {
  position: absolute; top: 9px; right: 9px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--lilac-light);
  background: rgba(17, 23, 31, .62); opacity: 0; transition: opacity .2s ease-out;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}
.bc-view__hint .ic { width: 17px; height: 17px; }
.bc-view:hover .bc-view__hint, .bc-view:focus-visible .bc-view__hint { opacity: 1; }
@media (hover: none) { .bc-view__hint { opacity: .7; } }
.bc-view:focus-visible { outline: 2px solid var(--lilac-light); outline-offset: -2px; }
@supports selector(:has(*)) {
  .bc-view:focus-visible { outline: none; }
  .bc-card:has(> .bc-view:focus-visible) > .plate { --rim: var(--lilac); --glow: inset 0 0 0 1px var(--lilac), inset 0 0 18px rgba(var(--lilac-rgb), .22); }
  .bc-card:has(> .bc-view:hover) > .plate { --rim: #33495A; filter: brightness(1.06); }
  .bc-card:has(> .bc-view:hover) .bc-card__art img, .bc-card:has(> .bc-view:focus-visible) .bc-card__art img { transform: translateY(-4px) scale(1.03); filter: brightness(1.08); }
}

/* the Add cases card: a recessed bay with a frost medallion and the button's label; the whole card is the button */
.bc-add { min-width: 0; }
.bc-add__btn {
  position: relative; isolation: isolate; width: 100%; height: 100%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 16px 10px; border: 0; background: none; color: var(--lilac-light);
}
.bc-add__btn > .plate {
  --c: 14px; --n: 5px; --rim: var(--rim-iron); --bt: rgba(5, 8, 12, .5); --bb: rgba(var(--hi), .34);
  --face: radial-gradient(70% 50% at 50% 42%, rgba(var(--lilac-rgb), .07) 0%, rgba(var(--lilac-rgb), 0) 100%), linear-gradient(180deg, #19202B 0%, #1D2531 100%);
  transition: filter .2s ease-out;
}
.bc-add__ic {
  width: 60px; height: 60px; display: grid; place-items: center; color: var(--lilac);
  background: linear-gradient(180deg, #232C3A 0%, #1C2430 100%);
  box-shadow: inset 0 1px 0 rgba(var(--hi), .6), inset 0 -2px 0 rgba(var(--lo), .7), inset 0 0 0 1px rgba(var(--lilac-rgb), .3), inset 0 0 16px rgba(var(--lilac-rgb), .12);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  transition: transform .25s cubic-bezier(.22, 1, .36, 1);
}
.bc-add__ic .ic { width: 26px; height: 26px; }
.bc-add__lbl { height: 40px; padding: 0 18px 4px; color: var(--lilac-light); pointer-events: none; }
.bc-add__btn:hover > .plate { filter: brightness(1.12); }
.bc-add__btn:hover .bc-add__lbl { filter: brightness(1.1); --rim: #33495A; }
.bc-add__btn:hover .bc-add__ic { transform: translateY(-2px); }
.bc-add__btn:focus-visible { outline: none; }
.bc-add__btn:focus-visible > .plate { --rim: var(--lilac); --glow: inset 0 0 0 1px var(--lilac), inset 0 0 18px rgba(var(--lilac-rgb), .2); }
.bc-add__btn:active .bc-add__lbl { transform: translateY(1px); }
@container bc (width < 460px) {   /* phones: Add cases is a bar across the row, the cards two a row under it */
  .bc-add { grid-column: 1 / -1; }
  .bc-add__btn { min-height: 76px; flex-direction: row; justify-content: center; gap: 14px; padding: 12px; }
  .bc-add__ic { width: 46px; height: 46px; }
  .bc-add__ic .ic { width: 22px; height: 22px; }
}

/* a faded empty round: the dark silhouette of a case, so the row never looks empty */
.bc-ghost { position: relative; isolation: isolate; min-width: 0; aspect-ratio: 212 / 290; display: grid; place-items: center; opacity: .5; }
.bc-ghost > .plate { --c: 14px; --n: 5px; --bt: rgba(var(--hi), .14); --bb: rgba(var(--lo), .5); --face: linear-gradient(180deg, #1E2531 0%, #1B212B 100%); }
.bc-ghost__art { width: 64%; aspect-ratio: 1; margin-top: -16%; }
.bc-ghost__art img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(1) brightness(.6); opacity: .22; }

/* ---------------------------------------------------------------- the case picker (valblox.modal) */
.vbm--pick { --vbm-w: 1020px; }
.vbm--pick .vbm__dlg { height: min(860px, calc(100vh - 48px)); height: min(860px, calc(100dvh - 48px)); }
.vbm--pick .vbm__body { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.bcp { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bcp__bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 18px 26px 0; }
.vbm .bcp__search { flex: 1 1 220px; max-width: 340px; height: 44px; padding: 0 12px 0 14px; }
.bcp__sort { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.bcp__sort .csortseg__ic { width: 20px; height: 20px; flex: none; color: var(--muted); }
.bcp__sort .btn { height: 44px; padding: 0 16px 4px; }
.bcp__scroll {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 26px 22px; outline: none;
  scrollbar-width: thin; scrollbar-color: #3A4559 transparent; container: bcp / inline-size;
}
.bcp__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
@container bcp (width >= 500px) { .bcp__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; } }
@container bcp (width >= 720px) { .bcp__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 14px; } }
.bcp__grid > [hidden] { display: none; }
.bcp-card { padding: 12px 10px 14px; }
.bcp-card .bc-card__art { width: 62%; }
.bcp-card.is-on > .plate { --rim: rgba(var(--lilac-rgb), .85); --glow: inset 0 0 18px rgba(var(--lilac-rgb), .18); }
.bcp-card__act { width: 100%; min-height: 80px; margin-top: 11px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bcp-card__act [hidden] { display: none; }
.bcp-add { position: relative; z-index: 2; width: 100%; max-width: 176px; height: 40px; padding: 0 12px 4px; gap: 6px; --c: 9px; --n: 3px; }
.bcp-add .ic { width: 16px; height: 16px; color: var(--lilac); }
.bcp-add img { width: 16px; height: 17px; }
.bcp-add .num { font-size: 15px; color: var(--gold); }
.bcp-price { display: inline-flex; align-items: center; gap: 6px; height: 22px; pointer-events: none; }
.bcp-price img { width: 16px; height: 17px; }
.bcp-price .num { font-size: 15px; color: var(--gold); }
.bcp-card .pstep { margin-top: 0; }
.bcp__empty { margin: 30px 0 10px; }
.bcp__foot {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; padding: 14px 22px 18px 26px;
  box-shadow: inset 0 2px 0 var(--rule), inset 0 3px 0 rgba(var(--hi), .3);
}
.bcp__sum { display: flex; align-items: center; gap: 10px; min-width: 0; font-family: "Skranji", sans-serif; font-size: 15px; letter-spacing: .4px; color: var(--muted); }
.bcp__sum > .ic { width: 22px; height: 22px; color: var(--lilac); }
.bcp__sum b { font-weight: 700; font-size: 17px; color: var(--white); }
.bcp__dot { opacity: .6; }
.bcp__sum img { width: 16px; height: 17px; }
.bcp__sum .num { font-size: 17px; color: var(--gold); }
.bcp__btns { display: flex; gap: 10px; }
.bcp__btns .btn { min-width: 150px; }
@media (max-width: 600px) {
  .vbm--pick .vbm__dlg { height: 100%; }   /* the whole screen, as every vb-modal on a phone */
  .bcp__bar { padding: 14px 16px 0; }
  .vbm .bcp__search { max-width: none; flex-basis: 100%; }
  .bcp__sort { margin-left: 0; flex: 1 1 100%; }
  .bcp__sort .mseg { flex: 1; }
  .bcp__scroll { padding: 14px 16px 18px; }
  .bcp__foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .bcp__btns { flex: 1 1 100%; }
  .bcp__btns .btn { flex: 1; min-width: 0; }
}

/* the risk bar under a case's name in the picker: four steps, the marker at the case's risk, the step it falls in lit
   in its level's colour (battle-create.js risk(): decoration only) */
.bcp-risk { position: relative; display: flex; align-items: center; gap: 4px; width: 80%; height: 8px; margin-top: 9px; pointer-events: none; }
.bcp-risk i { flex: 1; height: 2px; background: rgba(var(--lilac-rgb), .16); }
.bcp-risk--low i:nth-child(1) { background: var(--green); }
.bcp-risk--medium i:nth-child(2) { background: var(--lilac); }
.bcp-risk--high i:nth-child(3) { background: var(--gold); }
.bcp-risk--extreme i:nth-child(4) { background: var(--salmon); }
.bcp-risk b { position: absolute; top: 0; left: calc(var(--risk) * (100% - 2px)); width: 2px; height: 8px; background: var(--white); box-shadow: 0 0 0 2px rgba(17, 23, 31, .55); }

/* ---------------------------------------------------------------- narrow */
@container bc (width < 1040px) {   /* the modes take their own row, across it */
  .bc-set__r { flex: 1 1 100%; align-items: stretch; margin-left: 0; }
  .bc-modes { width: auto; }
  .bc-hint { text-align: left; }
}
@container bc (width < 640px) {
  .bc-head { grid-template-columns: auto minmax(0, 1fr); }
  .bc-act { grid-column: 1 / -1; align-items: stretch; }
  .bc-act .merr { max-width: none; text-align: left; }
  .bc-set__l { flex: 1 1 100%; }
  .bc-fmt { flex: 1 1 100%; width: auto; }
  .bc-chips { flex: 1 1 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .bc-chip { justify-content: center; padding: 0 6px 1px; }
  .bc-chips .vborrow { grid-column: 1 / -1; order: 5; }   /* three chips across, Borrow on its own line under them */
  .bc-chips .vborrow__chip { width: 100%; }
  .bc-chips .vborrow__lbl { margin-right: auto; }
  .bc-chips .vborrow__pop { right: 0; width: auto; }   /* the card as wide as the chip above it */
  .bc-modes .btn { padding: 0 4px 4px; font-size: 13px; }
}
@media (max-width: 600px) {
  /* Create Battle and its cost become a bar on the foot of the screen (as this page's summary bar did) */
  .bc { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .bc-back { width: 40px; padding: 0 0 3px; }
  .bc-back span { display: none; }
  .bc-head__t { font-size: 20px; line-height: 28px; }
  .bc-act {
    position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; gap: 6px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--header); box-shadow: inset 0 4px 0 var(--header-edge), 0 -10px 24px rgba(4, 7, 12, .45);
  }
  .bc-go { width: 100%; height: 50px; justify-content: space-between; padding-left: 18px; font-size: 16px; }
  .bc-chip .ctog__sw { display: none; }   /* three chips across a phone: the lit icon and word carry the state */
  .bc-chip[aria-checked="true"] .ctog__txt span { color: var(--lilac-lighter); }
  .bc-chip[aria-checked="true"] { --wr: var(--lilac); }   /* the bay's rim octagon (cases.css .ctog::before) in full frost */
  .bc-chip[aria-checked="true"]::after { box-shadow: inset 0 1px 0 rgba(5, 8, 12, .5), inset 0 0 12px rgba(var(--lilac-rgb), .2); }
  .bc-modes .btn .ic { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bc-card__art img, .bc-add__ic, .bc-card > .plate { transition: none; }
  .bc-add__btn:hover .bc-add__ic { transform: none; }
}
@media (prefers-reduced-motion: reduce) and (min-width: 0) {
  @supports selector(:has(*)) { .bc-card:has(> .bc-view:hover) .bc-card__art img, .bc-card:has(> .bc-view:focus-visible) .bc-card__art img { transform: none; } }
}
