/* Full-screen pages: Animals (ui/animals-page.js) and Heroes (ui/heroes.js).
   They replace the menu instead of floating over it: a blurred, darkened copy
   of the treehouse hall behind, a carved wooden Back button top left, and the
   same carved wood, gold rims and bark edges as the Upgrades page. */

.overlay.is-page { padding: 0; place-items: stretch; background: #0f2416; -webkit-backdrop-filter: none; backdrop-filter: none; }
.overlay.is-page.closing > * { animation: pg-out .16s ease-in forwards; }
@keyframes pg-out { to { opacity: 0; transform: scale(1.01); } }

.pg {
  --cream: #fff0d1; --ink: #1d2b1f; --gold: #f2c14e; --rim: #d9a64a; --bark: #2a170a; --drop: #160c04;
  --wood: repeating-linear-gradient(97deg, rgba(40,20,6,.16) 0 2px, transparent 2px 11px, rgba(255,210,150,.06) 11px 13px, transparent 13px 23px), linear-gradient(180deg, #9a6535 0%, #7a4b24 30%, #64391a 65%, #5a3216 100%);
  --back: clamp(42px, 10.5vh, 64px);
  position: absolute; inset: 0; overflow: hidden; isolation: isolate; color: var(--cream);
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  animation: pg-in .26s var(--ease-out, ease-out);
  -webkit-user-select: none; user-select: none;
}
@keyframes pg-in { from { opacity: 0; transform: scale(1.015); } }
.pg :where(button) { font: inherit; color: inherit; cursor: pointer; border: 0; padding: 0; background: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pg :where(button:focus-visible) { outline: 3px solid #fff3b0; outline-offset: 3px; }
.pg img { -webkit-user-drag: none; }

/* The hall, out of focus, with a dark woodland vignette and slow light. */
.pg-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: #163420; pointer-events: none; }
.pg-bg::before { content: ''; position: absolute; inset: -30px; background: url('../../assets/ui/menu-hall.webp') center / cover no-repeat;
  filter: blur(8px) saturate(1.1) brightness(.6); transform: scale(1.05); }
.pg-bg::after { content: ''; position: absolute; inset: 0;
  background: radial-gradient(75% 65% at 50% 46%, rgba(20,48,26,.05), rgba(8,22,12,.62) 100%), linear-gradient(180deg, rgba(10,26,14,.42), rgba(10,26,14,0) 28%, rgba(10,26,14,0) 64%, rgba(8,20,10,.72)); }
.pg-bg i { position: absolute; inset: -20% -10%; opacity: .55; mix-blend-mode: screen;
  background: linear-gradient(105deg, transparent 0 22%, rgba(255,226,150,.12) 26%, transparent 33% 46%, rgba(255,226,150,.08) 50%, transparent 56%);
  animation: pg-light 14s ease-in-out infinite alternate; }
@keyframes pg-light { to { transform: translateX(6%); opacity: .3; } }

/* Outlined game lettering. */
.pg-o { text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 -2px 0 var(--ink), 0 2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink), 0 4px 0 rgba(0,0,0,.35); }

/* Back: a carved wooden square, like the Upgrades page's. */
.pg-back { position: relative; z-index: 3; flex: none; width: var(--back); height: var(--back); border-radius: 16px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 28%, #a26b38, #5a3216); border: 3px solid var(--rim); color: var(--cream);
  box-shadow: 0 0 0 2.5px var(--bark), 0 5px 0 2.5px var(--drop), inset 0 2px 0 rgba(255,214,160,.35), 0 10px 16px rgba(0,0,0,.3); transition: transform .12s; }
.pg-back svg { width: 56%; height: 56%; filter: drop-shadow(0 2px 0 rgba(0,0,0,.5)); }
.pg-back:active { transform: translateY(3px); box-shadow: 0 0 0 2.5px var(--bark), 0 1px 0 2.5px var(--drop); }

/* Gold arrows either side. */
.pg-arrow { width: clamp(34px, 5.4vw, 64px); height: clamp(48px, 13vh, 92px); display: grid; place-items: center; }
.pg-arrow svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); transition: transform .14s var(--spring, ease); }
.pg-arrow:active svg { transform: scale(.86); }

/* A purse pill: XP, acorns, trophies. */
.pg-pill { display: inline-flex; align-items: center; gap: 6px; height: clamp(32px, 7.4vh, 46px); padding: 0 clamp(10px, 1.4vw, 16px) 0 clamp(6px, 1vw, 10px); border-radius: 14px;
  font-weight: 700; font-size: clamp(14px, 3.6vh, 22px); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--cream);
  background: var(--wood); border: 2.5px solid var(--rim); box-shadow: 0 0 0 2px var(--bark), 0 4px 0 2px var(--drop); }
