/* loadout description, fight button loading state */
#lo-desc .desc-title { font-size: 18px; font-weight: 900; color: var(--navy); line-height: 1.2; }
#lo-desc .desc-text { font-size: 14px; font-weight: 800; color: #2c4a60; line-height: 1.3; margin-top: 1px; }
#btn-fight.loading { filter: saturate(.55) brightness(.9); animation: pulse 0.9s ease-in-out infinite; pointer-events: none; }

/* subtitles sit under the announcer banner, clear of the thumbs and touch buttons */
#subtitle { top: calc(22% + 62px); bottom: auto; }

/* the store covers the title or loadout it was opened from: those stay laid out (no animation replays) but unseen */
body:has(#store:not(.hidden)) #title,
body:has(#store:not(.hidden)) #loadout { visibility: hidden; }
/* a store dialog stands alone over the dimmed art (the shelves come back when it closes) */
#store:has(#st-modal:not(.hidden)) .st-wrap { visibility: hidden; }
/* store cards: only the picture gives up height when a card is short, the texts, price and button never squeeze */
#st-items .scard > :not(.s-art) { flex-shrink: 0; }

/* the store dialog's pop-in class shares its name with the HUD's score popups (.pop): keep only the animation */
#st-dialog.pop { position: relative; transform: none; white-space: normal; font-size: 16px; color: var(--navy); text-shadow: none; }

/* loadout: the two rows of cards share the height, characters get the larger share */
#loadout .lo-wrap { gap: 6px; padding-top: 10px; padding-bottom: 14px; }
#lo-sec-chars { flex: 1.55 1 0; display: flex; flex-direction: column; min-height: 0; }
#lo-sec-wpns { flex: 1 1 0; display: flex; flex-direction: column; min-height: 0; }
.lo-row { flex: 1 1 auto; min-height: 0; }
.lo-label { margin-bottom: 8px; }
.card { min-height: 0; overflow: hidden; }
.card > img, .card.char > img, .card.wpn > img { flex: 1 1 auto; min-height: 0; height: auto; max-height: 100%; }
/* the weapon pictures have wide empty margins: zoom them so the gun fills its card */
.card.wpn > img { transform: scale(1.65); }
.card .cname { position: relative; z-index: 1; text-shadow: 0 0 3px #fff6e0, 0 0 3px #fff6e0; }
/* the price tag of a locked card keeps its small shell icon */
#loadout .card .lock img { transform: none; flex: 0 0 auto; width: 20px; height: 20px; min-height: 0; max-height: none; }
.lo-bottom { margin-top: 6px; }

/* title layout: the prompt above one row of three buttons (排行榜 / 商城 / 季票).
   The row is as wide as its buttons (an absolutely placed box at left:50% would otherwise shrink to half the
   screen and wrap the CJK labels one character per line), each button one line at a fixed height. */
#title .title-buttons { bottom: 4%; width: max-content; max-width: 96vw; gap: 12px; align-items: center; flex-wrap: nowrap; }
#title .title-buttons .btn9 { height: 56px; min-height: 0; padding: 0 16px; flex: 0 0 auto; white-space: nowrap; font-size: 18px; }
#title .title-buttons .btn9 span { white-space: nowrap; }
#title .title-buttons .btn9 img { height: 30px; width: auto; flex: 0 0 auto; }
#title-prompt { left: 8%; right: 8%; bottom: calc(4% + 72px); }

/* the UI art drawn uncropped (when the browser will not let the game read the pictures to crop them):
   slices measured on the 512 px panel and 384 px button, outsets hide their empty margins */
body.rawart .panel9 {
  border-image-source: url("../assets/ui-panel.webp");
  border-image-slice: 149 66 165 69 fill;
  border-image-width: 56px 25px 63px 26px;
  border-image-outset: 33px 4px 41px 5px;
}
body.rawart .btn9 {
  border-image-source: url("../assets/ui-button.webp");
  border-image-slice: 186 97 184 99 fill;
  border-image-width: 41px 21px 40px 22px;
  border-image-outset: 27px 1px 26px 2px;
}

@media (max-height: 460px) {
  #subtitle { top: calc(22% + 46px); font-size: 15px; }
  #loadout .lo-wrap { gap: 4px; padding-top: 6px; padding-bottom: 8px; }
  .lo-label { margin-bottom: 5px; }
  #lo-desc .desc-title { font-size: 15px; }
  #lo-desc .desc-text { font-size: 12px; }
  #lo-desc .stats { font-size: 12px; }
  #lo-desc .bar { width: 48px; }
  #title .title-buttons { bottom: 3%; gap: 10px; }
  #title .title-buttons .btn9 { height: 50px; padding: 0 12px; font-size: 16px; }
  #title .title-buttons .btn9 img { height: 26px; }
  #title-prompt { bottom: calc(3% + 62px); font-size: 18px; }
  /* the short weapon cards: a slimmer price tag in the corner, clear of the name */
  #loadout .card .lock { top: 2px; right: 2px; font-size: 12px; padding: 0 5px 0 3px; border-radius: 8px; }
  #loadout .card .lock img { width: 15px; height: 15px; }
  /* store cards on phones: one line of description, cut with an ellipsis; a little less space above the picture */
  #st-items .s-desc { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; min-height: 0; line-height: 1.3; }
  #st-items .s-art { margin-top: 17px; }
  /* store dialogs on phones: below the wallet, wider and shorter (daily missions in two columns) */
  #st-modal { padding: 54px 10px 4px; }
  #st-dialog { width: min(640px, 88vw); max-height: 100%; }
  #st-dialog .mlist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 6px; }
  #st-dialog .mrow { min-height: 44px; padding: 2px 6px; gap: 6px; }
  #st-dialog .mclaim, #st-dialog .mstate { min-width: 62px; }
  #st-dialog .mrew { font-size: 14px; }
  #st-dialog .mrew img { width: 20px; height: 20px; }
  #st-dialog .tips { gap: 3px 6px; }
  #st-dialog .dlg-btns { margin-top: 2px; }
}