.pg-pill svg { width: 1.25em; height: 1.25em; flex: none; filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
.pg-pill small { font-size: .62em; letter-spacing: .5px; opacity: .85; }
.pg-pill.xp { color: #e3f5a6; }
.pg-pill.ready { color: #3a2a08; background: linear-gradient(#ffe27a, #eea92c); border-color: #fff3c0; animation: pg-ready 1.6s ease-in-out infinite; }
@keyframes pg-ready { 50% { box-shadow: 0 0 0 2px var(--bark), 0 4px 0 2px var(--drop), 0 0 16px 4px rgba(255,214,90,.55); } }

/* Hanging plank title. */
.pg-plank { position: relative; min-width: 0; max-width: min(60vw, 640px); padding: 2px clamp(22px, 3vw, 40px) clamp(5px, 1.2vh, 10px); text-align: center; color: #fbe9c4;
  background: var(--wood); border: 3px solid var(--bark); border-top: 0; border-radius: 0 0 22px 22px;
  box-shadow: inset 0 -3px 0 var(--rim), inset 3px 0 0 var(--rim), inset -3px 0 0 var(--rim), inset 0 -6px 0 rgba(30,14,4,.5), 0 6px 0 rgba(20,10,3,.45), 0 14px 26px rgba(0,0,0,.35); }
.pg-plank::before, .pg-plank::after { content: ''; position: absolute; top: -6px; width: clamp(48px, 11vh, 86px); aspect-ratio: 200 / 170; pointer-events: none;
  background: url('../../assets/ui/frame-vine.svg') center / contain no-repeat; }
.pg-plank::before { left: -14px; } .pg-plank::after { right: -14px; transform: scaleX(-1); }
.pg-plank h2 { margin: 0; font-size: clamp(20px, 5.4vh, 38px); line-height: 1.15; letter-spacing: .5px; }
.pg-plank p { margin: 0; font-size: clamp(11px, 2.6vh, 16px); font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 rgba(30,14,4,.75); }

/* Little orange "!" badge. */
.pg-bang { position: absolute; z-index: 2; display: grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .35em; border-radius: 999px; font-style: normal; font-weight: 700; line-height: 1;
  color: #fff; background: radial-gradient(circle at 40% 32%, #ff9a52, #e2471c 72%); border: 2px solid #fff3dc; box-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 0 1.5px var(--bark); text-shadow: 0 1px 0 rgba(100,20,0,.6); }

/* ==== Animals ============================================================ */

.ap { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.ap-top { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(64px, 1fr) auto minmax(0, 1fr); align-items: start; gap: 10px;
  padding: 0 clamp(10px, 2vw, 26px); }
.ap-top .pg-back { justify-self: start; margin-top: 10px; }
.ap-purse { justify-self: end; display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.ap-body { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(4px, 1.4vw, 20px); min-height: 0;
  padding: clamp(10px, 2vh, 20px) clamp(6px, 1.6vw, 22px) 12px; touch-action: pan-y; }
.ap-stage { position: relative; height: 100%; min-height: 0; display: grid; place-items: center; container-type: size; }

/* Cards: two rows, up to four across, sized to fit the room (BTD6-like). */
.ap-grid { --gx: clamp(12px, 1.8vw, 26px); --cw: min(24vw, 32vh);
  --gy: calc(var(--cw) * .13);
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; column-gap: var(--gx); row-gap: var(--gy);
  width: calc(var(--cols) * var(--cw) + (var(--cols) - 1) * var(--gx)); padding: calc(var(--cw) * .09) 0 10px; }
@supports (width: 1cqw) {
  .ap-grid { --cw: min(calc((100cqw - (var(--cols) - 1) * var(--gx) - 24px) / var(--cols)), calc((100cqh - 12px) / 2.54)); }
}
.ap-grid.go-next > * { --from: 34px; } .ap-grid.go-prev > * { --from: -34px; }

.ap-card { --i: 0; position: relative; width: var(--cw); aspect-ratio: 1 / 1.16; flex: none; display: block; text-align: center; container-type: inline-size;
  border-radius: calc(var(--cw) * .085); animation: ap-pop .38s cubic-bezier(.2,1.3,.4,1) both; animation-delay: calc(var(--i) * 40ms);
  transition: transform .16s var(--spring, ease), filter .16s; }
@keyframes ap-pop { from { opacity: 0; transform: translateX(var(--from, 0)) translateY(14px) scale(.9); } }
/* The glade: a sunlit clearing in the band's colours, a hill and a few leaves. */
.ap-glade { position: absolute; inset: 0; overflow: hidden; border-radius: inherit;
  background:
    radial-gradient(60% 46% at 50% 40%, rgba(255,255,235,.75), rgba(255,255,235,0) 70%),
    radial-gradient(130% 90% at 50% 28%, var(--g1) 0%, var(--g2) 44%, var(--g3) 100%);
  border: 3px solid var(--rim);
  box-shadow: 0 0 0 3px var(--bark), 0 6px 0 3px var(--drop), 0 14px 22px rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,240,.55), inset 0 -10px 22px rgba(0,0,0,.18); }
.ap-glade::before { content: ''; position: absolute; left: -12%; right: -12%; bottom: -30%; height: 58%; border-radius: 50%;
  background: radial-gradient(70% 60% at 50% 20%, color-mix(in srgb, var(--g4) 70%, #fff) 0%, var(--g4) 55%, color-mix(in srgb, var(--g4) 70%, #000) 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,220,.35); }
.ap-glade::after { content: ''; position: absolute; inset: 0; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cg fill='%23ffffff' fill-opacity='.22'%3E%3Cpath d='M14 12c12 0 15 11 12 17-11-2-15-10-12-17z'/%3E%3Cpath d='M70 58c-12 1-12 12-7 17 11-4 14-12 7-17z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 46% auto; }
.ap-pic { position: absolute; left: 1%; right: 1%; top: 3%; bottom: 18%; display: grid; place-items: center; z-index: 1; }
.ap-pic img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 5px 3px rgba(20,30,10,.35)); transform-origin: 50% 90%; transition: transform .2s var(--spring, ease); }
.ap-pic::after { content: ''; position: absolute; left: 24%; right: 24%; bottom: 0; height: 9%; border-radius: 50%; background: rgba(20,36,10,.35); filter: blur(3px); z-index: -1; }
.ap-name { position: absolute; z-index: 3; left: -6%; right: -6%; top: 0; transform: translateY(-46%); margin: 0; font-size: clamp(12px, 12.5cqw, 34px); line-height: 1; font-weight: 700;
  letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 4px 6px; }
.ap-xp { position: absolute; z-index: 3; left: 0; right: 0; bottom: 4.5%; font-size: clamp(11px, 10.5cqw, 28px); line-height: 1; font-weight: 700; color: #d6f77a; font-variant-numeric: tabular-nums; }
.ap-xp.zero { color: #f3ead2; }
.ap-lv { position: absolute; z-index: 3; top: 9%; left: 6%; display: grid; place-items: center; min-width: 17cqw; height: 15cqw; padding: 0 2cqw; border-radius: 4cqw 4cqw 50% 50% / 4cqw 4cqw 38% 38%;
  font-size: clamp(9px, 7.5cqw, 20px); font-weight: 700; color: #4a2c04; background: linear-gradient(#ffe27a, #e9a32a); border: 2px solid #8a5a12; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.ap-lv small { font-size: .62em; margin-right: 1px; }
.ap-card .pg-bang { top: -4%; right: -4%; font-size: clamp(11px, 8.5cqw, 22px); animation: ap-bang 1.4s ease-in-out infinite; }
@keyframes ap-bang { 50% { transform: scale(1.12); } }
/* Upgrades unlocked so far: three path pips under the picture. */
.ap-paths { position: absolute; z-index: 3; left: 50%; bottom: 17%; transform: translateX(-50%); display: flex; gap: 2.5cqw; }
.ap-paths i { width: 14cqw; height: 3.2cqw; border-radius: 3cqw; background: rgba(20,30,14,.45); overflow: hidden; box-shadow: 0 0 0 1.5px rgba(255,255,240,.45); }
.ap-paths i b { display: block; height: 100%; width: var(--w); background: var(--pc); }

/* Locked: still asleep until the player reaches its level. */
.ap-card.locked .ap-glade { filter: grayscale(.92) brightness(.7); }
.ap-card.locked .ap-pic img { filter: grayscale(1) brightness(.55) drop-shadow(0 5px 3px rgba(0,0,0,.35)); }
.ap-lock { position: absolute; z-index: 3; left: 50%; top: 40%; transform: translate(-50%, -50%); width: 30cqw; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  color: #4a2c04; background: radial-gradient(circle at 40% 32%, #ffe58a, #e3a332 75%); border: 3px solid #fff3c4; box-shadow: 0 0 0 2.5px var(--bark), 0 4px 0 2.5px var(--drop); }
.ap-lock svg { width: 52%; height: 52%; }
.ap-need { position: absolute; z-index: 3; left: 9%; right: 9%; bottom: 5%; display: grid; gap: 1.6cqw; justify-items: center; }
.ap-need small { font-size: clamp(9px, 7.6cqw, 19px); font-weight: 700; color: #ffe7a6; line-height: 1; }
.ap-need span { display: block; width: 100%; height: 6.4cqw; border-radius: 4cqw; background: rgba(0,0,0,.55); box-shadow: 0 0 0 2px #e9b85a; overflow: hidden; }
.ap-need span b { display: block; height: 100%; width: var(--w); background: linear-gradient(180deg, #9ef06c, #49b532); }

.ap-card.recent .ap-glade { box-shadow: 0 0 0 3px var(--bark), 0 0 0 7px rgba(255,234,150,.9), 0 6px 0 3px var(--drop), 0 0 30px 8px rgba(255,220,120,.45), inset 0 2px 0 rgba(255,255,240,.55); }
.ap-card:active { transform: translateY(3px) scale(.97); transition-duration: .05s; }
@media (hover: hover) and (pointer: fine) {
  .ap-card:hover { transform: translateY(-5px) scale(1.03); }
  .ap-card:hover .ap-pic img { transform: scale(1.06) rotate(-2deg); }
  .pg-arrow:hover svg { transform: scale(1.07); }
  .ap-tab:hover { transform: translateY(-2px); filter: none; }
}

/* Bands: four pill tabs along the bottom, each a medallion with its name
   beside it; the chosen one is ringed in gold. */
.ap-tabs { position: relative; z-index: 2; display: flex; justify-content: center; align-items: center; gap: clamp(10px, 1.8vw, 22px); padding: 14px 12px clamp(10px, 2vh, 18px); }
.ap-tab { --m: clamp(40px, 8.4vh, 66px); position: relative; display: flex; align-items: center; gap: clamp(8px, 1vw, 12px); min-width: 0;
  padding: 4px clamp(14px, 1.6vw, 22px) 4px 4px; border-radius: 999px; color: #e6f2c8;
  background: linear-gradient(180deg, #2c5532, #1c3c22); border: 2.5px solid rgba(201,150,65,.6);
  box-shadow: 0 0 0 2px var(--bark), 0 4px 0 2px var(--drop), inset 0 2px 0 rgba(255,236,170,.12); transition: transform .14s var(--spring, ease), filter .14s; }
.ap-medal { position: relative; flex: none; width: var(--m); aspect-ratio: 1; border-radius: 50%; overflow: hidden; display: block;
  background: radial-gradient(circle at 50% 36%, var(--g1), var(--g2) 55%, var(--g3)); border: 3px solid #e9b85a;
  box-shadow: 0 0 0 2px var(--bark), inset 0 -6px 12px rgba(0,0,0,.25); }
.ap-medal img { position: absolute; left: -12%; top: -2%; width: 124%; height: 124%; object-fit: contain; }
.ap-tab b { font-size: clamp(13px, 2.8vh, 21px); font-weight: 700; letter-spacing: .8px; text-transform: uppercase; line-height: 1; white-space: nowrap; }
.ap-tab .pg-bang { top: -7px; right: -7px; font-size: clamp(10px, 2.4vh, 14px); }
.ap-tab[aria-selected="true"] { color: #fffaf0; border-color: #f4c95a;
  background: radial-gradient(120% 90% at 50% 0, rgba(255,226,130,.28), transparent 60%), linear-gradient(180deg, #3d7a42, #24502b);
  box-shadow: 0 0 0 2px var(--bark), 0 0 0 5px rgba(255,226,130,.75), 0 0 22px 6px rgba(255,214,110,.4), 0 4px 0 2px var(--drop); }
.ap-tab[aria-selected="true"] .ap-medal { border-color: #fff3c0; }
.ap-tab[aria-selected="true"] b { color: #ffe27a; }
.ap-tab:not([aria-selected="true"]) { filter: saturate(.8) brightness(.92); }
.ap-tab:active { transform: translateY(2px) scale(.97); }

/* Short screens: a compact header, with a separate row for the group tabs. */
@media (max-height: 520px) {
  .ap-top { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; padding: 8px 12px 0; }
  .ap-top .pg-plank { justify-self: center; border: 0; background: none; box-shadow: none; padding: 0 8px; }
  .ap-top .pg-plank::before, .ap-top .pg-plank::after, .ap-top .pg-plank p { display: none; }
  .ap-top .pg-back, .ap-purse { margin-top: 0; }
  .ap-purse .pg-pill { height: 30px; font-size: 13.5px; border-width: 2px; }
  .ap-tabs { padding-top: 12px; padding-bottom: 10px; }
  .ap-tab { --m: 38px; }
  .ap-tab b { font-size: 13px; }
  .ap-glade { border-width: 2px; box-shadow: 0 0 0 2px var(--bark), 0 4px 0 2px var(--drop), 0 10px 16px rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,240,.55); }
}
/* Landscape: keep the back button and purse in the side gutters, not a
   full header row. The card stage and tabs still have separate grid rows. */
@media (orientation: landscape) {
  .ap { grid-template-rows: minmax(0, 1fr) auto; }
  .ap-top { position: absolute; inset: 0 0 auto; pointer-events: none; }
  .ap-top > * { pointer-events: auto; }
  .ap-top .pg-plank { display: none; }
  .ap-purse { position: fixed; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); flex-direction: column; align-items: flex-end; }
  .ap-body { grid-row: 1; padding-top: 14px; }
  .ap-stage { width: 100%; max-width: calc(100vw - var(--safe-l) - var(--safe-r) - 2 * (var(--back) + 40px)); justify-self: center; }
  .ap-tabs { grid-row: 2; padding-left: max(12px, 18vw); padding-right: max(12px, 18vw); gap: clamp(10px, 1.6vw, 24px); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .ap-top { padding-top: 8px; }
  .ap-body { padding-top: 12px; padding-bottom: 8px; }
  .ap-tabs { padding-top: 8px; padding-bottom: 10px; gap: 12px; }
  .ap-tab { --m: 32px; gap: 7px; padding: 3px 13px 3px 3px; border-width: 2px; }
  .ap-tab b { font-size: 12px; letter-spacing: .5px; }
  .ap-purse { right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); gap: 7px; }
  .ap-purse .pg-pill { height: 28px; font-size: 12px; }
}
/* Narrow / portrait windows: a scrolling grid, two across. */
@media (orientation: portrait) {
  .ap-top { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding-top: 10px; }
  .ap-top .pg-plank { max-width: 100%; justify-self: stretch; }
  .ap-purse { grid-column: 1 / -1; justify-self: center; margin-top: 0; flex-wrap: wrap; justify-content: center; }
  .ap-top .pg-plank p { display: none; }
  .ap-body { grid-template-columns: minmax(0, 1fr); }
  .ap-body .pg-arrow { display: none; }
  .ap-stage { container-type: normal; overflow-y: auto; place-items: start center; padding: 16px 0 10px; }
  .ap-grid { --cw: min(calc((100vw - var(--safe-l) - var(--safe-r) - 48px) / 2), 320px); --cols: 2 !important; }
  .ap-card { container-type: inline-size; }
  .ap-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-left: 14px; padding-right: 14px; }
  .ap-tab { --m: 38px; }
  .ap-tab b { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: clamp(12px, 3.6vw, 17px); letter-spacing: .4px; }
}

/* ==== Heroes ============================================================= */

.hx { --h1: #d9f0b0; --h2: #6aa64e; --h3: #2f5a2a; --side: clamp(190px, 29vw, 420px); --rail: clamp(148px, 17vw, 248px);
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--rail); }
/* Heroes swap the hall for their own colours: a deep glade with slanted light. */
.hx .pg-bg { background: radial-gradient(70% 80% at 58% 42%, color-mix(in srgb, var(--h2) 55%, #0c2016) 0%, #0d2417 60%, #07160d 100%); }
.hx .pg-bg::before { filter: blur(10px) saturate(.9) brightness(.32); opacity: .55; }
.hx .pg-bg::after { background:
  linear-gradient(118deg, transparent 0 38%, color-mix(in srgb, var(--h1) 14%, transparent) 38% 52%, transparent 52% 60%, color-mix(in srgb, var(--h1) 8%, transparent) 60% 66%, transparent 66%),
  radial-gradient(60% 70% at 58% 44%, transparent 40%, rgba(4,12,7,.6) 100%); }

/* Left: back, count and the hero cards. */
.hx-side { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px; min-height: 0; padding: 10px 0 10px clamp(10px, 1.6vw, 22px); }
.hx-sidehead { display: flex; align-items: center; gap: 12px; }
.hx-count { display: grid; line-height: 1.05; }
.hx-count b { font-size: clamp(17px, 4.4vh, 28px); color: #ffe27a; }
.hx-count small { font-size: clamp(11px, 2.5vh, 15px); font-weight: 700; color: #d9e6c4; }
.hx-roster { --cols: 2; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); align-content: start; gap: clamp(8px, 1.6vh, 14px);
  padding: clamp(8px, 1.6vh, 14px); border-radius: 20px; scrollbar-width: thin; scrollbar-color: #b8873a transparent;
  background: linear-gradient(180deg, rgba(10,28,16,.82), rgba(6,18,10,.88)); border: 3px solid var(--rim);
  box-shadow: 0 0 0 3px var(--bark), 0 6px 0 3px rgba(16,8,2,.7), inset 0 0 0 2px rgba(255,236,170,.08), inset 0 10px 20px rgba(0,0,0,.35); }
.hx-card { min-width: 0; --c1: #d9f0b0; --c2: #6aa64e; position: relative; aspect-ratio: 1 / 1.08; border-radius: 16px; overflow: visible; display: block;
  animation: ap-pop .34s cubic-bezier(.2,1.3,.4,1) both; animation-delay: calc(var(--i, 0) * 45ms); transition: transform .15s var(--spring, ease); }
.hx-card-in { position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  background: radial-gradient(90% 80% at 50% 30%, var(--c1), var(--c2) 70%, color-mix(in srgb, var(--c2) 60%, #000) 100%);
  border: 3px solid #b8873a; box-shadow: 0 0 0 2.5px var(--bark), 0 5px 0 2.5px var(--drop), inset 0 2px 0 rgba(255,255,240,.45); }
.hx-card-in img { position: absolute; left: -8%; top: 0; width: 116%; height: 116%; object-fit: contain; object-position: 50% 0; filter: drop-shadow(0 4px 3px rgba(0,0,0,.3)); transition: transform .2s var(--spring, ease); }
.hx-card-name { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 14% 4px 5%; font-size: clamp(12px, 2.9vh, 18px); font-weight: 700; line-height: 1;
  background: linear-gradient(180deg, transparent, rgba(8,18,10,.78) 55%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-card .pg-bang { top: -7px; right: -7px; font-size: clamp(11px, 2.6vh, 15px); }
.hx-card-tag { position: absolute; z-index: 2; left: 50%; bottom: -9px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 5px; border-radius: 999px;
  font-style: normal; font-weight: 700; font-size: clamp(11px, 2.6vh, 15px); white-space: nowrap; color: #d6f77a; background: rgba(8,18,10,.92); box-shadow: 0 0 0 2px #b8873a, 0 3px 0 2px var(--drop); }
.hx-card-tag svg { width: 1.15em; height: 1.15em; }
.hx-card-tag.free { color: #3a2a08; background: linear-gradient(#ffe27a, #eea92c); box-shadow: 0 0 0 2px #fff3c0, 0 3px 0 2px var(--drop); }
.hx-card.unowned .hx-card-in img { filter: saturate(.25) brightness(.62); }
.hx-card.unowned .hx-card-name { color: #d4d6c4; }
.hx-card.unowned:has(.hx-card-tag) .hx-card-name { padding-bottom: 14%; }
.hx-star { position: absolute; z-index: 2; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  color: #4a2c04; background: radial-gradient(circle at 40% 32%, #fff0a0, #eaa52c 75%); box-shadow: 0 0 0 2px var(--bark), 0 2px 0 2px var(--drop); }
.hx-star svg { width: 62%; height: 62%; }
.hx-card.on { transform: translateY(-2px); }
.hx-card.on .hx-card-in { border-color: #fff3c0; box-shadow: 0 0 0 2.5px var(--bark), 0 0 0 6px #f6c84a, 0 0 22px 6px rgba(255,214,100,.5), 0 5px 0 2.5px var(--drop); }
.hx-card:active { transform: scale(.95); transition-duration: .05s; }

/* Centre: banner, hero, status, cost and the bio bar. */
.hx-main { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; justify-items: center; min-height: 0; min-width: 0;
  padding: 8px clamp(10px, 2vw, 30px) 10px; }
.hx-banner { position: relative; justify-self: stretch; display: grid; justify-items: start; margin: 0 0 0 clamp(0px, 3vw, 40px); padding: 0; min-width: 0; animation: hx-slide .4s var(--ease-out, ease-out) both; }
@keyframes hx-slide { from { opacity: 0; transform: translateX(-30px); } }
.hx-ribbon { position: relative; display: block; max-width: 100%; padding: clamp(2px, .6vh, 6px) clamp(70px, 12vw, 180px) clamp(2px, .6vh, 6px) clamp(18px, 2.4vw, 32px);
  transform: skewX(-12deg); border-radius: 8px 4px 4px 8px;
  background: linear-gradient(90deg, var(--h3) 0 1.6%, transparent 1.6% 2.6%, color-mix(in srgb, var(--h2) 90%, #fff) 2.6%, var(--h2) 45%, color-mix(in srgb, var(--h2) 45%, transparent) 76%, transparent);
  box-shadow: inset 0 3px 0 rgba(255,255,230,.35), inset 0 -4px 0 rgba(0,0,0,.2); }
.hx-ribbon::after { content: ''; position: absolute; left: 0; right: 30%; bottom: -7px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, #f6c84a, rgba(246,200,74,0)); }
.hx-ribbon h2 { margin: 0; transform: skewX(12deg); font-size: clamp(26px, 8.4vh, 66px); line-height: 1.05; font-weight: 700; letter-spacing: 1px; color: #fffbea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-title { margin: clamp(6px, 1.2vh, 10px) 0 0 clamp(24px, 3.4vw, 46px); font-size: clamp(13px, 3.6vh, 24px); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #ffb45a; line-height: 1.05; }
.hx-title small { margin-left: 8px; font-size: .72em; letter-spacing: .5px; color: #e8efd6; text-transform: none; }

.hx-stage { position: relative; width: 100%; height: 100%; min-height: 0; display: grid; place-items: center; }
.hx-stage::before { content: ''; position: absolute; left: 50%; top: 50%; width: min(78%, 92%); aspect-ratio: 1; max-height: 112%; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--h1) 70%, transparent) 0%, color-mix(in srgb, var(--h2) 45%, transparent) 38%, transparent 68%); }
.hx-rays { position: absolute; left: 50%; top: 50%; width: min(96%, 140vh); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; opacity: .55;
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 64%); mask: radial-gradient(circle, #000 18%, transparent 64%); }
.hx-rays::before { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--h1) 55%, transparent) 0 7deg, transparent 7deg 22deg); animation: hx-spin 40s linear infinite; }
@keyframes hx-spin { to { transform: rotate(1turn); } }
.hx-stage .hx-shadow { position: absolute; left: 50%; bottom: 6%; width: 30%; height: 7%; transform: translateX(-50%); border-radius: 50%; background: rgba(0,0,0,.4); filter: blur(5px); }
.hx-hero { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 8px rgba(0,0,0,.35));
  animation: hx-bob 3s ease-in-out infinite, hx-pop .45s cubic-bezier(.2,1.3,.4,1) both; transform-origin: 50% 90%; }
@keyframes hx-bob { 50% { transform: translateY(-2.5%); } }
@keyframes hx-pop { from { opacity: 0; scale: .85; } }
.hx-looks { position: absolute; z-index: 2; left: 0; top: 50%; transform: translateY(-50%); display: grid; gap: clamp(5px, 1.2vh, 9px); }
.hx-look { min-width: clamp(46px, 6vw, 66px); height: clamp(28px, 6.4vh, 40px); padding: 0 8px; border-radius: 12px; font-weight: 700; font-size: clamp(12px, 2.9vh, 17px);
  color: var(--cream); background: rgba(8,22,12,.72); box-shadow: inset 0 0 0 2px rgba(217,166,74,.6), 0 3px 0 rgba(0,0,0,.35); transition: transform .12s; }
.hx-look.on { color: #3a2a08; background: linear-gradient(#ffe27a, #e9a32a); box-shadow: 0 0 0 2px var(--bark), 0 3px 0 2px var(--drop); }
.hx-look:active { transform: scale(.94); }
.hx-skintag { position: absolute; z-index: 2; right: 2%; top: 4%; display: grid; justify-items: end; gap: 3px; max-width: 46%; text-align: right; }
.hx-skintag b { font-size: clamp(14px, 3.6vh, 22px); line-height: 1.1; }
.hx-skintag .sk-badge { font-style: normal; font-size: clamp(10px, 2.3vh, 13px); font-weight: 700; letter-spacing: .8px; text-transform: uppercase; padding: 2px 9px; border-radius: 999px;
  color: #1b1408; background: var(--rc); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.hx-status { position: absolute; z-index: 4; left: 50%; bottom: 4px; transform: translateX(-50%); max-width: 92%; margin: 0; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
  text-align: center; color: #fff6d0; background: rgba(8,22,12,.88); box-shadow: 0 0 0 2px #6fb34a, 0 4px 10px rgba(0,0,0,.35); animation: ap-pop .3s ease both; }
.hx-status.bad { box-shadow: 0 0 0 2px #e0533a, 0 4px 10px rgba(0,0,0,.35); color: #ffd0c4; }
.hx-status:empty { display: none; }

.hx-act { display: grid; justify-items: center; gap: 4px; min-height: clamp(38px, 9vh, 58px); align-content: center; }
.hx-selected { display: inline-flex; align-items: center; gap: 8px; font-size: clamp(22px, 6.4vh, 42px); font-weight: 700; color: #9ef06c; letter-spacing: 1px; text-transform: uppercase; line-height: 1; }
.hx-selected svg { width: .9em; height: .9em; color: #ffe27a; filter: drop-shadow(0 2px 0 var(--ink)); }
.hx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: clamp(170px, 24vw, 280px); height: clamp(40px, 9.6vh, 60px); padding: 0 22px; border-radius: 16px;
  font-weight: 700; font-size: clamp(16px, 4.2vh, 25px); color: #fffaf0; border: 3px solid #f4c95a;
  background: radial-gradient(70% 60% at 50% 0, rgba(255,255,210,.32), transparent 70%), linear-gradient(180deg, #8fe06a 0%, #62c447 36%, #45a236 70%, #2f8029 100%);
  box-shadow: 0 0 0 3px var(--bark), 0 6px 0 3px var(--drop), inset 0 2px 0 rgba(255,255,220,.5), inset 0 -5px 0 rgba(20,70,12,.38); transition: transform .1s; }
.hx-btn svg { width: 1em; height: 1em; }
.hx-btn:active { transform: translateY(4px); box-shadow: 0 0 0 3px var(--bark), 0 2px 0 3px var(--drop), inset 0 2px 0 rgba(255,255,220,.5); }
.hx-btn.buy { color: #3a2a08; border-color: #fff3c0; background: radial-gradient(70% 60% at 50% 0, rgba(255,255,230,.45), transparent 70%), linear-gradient(180deg, #ffe58a, #f2b843 55%, #d9901f); box-shadow: 0 0 0 3px var(--bark), 0 6px 0 3px var(--drop), inset 0 -5px 0 rgba(120,70,10,.3); }
.hx-btn.buy.poor { filter: saturate(.4) brightness(.92); }
.hx-btn.armed { color: #fffaf0; border-color: #f4c95a; background: linear-gradient(180deg, #8fe06a, #45a236 70%, #2f8029); animation: pg-ready .9s ease-in-out infinite; }
/* Skin actions from ui/skins-ui.js, restyled for the stage. */
.hx-act .sk-act { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 170px; height: clamp(38px, 9vh, 54px); padding: 0 18px; border-radius: 14px; font-weight: 700;
  font-size: clamp(14px, 3.8vh, 21px); color: #3a2a08; border: 3px solid #fff3c0; background: linear-gradient(180deg, #ffe58a, #f2b843 55%, #d9901f); box-shadow: 0 0 0 3px var(--bark), 0 5px 0 3px var(--drop); }
.hx-act .sk-act svg { width: 1.1em; height: 1.1em; }
.hx-act .sk-act.primary, .hx-act .sk-buy.armed { color: #fff; border-color: #f4c95a; background: linear-gradient(180deg, #8fe06a, #45a236 70%, #2f8029); }
.hx-act .sk-act.poor { filter: saturate(.4) brightness(.92); }
.hx-act .sk-goal { display: grid; gap: 4px; justify-items: center; min-width: min(320px, 100%); }
.hx-act .sk-goal small { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: #ffe7a6; text-align: center; }
.hx-act .sk-goal small svg { width: 15px; height: 15px; flex: none; }
.hx-act .sk-bar { position: relative; display: block; width: min(300px, 70vw); height: 20px; border-radius: 10px; background: rgba(0,0,0,.55); box-shadow: 0 0 0 2px #e9b85a; overflow: hidden; }
.hx-act .sk-bar i { display: block; height: 100%; background: linear-gradient(180deg, #9ef06c, #49b532); }
.hx-act .sk-bar b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; text-shadow: 0 1px 0 #000; }
.hx-act .sk-note { font-size: 12px; color: #cfd6b4; }
.hx-cost { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; margin: 2px 0 6px; font-size: clamp(12px, 3vh, 17px); font-weight: 700; color: #ffd76a; }
.hx-cost span { display: inline-flex; align-items: center; gap: 5px; }
.hx-cost span + span { color: #d9e6c4; font-weight: 500; }
.hx-cost svg { width: 1.2em; height: 1.2em; color: #ffc94a; filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
.hx-bio { position: relative; justify-self: stretch; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: clamp(6px, 1.4vh, 12px) 10px clamp(6px, 1.4vh, 12px) clamp(12px, 1.6vw, 22px);
  border-radius: 14px; background: rgba(4,12,7,.82); box-shadow: 0 0 0 2px rgba(217,166,74,.55), 0 5px 0 2px rgba(0,0,0,.35); }
.hx-bio::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -6px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(246,200,74,0), #f6c84a 20%, #f6c84a 80%, rgba(246,200,74,0)); }
.hx-bio p { margin: 0; font-size: clamp(12px, 3vh, 18px); line-height: 1.35; text-align: center; color: #f4ecd6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hx-more { width: clamp(38px, 8.6vh, 54px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 40% 32%, #9ef06c, #3f9a2e 75%); border: 3px solid #fff3c0; box-shadow: 0 0 0 2.5px var(--bark), 0 4px 0 2.5px var(--drop); transition: transform .2s var(--spring, ease); }
.hx-more svg { width: 58%; height: 58%; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.hx-more[aria-expanded="true"] svg { transform: rotate(180deg); }

/* Right: purse and the skins, as round medallions. */
.hx-rail { display: grid; grid-template-rows: auto auto minmax(0, 1fr); justify-items: center; gap: 6px; min-height: 0; padding: 10px clamp(8px, 1.4vw, 20px) 10px 0; }
.hx-rail .pg-pill { justify-self: end; height: clamp(32px, 7.4vh, 44px); font-size: clamp(13px, 3.4vh, 20px); }
.hx-rail h3 { margin: 4px 0 0; font-size: clamp(13px, 3.2vh, 19px); line-height: 1; letter-spacing: 1px; text-transform: uppercase; color: #ffe27a; text-align: center; }
.hx-rail h3 small { display: block; margin-top: 2px; font-size: .74em; color: #d9e6c4; letter-spacing: .5px; }
.hx-skins { min-height: 0; min-width: 0; width: 100%; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; justify-items: center; gap: 12px 8px;
  padding: 14px 10px 18px; border: 1px solid rgba(217,166,74,.3); border-radius: 18px; background: rgba(4,16,9,.35); scrollbar-width: thin; scrollbar-color: #b8873a transparent; container-type: inline-size; }
.hx-skin { --rc: #e9b85a; position: relative; display: grid; justify-items: center; gap: 9px; width: 100%; min-width: 0; padding: 4px 0; animation: ap-pop .34s cubic-bezier(.2,1.3,.4,1) both; animation-delay: calc(var(--i, 0) * 40ms); }
.hx-skin-pic { position: relative; width: min(84px, 12vh, calc((100cqw - 24px) / 2)); aspect-ratio: 1; border-radius: 50%; overflow: hidden; display: block;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--h1) 80%, #fff), var(--h2) 75%); border: 4px solid var(--rc);
  box-shadow: 0 0 0 2.5px var(--bark), 0 4px 0 2.5px var(--drop), inset 0 -6px 10px rgba(0,0,0,.25); transition: transform .18s var(--spring, ease), box-shadow .18s; }
.hx-skin-pic img { position: absolute; left: -10%; top: 0; width: 120%; height: 120%; object-fit: contain; object-position: 50% 0; }
.hx-skin { max-width: 100%; }
.hx-skin small { display: inline-flex; align-items: center; justify-content: center; gap: 3px; max-width: 100%; overflow: hidden; font-size: clamp(10.5px, 2.4vh, 14px); font-weight: 700; line-height: 1.15; color: #d6f77a; white-space: nowrap; }
.hx-skin small svg { width: 1.15em; height: 1.15em; flex: none; }
.hx-skin small.muted { color: #e8efd6; }
.hx-skin.locked .hx-skin-pic img { filter: saturate(.3) brightness(.7); }
.hx-skin.on .hx-skin-pic { transform: none; box-shadow: 0 0 0 2.5px var(--bark), 0 0 0 5px #fff3c0, 0 0 14px 3px color-mix(in srgb, var(--rc) 70%, transparent), 0 4px 0 2.5px var(--drop); }
.hx-skin .hx-worn { position: absolute; z-index: 2; top: 0; left: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 40% 32%, #9ef06c, #3f9a2e 75%); box-shadow: 0 0 0 2px var(--bark); }
.hx-skin .hx-worn svg { width: 64%; height: 64%; }
.hx-skin .pg-bang { top: -4px; right: -6px; font-size: 12px; }
.hx-skin:active .hx-skin-pic { transform: scale(.94); }

/* Details drawer: abilities and all 20 levels. */
.hx-drawer { position: absolute; z-index: 6; left: var(--side); right: 0; bottom: 0; top: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) 16px; margin-left: 10px;
  background: linear-gradient(180deg, rgba(14,36,20,.97), rgba(7,20,12,.98)); border-left: 3px solid var(--rim); box-shadow: -3px 0 0 var(--bark), -18px 0 40px rgba(0,0,0,.45);
  animation: hx-drawer .26s var(--ease-out, ease-out) both; }
@keyframes hx-drawer { from { transform: translateX(40px); opacity: 0; } }
.hx-drawer[hidden] { display: none; }
.hx-dhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hx-dhead h3 { margin: 0; font-size: clamp(18px, 4.6vh, 28px); line-height: 1.1; }
.hx-dhead h3 small { display: block; font-size: .55em; font-weight: 500; color: #d9e6c4; }
.hx-dscroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 12px; align-content: start; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #b8873a transparent; }
.hx-abs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hx-ab { position: relative; display: grid; gap: 4px; padding: 10px 12px 12px; border-radius: 16px; background: rgba(255,255,255,.06); box-shadow: 0 0 0 2px rgba(217,166,74,.55); }
.hx-ab b { display: flex; align-items: center; gap: 6px; font-size: 16px; padding-right: 50px; }
.hx-ab b svg { width: 18px; height: 18px; color: #f2c14e; flex: none; }
.hx-ab small { font-size: 13px; line-height: 1.35; color: #e1e9cf; }
.hx-ab small i { display: block; font-style: normal; color: #b9c6ae; margin-top: 2px; }
.hx-ab .max { color: #ffe08a; }
.hx-ab em { position: absolute; top: 9px; right: 10px; padding: 1px 8px; border-radius: 999px; font-style: normal; font-size: 12px; font-weight: 700; color: #3a2a08; background: linear-gradient(#ffd666, #e2a52c); }
.hx-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.hx-facts span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1.5px rgba(217,166,74,.45); }
.hx-facts svg { width: 15px; height: 15px; color: #ffc94a; }
.hx-blurb { margin: 0; font-size: 14px; line-height: 1.4; color: #e8efd6; }
.hx-levels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.hx-levels li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; align-items: start; padding: 6px 8px; border-radius: 12px; }
.hx-levels li em { font-style: normal; font-weight: 700; text-align: center; height: 28px; line-height: 28px; border-radius: 9px; background: rgba(255,255,255,.1); font-variant-numeric: tabular-nums; }
.hx-levels li b { display: block; font-size: 14px; }
.hx-levels li small { display: block; font-size: 12.5px; line-height: 1.3; color: #c9d4b8; }
.hx-levels li.key { background: rgba(255,255,255,.06); }
.hx-levels li.key em { background: linear-gradient(#ffd666, #e2a52c); color: #3a2a08; }
.hx-levels li.look em { box-shadow: 0 0 0 2px #9ef06c; }
.hx-note { margin: 0; font-size: 12.5px; color: #b9c6ae; line-height: 1.4; }

.hx-close { background: radial-gradient(circle at 40% 32%, #a26b38, #5a3216 75%); }
/* In-place redraws (HeroUI.refresh) only replay what changed. */
.hx.calm-side .hx-card, .hx.calm-rail .hx-skin, .hx.calm-banner .hx-banner { animation: none; }
.hx.calm-hero .hx-hero { animation: hx-bob 3s ease-in-out infinite; }

@media (hover: hover) and (pointer: fine) {
  .hx-card:hover { transform: translateY(-3px); }
  .hx-card:hover .hx-card-in img { transform: scale(1.05); }
  .hx-skin:hover .hx-skin-pic { transform: scale(1.06); }
  .hx-more:hover { transform: translateY(-2px); }
}
/* Phones in landscape: three hero cards across, slimmer rims. */
@media (max-height: 520px) {
  .hx { --side: clamp(180px, 31vw, 300px); }
  .hx-roster { --cols: 3; gap: 18px 8px; padding: 8px 8px 12px; border-width: 2px; }
  .hx-card-in { border-width: 2px; border-radius: 12px; }
  .hx-card-name { font-size: 11px; }
  .hx-card-tag { font-size: 10.5px; bottom: -7px; }
  .hx-star { width: 20px; height: 20px; top: 3px; left: 3px; }
  .hx-count small { display: none; }
  .hx-main { padding-top: 6px; padding-bottom: 8px; }
  .hx-ribbon { padding-right: 70px; }
  .hx-title { margin-top: 5px; }
  .hx-bio p { -webkit-line-clamp: 2; font-size: 12px; }
  .hx-abs, .hx-levels { grid-template-columns: minmax(0, 1fr); }
  .hx-skin-pic { border-width: 3px; }
  .hx-skins { gap: 10px 8px; padding: 12px 8px 16px; }
  .hx-skin small { font-size: 10px; }
  .hx-skin .hx-worn { width: 18px; height: 18px; }
  .hx-rail h3 small { display: none; }
}
@media (max-height: 380px) { .hx-title small { display: none; } .hx-cost span + span { display: none; } }
/* Narrow / portrait windows: stack the three columns and scroll. */
@media (orientation: portrait) {
  .hx { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; overflow-y: auto; }
  .hx-side { padding-right: 12px; }
  .hx-roster { --cols: 3; overflow: visible; gap: 16px 12px; }
  .hx-main { min-height: 600px; grid-template-rows: auto minmax(260px, 1fr) auto auto auto; }
  .hx-rail { padding: 0 12px 20px; }
  .hx-skins { grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .hx-skin-pic { width: min(84px, 18vw); }
  .hx-rail { grid-template-rows: auto auto auto; gap: 12px; }
  .hx-ribbon { padding-right: 36px; }
  .hx-title { margin-left: 12px; }
  .hx-drawer { left: 0; position: fixed; }
}
@media (prefers-reduced-motion: reduce) {
  .pg, .pg *, .pg *::before, .pg *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
