/*
 * Every screen fits the window: the page itself never scrolls (Cole, 2026-10-27).
 * Phones: a 48 px top bar, the screen, and the 62 px bottom nav, all inside one window-tall box.
 */
@media (max-width: 760px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .appbar { position: relative; top: auto; }
  .app > .strip { position: relative; top: auto; flex: none; }
  /* Pages fill the space between the bars; one still taller than that scrolls inside it until it is fitted. */
  .app > #page { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; }
  .app > #kinhall { flex: 1 1 auto; min-height: 0; }

  /* ---------- Hunt: the field on top, then one panel under its tabs ---------- */
  #huntview.game { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 6px; }
  #huntview > * { flex: none; }
  #huntview { --fieldh: clamp(176px, calc(100dvh - 500px), 380px); }
  #huntview .stage { height: var(--fieldh); min-height: 0; }
  #huntview .stage canvas#field { height: var(--fieldh); }
  /* Battery saver: its cards scroll inside the field's box (they ran out of it over the panel below; Custang 11-15). */
  #huntview .stage.saver-on { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
  #huntview .ptabs { order: 3; grid-template-columns: repeat(5, 1fr); }
  #huntview .ptabs button { min-height: 38px; padding: 0 2px; }
  /* The fold button at the end of the tabs: the panel goes, the hunt takes the screen down to the tabs (Cole, 11-23). */
  #huntview .ptabs { grid-template-columns: repeat(5, 1fr) 40px; }
  #huntview .ptabs .pt-fold { display: grid; place-items: center; align-self: center; width: 32px; height: 30px; min-height: 0; margin-left: 4px; padding: 0; border: 1px solid var(--rule-soft, var(--line)); border-radius: 6px; background: rgba(0, 0, 0, .18); color: var(--cream-2, var(--muted)); }
  #huntview .ptabs .pt-fold:active { background: rgba(0, 0, 0, .32); }
  #huntview.pfold .stage { flex: 1 1 auto; height: auto; }
  #huntview.pfold .stage canvas#field { height: 100%; }
  #huntview.pfold > .lcol, #huntview.pfold > .rcol, #huntview.pfold .session { display: none !important; }
  #huntview.pfold[data-ptab="log"] .combatlog { display: none; }
  /* The hunt card stops short of the scene tools on the right (it ran under them, Cole 11-23). */
  [data-theme] #huntview .stage .huntcard { max-width: calc(100% - 56px); }

  /* The away card: over the field just under the hunt card, and over the tabs below it until it is closed. The field
     is a fixed height here, so a card in the flow under it spilled over the tabs and the panel, and chat lines showed
     through it. */
  #huntview .ov.away { position: absolute; top: var(--away-top, 8px); left: 6px; right: 6px; width: auto; margin: 0; z-index: 30; max-height: calc(100dvh - var(--away-top, 8px) - 140px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }

  /* Overlays sit by the field's edges, whatever its height. */
  #huntview .combatlog { top: auto; bottom: 8px; }
  #huntview .zoom { top: auto; bottom: 8px; }
  #huntview .fieldtools { bottom: auto; }

  /* Team: the lead in one compact card, the other four two by two. */
  #huntview:not([data-ptab="team"]) .slot.lead { display: none; }
  #huntview .slot.lead { order: 4; padding: 6px 8px 7px; }
  #huntview .slot.lead .lead-top { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
  #huntview .slot.lead .lead-top img, #huntview .slot.lead .lead-top .walker { width: 44px; height: 44px; }
  #huntview .slot.lead .r1 .nm { font-size: 16px; }
  #huntview .slot.lead .r2 { margin: 0; }
  #huntview .slot.lead .rpills:not(.m) { display: none; }
  #huntview .slot.lead .lead-top .grow { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; }
  #huntview .slot.lead .lead-top .r1 { flex: 1 0 100%; }
  #huntview .slot.lead .lead-mini { display: block; }
  #teamlist .slot.bench .peek-btn { display: none; }
  #huntview .slot.lead .bar.big { margin-top: 4px; height: 14px; }
  #huntview .slot.lead .movebar { margin-top: 5px; }
  #huntview[data-ptab="team"] #teamlist .slots { display: grid; order: 4; }
  #huntview[data-ptab="team"] .slot.lead { grid-column: 1 / -1; }
  #huntview[data-ptab="team"] .slot.bench, #huntview[data-ptab="team"] .slot.empty { order: 5; }
  #teamlist .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }

  /* Trainer: who you are, the pass and VIP, boosts, and the day's quests. */
  #huntview:not([data-ptab="trainer"]) .panel.playercard,
  #huntview:not([data-ptab="trainer"]) .questsum,
  #huntview:not([data-ptab="trainer"]) .boostsum,
  #huntview:not([data-ptab="trainer"]) .shrinesum,
  #huntview:not([data-ptab="trainer"]) .startersum { display: none !important; }
  #huntview[data-ptab="trainer"] .panel.playercard { display: block; order: 4; }
  /* What you wear and the gear sets, right under your card (phones are the main platform). */
  #huntview[data-ptab="trainer"] .statsum { order: 4; }
  #huntview[data-ptab="trainer"] .startersum { order: 5; }
  #huntview[data-ptab="trainer"] .shrinesum { order: 6; }
  #huntview[data-ptab="trainer"] .boostsum { order: 7; }
  #huntview[data-ptab="trainer"] .questsum { order: 8; }
  #huntview[data-ptab="trainer"] .questsum:not([hidden]), #huntview[data-ptab="trainer"] .boostsum:not([hidden]) { display: block; }
  #huntview[data-ptab="trainer"] .rcol { display: none; }

  /* Log: the whole log and the session fill what is left. */
  #huntview { --panelh: calc(100dvh - 172px - var(--fieldh)); }
  #huntview[data-ptab="log"] .combatlog { position: absolute; top: calc(var(--fieldh) + 50px); left: 0; right: 0; bottom: auto; height: calc(var(--panelh) - 68px); margin: 0; overflow: hidden; display: flex; flex-direction: column; }
  #huntview[data-ptab="log"] .combatlog > * { flex: none; }
  /* The Catches and Relics tabs keep the full width too (their desktop box is 440-520 px). */
  #huntview[data-ptab="log"] .combatlog.catches { width: auto; max-width: none; }
  #huntview[data-ptab="log"] .combatlog > .cap-list { display: grid; }
  #huntview[data-ptab="log"] .combatlog > .fit-pager { display: flex; }
  #huntview[data-ptab="log"] .combatlog > .fit-pager[hidden] { display: none; }
  #huntview[data-ptab="log"] .session { position: absolute; top: calc(var(--fieldh) + 50px + var(--panelh) - 62px); left: 0; right: 0; height: 62px; margin: 0; }
  #huntview[data-ptab="log"] .rcol { display: none; }
  /* Battery saver: the field's box scrolls its cards and clipped the log into it, so the log showed up there and the
     panel under the tabs stayed empty (Discord, 11-19). The log hangs from the hunt view instead, in the same place,
     and takes the session strip's room too (the strip is off in the saver; its cards say the same). */
  #huntview[data-ptab="log"]:has(> .stage.saver-on) { position: relative; }
  #huntview[data-ptab="log"] > .stage.saver-on { position: static; }
  #huntview[data-ptab="log"] > .stage.saver-on .combatlog { top: calc(var(--fieldh) + 61px); left: 13px; right: 13px; height: calc(var(--panelh) - 6px); }

  /* Auto and Chat: the panel takes what is left under the tabs. */
  #huntview[data-ptab="auto"] .rcol, #huntview[data-ptab="chat"] .rcol { order: 4; flex: 1 1 0; min-height: 0; display: flex; }
  #huntview[data-ptab="auto"] .rcol > .panel.auto { flex: 1 1 0; min-height: 0; overflow: hidden; }
  #huntview[data-ptab="chat"] .rcol .feed { flex: 1 1 0; min-height: 0 !important; }
}
.lead-mini { display: none; }
@media (max-width: 760px) {
  /* Automation on a phone: the two main choices side by side, the rest as short rows; an open row takes the panel. */
  #huntview .panel.auto .phead { padding-top: 6px; padding-bottom: 6px; }
  #huntview .auto .grp.now { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; align-items: center; padding-bottom: 4px; }
  #huntview .auto .grp.now > :not(.line) { grid-column: 1 / -1; }
  #huntview .auto .grp.now .line { margin: 2px 0; font-size: 13px; }
  #huntview .auto .grp.now .line select { max-width: 64%; }
  #huntview .auto .grp.now .ainuse { order: 3; margin: 4px 0 2px; }
  #huntview .auto .adv-h { height: 31px; }
  #huntview .auto:has(.adv.open) .grp.now, #huntview .auto:has(.adv.open) .adv:not(.open) { display: none; }
}
@media (max-width: 760px) {
  /* Trainer tab: short offer rows, quests in short rows. */
  #huntview .playercard .perks { gap: 2px; }
  #huntview .playercard .perk, #huntview .playercard .pc-xpb, #huntview .playercard .pc-next { height: 26px; }
  #huntview .questsum { padding-top: 8px; padding-bottom: 8px; }
  #huntview .questsum .qs-head { padding-bottom: 6px; }
  #huntview .questsum .qs-row { min-height: 21px; font-size: 13px; }
  #huntview .questsum .qs-row.qs-hour .btn { min-height: 26px; height: 26px; padding: 0 10px; }
  #huntview .auto .grp.now .line { white-space: nowrap; }
}
/* Short phones: the field keeps its view, so the last-kill line lives in the Log tab only. */
@media (max-width: 760px) and (max-height: 740px) {
  #huntview:not([data-ptab="log"]) .combatlog { display: none; }
  .huntcard { padding-top: 5px; padding-bottom: 5px; }
}
@media (max-width: 760px) {
  #huntview .questsum .qs-head { min-height: 0; }
  #huntview .questsum .qs-head .link { min-height: 28px; display: inline-flex; align-items: center; }
  /* A ready claim takes the place of the All quests link, so it adds no row. */
  #huntview .questsum { position: relative; }
  #huntview .questsum:has(.q-claimbtn) .qs-head .link { visibility: hidden; }
  #huntview .questsum .q-claimbtn { position: absolute; top: 8px; right: 14px; min-height: 30px; height: 30px; margin: 0; }
  #huntview .playercard .bchips { padding-bottom: 5px; }
}
/* The shortest phones: the top bar already shows your level, so the Trainer tab starts at the pass. */
@media (max-width: 760px) and (max-height: 700px) {
  #huntview .playercard .pc { display: none; }
}

/* ---------- Pages on a phone ---------- */
@media (max-width: 760px) {
  /* The bottom nav's Hunt returns to the hunt, so pages skip the hunt strip. */
  .app > .strip { display: none !important; }
  .page-inner { padding: 8px 10px 8px; }
  [data-theme="codex"] .pagetitle { padding-bottom: 7px; margin-bottom: 8px; align-items: center; row-gap: 6px; }
  [data-theme="codex"] .pagetitle h1 { font-size: 26px; }
}

/* Phone sections (client/psec.ts): tabs and one section at a time on a phone, everything in place elsewhere. */
.psec-tabs { display: none; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: 0 0 8px; border-bottom: 1px solid var(--rule-soft, var(--line)); }
.psec { display: contents; }
/* Tabs marked "all" take turns at every size, not just on a phone. */
.psec-tabs.all { display: grid; }
.psec.all:not(.on) { display: none; }
.psec-tabs button { position: relative; min-height: 36px; padding: 0 4px; background: none; border: 0; color: var(--cream-2, var(--muted)); font: 700 14px var(--pixel, var(--sans)); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psec-tabs button.on { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
.panel .psec-tabs button { color: var(--muted); }
.panel .psec-tabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--rg-ink, var(--accent)); }
/* The dot sits just after the word, centred on it, never over its letters. */
.psec-tabs .dot { display: inline-block; width: 6px; height: 6px; margin: 0 0 0 4px; border-radius: 50%; background: var(--rg-rubric, var(--warn)); vertical-align: middle; transform: translateY(-1px); }
@media (min-width: 761px) { .psec-tabs .dot { width: 7px; height: 7px; margin-left: 6px; } }
@media (min-width: 761px) { .psec-tabs.all { justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; } .psec-tabs.all button { padding: 0 2px; font-size: 15px; } }
@media (max-width: 760px) {
  .psec-tabs { display: grid; }
  .psec:not(.on) { display: none; }
}

/* Battle boards on a phone: as tall as the screen allows, the width from the board's 5:6 shape. */
@media (max-width: 760px) {
  .bv-frame { width: fit-content; max-width: 100%; margin: 0 auto; }
  .bv-cv { width: calc((100dvh - var(--bv-room, 410px) - var(--bv-more, 0px) - var(--bv-fix, 0px)) * 5 / 6); max-width: 100%; height: auto; margin: 0 auto; }
  /* Under the Battle tabs (the field) the page head is a row taller than a plain title. */
  #page:has(.bt-title) { --bv-more: 8px; }
}
@media (max-width: 760px) {
  .bv-wrap > .bv-frame { justify-self: center; }
  :has(> * > .bv-after:not([hidden])), :has(> .bv-after:not([hidden])) { --bv-room: var(--bv-room-after, 520px); }
}
/* Short phones: once a fight ends its summary takes the board's place; Replay brings the board back. */
@media (max-width: 760px) and (max-height: 760px) {
  :has(> * > .bv-after:not([hidden])) .bv-frame, :has(> .bv-after:not([hidden])) .bv-frame { display: none; }
}

/* Creatures › Team on a phone: the five in one row, the shrines under them. */
@media (max-width: 760px) {
  .tcards { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
  .tcard { min-height: 0; padding: 18px 2px 6px; gap: 1px; }
  .tcard img { width: 48px; height: 48px; }
  .tcard .nm { font-size: 11.5px; gap: 2px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
  .tcard .nm .gr { display: none; }
  .tcard .lv { font-size: 11px; }
  .tcard .pill.lead { display: none; }
  .tcard .slotno { top: 4px; left: 5px; font-size: 10px; }
  .tcard .x { top: 2px; right: 2px; }
  .tcard.empty { font-size: 11px; padding-top: 18px; min-height: 96px; }
  #shrines .shead { flex-wrap: wrap; row-gap: 4px; }
}

/* Bag on a phone: two pockets a row, each a short card with the picture beside the words. */
@media (max-width: 760px) {
  [data-theme="codex"] .bp-head { margin-bottom: 8px; }
  [data-theme="codex"] .bp-grid { gap: 6px; }
  [data-theme="codex"] .bp-card { --rx: 4px; --ry: 0px; grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-content: center; align-items: center; gap: 8px; min-height: 60px; padding: 6px 8px 6px 10px; text-align: left; }
  [data-theme="codex"] .bp-card .bp-art { width: 42px; height: 42px; }
  [data-theme="codex"] .bp-card .bp-art img, [data-theme="codex"] .bp-card .bp-art .bp-ui { width: 38px; height: 38px; }
  [data-theme="codex"] .bp-card .bp-art { place-items: center; overflow: visible; }
  [data-theme="codex"] .bp-card .bp-prop { transform: scale(.55); max-width: none; margin: -100px; }
  [data-theme="codex"] .bp-card .bp-txt { align-items: flex-start; gap: 3px; min-width: 0; }
  [data-theme="codex"] .bp-card .bp-nm { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  [data-theme="codex"] .bp-card .bp-pill { font-size: 11.5px; padding: 1px 7px; }
}

/* Shop cards on a phone (and a short tablet): the seal beside its name, the price and stepper in short rows, Buy beside the total. */
@media (max-width: 760px), (max-width: 1200px) and (max-height: 860px) {
  [data-theme="codex"] .bs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  [data-theme="codex"] .bs-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "art name name" "art stat stat" "quiet quiet quiet" "have have price" "step step step" "total total go"; align-items: center; justify-items: start; gap: 3px 6px; padding: 14px 8px 8px; text-align: left; }
  [data-theme="codex"] .bs-card > .bs-art { grid-area: art; width: 34px; height: 34px; margin: 0; }
  [data-theme="codex"] .bs-card > h5 { grid-area: name; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  [data-theme="codex"] .bs-card > .bs-stat { grid-area: stat; font-size: 12px; gap: 5px; }
  [data-theme="codex"] .bs-card > .bs-quiet { grid-area: quiet; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  [data-theme="codex"] .bs-card > .bs-have { grid-area: have; margin: 0; font-size: 12.5px; }
  [data-theme="codex"] .bs-card > .bs-price { grid-area: price; font-size: 13px; justify-self: end; }
  [data-theme="codex"] .bs-card > .bs-step { grid-area: step; grid-template-columns: 30px minmax(30px, 1fr) 30px auto; margin: 2px 0 0; max-width: none; }
  [data-theme="codex"] .bs-card > .bs-step > * { grid-column: auto !important; grid-row: auto !important; }
  [data-theme="codex"] .bs-card > .bs-step input, [data-theme="codex"] .bs-card > .bs-step .bs-sb { height: 32px; min-height: 32px; }
  [data-theme="codex"] .bs-card > .bs-step .bs-max { padding: 0 6px; width: auto; }
  [data-theme="codex"] .bs-card > .bs-total { grid-area: total; margin: 0; font-size: 13px; gap: 4px; white-space: nowrap; }
  [data-theme="codex"] .bs-card > .bs-total > .muted { display: none; }
  [data-theme="codex"] .bs-card > .bs-go { grid-area: go; justify-self: end; width: auto; min-width: 72px; margin: 0; min-height: 34px; padding: 4px 8px; }
  [data-theme="codex"] .bs-card > .bs-tag { top: 2px; left: 6px; }
}

/* The pager under a list that pages instead of scrolling (client/fitlist.ts). */
.fit-pager { display: flex; align-items: center; justify-content: center; gap: 12px; height: 32px; margin: 8px 0 0; }
.fit-pager[hidden] { display: none; }
.fit-pager .btn { min-width: 44px; min-height: 30px; height: 30px; padding: 0 10px; font-size: 18px; line-height: 1; }
.fit-pager .fit-n { min-width: 52px; text-align: center; font: 600 13px var(--sans); font-variant-numeric: lining-nums tabular-nums; color: var(--cream-2, var(--muted)); }
.panel .fit-pager .fit-n { color: var(--muted); }
@media (max-width: 760px) {
  /* Line-ups on a phone: the faces smaller and the level under them dropped, so two fit a page. */
  .ar-list > li .ar-team { gap: 2px; }
  .ar-list > li .ar-team span:not([class]) { display: none; }
}
@media (max-width: 760px) {
  .q-cols > div:not(:has(> .psec.on)) { display: none; }
}
@media (max-width: 760px) {
  /* Quests on a phone: the claims side by side; each quest in two short lines. */
  .q-claim { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .q-claim > * { margin: 0 !important; flex: 1 1 0; min-width: 0; min-height: 36px; padding-left: 6px; padding-right: 6px; font-size: 12px; letter-spacing: .02em; white-space: nowrap; }
  .q-day .q-chest { margin-top: 6px; padding-top: 6px; }
  .q-day .q-list { gap: 5px; }
  .q-list .q-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 5px; padding-top: 6px; padding-bottom: 6px; }
  .q-list .q-row > .q-main { grid-column: 1 / -1; flex-wrap: nowrap; }
  .q-list .q-row > .q-main > b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .q-list .q-row > .q-main > .q-st { flex: none; margin-left: auto; margin-top: 0; }
  .q-list .q-row > .q-bar { margin: 0; }
  .q-list .q-row > .q-reward { margin: 0; }
}
@media (max-width: 760px) {
  /* The tab already names the block. */
  .psec > .q-day:first-child > .cp-h h4 { display: none; }
  .psec > .q-day:first-child > .cp-h { min-height: 0; margin-bottom: 4px; }
  .q-claim > * { flex-wrap: wrap; justify-content: center; row-gap: 0; }
}
/* Both claims side by side on a narrow phone: "Daily reward · day 1" ran past its half of the row (cut at 360 px wide
   and under; the second review, 2026-11-23). Its letters close up, and on the narrowest phones are a size smaller. */
@media (max-width: 374px) { [data-theme] .q-claim .q-claimbtn > b { letter-spacing: 0; } }
@media (max-width: 340px) { [data-theme] .q-claim .q-claimbtn > b { font-size: 11.5px; } }
@media (max-width: 760px) and (max-height: 700px) {
  .q-list .q-row { padding-top: 4px; padding-bottom: 4px; row-gap: 3px; }
  .q-day { padding-top: 8px; padding-bottom: 8px; }
}

/* Trainer: who you are leads the Overview; the other tabs get the whole screen on a phone. */
.ph-who { display: contents; }
@media (max-width: 760px) {
  .ph-who { display: none; }
  .subtabs .hub-ti { display: none; }
  .page[data-view="trainer"] .subtabs, .page[data-view="account"] .subtabs { flex-wrap: nowrap; justify-content: space-between; gap: 0; }
  .page[data-view="trainer"] .subtabs a, .page[data-view="account"] .subtabs a { padding-left: 4px; padding-right: 4px; white-space: nowrap; }
}
@media (max-width: 760px), (max-width: 1100px) and (max-height: 860px), (max-height: 700px) {
  /* A team strip (World Boss, Trail, Tournaments) keeps every slot in one row. */
  .tn-strip { grid-template-columns: repeat(var(--slots, 6), minmax(0, 1fr)); gap: 4px; }
  .tn-strip .tn-cd { padding: 4px 2px; }
  .tn-strip .tn-cd img { width: 36px; height: 36px; }
  .tn-strip .tn-cd b { font-size: 11px; }
  .tn-strip .tn-cd small { font-size: 10px; }
  .tn-strip .tn-slot.empty .tn-cd { min-height: 64px; }
}
@media (max-width: 760px) {
  .ph-records .ph-rec { padding-top: 4px; padding-bottom: 4px; }
  .ph-records .ph-links { margin-top: 2px; }
  .ph-records .rpills { gap: 3px; }
  /* The trophies link reads in its line (a phone's taller tap box dropped the space after the count and pushed the row down). */
  .ph-rec .link:not(.btn) { display: inline; min-height: 0; }
}
/* Trainer: nothing scrolls, whatever the trainer holds. The Boosts list pages (client/fitlist.ts) past what the page
   has room for, its pager beside the heading so it costs no height. */
.ph-boosts { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 10px; align-items: center; }
.ph-boosts > :is(ul, p, .btn) { grid-column: 1 / -1; }
.ph-boosts > .fit-pager { grid-row: 1; grid-column: 2; height: 26px; margin: 0; gap: 6px; }
.ph-boosts > .fit-pager .btn { min-height: 26px; height: 26px; min-width: 40px; }
.ph-boosts > .fit-pager .fit-n { min-width: 40px; }
/* A tablet's card is wide: the boosts run two across, and the shop button shares the heading's row (as a bar under
   the list its end lay under the chat bubble, and the page gave up a strip for it). */
@media (min-width: 761px) and (max-width: 1100px) {
  .ph-boosts ul { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; }
  .ph-boosts > .btn { grid-row: 1; grid-column: 3; }
}
/* A laptop's card is a narrow column under a tall portrait: three boosts or more take the room from the portrait. */
@media (min-width: 1101px) and (max-height: 800px) { .ph-id:has(.ph-boosts li:nth-child(3)) .ph-portrait { height: 128px; } }
@media (min-width: 1101px) and (max-height: 760px) {
  .ph-id:has(.ph-boosts li:nth-child(3)) .ph-portrait { height: 96px; }
  .ph-id:has(.ph-boosts li:nth-child(3)) .ph-portrait .picon-xl { zoom: .75; }
}
/* Small phones (360x640, 375x667 and under): the portrait sits beside the name, outfit and level alone; the XP bar and
   the lines under it run the full width, and the shop button shares the Boosts heading's row. */
@media (max-width: 760px) and (max-height: 700px) {
  .ph-id { grid-template-columns: 88px minmax(0, 1fr); column-gap: 12px; row-gap: 4px; align-items: center; }
  [data-theme="codex"] .ph-id { padding-top: 10px; padding-bottom: 10px; }
  .ph-portrait { grid-row: span 3; height: 88px; align-self: start; }
  .ph-id:has(> .trainer-title) .ph-portrait { grid-row: span 4; }
  .ph-portrait .picon-xl { zoom: .66; }
  .ph-id > :is(.ph-name, .trainer-title, .ph-outfit, .ph-lv) { grid-column: 2; margin-top: 0; }
  .ph-id > :is(.bar, .ph-next) { grid-column: 1 / -1; }
  .ph-outfit { display: flex; align-items: center; gap: 8px; line-height: 1.2; }
  .ph-outfit > span { min-width: 0; }
  .ph-outfit > .btn { flex: none; min-height: 28px; }
  .ph-lv > span:first-child { display: none; }
  .ph-boosts { margin-top: 3px; padding-top: 6px; }
  .ph-boosts > .btn { grid-row: 1; grid-column: 3; min-height: 28px; }
  /* More boosts than fit: the pager takes the shop button's place beside the heading. */
  .ph-boosts > .fit-pager, .ph-boosts > .fit-pager .btn { height: 28px; min-height: 28px; }
  .ph-boosts:has(> .fit-pager:not([hidden])) > .btn { display: none; }
}
/* The shortest phones (320x568, 375x548): the page title goes too (the card under the tabs names the trainer and
   the level), and Lifetime and Records drop the heading their tab already shows. Records page past what fits. */
@media (max-width: 760px) and (max-height: 600px) {
  .page[data-view="trainer"] #pagehead .pagetitle { display: none; }
  .ph-over :is(.ph-life, .ph-records) > h4 { display: none; }
  .ph-tiles { gap: 6px; }
  .ph-tile { padding: 5px 8px; }
  [data-theme="codex"] .ph-tile b { font-size: 17px; }
  .ph-records .ph-rec { padding-top: 3px; padding-bottom: 3px; }
  /* Best catch: its name beside the label, its rolls the full width under them. */
  .ph-rec:has(.rpills) > div { display: contents; }
  .ph-rec:has(.rpills) .rpills { grid-column: 1 / -1; margin-top: 0; }
  .ph-rec:has(.rpills) { row-gap: 4px; }
  .ph-records .fit-pager { margin-top: 2px; }
  /* Settings and Friends: slimmer panels and rows. */
  [data-theme="codex"] :is(.ph-settings, .ph-fr) .panel { padding-top: 8px; padding-bottom: 8px; }
  .player-hub .ph-settings .ph-set { padding: 3px 0; }
  .ph-settings, .ph-settings .ph-col { gap: 6px; }
  .ac-acct .fit-pager { margin-top: 4px; }
}
}

/* Trainer sub-tabs (client/player-hub.ts). Lists page instead of scrolling at every size. Tablets share the phone layout. */
.ph-picklist { max-height: none; overflow: visible; }
@media (min-width: 761px) and (max-width: 1100px) { .player-hub > .ph-who { display: none; } }
@media (max-width: 1100px) {
  .ph-settings .ph-col:not(:has(> .psec.on)) { display: none; }
  .player-hub .psec-tabs { margin-bottom: 8px; }
  .ph-set { padding: 6px 0; gap: 8px; }
  .player-hub .panel h4 { margin-bottom: 4px; }
  /* Card: showcase slots in three columns. */
  .ph-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ph-slot { min-height: 92px; padding: 4px; }
  .ph-picks .ph-h { flex-wrap: wrap; gap: 6px; }
  .ph-picks .fsearch { flex: 1 1 100%; }
  .ph-picks-n { margin: 4px 0 0; font-size: 12px; }
  /* Friends: buttons beside the name, one row per friend. */
  :is(.ph-fr, #pane > div > .fl-panel) .fl-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; min-height: 48px; padding: 4px 8px; }
  :is(.ph-fr, #pane > div > .fl-panel) .fl-acts { grid-column: auto; flex-wrap: nowrap; gap: 4px; }
  :is(.ph-fr, #pane > div > .fl-panel) .fl-acts .btn { display: inline-flex; align-items: center; min-height: 24px; padding: 0 7px; }
  :is(.ph-fr, #pane > div > .fl-panel) .fl-row .picon { transform: scale(.85); }
}
@media (max-width: 1100px) {
  /* Skin and hair, in the Style tab's Outfit slot (client/style.ts). */
  .cz-look .lookpk { position: relative; margin: 0; gap: 8px; }
  .cz-look .lk-end { position: absolute; top: 0; right: 0; }
  .cz-look .lk-opts { gap: 6px; }
  :is(.ph-fr, #pane > div > .fl-panel) .fl-nm { flex-wrap: wrap; gap: 0 6px; }
  .player-hub .ph-set .btn.small { min-height: 28px; height: 28px; }
  .ac-acct .ph-set { grid-template-columns: auto minmax(0, 1fr); }
  .ac-acct .ph-ctl { min-width: 0; }
  .ac-acct .ac-mail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ac-acct .ac-danger h5 { margin: 6px 0 0; }
}
@media (max-width: 1100px) and (max-height: 720px) {
  .cz-look .lk-big { width: 96px; height: 96px; }
  .cz-look .lk-dirs img { width: 30px; height: 30px; }
  .player-hub .ph-set { padding: 4px 0; }
}
/* Desktop: the Card tab keeps the creature list beside the showcase so it pages in a tall area. */
@media (min-width: 1101px) {
  .ph-show { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
  .ph-show .ph-col { grid-row: span 2; }
  .ph-show .ph-picks { grid-column: 2; }
  .ph-show .ph-slots { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ph-show .ph-slot { min-height: 96px; }
  .ac-private .ph-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  [data-theme="codex"] .ac-private .ph-tile { padding: 6px 8px; }
  [data-theme="codex"] .ac-private .ph-tile b { font-size: 16px; }
}
@media (min-width: 761px) {
  .ph-settings .ph-set { padding: 5px 0; }
  .ph-settings .panel { padding-top: 12px; padding-bottom: 12px; }
}

/* Map (client/map.ts). The area panel's hunts page instead of scrolling inside it. */
.apanel { max-height: none; }
.ap-cards { overflow: visible; }
@media (max-width: 760px) {
  .mhead { gap: 6px 8px; margin-bottom: 6px; }
  .mhead label { gap: 4px; font-size: 0; }
  .mhead label select { font-size: 13px; }
  .mapwrap { gap: 0; }
  .mapart { height: calc(100dvh - var(--map-room, 330px)); min-height: 220px; }
  .winset { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 6px; }
  .winset .wmini { display: flex; gap: 4px; height: auto; margin: 0; background: none; padding: 0; }
  .winset .wreg { position: static; padding: 4px 11px; border-radius: 999px; }
  .winset .wlines { display: none; }
  .ap-head { padding: 10px 12px 6px; }
  .ap-cards { gap: 6px; padding: 2px 8px 8px; }
  .hcard { padding: 8px; }
  .hcard .tiles { gap: 4px; margin-top: 6px; }
  .hcard .tiles > div { padding: 4px 6px; }
  .ap-foot { padding: 6px 12px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .ap-foot p { margin: 0; }
  /* The Drops row takes the region line's place: the map tab and every hunt card already give the level. */
  .ap-head .ap-where:has(+ .ap-drops) { display: none; }
  .ap-drops { margin-top: 5px; }
}
.apanel .fit-pager .fit-n { color: var(--muted); }
/* A hunt card: its risk pill sits beside the rate tiles. */
.hcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
.hcard > :not(.tiles, .hc-foot), .hcard > .hc-foot:has(.muted) { grid-column: 1 / -1; }
.hcard > .tiles { grid-column: 1; }
.hcard > .hc-foot:not(:has(.muted)) { grid-column: 2; align-self: center; margin-top: 6px; }
.ap-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-foot p { margin: 0; }
@media (max-width: 760px) {
  .hcard .tiles b { font-size: 14px; }
  .hcard .tiles > div { font-size: 11px; line-height: 1.2; }
}
@media (max-width: 760px) {
  .mtbl td { padding-block: 3px; }
  .mtbl .ml-act .btn { min-height: 30px; }
  .ml-bar { gap: 6px; }
}
/* Desktop pages end at the screen's foot instead of carrying a 40 px tail that tipped them into scrolling. */
@media (min-width: 761px) { .page-inner { padding-bottom: 14px; } }

/* Trail (client/trail.ts): the path is one row of faces; the duel and the team take turns. */
@media (max-width: 760px) {
  .tl-path { overflow: visible; justify-content: space-between; gap: 2px; padding: 4px; }
  .tl-stop { flex: 1 1 0; min-width: 0; }
  .tl-stop > button { display: grid; grid-template-columns: 1fr; justify-items: center; padding: 3px 0; position: relative; }
  .tl-stop .tl-txt { display: none; }
  .tl-stop .tl-dot { position: absolute; top: 0; left: 0; transform: scale(.8); transform-origin: top left; }
  .tl-stop.on > button { box-shadow: inset 0 -3px 0 var(--accent); }
  .tl-detail { gap: 8px; }
  .tl-card { padding: 8px 10px; --bv-room: 540px; }
  .tl-card .psec-tabs { margin: -2px 0 6px; }
  .tl-who { gap: 8px; flex-wrap: nowrap; }
  .tl-who .picon.lg { transform: scale(.75); margin: -10px; }
  .tl-who h3 { font-size: 18px; margin: 0 0 2px; }
  .tl-line { display: none; }
  .tl-board { margin-top: 4px; }
  .tl-card .lentry { margin-top: 6px; }
}
@media (max-width: 760px) {
  .tl-syn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .tl-syn > div { min-width: 0; }
  .tl-card h4.sec { margin: 8px 0 4px; }
  .tl-card .tn-sec { margin-bottom: 4px; }
}
@media (max-width: 760px) {
  .tl-regions { margin-bottom: 6px; }
  .tl-wrap { gap: 6px; }
  .tl-card .lentry { padding-top: 4px; }
}
/* Short phones: the picked face on the path and the board's "vs" line name the trainer, so the header steps aside. */
@media (max-width: 760px) and (max-height: 700px) {
  .tl-card { --bv-room: 445px; }
  .tl-card .tl-syn { margin-top: 2px; }
  .tl-card .tl-who { display: none; }
  .tl-stop .tl-face .picon { transform: scale(.85); margin: -3px 0; }
}
/* A Trail fight on a phone: the board, its HP meter and the buttons; the header and synergy lines wait on the Duel tab. */
@media (max-width: 760px) {
  .tl-fight { --bv-room: calc(468px + var(--bv-n, 3) * 30px); --bv-room-after: calc(488px + var(--bv-n, 3) * 30px); }
  .tl-fight .tl-who, .tl-fight .bv-chips { display: none; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .tl-fight { --bv-room: 440px; }
  .tl-fight .bv-meter { display: none; }
}
/* A boss fight on its Trail stop, on a phone: the board, a slim result and Done / Fight again; the HP meter waits. */
@media (max-width: 760px) {
  .tl-bossfight { --bv-room: 505px; --bv-room-after: 570px; }
  .tl-bossfight .bv-meter, .tl-bossfight .bv-chips { display: none; }
  .tl-bossfight .boss-replay { margin-bottom: 6px; }
  .tl-bossfight .bossres { gap: 10px; padding: 8px 10px; margin-bottom: 0; }
  .tl-bossfight .bossres > img, .tl-bossfight .bossres .muted { display: none; }
  .tl-bossfight .bossres h3 { margin-bottom: 4px; font-size: 15px; }
  .tl-bossfight .lentry { margin-top: 6px; padding-top: 6px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .tl-bossfight { --bv-room: 490px; }
}
/* Trail on tablets and desktop: the board on the left, sized from the screen's height; who, team, reward and buttons beside it. */
@media (min-width: 761px) {
  .tl-card { display: grid; grid-template-columns: minmax(0, 1fr) 330px; column-gap: 18px; align-content: start; }
  .tl-card > *, .tl-card > .psec > * { grid-column: 2; min-width: 0; }
  .tl-card .tl-board { grid-column: 1; grid-row: 1 / span 30; margin-top: 0; align-self: start; }
  .tl-card .tl-board .bv-frame { width: min(100%, max(530px, calc((100vh - 290px) * 16 / 9 + 10px))); box-sizing: border-box; margin: 0 auto; justify-self: center; }
  .tl-card .tl-board .bv-cv { width: 100%; }
  .tl-card .tl-who .chips { flex-wrap: wrap; }
  .tl-card .tn-strip { gap: 4px; }
  /* Team title and its buttons sit on one centred row with clear air above the cards, so the buttons never touch them. */
  .tl-card .tn-sec { flex-wrap: nowrap; align-items: center; gap: 6px; margin-bottom: 8px; }
  .tl-card .tn-sec .btn.small { flex: none; }
  .tl-card .tl-syn { grid-template-columns: minmax(0, 1fr); }
  .tl-card .lentry { flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .tl-card h4.sec { margin: 4px 0 2px; font-size: 15px; }
  .tl-card .tn-sec { min-height: 0; margin-bottom: 2px; }
  .tl-card .tn-sec .btn.small { min-height: 28px; height: 28px; }
  .tl-card .psec-tabs button { min-height: 32px; }
  .tl-card .rewards { row-gap: 2px; }
}
@media (min-width: 761px) and (max-height: 860px) {
  .tl-card .tl-line { display: none; }
  .tl-card h4.sec { margin: 8px 0 4px; }
}
@media (min-width: 761px) {
  .tl-card.tl-fight { grid-template-columns: minmax(0, 1fr) 210px; }
  .tl-fight .tl-who { flex-wrap: wrap; }
  .tl-fight .bv-wrap.with-meter { grid-template-columns: minmax(0, 1fr) 132px; }
}

/* A Trail boss stop (client/trail.ts): boss, first clear and ladder under tabs. The ladder's steps are one boss,
   so each step is just its level, in a grid over the detail. */
.tl-boss .ladder-h { margin-top: 0; }
.tl-boss .ladder-h h3 { display: none; }
.tl-boss .ladder { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tl-boss .lsteps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; max-height: none; overflow: visible; padding: 0; }
.tl-boss .lstep { grid-template-columns: minmax(0, 1fr) auto; padding: 6px 8px; min-height: 34px; }
.tl-boss .lstep img, .tl-boss .lstep .nm { display: none; }
.tl-boss .lstep .lv { font-size: 13px; font-weight: 600; }
.tl-boss .lhead > img, .tl-boss .lhead .bosspic { width: 60px; height: 60px; }
.tl-boss .lhead h3 { margin-bottom: 4px; }
.tl-boss .lstep-detail h4.sec { margin: 8px 0 4px; }
.tl-boss .drops { margin: 8px 0 2px; gap: 6px; }
.tl-boss .drop { padding: 5px 8px; }
@media (max-width: 760px) {
  .tl-boss .lsteps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tl-boss .lstep { padding: 4px; min-height: 30px; justify-content: center; }
  .tl-boss .lstep .lv { font-size: 12px; }
  .tl-boss .drops { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .tl-boss .drop { grid-template-columns: 22px minmax(0, 1fr); column-gap: 5px; padding: 4px 5px; }
  .tl-boss .drop img { width: 22px; height: 22px; }
  .tl-boss .drop .pct { font-size: 13px; }
  .tl-boss .drop b { font-size: 10.5px; }
  .tl-boss :is(.bosscard, .lstep-detail) { padding: 10px; }
}
@media (max-width: 760px) {
  /* Drops as one row of icons and chances; a tap on one names it (client/tip.ts). */
  .tl-boss .drops { display: flex; flex-wrap: nowrap; gap: 4px; }
  .tl-boss .drop { flex: 1 1 0; min-width: 0; grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 4px 2px; text-align: center; }
  .tl-boss .drop img { grid-row: auto; width: 24px; height: 24px; }
  .tl-boss .drop b { display: none; }
  .tl-boss .drop .pct { font-size: 12px; }
  .tl-boss .ladder-h a.link { display: none; }
  .tl-boss .ladder-h:not(:has(.muted)) { display: none; }
  .tl-boss .lstep-detail .lhead > img { display: none; }
  .tl-boss .lstep-detail h4.sec { display: none; }
  .tl-boss .mate { width: 40px; }
  .tl-boss .mate img { width: 28px; height: 28px; }
  .tl-boss .est { padding: 6px 8px; }
  .tl-boss .lentry { gap: 6px; margin-top: 8px; padding-top: 8px; }
  .tl-boss .lentry .btn.primary { flex: 1; min-width: 0; }
  .tl-boss .lrepeat { display: flex; align-items: center; gap: 8px; width: 100%; }
  .tl-boss .lrepeat .btn { margin-left: auto; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .tl-boss .lstep-detail .est-weak, .tl-boss .lstep-detail .est-team { display: none; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .tl-path { padding: 2px 4px; }
  .tl-stop > button { padding: 1px 0; }
  .tl-regions button { min-height: 34px; height: 34px; }
  .tl-boss .lhead { gap: 8px; }
  .tl-boss .lstep-detail .lhead .grow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .tl-boss .lstep-detail .lhead h3 { margin: 0; font-size: 17px; }
  .tl-boss :is(.bosscard, .tl-bcard) .lhead > img { width: 48px; height: 48px; }
}
/* Short phones: the step grid, the tab and the Fight button already say which boss, which level and its gate. */
@media (max-width: 760px) and (max-height: 700px) { .tl-boss .lstep-detail .lhead { display: none; } .tl-boss .lstep-detail .est { margin-top: 0; } }
@media (max-width: 760px) and (max-height: 700px) { .tl-boss :is(.bosscard, .tl-bcard) .est { padding: 4px 8px; } .tl-boss :is(.bosscard, .tl-bcard) .drops { margin-top: 6px; } }
@media (min-width: 761px) and (max-height: 760px) {
  .tl-boss .lstep-detail .lhead > img { display: none; }
  .tl-boss .lentry { margin-top: 8px; padding-top: 8px; }
  .tl-boss .lstep { min-height: 30px; padding: 4px 8px; }
  .tl-boss .drops { margin-top: 6px; }
  .tl-boss .lstep-detail { padding-top: 10px; padding-bottom: 10px; }
}
@media (max-width: 760px) {
  .tl-boss .lentry .btn.primary { padding: 0 8px; font-size: 12px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tl-boss .lstep { justify-items: center; text-align: center; }
}

/* Season pass (client/pass.ts): the track pages its tiers instead of scrolling sideways. */
.pz-rows > .fit-pager { grid-column: 1 / -1; }
.pz-strip { overflow: hidden; }
@media (max-width: 760px) {
  .pz-hero:not(:has(.psec.on)) { display: none; }
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero { flex-basis: 66px; }
  [data-theme="codex"] .pz-strip { gap: 4px; padding-bottom: 4px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  [data-theme="codex"] .pz-show { min-height: 0; height: 170px; padding-bottom: 48px; }
  [data-theme="codex"] .pz-show-pic { width: 150px; height: 150px; }
}
/* The smallest phones (320x568): a shorter showpiece keeps the tier bar and the hunting line on screen without scrolling. */
@media (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] .pz-show { height: 104px; padding-bottom: 40px; }
  [data-theme="codex"] .pz-show-pic { width: 76px; height: 76px; }
  [data-theme="codex"] .pz-show-cap { padding-top: 10px; }
  [data-theme="codex"] .pz-show-cap span:not(.pz-show-tier) { display: none; }
}
/* Desktop: the season's name and its tier bar share a row, the offers under them; the art fills the height beside. */
@media (min-width: 761px) {
  [data-theme="codex"] .pz-main { grid-template-columns: auto minmax(0, 1fr); column-gap: 28px; row-gap: 12px; padding: 14px 20px 16px; align-items: center; }
  [data-theme="codex"] .pz-main > :not(.psec), [data-theme="codex"] .pz-main > .psec > :not(.pz-season, .pz-level) { grid-column: 1 / -1; }
  [data-theme="codex"] .pz-show { min-height: 0; }
  [data-theme="codex"] .pz-offer { gap: 6px; padding: 10px 12px 12px; }
  [data-theme="codex"] .pz-offer ul { font-size: 13.5px; gap: 2px; }
}
@media (min-width: 761px) and (max-height: 800px) {
  [data-theme="codex"] .pz-track .cp-h { min-height: 26px; }
  [data-theme="codex"] .pz-rows > .fit-pager { margin-top: 2px; }
  [data-theme="codex"] .pz-season .ps-emblem { width: 44px; height: 44px; }
  [data-theme="codex"] .pz-season h3 { font-size: 28px; }
  [data-theme="codex"] .pz-track { padding: 8px 14px 10px; }
  [data-theme="codex"] .pz-col { grid-template-rows: 78px 26px 78px; }
  [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 78px 26px 78px; }
  [data-theme="codex"] .pz-strip { align-items: start; }
}
@media (min-width: 761px) {
  /* An offer: its name and Unlock button on one row (the button carries the price), the perks in two columns. */
  [data-theme="codex"] .pz-offer { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; }
  [data-theme="codex"] .pz-offer-h { grid-column: 1; }
  [data-theme="codex"] .pz-offer-h > :not(b) { display: none; }
  [data-theme="codex"] .pz-offer .btn { grid-column: 2; grid-row: 1; justify-self: end; }
  [data-theme="codex"] .pz-offer ul { grid-column: 1 / -1; }
  [data-theme="codex"] .pz-offers { max-width: 760px; }
  [data-theme="codex"] .pz-offer.best .btn { margin-right: 0; }
}
@media (min-width: 761px) and (max-height: 800px) {
  [data-theme="codex"] .pz-show { padding-bottom: 50px; }
  [data-theme="codex"] .pz-show-pic { width: 150px; height: 150px; }
}
@media (min-width: 761px) and (max-height: 740px) {
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 64px 24px 64px; }
  [data-theme="codex"] .pz-offer ul { font-size: 13px; line-height: 1.2; gap: 1px; }
  [data-theme="codex"] .pz-main { row-gap: 8px; padding: 10px 18px 12px; }
  [data-theme="codex"] .pz-level .pz-medal { transform: scale(.8); margin: -8px; }
}
@media (min-width: 761px) and (max-height: 740px) { [data-theme="codex"] .pz-lab b { font-size: 11px; letter-spacing: .06em; } }

/* Element Halls (client/halls.ts): a row of the eight halls, then the picked hall. */
.hl-tiles { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin: 0 0 10px; }
.hl-tile { position: relative; display: grid; justify-items: center; gap: 4px; padding: 6px 4px 4px; min-width: 0; border: 0; border-radius: 2px; cursor: pointer; color: var(--ink);
  background: var(--inlay, var(--panel-2)); box-shadow: inset 0 3px 0 var(--hc), inset 0 0 0 1px var(--rule-soft, var(--line)); }
.hl-tile:hover { box-shadow: inset 0 3px 0 var(--hc), inset 0 0 0 1px var(--gilt, var(--accent)); }
.hl-tile.on { background: var(--inlay-hi, var(--panel)); box-shadow: inset 0 3px 0 var(--hc), inset 0 0 0 2px var(--rg-ink, var(--accent)), 0 2px 0 rgba(0, 0, 0, .25); }
.hl-tile .el { pointer-events: none; }
.hl-t-k { display: grid; place-items: center; height: 34px; }
.hl-t-k .tface { width: 34px; height: 34px; }
.hl-t-none { color: var(--faint, var(--muted)); font-size: 14px; }
.hl-t-mine, .hl-t-in { position: absolute; top: 6px; right: 5px; width: 9px; height: 9px; border-radius: 50%; }
.hl-t-mine { background: radial-gradient(circle at 35% 30%, #f6d47e, #c08a2a 70%); box-shadow: 0 0 0 1px #7a5214; }
.hl-t-in { background: var(--rg-ink, var(--accent)); }
.hl-detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.hl-detail > * { min-width: 0; }
.hl-side { padding: 12px 14px; }
.hl-duels h3 { margin: 0 0 8px; font-size: 16px; }
/* Desktop: the hall's ranking and your duels take turns in the side column (client/halls.ts H.side). */
.hl-side-tabs.psec-tabs.all { margin: -4px 0 8px; }
.hl-side[data-side="rank"] > [data-key="psec-halls-duels"], .hl-side[data-side="duels"] > [data-key="psec-halls-rank"] { display: none; }
.hl-side .hl-duels h3 { display: none; }
@media (max-width: 1100px) {
  .hl-detail { grid-template-columns: minmax(0, 1fr); }
  .hl-detail > .hl-card:not(:has(.psec.on)) { display: none; }
  .hl-side-tabs.psec-tabs.all { display: none; }
  .hl-side[data-side] > .psec.on { display: contents; }
  .hl-detail > .hl-side:not(:has(.psec.on)) { display: none; }
}
@media (max-width: 760px) {
  .hl-side { padding: 10px; }
  .hl-rank .pill { display: none; }
}

@media (max-width: 760px) {
  .hl-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
  .hl-tile { padding: 5px 2px 3px; gap: 2px; }
  .hl-t-k, .hl-t-k .tface { height: 28px; width: 28px; }
  .hl-detail { gap: 0; }
  .hl-card { padding: 10px; }
  .hl-card .hl-head { display: none; }
  .hl-duels h3 { display: none; }
}
@media (max-width: 760px) {
  .hl-mini { flex-wrap: nowrap; }
  .hl-mini .ar-mon { width: 22px; }
  .hl-mini .ar-mon img { width: 22px; height: 22px; }
}
/* Halls team editor (client/halls.ts editorHtml), laid out as the Team page: the formation over your creatures that fit
   the hall, and beside them the open creature or the hall's Keeper (Cole 2026-11-12: the same editor as Team). Tablets
   and phones show the team, the creature and the Keeper as tabs. */
.hl-ed { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.hl-ed > .hl-ed-tabs { display: none; }
.hl-ed > .hl-form { grid-column: 1; grid-row: 1; }
.hl-ed > .hl-box { grid-column: 1; grid-row: 2; }
.hl-ed > .hl-ed-side { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hl-ed-side > .panel { flex: 1 1 auto; min-height: 0; }
.hl-ed-side > .hl-side-tabs.psec-tabs.all { display: grid; margin: 0 0 6px; }
.hl-ed-keep { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.hl-ed-keep h4.sec { margin: 0; }
.hl-ed-keep .hl-keeper { margin-bottom: 6px; }
.hl-mem-none { justify-content: center; align-items: center; text-align: center; }
.hl-ed .tm-bar > .el { flex: none; }
.hl-ed-hint { margin: 6px 0 0; text-align: center; }
.hl-mem .tm-macts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hl-mem .tm-why { font-size: 13px; }
.hl-ed-tabs .dim { opacity: .55; }
@media (max-width: 1100px) {
  #page:has(.hl-ed) #pagehead { display: none; }
  .hl-ed { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); gap: 8px; }
  .hl-ed > .hl-ed-tabs.psec-tabs.all { display: grid; grid-row: 1; margin: 0; }
  .hl-ed > .hl-form { grid-row: 2; }
  .hl-ed > .hl-box { grid-row: 3; }
  .hl-ed > .hl-ed-side { grid-column: 1; grid-row: 2 / span 2; }
  .hl-ed-side > .hl-side-tabs.psec-tabs.all { display: none; }
  .hl-ed-tabs .hl-tb-add { display: none; }
  .hl-ed-tabs button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hl-ed:is([data-tab="team"], [data-tab="add"]) > .hl-ed-side { display: none; }
  .hl-ed:not([data-tab="team"], [data-tab="add"]) > .hl-form, .hl-ed:not([data-tab="team"], [data-tab="add"]) > .hl-box { display: none; }
}
/* Short phones: your creatures move to an Add tab, so the team and the box each get the whole height. */
@media (max-width: 760px) and (max-height: 659px) {
  .hl-ed > .hl-ed-tabs.psec-tabs.all { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
  .hl-ed-tabs .hl-tb-add { display: block; }
  .hl-ed[data-tab="team"] > .hl-box, .hl-ed[data-tab="add"] > .hl-form { display: none; }
  .hl-ed[data-tab="add"] > .hl-box { grid-row: 2 / span 2; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .hl-ed .tm-withbox .tm-row .tm-cards:not(:has(.tm-card)) { min-height: 64px; }
}
/* The board fits the window's height (the Keeper's column leaves it no more width than the Team page's). */
@media (min-width: 1101px) {
  .hl-ed .tm-bv .bv-frame { width: min(100%, 668px, calc((100vh - 335px) * 1.75)); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .hl-ed .tm-bv .bv-frame { width: min(100%, calc((100vh - 390px) * 5 / 6 + 10px)); }
}
/* Tablets: the hall's sections take turns too, as on a phone. */
@media (min-width: 761px) and (max-width: 1100px) {
  .psec-tabs[data-key="psec-halls"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec[data-key^="psec-halls-"]:not(.on) { display: none; }
  .hl-detail { grid-template-columns: minmax(0, 1fr); }
  .hl-detail > .hl-card:not(:has(.psec.on)) { display: none; }
}
/* Arena (client/ranked.ts): Play / Season / Matches / Top 100 / Rewards take turns; on wide screens Season sits beside Play. */
.ar-ranked .rk-top:not(:has(> .psec.on)) { display: none; }
.ar-ranked .rk-scroll { max-height: none; overflow: visible; }
.ar-ranked .rk-matches, .ar-ranked .rk-top100 { margin: 0; }
@media (min-width: 1101px) {
  .psec-tabs[data-key="psec-arena"] button[data-id="arena:season"] { display: none; }
  .ar-ranked:has(> .rk-top > [data-key="psec-arena-season"].on) .psec-tabs[data-key="psec-arena"] button[data-id="arena:play"] { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  .ar-ranked:has(> .rk-top > :is([data-key="psec-arena-play"], [data-key="psec-arena-season"]).on) :is([data-key="psec-arena-play"], [data-key="psec-arena-season"], [data-key="psec-arena-play-lu"]) { display: contents; }
  .ar-ranked .rk-top { margin-bottom: 12px; }
}
@media (max-width: 760px) {
  /* Rewards on a phone: the prizes as a two-column list of short rows, the milestones tighter. */
  .rk-rewards { gap: 6px; }
  .rk-rewards h3 { margin: 0 0 4px; font-size: 15px; }
  .rk-rewards .rk-ms th, .rk-rewards .rk-ms td { padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }
  .rk-rewards .rk-ms .rk-st { display: none; }
  .rk-rewards .ar-prizes, .rk-rewards .ar-prizes tbody { display: block; width: 100%; }
  .rk-rewards .ar-prizes tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .rk-rewards .ar-prizes tr:has(th) { display: none; }
  .rk-rewards .ar-prizes tr { display: grid; grid-template-columns: 3.2em 1fr 3em; align-items: center; border-bottom: 1px solid var(--rule-soft, var(--line)); }
  .rk-rewards .ar-prizes td { padding: 5px 2px; border: 0; font-size: 12.5px; }
  .rk-rewards .ar-prizes tr.rk-legend { grid-column: 1 / -1; grid-template-columns: auto 1fr; gap: 8px; border: 0; }
  .rk-rewards .hint { margin: 4px 0 0; font-size: 11.5px; }
}
@media (max-width: 760px) and (max-height: 600px) {
  /* A short phone: the milestone list drops its heading row and both lists close up, so Rewards fits under the Battle tabs. */
  .rk-rewards { gap: 2px; }
  .rk-rewards h3 { margin: 0 0 2px; }
  .rk-rewards .rk-ms tr:has(th) { display: none; }
  .rk-rewards .rk-ms td { padding-top: 2px; padding-bottom: 2px; line-height: 1.25; }
  .rk-rewards .ar-prizes td { padding-top: 3px; padding-bottom: 3px; }
  .rk-rewards .hint { margin-top: 2px; }
}
@media (min-width: 761px) and (max-width: 1100px) { .ar-ranked .rk-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ar-ranked .rk-next { grid-column: auto; } }
@media (min-width: 761px) and (max-width: 1100px) { .rk-rewards.ar-cols { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1101px) { .ar-ranked .ar-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Arena line-up editor: the whole page. Phones: one short row per creature, and with a board, Board and Team tabs. */
.ar-ranked.editing .ar-l-title { margin-bottom: 4px; }
.ar-esave { margin-top: 8px; }
@media (max-width: 760px) {
  #page:has(.ar-ranked.editing) #pagehead { display: none; }
  .ar-ranked.editing .ar-lineups { padding: 8px 10px; }
  .ar-ranked.editing .rw-top input { width: 9em; }
  .ar-ranked.editing .ar-elist { gap: 2px; margin: 4px 0; }
  .ar-ranked.editing .ar-elist li { flex-wrap: nowrap !important; gap: 4px; min-height: 40px; }
  .ar-ranked.editing .ar-elist li > span:not([class]) { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
  .ar-ranked.editing .ar-elist .ar-mon { width: 32px; }
  .ar-ranked.editing .ar-elist .ar-mon img { width: 30px; height: 30px; }
  .ar-ranked.editing .ar-elist .held-chip, .ar-ranked.editing .ar-elist .rw-reach { display: none; }
  .ar-ranked.editing .ar-elist .rw-ed { margin-left: 0; }
  .ar-ranked.editing .ar-elist li > .spacer { display: none; }
  .ar-ranked.editing .ar-elist .rw-o { min-width: 40px; height: 32px; padding: 0 5px; }
  .ar-ranked.editing .ar-elist .btn.small { min-width: 32px; min-height: 32px; padding: 0 6px; }
  .ar-ranked.editing .ar-edit { --bv-room: 355px; }
  .ar-ranked.editing .ar-edit .psec-tabs { margin: 2px 0 6px; }
}
@media (min-width: 761px) {
  .ar-edit.has-board { display: grid; grid-template-columns: auto minmax(280px, 1fr); column-gap: 16px; align-items: start; }
  .ar-edit.has-board > .rw-top, .ar-edit.has-board > .psec-tabs { grid-column: 1 / -1; }
  .ar-edit.has-board .ar-board { grid-column: 1; grid-row: 2 / span 2; margin: 0; }
  .ar-edit.has-board .ar-eside, .ar-edit.has-board > .ar-esave { grid-column: 2; }
  .ar-edit.has-board .ar-eside .ar-elist { margin-top: 0; }
  .ar-edit.has-board .bv-frame { width: min(calc(min(100vw, 1600px) - 400px), max(530px, calc((100vh - 375px) * 16 / 9 + 10px))); box-sizing: border-box; margin: 0; }
  .ar-edit.has-board .bv { max-width: none; margin: 0; }
  .ar-edit.has-board .bv-cv { width: 100%; }
}
@media (min-width: 761px) and (max-width: 909px) {
  .ar-edit.has-board .bv-frame { width: min(calc(100vw - 400px), calc((100vh - 375px) * 5 / 6)); }
}
/* The chat window open beside the builder (it opens by itself from 1200 px wide): the board gives up the chat's width
   and the list stops short of it, so the held item, move and remove buttons stay in reach. */
@media (min-width: 1201px) {
  body[data-dock="open"] .ar-edit.has-board { --chat: max(0px, calc(350px - (100vw - min(100vw, 1600px)) / 2)); }
  body[data-dock="open"] .ar-edit.has-board .bv-frame { width: max(530px, min(calc(min(100vw, 1600px) - 400px - var(--chat)), calc((100vh - 375px) * 16 / 9 + 10px))); }
  body[data-dock="open"] .ar-edit.has-board .ar-eside, body[data-dock="open"] .ar-edit.has-board > .ar-esave { margin-right: var(--chat); }
  /* Each creature takes two short lines there: name and order buttons, then held item and reach. */
  body[data-dock="open"] .ar-edit.has-board .ar-elist li:has(> .btn) { display: grid; grid-template-columns: 44px minmax(0, 1fr) repeat(3, auto); column-gap: 6px; row-gap: 2px; align-items: center; }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > .ar-mon { grid-area: 1 / 1 / 3 / 2; }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > span:not([class]) { grid-area: 1 / 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > .held-chip { grid-area: 2 / 2 / 3 / 6; justify-self: start; min-width: 0; max-width: calc(100% - 66px); }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > .held-chip > span { overflow: hidden; text-overflow: ellipsis; }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > .spacer { display: none; }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > .rw-ed { grid-area: 2 / 3 / 3 / 6; justify-self: end; margin: 0; }
  body[data-dock="open"] .ar-edit.has-board .ar-elist li > .btn { grid-row: 1; }
  /* The saved line-ups stand two across, left of the chat, so Use and Edit stay in reach (the list pages as before). */
  body[data-dock="open"] .ar-ranked .ar-lineups .ar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-right: max(0px, calc(350px - (100vw - min(100vw, 1600px)) / 2)); }
}
/* Tournaments (client/tournaments.ts): one card at a time on a phone, the banner shorter and each fact one line. */
@media (max-width: 760px) {
  .tn2-cards { margin-bottom: 0; }
  [data-theme="codex"] .tn2-hero { flex-direction: row; justify-content: center; gap: 10px; padding: 10px 12px; text-align: left; }
  [data-theme="codex"] .tn2-hero .tn-emblem, [data-theme="codex"] .tn2-hero img.tn-emblem { width: 64px; height: 56px; }
  .tn2-hero > .tn2-kicker, .tn2-hero > h3 { display: block; }
  .tn2-hero { display: grid !important; grid-template-columns: auto auto; grid-template-rows: auto auto; align-content: center; column-gap: 10px; }
  .tn2-hero .tn-emblem { grid-row: 1 / span 2; }
  .tn2-hero .tn2-name { grid-column: 2; grid-row: 1 / span 2; align-self: center; align-items: flex-start; }
  .tn2-hero .tn2-kicker { align-self: end; margin: 0; font-size: 10.5px; }
  .tn2-hero h3 { align-self: start; font-size: 21px !important; margin: 2px 0 0; }
  .tn2-body { gap: 7px; padding: 10px 12px; }
  .tn2-fact { padding: 4px 8px; }
  .tn2-fact small { width: 86px !important; font-size: 10.5px; }
  .tn2-fact b { font-size: 13px; }
  .tn2-fact em { font-size: 12px; }
  .tn2-chips .pill { font-size: 11px; }
  .tn2-prizes { font-size: 12.5px; gap: 3px; }
}
@media (max-width: 760px) {
  .tn2.soon .tn2-ribbon { display: none; }
  .tn2.soon .tn2-hero::after { content: 'Coming soon'; grid-column: 2; font: 700 10.5px/1 var(--pixel, var(--sans)); letter-spacing: .1em; text-transform: uppercase; color: #f0b27a; margin-top: 3px; }
  .tn2-hero { grid-template-rows: auto auto auto; }
  .tn2-hero .tn-emblem { grid-row: 1 / span 3; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .psec-tabs[data-key="psec-tn"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec[data-key^="psec-tn-"]:not(.on) { display: none; }
  .tn2-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 761px) and (max-height: 740px) {
  [data-theme="codex"] .tn2-hero { padding-top: 14px; padding-bottom: 10px; }
  [data-theme="codex"] .tn2-hero .tn-emblem, [data-theme="codex"] .tn2-hero img.tn-emblem { width: 104px; height: 91px; }
}

/* A short window between phone and desktop width (itch's 800x600 and 860x585 frames): the banner as a slim row,
   emblem beside the name, so a whole card fits. */
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 700px) {
  [data-theme="codex"] .tn2-hero { flex-direction: row; justify-content: center; gap: 12px; padding: 8px 12px; text-align: left; }
  [data-theme="codex"] .tn2-hero .tn-emblem, [data-theme="codex"] .tn2-hero img.tn-emblem { width: 64px; height: 56px; }
  .tn2-hero .tn2-name { align-items: flex-start; }
  .tn2-hero .tn2-kicker { margin: 0; }
  .tn2-hero h3 { font-size: 22px !important; }
  .tn2-body { gap: 7px; padding: 9px 14px; }
}
/* A short desktop window (1366x657: a laptop with its browser bars): prizes drop "the title" and sit tighter, so
   the three cards under the Launch Cup end inside the window. */
@media (min-width: 1101px) and (max-height: 700px) {
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-tt { display: none; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-prizes { gap: 3px; font-size: 13px; line-height: 1.3; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-fact { padding-top: 3px; padding-bottom: 3px; }
  .tn2-cards:has(.tn2[data-tier="launch"]) { gap: 10px; }
}
/* The same short window beside the docked chat column: the three cards are narrower, so their banners are the
   slim row (emblem beside the name) and the cards still end inside the window. */
@media (min-width: 1360px) and (max-height: 700px) {
  [data-theme="codex"] body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-hero { flex-direction: row; justify-content: center; gap: 12px; padding: 8px 12px; text-align: left; }
  [data-theme="codex"] body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-hero .tn-emblem, [data-theme="codex"] body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-hero img.tn-emblem { width: 64px; height: 56px; }
  body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-hero .tn2-name { align-items: flex-start; }
  body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-hero .tn2-kicker { margin: 0; }
  body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-hero h3 { font-size: 22px !important; }
  body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-fact small { width: 76px !important; font-size: 10px; }
  body[data-dock="open"] .tn2:not([data-tier="launch"]) .tn2-body { gap: 6px; padding: 8px 12px; }
  body[data-dock="open"] .tn2[data-tier="launch"] .tn2-body { padding-top: 5px; padding-bottom: 5px; row-gap: 4px; }
  body[data-dock="open"] .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-prizes { gap: 1px; }
  body[data-dock="open"] .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-prizes { font-size: 12.5px; }
}

.tn2-rules { display: none; }
/* A short phone: the rules as one line, a slimmer banner and tighter rows, so a whole card fits. */
@media (max-width: 760px) and (max-height: 640px) {
  .tn2-chips { display: none !important; }
  .tn2-rules { display: block; margin: 0; color: var(--bad, #8a2a1c); font-size: 12px; line-height: 1.3; text-align: center; }
  [data-theme="codex"] .tn2-hero { padding: 5px 12px; }
  [data-theme="codex"] .tn2-hero .tn-emblem, [data-theme="codex"] .tn2-hero img.tn-emblem { width: 46px; height: 40px; }
  .tn2-hero .tn2-kicker { font-size: 9.5px; }
  .tn2-hero h3 { font-size: 18px !important; }
  .tn2-body { gap: 5px; padding: 7px 12px; }
  .tn2-facts { gap: 3px; }
  .tn2-fact { padding: 3px 8px; }
  .tn2-fact small { width: 76px !important; font-size: 10px; }
  .tn2-fact em { font-size: 11.5px; }
  .tn2-rules { font-size: 11.5px !important; }
  .tn2-prizes { font-size: 11.5px; line-height: 1.25; gap: 2px; }
  .tn2-foot { padding-top: 5px; flex-wrap: nowrap; }
  .tn2-foot .btn { min-height: 34px; }
  .tn2-state.open, .tn2-tt { display: none; }
}
/* A phone has no room for a third button beside Change team and Withdraw: once entered, Drill is on the Training page. */
@media (max-width: 760px) { .tn2-foot:has([data-act="tn-withdraw"]) .tn2-drill { display: none; } }
/* The narrowest phones: Enter and Drill tighten so the sign-up line beside them stays on one line. */
@media (max-width: 380px) {
  .tn2-foot { gap: 6px; }
  .tn2-foot .actions { gap: 4px; }
  [data-theme="codex"] .tn2-foot .actions .btn { padding-left: 9px; padding-right: 9px; }
}

/* Tournaments on a wide screen: the events, the bracket and the trophies take turns (the head's switch), so the
   page fits without scrolling. Narrower screens use the section tabs above. */
.tn-desk { display: inline-flex; gap: 4px; margin-right: 10px; }
@media (max-width: 1100px) { .tn-desk { display: none; } }
@media (min-width: 1101px) {
  .tn-page[data-desk="events"] > [data-key="psec-tn-history"], .tn-page[data-desk="events"] > [data-key="psec-tn-trophies"],
  .tn-page[data-desk="history"] > .tn2-cards, .tn-page[data-desk="history"] > [data-key="psec-tn-trophies"],
  .tn-page[data-desk="trophies"] > .tn2-cards, .tn-page[data-desk="trophies"] > [data-key="psec-tn-history"] { display: none; }
  .tn-page[data-desk="events"] > .tn2-cards { margin-bottom: 0; }
}

/* Shop › Gems on a phone: the four packs as short rows, art on the left and the price button on the right. */
@media (max-width: 760px) {
  [data-theme="codex"] .dp-grid.gp-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 4px; }
  [data-theme="codex"] .dp-card.gp-card { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-rows: auto auto; justify-items: start; align-items: center; column-gap: 10px; row-gap: 3px; padding: 5px 10px 5px 5px; }
  [data-theme="codex"] .gp-card .gp-art { grid-row: 1 / 3; width: 52px; height: 52px; }
  [data-theme="codex"] .gp-card .dp-name { grid-column: 2; align-self: end; font-size: 11px; }
  [data-theme="codex"] .gp-card .dp-n { grid-column: 2; align-self: start; font-size: 22px; }
  [data-theme="codex"] .gp-card .dp-n img { width: 18px; height: 18px; }
  [data-theme="codex"] .dp-card.gp-card .btn { grid-column: 3; grid-row: 1 / 3; justify-self: end; min-width: 92px; }
  [data-theme="codex"] .gp-art .dp-still { width: 48px; height: 48px; }
  [data-theme="codex"] .gp-art .dp-pile { width: 48px; }
  [data-theme="codex"] .gp-art .dp-pile img { width: 20px; height: 20px; margin: -4px -3px; }
  [data-theme="codex"] .gp-art .dp-pile.n1 img { width: 36px; height: 36px; }
  [data-theme="codex"] .gp-art .dp-pile.n2 img { width: 26px; height: 26px; }
  /* The top bar already shows the gem count. */
  [data-theme="codex"] .dp-gembal:has(+ .gp-grid) { display: none; }
  [data-theme="codex"] .dpack-test:has(+ .dp-gembal + .gp-grid) { margin-bottom: 4px; font-size: 13px; line-height: 1.3; }
  [data-theme="codex"] .gp-grid + .dpack-policy { margin-top: 8px; font-size: 13px; line-height: 1.35; }
}
@media (max-width: 760px) {
  /* Arena on a phone: the queue button beside the league, and each line-up shorter, so one always fits a page. */
  .ar-ranked .rk-me { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 6px; padding: 10px 12px; }
  .ar-ranked .rk-me .rk-me-top { grid-column: 1; grid-row: 1; }
  .ar-ranked .rk-me .ar-q { grid-column: 2; grid-row: 1; margin: 0; }
  .ar-ranked .rk-me .ar-q .muted { display: none; }
  /* Queued: the button and the search line go back under the numbers. */
  .ar-ranked .rk-me:has(.ar-q [aria-pressed="true"]) .ar-q { grid-column: 1 / -1; grid-row: 3; }
  .ar-ranked .rk-me:has(.ar-q [aria-pressed="true"]) .ar-q .muted { display: block; }
  .ar-ranked .rk-me .rk-grid { grid-column: 1 / -1; }
  .ar-ranked .ar-lineups { padding: 8px 10px; }
  .ar-ranked .ar-list > li { padding: 5px 7px; }
  .ar-ranked .ar-list > li .ar-team img { width: 34px; height: 34px; }
  .ar-ranked .ar-list > li .syn-chips { gap: 3px; margin-top: 2px; }
  .ar-ranked .ar-list > li .syn-chips > * { font-size: 10.5px; padding-top: 1px; padding-bottom: 1px; }
}
/* Shop › Diamond packs on a phone: the packs as short rows like the gem packs, the Starter Pack one compact card. */
@media (max-width: 760px) {
  /* The sale band (client/store.ts saleBanner) on a phone: one short row; the Packs tab's -20% tag gives way to it. */
  [data-theme="codex"] .dp-sale { gap: 10px; margin: 0 0 6px; padding: 4px 10px 4px 4px; }
  [data-theme="codex"] .dp-sale-pct { min-width: 0; height: 30px; padding: 0 8px; font-size: 15px; }
  [data-theme="codex"] .dp-sale-txt b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  [data-theme="codex"] .dp-sale-what { display: none; }
  [data-theme="codex"] .dp-sale-end { font-size: 12px; }
  [data-theme="codex"] .subtabs .st-sale { display: none; }
  [data-theme="codex"] .dp-bar:has(.dp-sale) { flex-wrap: wrap; }
  [data-theme="codex"] .dp-bar .dp-sale { order: -1; flex: 1 0 100%; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) { grid-template-columns: minmax(0, 1fr); gap: 5px; margin-top: 6px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto auto; justify-items: start; align-items: center; column-gap: 10px; row-gap: 1px; padding: 4px 8px 4px 4px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .pz-tag { top: -1px; right: auto; left: 64px; transform: none; font-size: 9px; padding: 1px 5px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card.tagged .dp-name { visibility: hidden; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-art { grid-row: 1 / 4; width: 48px; height: 48px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-still { width: 46px; height: 46px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-pile { width: 46px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-pile img { width: 18px; height: 18px; margin: -4px -3px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-name { grid-column: 2; grid-row: 1; align-self: end; font-size: 10px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-n { grid-column: 2; grid-row: 2; font-size: 20px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-n img { width: 16px; height: 16px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-more { grid-column: 2; grid-row: 3; align-self: start; font-size: 11px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn { grid-column: 3; justify-self: stretch; min-width: 96px; min-height: 30px; height: 30px; padding: 0 8px; font-size: 13.5px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn:not(.dp-gem) { grid-row: 1 / 4; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card:has(.dp-gem) .btn:not(.dp-gem) { grid-row: 1 / 3; align-self: end; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn.dp-gem { grid-row: 3; align-self: start; margin-top: 3px; font-size: 12.5px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn.dp-gem img { width: 14px; height: 14px; }
  /* The top bar already shows the gem count. */
  [data-theme="codex"] .dp-gembal:has(+ .dp-grid) { display: none; }
  [data-theme="codex"] .sp-feat { grid-template-columns: 76px minmax(0, 1fr); margin-top: 6px; }
  [data-theme="codex"] .sp-feat .sf-pass-art { min-height: 0; }
  [data-theme="codex"] .sp-feat .sp-art .pz-show-pic, [data-theme="codex"] .sp-art .sp-still { width: 68px; height: 68px; }
  [data-theme="codex"] .sp-feat .sf-pass-body { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 8px 10px; }
  [data-theme="codex"] .sp-feat .pz-eyebrow { display: none; }
  [data-theme="codex"] .sp-feat h3 { font-size: 21px; }
  [data-theme="codex"] .sp-feat .btn { grid-column: 2; grid-row: 1; min-height: 32px; padding: 0 12px; }
  [data-theme="codex"] .sp-feat .sp-list { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; font-size: 11.5px; line-height: 1.2; }
  [data-theme="codex"] .sp-feat .sp-list img { width: 16px; height: 16px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) + .dpack-policy { margin-top: 6px; font-size: 11.5px; line-height: 1.3; }
  [data-theme="codex"] .dpack-test { margin: 0 0 4px; font-size: 11.5px; line-height: 1.3; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn { min-height: 28px !important; height: 28px; line-height: 1; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn.dp-gem { min-height: 26px !important; height: 26px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card.best { padding: 6px 10px 6px 6px; }
  .psec-tabs[data-key="psec-dpacks"] { margin: 2px 0 4px; }
}
/* Phones price the packs one way at a time: Card or Gems (client/store.ts payBy). */
.dp-pay { display: none; }
@media (max-width: 760px) {
  [data-theme="codex"] .dp-pay { display: inline-flex; margin: 0 0 2px auto; float: right; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--rule-soft, var(--line)); }
  [data-theme="codex"] .dp-pay + .dp-grid { clear: both; }
  [data-theme="codex"] .dp-pay button { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 12px; background: none; border: 0; font: 600 12.5px var(--sans); color: var(--cream-2, var(--muted)); cursor: pointer; }
  [data-theme="codex"] .dp-pay button.on { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  [data-theme="codex"] .dp-pay img { width: 14px; height: 14px; }
  [data-theme="codex"] .dp-grid.pay-card .dp-card .btn.dp-gem, [data-theme="codex"] .dp-grid.pay-gems .dp-card .btn:not(.dp-gem) { display: none; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn, [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card:has(.dp-gem) .btn:not(.dp-gem) { grid-row: 1 / 4 !important; align-self: center !important; margin: 0; min-height: 34px !important; height: 34px; font-size: 14px; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .dp-gembal:has(+ .dp-pay) { display: none; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) { gap: 4px; margin-top: 2px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 3px 8px 3px 3px; row-gap: 0; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-art { width: 44px; height: 44px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-still { width: 42px; height: 42px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-n { font-size: 18px; line-height: 1.05; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-more:empty, [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-more { font-size: 10.5px; line-height: 1.1; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card.best { padding: 5px 10px 5px 5px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) + .dpack-policy { font-size: 11px; line-height: 1.25; margin-top: 5px; }
}
/* Shop tabs: shorter names on a phone so the five fit one row. */
.st-short { display: none; }
@media (max-width: 760px) {
  .st-long { display: none; }
  .st-short { display: inline; }
  .page:has(.st-short) .subtabs { flex-wrap: nowrap; gap: 0; justify-content: space-between; }
  .page:has(.st-short) .subtabs a { padding-left: 4px; padding-right: 4px; font-size: 12px; white-space: nowrap; }
  .page:has(.st-short) .subtabs a .ti { width: 14px; height: 14px; }
}
@media (max-width: 760px) {
  /* The Starter Pack / Diamonds tabs and the Card / Gems switch share one row. */
  [data-theme="codex"] .dp-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; border-bottom: 1px solid var(--rule-soft, var(--line)); }
  [data-theme="codex"] .dp-bar:empty { display: none; }
  [data-theme="codex"] .dp-bar .psec-tabs { flex: 1 1 auto; margin: 0; border: 0; grid-template-columns: repeat(2, max-content); gap: 14px; }
  [data-theme="codex"] .dp-bar .dp-pay { float: none; margin: 0 0 0 auto; }
  [data-theme="codex"] .dp-bar:has(button.on[data-id="dpacks:starter"]) .dp-pay { display: none; }
  [data-theme="codex"] .dp-gembal:has(+ .dp-grid) { display: none; }
  [data-theme="codex"] .dpack-policy { font-size: 11px; line-height: 1.25; margin-top: 5px; }
  [data-theme="codex"] .dpack-test { font-size: 11px; }
}
@media (max-width: 760px) {
  /* The Starter Pack has its own tab, so it can be bigger. */
  [data-theme="codex"] .sp-feat { grid-template-columns: 120px minmax(0, 1fr); }
  [data-theme="codex"] .sp-feat .sp-art .pz-show-pic, [data-theme="codex"] .sp-art .sp-still { width: 108px; height: 108px; }
  [data-theme="codex"] .sp-feat .pz-eyebrow { display: block; grid-column: 1 / -1; font-size: 10.5px; }
  [data-theme="codex"] .sp-feat .sf-pass-body { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; }
  [data-theme="codex"] .sp-feat .sp-list { grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 13px; }
  [data-theme="codex"] .sp-feat .sp-list img { width: 20px; height: 20px; }
  [data-theme="codex"] .sp-feat .btn { grid-column: 1; grid-row: auto; justify-self: start; min-height: 38px; padding: 0 18px; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .sp-feat .sf-pass-art { width: 100%; height: 100%; align-self: stretch; place-items: center; }
}
/* Diamond packs on desktop: the Starter Pack one short band, the pack art smaller on screens under 900px tall. */
@media (min-width: 761px) {
  [data-theme="codex"] .sp-feat { grid-template-columns: 120px minmax(0, 1fr); margin-top: 8px; }
  [data-theme="codex"] .sp-feat .sf-pass-art { min-height: 0; }
  [data-theme="codex"] .sp-feat .sp-art .pz-show-pic, [data-theme="codex"] .sp-art .sp-still { width: 96px; height: 96px; }
  [data-theme="codex"] .sp-feat .sf-pass-body { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 18px; row-gap: 6px; padding: 12px 18px; }
  [data-theme="codex"] .sp-feat .sf-pass-body > :not(.btn) { grid-column: 1; }
  [data-theme="codex"] .sp-feat .sf-pass-body > .btn { grid-column: 2; grid-row: 1 / span 3; min-width: 120px; }
  [data-theme="codex"] .sp-feat h3 { font-size: 26px; }
  [data-theme="codex"] .dp-gembal { margin: 6px 0 0; }
}
@media (min-width: 761px) and (max-height: 900px) {
  [data-theme="codex"] .dp-grid:not(.gp-grid) { margin-top: 8px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card { gap: 4px; padding: 10px 10px 10px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-art { height: 96px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-still { width: 88px; height: 88px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-n { font-size: 24px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .psec-tabs[data-key="psec-dpacks"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; margin: 4px 0 0; }
  .psec[data-key^="psec-dpacks-"]:not(.on) { display: none; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-card .btn { font-size: 14px; padding-left: 4px; padding-right: 4px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-name { font-size: 11px; text-align: center; }
}
@media (min-width: 761px) and (max-height: 740px) {
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-art { height: 80px; }
  [data-theme="codex"] .dp-grid:not(.gp-grid) .dp-still { width: 76px; height: 76px; }
}
/* Diamond shop (client/pages.ts diamonds): a rail like the Merchant's (a row of picture tabs on a phone), one shelf at a time; each shelf's list pages. */
[data-theme="codex"] .ds-rail button .ds-ic { width: 32px; height: 32px; image-rendering: pixelated; flex: none; object-fit: contain; }
[data-theme="codex"] .ds-body { min-width: 0; }
/* Beside the rail the boosts run one a row, so each card's tiers stay on one line. */
@media (min-width: 761px) { [data-theme="codex"] .dshop .pb-grid { grid-template-columns: minmax(0, 1fr); } [data-theme="codex"] .dshop .pb-tiers { flex-wrap: nowrap; } }
[data-theme="codex"] .ds-feat { display: grid; gap: 10px; margin: 0; }
[data-theme="codex"] .ds-feat > .sf-pass { margin: 0; }
[data-theme="codex"] .ds-feat > .sf-pass.feat { margin-top: 10px; }
[data-theme="codex"] .dshop .ofgrid { margin-top: 0; }
@media (min-width: 761px) {
  [data-theme="codex"] .ds-feat { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  [data-theme="codex"] .ds-feat > .feat, [data-theme="codex"] .ds-feat.n1 > *, [data-theme="codex"] .ds-feat.n2:has(> .feat) > * { grid-column: 1 / -1; }
  [data-theme="codex"] .ds-feat .sf-pass { grid-template-columns: 140px minmax(0, 1fr); }
  [data-theme="codex"] .ds-feat .sf-pass-art { min-height: 0; }
  [data-theme="codex"] .ds-feat .sf-pass-art .pz-show-pic { width: 112px; height: 112px; }
  [data-theme="codex"] .ds-feat .vip-crest { width: 88px; height: 88px; font-size: 28px; }
  [data-theme="codex"] .ds-feat .sf-pass-body { padding: 12px 16px; gap: 6px; }
  [data-theme="codex"] .ds-feat .sf-pass-body h3 { font-size: 24px; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .dshop.bs-shop { gap: 8px; }
  [data-theme="codex"] .bs-rail.ds-rail { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 5px; flex-wrap: nowrap; }
  [data-theme="codex"] .bs-rail.ds-rail button { flex-direction: column; justify-content: center; gap: 2px; min-height: 54px; padding: 5px 2px 4px; font-size: 13px; letter-spacing: .01em; text-align: center; min-width: 0; white-space: nowrap; }
  [data-theme="codex"] .bs-rail.ds-rail button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  [data-theme="codex"] .bs-rail.ds-rail button .ds-ic { width: 26px; height: 26px; }
  /* Phones with the Filters panel open and no room for a row of creatures: the panel takes the screen (creatures.ts
   noRoomCheck); "Show them" closes it. */
.fbar ~ .hint .cf-show { display: none; }
@media (max-width: 760px) {
  #page.cf-noroom :is(#cgrid, .ctable-wrap, .cpager) { display: none; }
  #page.cf-noroom .fbar ~ .hint .cf-show { display: inline; margin-right: 10px; }
}
@media (max-width: 360px) { [data-theme="codex"] .bs-rail.ds-rail { gap: 3px; } [data-theme="codex"] .bs-rail.ds-rail button { font-size: 11px; letter-spacing: 0; padding: 5px 0 4px; } }
  [data-theme="codex"] .bs-rail.ds-rail button.on { box-shadow: inset 0 0 0 1px var(--edge), inset 0 -3px 0 var(--rg-rubric), inset 0 0 0 2px var(--gilt), 0 2px 0 rgba(0, 0, 0, .3); }
  [data-theme="codex"] .ds-feat { gap: 6px; }
  [data-theme="codex"] .ds-feat .sf-pass { grid-template-columns: 76px minmax(0, 1fr); }
  [data-theme="codex"] .ds-feat .sf-pass.feat { border-width: 12px; margin-top: 8px; }
  [data-theme="codex"] .ds-feat .sf-pass-art { min-height: 0; width: 100%; height: 100%; align-self: stretch; }
  [data-theme="codex"] .ds-feat .sf-pass-art .pz-show-pic { width: 68px; height: 68px; }
  [data-theme="codex"] .ds-feat .vip-crest { width: 56px; height: 56px; font-size: 18px; }
  [data-theme="codex"] .ds-feat .sf-pass-body { padding: 7px 10px; gap: 3px; }
  [data-theme="codex"] .ds-feat .sf-pass-body h3 { font-size: 19px; }
  [data-theme="codex"] .ds-feat .pz-eyebrow { font-size: 9.5px; }
  [data-theme="codex"] .ds-feat :is(.sf-pass-body p, .sf-pass-pts, .sp-list) { font-size: 11.5px; line-height: 1.25; gap: 1px 10px; }
  [data-theme="codex"] .ds-feat .sf-pass-pts b { font-size: 13px; }
  [data-theme="codex"] .ds-feat .sf-pass-body .btn { min-height: 30px; height: 30px; padding: 0 12px; font-size: 13px; margin-top: 2px; white-space: nowrap; justify-self: start; max-width: 100%; display: inline-flex; align-items: center; justify-content: center; }
  /* Boosts */
  [data-theme="codex"] .dshop .pb-grid { gap: 6px; }
  [data-theme="codex"] .dshop .pb-card { padding: 8px 10px; gap: 8px; }
  [data-theme="codex"] .dshop .pb-card > img { width: 36px; flex: none; }
  [data-theme="codex"] .dshop .pb-trio { width: 40px; height: 36px; }
  [data-theme="codex"] .dshop .pb-trio img { width: 24px; height: 24px; }
  [data-theme="codex"] .dshop .pb-trio img:nth-child(2) { left: 14px; top: 10px; }
  [data-theme="codex"] .dshop .pb-trio img:nth-child(3) { left: 3px; top: 13px; }
  [data-theme="codex"] .dshop .pb-card p { margin: 2px 0 4px; font-size: 11.5px; line-height: 1.25; }
  [data-theme="codex"] .dshop .pb-tiers { margin-top: 2px; gap: 4px; }
  [data-theme="codex"] .dshop .pb-tiers .btn { min-height: 30px !important; height: 30px; padding: 0 6px; font-size: 12.5px; }
  [data-theme="codex"] .dshop .pb-all .pb-tiers { gap: 4px; }
  [data-theme="codex"] .dshop .pb-deal { flex: 1 1 100%; }
  /* Outfits and skins: two small cards a row. */
  [data-theme="codex"] .dshop .ofgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  [data-theme="codex"] .dshop .ofcard { flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 8px; }
  [data-theme="codex"] .dshop .of-pic { width: 64px; height: 64px; }
  [data-theme="codex"] .dshop .of-pic :is(img, .of-fit) { width: 56px; height: 56px; }
  [data-theme="codex"] .dshop .ofcard p:not(.of-how) { display: none; }
  [data-theme="codex"] .dshop .ofcard .row.between { justify-content: center; }
  [data-theme="codex"] .dshop .ofcard .nm { font-size: 13.5px; }
  [data-theme="codex"] .dshop .ofcard .pill { font-size: 10.5px; }
  [data-theme="codex"] .dshop .ofcard .buyrow { justify-content: center; margin-top: 2px; }
  /* Charms */
  [data-theme="codex"] .dshop .ds-charms { gap: 6px; }
  [data-theme="codex"] .dshop .ds-charms .scard2 { padding: 8px 10px; gap: 10px; }
  [data-theme="codex"] .dshop .ds-charms .scard2 > img { width: 36px; height: 36px; }
  [data-theme="codex"] .dshop .ds-charms p { margin: 2px 0 4px; font-size: 11.5px; line-height: 1.25; }
  [data-theme="codex"] .dshop :is(.ds-charms, .ofgrid) .btn.small { min-height: 30px !important; height: 30px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  [data-theme="codex"] .ds-feat { gap: 8px; }
  [data-theme="codex"] .ds-feat .sf-pass { grid-template-columns: 110px minmax(0, 1fr); }
  [data-theme="codex"] .ds-feat .sf-pass-art .pz-show-pic { width: 92px; height: 92px; }
  [data-theme="codex"] .ds-feat .vip-crest { width: 72px; height: 72px; font-size: 22px; }
  [data-theme="codex"] .ds-feat .sf-pass-body { padding: 10px 14px; gap: 4px; }
  [data-theme="codex"] .ds-feat .sf-pass-body h3 { font-size: 22px; }
  [data-theme="codex"] .ds-feat :is(.sf-pass-body p, .sf-pass-pts, .sp-list) { font-size: 13px; line-height: 1.25; }
  [data-theme="codex"] .ds-feat .sf-pass-body .btn { min-height: 32px; }
}
/* Shop › Eggs (client/pages.ts eggsPane): Eggs / Hatches / Incubators take turns; wide screens show Hatches with Eggs. */
.egg-shop:has(> .psec-tabs button.on[data-id="eggs:inc"]) .egg-hall { display: none; }
.egg-shop > .psec-tabs { margin: 2px 0 10px; }
[data-theme="codex"] .egg-shop .incubators { margin-bottom: 0; }
@media (min-width: 1101px) {
  .psec-tabs[data-key="psec-eggs"] button[data-id="eggs:hatch"] { display: none; }
  .egg-shop:has(> .psec-tabs button.on[data-id="eggs:hatch"]) .psec-tabs button[data-id="eggs:egg"] { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  .egg-shop:has(> .psec-tabs button.on:is([data-id="eggs:egg"], [data-id="eggs:hatch"])) :is([data-key^="psec-eggs-egg"], [data-key="psec-eggs-hatch"]) { display: contents; }
}
@media (max-width: 1100px) {
  /* The Hatches tab is the hatch list alone, with the Incubate button under it. */
  [data-theme="codex"] .egg-shop:has(> .psec-tabs button.on[data-id="eggs:hatch"]) .egg-hatch { padding-top: 0; border-top: 0; }
}
@media (max-height: 900px) and (min-width: 761px) {
  [data-theme="codex"] .egg-peek { padding: 12px 16px; row-gap: 8px; }
  [data-theme="codex"] .eh-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin-top: 6px; }
  [data-theme="codex"] .eh-grid .eh :is(img, .walker) { width: 48px; height: 48px; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .egg-hall { gap: 8px; }
  [data-theme="codex"] .egg-peek { padding: 10px; }
  [data-theme="codex"] .eh-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
  [data-theme="codex"] .eh-grid .eh :is(img, .walker) { width: 44px; height: 44px; }
  [data-theme="codex"] .eh-grid .eh { padding: 4px 2px 5px; gap: 1px; }
  [data-theme="codex"] .eh-grid .eh b { font-size: 11.5px; }
  [data-theme="codex"] .eh-grid .eh-p { font-size: 11px; }
  [data-theme="codex"] .egg-hatch .row { flex-wrap: nowrap; }
}
@media (min-width: 761px) and (max-width: 900px) {
  /* Tablets: the three eggs side by side above the preview. */
  [data-theme="codex"] .egg-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  [data-theme="codex"] .egg-tile { padding: 8px 10px; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .egg-tile { padding: 6px 4px; gap: 2px; }
}
/* Help (client/help.ts): chapter cards page, a chapter has its own page, and a topic pages block by block. */
[data-theme="codex"] .hp-page > .hp-li { margin: 0; }
[data-theme="codex"] .hp-page > .hp-li > li { margin: 0 0 7px; }
[data-theme="codex"] .hp-page > .hp-li:not(:has(+ .hp-li)) { margin-bottom: 12px; }
[data-theme="codex"] .hp-page > :last-child { margin-bottom: 0; }
[data-theme="codex"] .hp-page + .fit-pager { margin: -2px 0 0; }
.hp-ch-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hp-ch-n { display: none; }
[data-theme="codex"] .hp-toc { margin: 0; padding: 6px 8px; list-style: none; }
[data-theme="codex"] .hp-toc li + li { border-top: 1px solid var(--rule-soft); }
[data-theme="codex"] .hp-toc a { display: block; padding: 10px 12px 10px 14px; font: 600 17px/1.25 var(--sans); color: var(--ink-v); text-decoration: none; box-shadow: inset 3px 0 0 var(--pk); }
[data-theme="codex"] .hp-toc a:hover { background: var(--inlay); color: var(--pk); }
@media (min-width: 761px) {
  /* The rail and the header take less room so a topic and its chapter list fit beside each other. */
  [data-theme="codex"] .help .bp-head { margin-bottom: 10px; padding-top: 4px; padding-bottom: 4px; }
  [data-theme="codex"] .help .bp-head .bp-art { width: 52px; height: 52px; }
  [data-theme="codex"] .help .bp-head .bp-art :is(img, .bp-ui) { width: 40px; height: 40px; }
  [data-theme="codex"] .help .bp-head h1 { font-size: 28px; }
  [data-theme="codex"] .hp-rail { padding: 8px 8px 10px; gap: 0; }
  [data-theme="codex"] .hp-rail .hp-search { margin-bottom: 4px; }
  [data-theme="codex"] .hp-rail .hp-search input { padding: 5px 0; font-size: 14px; }
  [data-theme="codex"] .hp-rc-head { padding: 3px 6px; font-size: 14.5px; }
  [data-theme="codex"] .hp-rc-head :is(img, svg) { width: 20px !important; height: 20px !important; }
  [data-theme="codex"] .hp-rc ul { margin: 1px 0 3px 16px; }
  [data-theme="codex"] .hp-rc li a { padding: 2px 8px; font-size: 14px; }
  [data-theme="codex"] .hp-ch { gap: 6px; padding: 8px 14px 10px; }
  [data-theme="codex"] .hp-ch-head .bp-art { width: 48px; height: 48px; }
  [data-theme="codex"] .hp-ch-head .bp-art :is(img, .bp-ui) { width: 40px; height: 40px; }
  [data-theme="codex"] .hp-ch-head .bp-nm { font-size: 20px; }
  [data-theme="codex"] .hp-ch ul { padding-top: 5px; }
  [data-theme="codex"] .hp-ch li a { font-size: 14.5px; line-height: 1.5; }
  [data-theme="codex"] .hp-page { padding: 14px 22px 16px; }
  [data-theme="codex"] .hp-page :is(p, li) { font-size: 16px; line-height: 1.5; }
  [data-theme="codex"] .hp-step { padding: 6px 12px; }
  [data-theme="codex"] .hp-step b { font-size: 15.5px; }
}
@media (max-width: 760px) {
  /* Phones: Help is a title row, the search, then the chapters as tiles. */
  [data-theme="codex"] .help .hp-head:not(.in) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; padding: 6px 10px 8px; margin-bottom: 8px; }
  [data-theme="codex"] .help .hp-head:not(.in) > .bp-art, [data-theme="codex"] .help .hp-head:not(.in) .bp-sub { display: none; }
  [data-theme="codex"] .help .hp-head:not(.in) h1 { font-size: 26px; }
  .help .hp-head:not(.in) .hp-tools { display: contents; }
  .help .hp-head:not(.in) .hp-btns { grid-column: 2; grid-row: 1; align-self: center; }
  .help .hp-head:not(.in) :is(.hp-fb, .hp-dc) { min-height: 32px; padding: 0 10px; font-size: 13px; }
  .help .hp-head:not(.in) .hp-search { grid-column: 1 / -1; }
  [data-theme="codex"] .help .hp-search input { padding: 6px 0; font-size: 15px; }
  .help .hp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  [data-theme="codex"] .hp-ch { padding: 6px 8px; gap: 0; }
  [data-theme="codex"] .hp-ch ul { display: none; }
  [data-theme="codex"] .hp-ch-head { gap: 6px; min-height: 52px; }
  [data-theme="codex"] .hp-ch-head .bp-art { width: 40px; height: 40px; flex: none; }
  [data-theme="codex"] .hp-ch-head .bp-art :is(img, .bp-ui) { width: 34px; height: 34px; }
  [data-theme="codex"] .hp-ch-head .bp-nm { font-size: 15px; line-height: 1.15; }
  .hp-ch-n { display: block; font: 600 11.5px var(--sans); color: var(--muted-v, var(--muted)); }
  /* A chapter or topic: a short header, the text, Previous and Next. */
  [data-theme="codex"] .help .hp-head.in { gap: 8px; margin-bottom: 8px; padding: 4px 10px 4px 6px; }
  [data-theme="codex"] .help .hp-head.in .bp-art { width: 40px; height: 40px; }
  [data-theme="codex"] .help .hp-head.in .bp-art :is(img, .bp-ui) { width: 34px; height: 34px; }
  [data-theme="codex"] .help .hp-head.in h1 { font-size: 22px; }
  [data-theme="codex"] .help .hp-head.in .bp-eye { font-size: 10.5px; }
  [data-theme="codex"] .hp-page { padding: 10px 12px 12px; }
  [data-theme="codex"] .hp-page :is(p, li) { font-size: 15px; line-height: 1.45; }
  [data-theme="codex"] .hp-page .tbl { font-size: 13.5px; }
  .help .hp-main { gap: 6px; }
  [data-theme="codex"] .hp-step { padding: 5px 10px; }
  [data-theme="codex"] .hp-step b { font-size: 14px; }
  [data-theme="codex"] .hp-toc a { padding: 9px 10px 9px 12px; font-size: 16px; }
}
@media (min-width: 761px) and (max-width: 1100px), (min-width: 761px) and (max-height: 900px) {
  /* The other chapters shrink to a row of icons above the open one. */
  [data-theme="codex"] .hp-rail { flex-flow: row wrap; align-items: center; gap: 2px; }
  [data-theme="codex"] .hp-rail > .hp-search { flex: 1 1 100%; order: -2; }
  [data-theme="codex"] .hp-rail > .hp-rc:not(.open) { order: -1; }
  [data-theme="codex"] .hp-rail > .hp-rc:not(.open) .hp-rc-head { padding: 4px; }
  [data-theme="codex"] .hp-rail > .hp-rc:not(.open) .hp-rc-head > span { display: none; }
  [data-theme="codex"] .hp-rail > .hp-rc.open { flex: 1 1 100%; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule-soft); }
}
@media (max-width: 760px) {
  [data-theme="codex"] .hp-results { padding: 8px 10px 10px; }
  [data-theme="codex"] .hp-results a { padding: 6px 8px 6px 12px; }
  [data-theme="codex"] .hp-results b { font-size: 16px; }
  [data-theme="codex"] .hp-r-snip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 13.5px; line-height: 1.35; }
}
/* Grade calculator (client/calc.ts): Rolls / Grade / Stats / Hunt take turns; wide screens keep the rolls on the left. */
.calc > .psec-tabs { grid-column: 1 / -1; margin-bottom: 0; }
@media (min-width: 761px) {
  .psec-tabs[data-key="psec-calc"] button[data-id="calc:rolls"] { display: none; }
  .calc [data-key="psec-calc-rolls"] { display: contents !important; }
  .calc:has(> .psec-tabs button.on[data-id="calc:rolls"]) [data-key="psec-calc-grade"] { display: contents !important; }
  .calc:has(> .psec-tabs button.on[data-id="calc:rolls"]) .psec-tabs button[data-id="calc:grade"] { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  [data-theme="codex"] .calc { row-gap: 10px; }
  [data-theme="codex"] .calc > .panel { padding: 10px 14px; }
  [data-theme="codex"] .calc h5 { margin: 10px 0 5px; }
  [data-theme="codex"] .calc-ivs { row-gap: 3px; }
  [data-theme="codex"] .calc input[type=number], [data-theme="codex"] .calc select { min-height: 30px; padding-top: 3px; padding-bottom: 3px; }
}
@media (max-width: 760px) {
  .calc-in:not(:has(> .psec.on)) { display: none; }
  [data-theme="codex"] .calc { gap: 8px; }
  [data-theme="codex"] .calc > .panel { padding: 8px 10px; }
  [data-theme="codex"] .calc h5 { margin: 8px 0 4px; font-size: 14px; }
  [data-theme="codex"] .calc label.row { margin-bottom: 4px; }
  [data-theme="codex"] .calc input[type=number], [data-theme="codex"] .calc select { min-height: 32px; height: 32px; padding-top: 2px; padding-bottom: 2px; }
  /* Talent: two columns of name, roll and weight. */
  [data-theme="codex"] .calc-ivs { grid-template-columns: 50px 52px 40px 50px 52px 40px; gap: 4px 6px; }
  [data-theme="codex"] .calc-ivs .bar { display: none; }
  [data-theme="codex"] .calc .actions { margin-top: 6px; }
  [data-theme="codex"] .calc .actions .btn { min-height: 30px; }
  [data-theme="codex"] .calc .seg .btn { min-height: 30px; min-width: 36px; }
  [data-theme="codex"] .calc label.row:has(> input[type=checkbox]) { margin-top: 6px !important; font-size: 13px; }
  [data-theme="codex"] .calc-head img { width: 64px; height: 64px; }
  [data-theme="codex"] .calc-out .tbl.odds { font-size: 11.5px; }
  [data-theme="codex"] .calc-out .tbl.odds :is(th, td) { padding: 3px 4px; line-height: 1.2; }
  [data-theme="codex"] .calc-out .tbl.odds td.num, [data-theme="codex"] .calc-out .tbl.odds th { white-space: nowrap; }
  [data-theme="codex"] .calc-out .tbl.odds .el { padding: 0 4px; font-size: 10.5px; }
  [data-theme="codex"] .calc-out .tbl.odds td:first-child .muted { display: block; font-size: 10.5px; }
  [data-theme="codex"] .calc-out label.row + * { margin: 4px 0; font-size: 12.5px; }
  [data-theme="codex"] .calc input[type=range] { margin: 4px 0 0; height: 20px; }
  [data-theme="codex"] .calc h5:has(+ input[type=range]) { margin-bottom: 0; }
}
@media (max-width: 760px), (min-width: 761px) and (max-height: 800px) {
  /* Species and level share a row; talent sits in two columns without bars. */
  [data-theme="codex"] .calc-in { display: grid; grid-template-columns: minmax(0, 1fr) 104px; column-gap: 8px; align-content: start; }
  [data-theme="codex"] .calc-in > * , [data-theme="codex"] .calc-in > .psec > * { grid-column: 1 / -1; }
  [data-theme="codex"] .calc-in > .psec > label.row:nth-child(1) { grid-column: 1; }
  [data-theme="codex"] .calc-in > .psec > label.row:nth-child(2) { grid-column: 2; }
  [data-theme="codex"] .calc-in > .psec > label.row:nth-child(-n+2) > span:first-child { width: auto; }
  [data-theme="codex"] .calc-ivs { grid-template-columns: 50px 52px 40px 50px 52px 40px; gap: 4px 6px; }
  [data-theme="codex"] .calc-ivs .bar { display: none; }
}
/* The smallest phones (320x568): the talent grid ran 40 px past the card's right edge and the Aura line under the
   bottom bar. Narrower columns, and slimmer rows on a short screen. */
@media (max-width: 340px) {
  [data-theme="codex"] .calc-ivs { grid-template-columns: 44px 46px 32px 44px 46px 32px; gap: 4px; }
  [data-theme="codex"] .calc-ivs > * { min-width: 0; }
  /* The Hunt tab's table: its Power column steps aside (the move's damage says it), so One hit stays on the card. */
  [data-theme="codex"] .calc-out .tbl.odds :is(th, td):nth-child(2) { display: none; }
}
@media (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] .calc { gap: 6px; }
  [data-theme="codex"] .calc h5 { margin: 5px 0 2px; }
  [data-theme="codex"] .calc label.row { margin-bottom: 2px; }
  [data-theme="codex"] .calc input[type=number], [data-theme="codex"] .calc select { min-height: 28px; height: 28px; }
  [data-theme="codex"] .calc-ivs { row-gap: 3px; }
  [data-theme="codex"] .calc .actions { margin-top: 4px; }
  [data-theme="codex"] .calc .actions .btn, [data-theme="codex"] .calc .seg .btn { min-height: 28px; }
  [data-theme="codex"] .calc label.row:has(> input[type=checkbox]) { margin-top: 4px !important; }
  [data-theme="codex"] .calc-out .tbl.odds :is(th, td) { padding-top: 2px; padding-bottom: 2px; }
  [data-theme="codex"] .calc-out .tbl.odds tr:not(.splash) td:first-child .muted { display: none; }
}
@media (min-width: 761px) and (max-height: 800px) {
  [data-theme="codex"] .calc .seg .btn { min-height: 28px; }
  [data-theme="codex"] .calc h5 { margin: 8px 0 4px; }
}
@media (min-width: 761px) and (max-height: 800px) {
  [data-theme="codex"] .calc-out .tbl.odds :is(th, td) { padding-top: 3px; padding-bottom: 3px; line-height: 1.2; }
}
@media (max-width: 760px) {
  [data-theme="codex"] .calc label.row:has(> input[type=checkbox]) { margin: 4px 0 0 !important; }
  [data-theme="codex"] .calc-in > .psec > h5:first-of-type { margin-top: 4px; }
}
@media (max-width: 760px) { .calc-out:not(:has(> .psec.on)) { display: none; } }
.calc-in label.row select, .calc-in label.row input[type=number] { min-width: 0; }
@media (max-width: 760px) {
  /* Friends: the add form on one line. */
  [data-theme="codex"] .fl-h .fr-add { display: flex; gap: 6px; width: 100%; }
  [data-theme="codex"] .fl-h .fr-add input { flex: 1 1 auto; min-width: 0; min-height: 34px; padding: 4px 8px; }
  [data-theme="codex"] .fl-h .fr-add .btn { min-height: 34px; padding: 0 10px; font-size: 12px; white-space: nowrap; }
}
/* Training (client/training.ts): Board / Side A / Side B / Result take turns on phones and tablets. */
@media (min-width: 761px) and (max-width: 1100px) {
  .psec-tabs[data-key="psec-tr"] { display: grid; }
}
@media (max-width: 1100px) {
}
@media (max-width: 760px) {
}
/* A 320 px phone: Training's three team buttons take two rows instead of running off the edge. */
@media (max-width: 350px) { [data-theme="codex"] .tr-side .actions { flex-wrap: wrap; } }
@media (max-width: 760px) {
  /* The made-up creature editor: two fields a row, talents and refine six across. */
  [data-theme="codex"] .tr-edit :is(select, input[type=number]) { min-height: 30px !important; height: 30px !important; padding-top: 2px; padding-bottom: 2px; font-size: 13.5px; }
}
@media (max-width: 760px) {
}
/* Training on wide screens: the board on the left (portrait), both sides beside it, the result under them. */
@media (min-width: 1101px) {
}
@media (min-width: 761px) and (max-width: 1100px) {
}
/* A training slot: the picture and text across, its buttons in a row under them. */
@media (max-width: 760px) {
}
/* While the result is open, it takes the page on wide screens too ("Teams" goes back). */
@media (min-width: 1101px) {
}
@media (min-width: 761px) {
}
@media (max-width: 760px) {
}
/* Every blow pages instead of scrolling inside its box; while it is open the board steps aside. */
.ar-log ol { max-height: none; overflow: visible; }
.fb-log:has(> details.ar-log[open]) > :is(.bv, .bv-chips), .bv-log:has(> details[open]) > :is(.bv, .bv-chips) { display: none; }
@media (min-width: 761px) and (max-width: 1100px) {
}
@media (max-width: 1100px) {
  /* The result tab is the replay alone. */
}
@media (max-width: 1100px) {
  /* The replay gets the page's room: the Friends header steps aside while it is open (the tabs above it go back). */
}
/* Creatures: pages instead of a long scroll (client/creatures.ts creaturesFit). */
.cgrid, .ctable-wrap { padding-bottom: 0; }
.cpager { margin-top: 8px; }
.fbar > .fmore { display: none; }
/* The search gives up width before the filter row wraps (the Trait filter joined it, 2026-11-10). */
@media (min-width: 761px) { .fbar > .fsearch { flex: 1 1 150px; max-width: 260px; } }
.cr-acts { display: contents; }
.cr-acts .cr-s { display: none; }
@media (max-width: 760px) {
  .cr-acts { display: flex; flex-wrap: nowrap; gap: 6px; width: 100%; }
  .cr-acts .btn { flex: 1 1 0; min-width: 0; padding: 0 4px; font-size: 12px; white-space: nowrap; justify-content: center; }
  .cr-acts .cr-l { display: none; }
  .cr-acts .cr-s { display: inline; }
  /* Search, Filters and Select on one row; the rest folds open under them. */
  .fbar { flex-wrap: wrap; overflow: visible; padding-bottom: 0; gap: 6px; margin-bottom: 8px; }
  .fbar > .fmore { display: inline-flex; order: -1; }
  .fbar > .fmore b { margin-left: 4px; color: var(--gold); }
  .fbar > .fsearch { flex: 1 1 0; min-width: 0; }
  .fbar:not(.open) > :not(.fsearch, .fmore, [data-act=cf-select]) { display: none; }
  .fbar.open > .gseg { order: 1; flex: 1 1 100%; }
  .fbar.open > * { order: 2; }
  .fbar.open > .fsearch, .fbar.open > .fmore, .fbar.open > [data-act=cf-select] { order: -1; }
  .fbar.open > select, .fbar.open > .fsort { flex: 1 1 40%; min-width: 0; }
  .fbar.open > .fsort select { width: 100%; }
  /* Trait, Sort and the view switch share the last row (the Trait filter joined, 2026-11-10). */
  .fbar.open > select[data-cf=trait], .fbar.open > .fsort { flex: 1 1 34%; }
  .cgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .cgrid .card { height: auto; padding: 14px 2px 6px; }
  .cgrid .card img { width: 48px; height: 48px; }
  .cgrid .card .rpills.m { gap: 2px; margin-top: 3px; }
  .cgrid .card .rpills.m .rp { padding: 0 3px; font-size: 10px; height: 17px; line-height: 17px; }
}
@media (max-width: 760px) {
  /* List view: name, level, grade and talent; the Sort menu still sorts by the rest. */
  .ctable :is(th, td):nth-child(n+7) { display: none; }
  .ctable td { padding: 3px 5px; }
  .ctable th button { padding: 7px 5px; }
  /* Open filters: shorter controls so a row of cards still fits under them. */
  .fbar.open > :not(.fsearch, .fmore, [data-act=cf-select]), .fbar.open select { min-height: 32px; height: 32px; }
  .fbar.open .gseg button { min-height: 0; }
}
@media (max-width: 360px) {
  /* The narrowest phones: the Sort menu speaks for itself, so its label gives the Trait filter room. */
  .fbar.open > .fsort { font-size: 0; gap: 0; }
  .fbar.open > .fsort select { font-size: 13px; }
}
/* Team order: all five seats on one row from tablets up. */
@media (min-width: 761px) {
  .tcards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  /* List view on tablets: Caught drops off so the table fits across. */
  .ctable :is(th, td):nth-child(13) { display: none; }
}
@media (max-width: 760px) {
  /* Select mode: the action bar is two short rows, and the page of cards ends above it. */
  .selbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 7px; bottom: 66px; }
  .selbar > b, .selbar > span { margin: 0; align-self: center; font-size: 12px; text-align: center; }
  .selbar .btn { min-height: 34px; height: auto; padding: 2px 4px; font-size: 11.5px; line-height: 1.15; white-space: normal; justify-content: center; text-align: center; }
  .selbar [data-act=sel-clear] { order: 1; }
  .selbar [data-act=sel-list], .selbar [data-act=sel-altar], .selbar [data-act=sel-release] { order: 2; }
  .selbar [data-act=sel-release] { grid-column: span 2; }
}
/* Bestiary: one region at a time under tabs; its cards page to fit (client/ui.ts dexPane). */
.dex-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.dex-head h3 { margin: 0; }
.dex-head .dexall-seg { margin: 0 0 0 auto; }
.dex-myth { margin: 0 0 6px; font-size: 12px; }
.dex-count { font-size: 13px; color: var(--muted); }
.dex-count b { color: var(--ink); }
/* Milestones: five small steps on one row. */
.dexm { padding: 8px 10px; }
.dexm-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-top: 6px; }
.dexm-steps li { display: grid; grid-template-columns: auto auto 1fr; align-items: center; column-gap: 8px; padding: 4px 8px; }
.dexm-steps li > .dm-s { justify-self: end; }
@media (max-width: 760px) {
  .dexm-steps li { grid-template-columns: 1fr auto; column-gap: 2px; padding: 3px 5px; font-size: 11px; }
  .dexm-steps li > span:nth-of-type(1) { display: none; }
  .dexm-steps li > .dm-s { grid-column: 1 / -1; justify-self: start; font-size: 10.5px; }
  .dexm-steps li b { font-size: 12px; }
  .dexm-top { font-size: 12px; gap: 6px; }
}
@media (max-width: 760px) {
  .dex-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .dex-grid .card { height: auto; min-height: 0; padding: 6px 2px 5px; }
  .dex-grid .card img { width: 48px; height: 48px; }
  .dex-grid .card .nm { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dex-grid .card .lv { font-size: 10px; }
}
/* Ranks: the board's rows page to fit; Records show one region at a time (client/community.ts). */
.lb-name { display: none; }
.lb-menu { position: static; }
.rc-tabs { margin-bottom: 8px; }
.rc-tabs button .muted { font-size: .85em; margin-left: 3px; }
.rc-head { margin-bottom: 0; }
@media (max-width: 760px) {
  /* The eight boards as one row of icons; the open board's name heads it. */
  [data-theme="codex"] .lb-menu { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
  [data-theme="codex"] .lb-menu button { min-height: 40px; padding: 3px 0; display: grid; place-items: center; }
  [data-theme="codex"] .lb-menu button span { display: none; }
  [data-theme="codex"] .lb-menu button img { width: 26px; height: 26px; }
  .lb-name { display: block; margin: 2px 0 6px; font-size: 14px; }
  .lb-podium { gap: 5px; }
  [data-theme="codex"] .lb-pod, [data-theme="codex"] .lb-pod.r1 { padding: 4px 2px 5px; border-width: 8px; gap: 1px; }
  .lb-pod .picon-lg { transform: scale(.72); margin: -14px 0 -12px; }
  .lb-pod-name { font-size: 13px; }
  .lb-pod-name .gtag, .lb-pod .smp-tag { display: none; }
  .lb-pod-rank { font-size: 10px; }
  .lb-you { padding: 5px 8px; }
  .lb-you .lb-rank { min-width: 34px; height: 34px; font-size: 15px; }
  /* Records: search and Yours on one row, cards one column. */
  .rc-bar-f { flex-wrap: nowrap; }
  .rc-tabs button { font-size: 12px; padding-left: 2px; padding-right: 2px; }
}
/* Board rows: smaller portraits so more rows fit a page. */
.lb-table .board td { padding-top: 3px; padding-bottom: 3px; }
.lb-table .lb-who .picon-md { transform: scale(.72); transform-origin: left center; margin: -7px -16px -7px 0; }
.lb-you { padding-top: 6px; padding-bottom: 6px; }
.lb-you .lb-rank { min-width: 36px; height: 36px; }
[data-theme="codex"] .lb-you .lb-rank:is(.r1, .r2, .r3) { width: 38px; height: 38px; }
.lb-pod .picon-lg { transform: scale(.8); margin: -10px 0 -8px; }
[data-theme="codex"] .lb-pod, [data-theme="codex"] .lb-pod.r1 { padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 760px) {
  .lb-table .board { table-layout: fixed; width: 100%; }
  .lb-table .board th:last-child, .lb-table .board td:last-child { width: 92px; }
  .lb-table .board td:nth-child(2) { overflow: hidden; }
  .lb-at { display: none; }
  .lb-pod .picon-lg { transform: scale(.66); margin: -16px 0 -14px; }
}
/* The podium shows the top three, so their rows hide under it; a short phone drops the podium for more rows. */
.lb-podium ~ .lb-table tr.pod { display: none; }
@media (min-width: 761px) {
  /* Podium cards lie flat: portrait at left, name, level and value at right. */
  [data-theme="codex"] .lb-pod, [data-theme="codex"] .lb-pod.r1 { grid-template-columns: auto minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; column-gap: 6px; row-gap: 0; padding: 4px 8px; }
  .lb-pod > .picon { grid-column: 1; grid-row: 1 / span 4; }
  .lb-pod > :not(.picon) { grid-column: 2; }
  .lb-pod .picon-lg { transform: scale(.7); margin: -16px -18px -16px -14px; }
  .lb-pod-name { justify-content: flex-start; }
}
@media (max-width: 760px) and (max-height: 760px) {
  .lb-podium { display: none; }
  .lb-podium ~ .lb-table tr.pod { display: table-row; }
}
@media (max-width: 760px) {
  .wc { padding: 6px 8px; }
  .wc-h { flex-wrap: wrap; font-size: 12px; gap: 4px; }
  .wc-steps { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 3px !important; margin-top: 4px !important; }
  .wc-step { padding: 3px 2px !important; font-size: 10px; line-height: 1.15; }
  .wc-step span { font-size: 10px; }
}
@media (max-width: 1100px) and (max-height: 760px) {
  /* Weekly Catch's milestones take the podium's room on short tablets; its top three stay in the rows. */
  .lb:has(.wc) .lb-podium { display: none; }
  .lb:has(.wc) .lb-podium ~ .lb-table tr.pod { display: table-row; }
}
@media (max-width: 760px) {
  /* Top holders: both short lists fit one phone screen. */
  .rc-head { gap: 8px; }
  .rc-head > .panel { padding-top: 8px; padding-bottom: 8px; }
  .rc-head h4 { margin: 0 0 4px; font-size: 15px; }
  .rc-lead li { min-height: 22px; font-size: 13px; }
  .rc-fresh li { min-height: 24px; font-size: 12.5px; gap: 6px; }
  .rc-fresh img { width: 24px; height: 24px; }
}
/* Names come first: guild tags give way in the podium and in phone rows. */
.lb-pod-name .gtag { display: none; }
@media (max-width: 760px) { .lb-table .lb-who .gtag { display: none; } }
/* Quests: each quest in two short lines at every size; a finished set waiting to be claimed is one line. */
.q-list .q-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
.q-list .q-row > .q-main { grid-column: 1 / -1; flex-wrap: nowrap; }
.q-list .q-row > .q-main > b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.q-list .q-row > .q-main > .q-st { flex: none; margin-left: auto; margin-top: 0; }
.q-list .q-row > .q-bar { margin: 0; }
.q-list .q-row > .q-reward { margin: 0; }
.q-day .q-list { gap: 5px; }
.q-past { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 10px; padding: 7px 12px; font-size: 12.5px; border-radius: 2px; background: color-mix(in srgb, var(--gold) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent); }
.q-past img { width: 16px; height: 16px; vertical-align: -3px; }
.q-past .muted { margin-left: auto; }
@media (max-width: 560px) {
  /* Chest steps with two rewards: each reward one short line (icon then amount), so the track stays low. */
  .chest:has(.cn-rw > :nth-child(2)) .cn-rw { gap: 1px; }
  .chest:has(.cn-rw > :nth-child(2)) .cn-rw .rw { flex-direction: column; }
  .chest .cn-rw:has(> :nth-child(2)) .rw { flex-direction: row; gap: 2px; font-size: 10.5px; line-height: 1; }
  .chest .cn-rw:has(> :nth-child(2)) .rw img { width: 15px; height: 15px; }
  .chest:has(.cn-rw > :nth-child(2)) { padding-bottom: 60px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  /* Tablets show quests one block at a time under the tabs, as phones do. */
  .psec-tabs[data-key="psec-quests"] { display: grid; }
  .psec[data-key^="psec-quests-"]:not(.on) { display: none; }
  .q-cols > div:not(:has(> .psec.on)) { display: none; }
}
/* ---------- Market: the board pages to fit (client/market-view.ts marketFit); filters fold away when room is short ---------- */
.mk-pager { margin-top: 6px; }
@media (max-width: 1100px), (max-height: 900px) {
  .mk-fsum { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 12px; border: 0; border-radius: 2px; cursor: pointer;
    color: var(--cream); font: 700 14.5px var(--pixel); letter-spacing: .04em; background: rgba(244, 233, 205, .06); box-shadow: inset 0 0 0 1px var(--rule-soft); }
  .mk-fsum b { font: 600 12.5px var(--sans); color: var(--gilt-hi); margin-left: auto; }
  .mk-side:not(.fopen) .mk-filters { display: none; }
  .mk-side { gap: 8px; }
  .mk-cat { height: 32px; }
  .mk-cats { padding: 3px 0; }
}
@media (max-width: 1100px) {
  /* Phones and tablets: search; the nine categories as one row of icons; Filters, currency and sort on one row; then the board. */
  .mkt { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 6px; align-items: center; }
  .mkt > .mk-side, .mkt > .mk-main, .mk-main > .mk-bar { display: contents; }
  .mkt > .mk-side > *, .mkt > .mk-main > *, .mk-main > .mk-bar > * { grid-column: 1 / -1; order: 6; margin: 0; }
  .mk-search { order: 1 !important; height: 36px; }
  .mk-cats { order: 2 !important; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; padding: 0; }
  .mk-cat { display: grid; place-items: center; height: 36px; padding: 0; grid-template-columns: 1fr; }
  .mk-cat .mc-nm, .mk-cat .mc-n { display: none; }
  .mk-fsum { order: 3 !important; grid-column: 1 !important; height: 34px; padding: 0 10px; font-size: 13.5px; }
  .mk-bar > .mk-seg.cur { order: 3 !important; grid-column: 2 !important; flex-wrap: nowrap; }
  .mk-seg.cur button { font-size: 0; height: 34px; padding: 0 9px; }
  .mk-seg.cur button:first-child { font-size: 12.5px; }
  .mk-seg.cur img { width: 17px; height: 17px; }
  .mk-bar > .mk-sortsel { order: 3 !important; grid-column: 3 !important; width: auto; min-width: 0; }
  .mk-bar > .mk-sortsel > span { display: none; }
  .page .mk-bar > .mk-sortsel select { min-width: 0; width: 100%; height: 34px; }
  .mk-bar > .mk-title { display: none; }
  .mk-filters { order: 4 !important; }
  .mk-chips { order: 5 !important; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .mk-cat { height: 38px; }
  .mk-cat .mc-ico img { width: 24px; height: 24px; }
  .mk-bar > .mk-sortsel { justify-self: end; }
  .page .mk-bar > .mk-sortsel select { width: 220px; }
}
@media (max-width: 760px) {
  /* Board rows on a phone: name and seller beside the art, price and Buy at right; the description is on the item's page. */
  .mk-board .mk-row .mk-sub { display: none; }
  .mk-board .mk-row { padding-top: 6px; padding-bottom: 6px; min-height: 0; row-gap: 2px; }
  .mk-board .mk-row .mk-nm { font-size: 15px; }
}
@media (max-width: 1100px) {
  .mk-cat.on::before { display: none; }
  .mk-board .mk-row .mk-sub { max-height: 18px; }
  .mk-board .mk-row { min-height: 0; padding-top: 5px; padding-bottom: 5px; }
}
@media (max-width: 760px) {
  .mk-board .mk-row, .mk-board.mine .mk-row, .mk-board.hist .mk-row { grid-template-columns: 46px auto minmax(0, 1fr) auto auto; grid-template-areas: "art what what price act" "art stat by price act"; gap: 2px 8px; }
  .mk-board .mk-row .mk-art { align-self: center; }
  .mk-board .mk-row .mk-price, .mk-board .mk-row .mk-act { align-self: center; }
}
@media (max-width: 760px) {
  /* Phone: search and Filters share the top row; currency and sort fold into Filters with the rest. */
  .mkt { grid-template-columns: auto minmax(0, 1fr) auto; }
  .mk-search { grid-column: 1 / 3 !important; }
  .mk-fsum { order: 1 !important; grid-column: 3 !important; }
  .mk-cats { order: 2 !important; }
  .mkt:not(:has(.mk-side.fopen)) .mk-bar > :is(.mk-seg.cur, .mk-sortsel) { display: none; }
  .mk-bar > .mk-seg.cur { order: 3 !important; grid-column: 1 !important; }
  .mk-bar > .mk-sortsel { order: 3 !important; grid-column: 2 / -1 !important; }
  .mk-board .mk-row .mk-when { display: none; }
  .mk-board .mk-row .mk-act .btn { min-height: 34px; height: 34px; padding: 0 12px; font-size: 12.5px; }
}
@media (max-width: 760px) {
  /* Filters open on a phone: the panel takes the board's place, each filter one short row (label, then choices). */
  .mkt:has(.mk-side.fopen) :is(.mk-cats, .mk-board, .mk-pager, .mk-pin, .mk-note, .mk-empty) { display: none; }
  .mk-side.fopen .mk-filters { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 8px 10px 10px; }
  .mk-filters h5 { margin: 0 !important; font-size: 12px; line-height: 1.1; }
  .mk-filters > :not(h5) { grid-column: 2; }
  .mk-filters > .mk-check { grid-column: 1 / -1; margin: 0; font-size: 13px; }
  .mk-filters .mk-seg button, .mk-filters .mk-el { height: 28px; min-height: 0; font-size: 12px; padding: 0 4px; }
  .mk-filters .mk-el { padding-left: 13px; }
  .mk-filters .mk-el::before { left: 4px; }
  .page .mk-filters .mk-range input { height: 30px; min-height: 0; }
}
/* A market item's page: Buy at left; Sell orders and Price history take turns at right (phones: all three take turns). */
.mk-iright { min-width: 0; }
@media (min-width: 761px) {
  .psec-tabs[data-key="psec-mkr"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec-tabs[data-key="psec-mkr"] button { padding: 0 2px; font-size: 15px; }
  .psec[data-key^="psec-mkr-"]:not(.on) { display: none; }
  .mk-iright .mk-hist { margin: 0; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .mk-itemgrid { grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); gap: 12px; }
  .mk-bh, .mk-br { grid-template-columns: 100px 50px minmax(0, 1fr) 100px; gap: 0 10px; padding: 0 10px; }
}
@media (max-width: 760px) {
  .psec-tabs[data-key="psec-mkr"] { display: none; }
  .psec[data-key^="psec-mkr-"] { display: contents !important; }
  .mk-hero p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-width: 1100px), (max-height: 800px) {
  /* A lower item header: smaller plate, one line of description. */
  .mk-hero { padding: 8px 14px; gap: 12px; margin-bottom: 8px; }
  .mk-hart { width: 62px; height: 62px; }
  .mk-hart img { width: 42px; height: 42px; }
  .mk-htxt h2 { font-size: 24px; }
  .mk-htxt p { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; }
  .mk-back { display: inline-block; margin-bottom: 4px; }
  .mk-buy, .mk-hist { padding: 8px 12px 10px; }
  .mk-buy h4, .mk-hist h4 { margin-bottom: 6px; }
  .mk-sum { margin: 6px 0; padding-top: 4px; }
  .mk-sum > div { min-height: 24px; }
}
@media (max-width: 760px) {
  /* Phone: name and price beside the plate; the currency switch on its own short row; the tab names each panel. */
  .mk-hero { grid-template-columns: auto minmax(0, 1fr) auto; padding: 6px 10px; gap: 4px 10px; }
  .mk-hart { width: 46px; height: 46px; } .mk-hart img { width: 32px; height: 32px; }
  .mk-htxt h2 { font-size: 20px; margin: 0; }
  .mk-htxt p { display: none; }
  .mk-hprice { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 0; }
  .mk-hprice > i { display: none; }
  .mk-hprice .mk-icur { order: 9; margin: 4px 0 0; }
  .mk-hprice .mk-icur a { height: 24px; padding: 0 7px; font-size: 12px; }
  .psec[data-key^="psec-mki-"] .mk-buy > h4, .psec[data-key^="psec-mki-"] .mk-hist h4 { display: none; }
  .psec-tabs[data-key="psec-mki"] { margin-bottom: 6px; }
}
@media (max-width: 1100px), (max-height: 800px) { .mk-chart { height: 130px; } }
@media (max-width: 760px) {
  .mk-chart { height: 120px; }
  .mk-stats { gap: 4px; } .mk-stats > div { padding: 2px 4px; }
  .mk-buy .mk-own { margin-top: 6px; padding-top: 6px; }
  .mk-buy .mk-qty > span:first-child { display: none; }
}
@media (max-width: 760px) {
  .mk-stats { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .mk-stats i { font-size: 10px; line-height: 1.1; display: block; }
  .mk-stats b { font-size: 13px; }
  .psec[data-key^="psec-mki-"] .mk-histhead { justify-content: flex-end; margin: 0; min-height: 0; }
}
@media (max-width: 760px) and (max-height: 700px) { .mk-chart { height: 80px; } }
@media (min-width: 761px) and (max-width: 1100px) { .mk-chart { height: 118px; } }
@media (max-width: 1100px), (max-height: 800px) { .mk-chart.none { height: 80px; } }
/* Gems: a lower wallet strip; the packs in one row; Buy and Cash out side by side from tablets up. */
.mk-packs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mk-pack { padding: 10px 4px 9px; }
@media (min-width: 761px) { .mk-wgrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; } }
@media (max-width: 1100px), (max-height: 800px) {
  .mk-wallet { padding: 8px 14px; margin-bottom: 8px; gap: 16px; }
  .mk-wico { width: 46px; height: 46px; } .mk-wico img { width: 28px; height: 28px; }
  .mk-wbal b { font-size: 26px; margin: 2px 0 0; }
  .mk-wstat b { font-size: 18px; margin: 3px 0 0; }
}
@media (max-width: 760px) {
  .mk-wallet { flex-direction: row; align-items: center; gap: 10px; padding: 6px 10px; }
  .mk-wbal { gap: 8px; }
  .mk-wbal i { font-size: 11px; } .mk-wbal b { font-size: 20px; } .mk-wbal span { font-size: 12px; }
  .mk-wstats { width: auto; flex: 1; justify-content: flex-end; }
  .mk-wstat { padding: 0 6px; flex: none; }
  .mk-wstat i { font-size: 10px; } .mk-wstat b { font-size: 15px; } .mk-wstat span { display: none; }
  .mk-wico { width: 36px; height: 36px; } .mk-wico img { width: 22px; height: 22px; }
  .mk-pack b { font-size: 15px; } .mk-pack span { font-size: 12px; } .mk-pack img { width: 22px; height: 22px; }
  .mk-wpanel { padding: 8px 10px 10px; }
  .mk-wpanel h4 { margin: 0 0 6px; }
}
@media (max-width: 760px) {
  /* Your listings on a phone: name and price on top, when it ends under them, then the buttons on their own line. */
  .mk-board.mine .mk-row { grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-areas: "art what price" "art by by" "art act act"; gap: 3px 8px; }
  .mk-board.mine .mk-row .mk-act { justify-content: flex-end; }
  .mk-board.mine .mk-row .mk-when { display: inline; }
  .mk-board.mine .mk-row .mk-act { display: flex; gap: 4px; }
  .mk-board.mine .mk-row .mk-act .btn { min-height: 30px; height: 30px; padding: 0 8px; font-size: 11.5px; }
  .mk-board.mine .mk-row .mk-nm { flex-wrap: nowrap; min-width: 0; }
  .mk-board.mine .mk-row .mk-nm > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mk-board.mine .mk-row .mk-nm > .mk-ph { flex: none; }
}
@media (max-width: 1100px) {
  .mk-board .mk-row .mk-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* As one line the row loses the flex gap, so its pieces (elements, trait, stars, seller) keep a little room. */
  .mk-board .mk-row .mk-sub > * + * { margin-left: 6px; }
}
@media (max-width: 760px) {
  .mk-board .mk-row .mk-sub { display: none; }
  .mk-board.mine .mk-row .mk-by { white-space: nowrap; font-size: 12px; }
}
/* Recent sales (under the price table): one row that pages sideways instead of a block of rows. */
.mk-tape[data-fit-x] { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); overflow: hidden; }
.mk-board .fit-pager .fit-n { color: var(--ink-v); }
/* ---------- Creature page: the creature at left, its cards under tabs at right (client/creature-page.ts cpTabs) ---------- */
.cp { grid-template-columns: 340px minmax(0, 1fr) !important; }
.cp-tabs { min-width: 0; }
.cp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-items: start; }
.cp-cards > * { grid-column: auto !important; }
@media (min-width: 761px) {
  .psec-tabs[data-key="psec-cp"] { display: none !important; }
  .psec[data-key^="psec-cp-"] { display: contents !important; }
  .psec-tabs[data-key="psec-cpw"] { margin-bottom: 10px; }
}
@media (max-width: 1100px), (max-height: 800px) {
  .cp { gap: 12px; }
  .cp-pic { height: 170px; } .cp-pic img { width: 140px; height: 140px; }
  .cp-body { padding: 10px 12px 12px; }
  .cp-grade { margin-top: 8px; padding: 6px 10px; }
  .cp-acts { gap: 5px; margin-top: 8px; }
  .cp-acts .btn { height: 32px; min-height: 0; font-size: 12px; }
  .cp-facts { margin-top: 8px; gap: 4px 8px; font-size: 12.5px; }
  .cp-card { padding: 10px 12px !important; }
  .cp-h { margin-bottom: 4px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .cp { grid-template-columns: 290px minmax(0, 1fr) !important; }
}
@media (max-width: 760px) {
  .psec-tabs[data-key="psec-cpw"] { display: none !important; }
  .psec[data-key^="psec-cpw-"] { display: contents !important; }
  .cp { grid-template-columns: minmax(0, 1fr) !important; }
  .cp-cards { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .crumbs { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .crumbs > .muted:not(:first-of-type) { display: none; }
}
.cp-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px), (max-height: 800px) {
  .cp-pic { height: 150px; } .cp-pic img { width: 124px; height: 124px; }
  .cp-grade { font-size: 12px; } .cp-grade b { font-size: 14px; }
}
@media (max-width: 760px) {
  .cp-body > .cp-sub .muted { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .cp-pic { height: auto; }
  .cp-body > .cp-acts { margin-bottom: 10px; }
}
@media (max-width: 1100px) {
  .cp-body > .rpills { padding-bottom: 6px; }
  .cp-body > .cp-grade { gap: 8px; padding: 5px 8px; }
  .cp-grade .gr.lg { transform: scale(.75); margin: -6px; }
  .cp-grade > div > .muted { font-size: 11px; line-height: 1.25; }
  .cp-body > .cp-why { margin-top: 0; margin-bottom: 8px; }
  .cp-body > .cp-sub .muted { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .cp-body > .cp-acts { margin-bottom: 10px; }
  /* Info: the picture beside the name; three short buttons a row. */
  .cp-id { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
  .cp-pic { height: auto; min-height: 96px; border-radius: 2px 0 0 0; border-bottom: 0; }
  .cp-pic img { width: 80px; height: 80px; }
  .cp-state { top: 4px; left: 4px; } .cp-state .pill { font-size: 9.5px; padding: 0 4px; }
  .cp-body { display: contents; }
  .cp-body > .cp-name, .cp-body > .cp-sub, .cp-body > .rpills { grid-column: 2; padding: 0 10px; }
  .cp-body > .cp-name { padding-top: 8px; font-size: 18px; }
  .cp-body > :not(.cp-name, .cp-sub, .rpills) { grid-column: 1 / -1; margin-left: 10px; margin-right: 10px; }
  .cp-body > .cp-facts { margin-bottom: 10px; }
  .cp-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp-acts .btn { font-size: 11.5px; padding: 0 4px; }
  .cp-id > .cp-pic { grid-row: 1 / span 3; align-self: stretch; }
}
/* ---------- Tablets (761-1200 px): one window-tall box like a phone; the hunt is the field with one tabbed side panel ---------- */
@media (min-width: 761px) and (max-width: 1200px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .app > #page { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; }
  .app > #kinhall { flex: 1 1 auto; min-height: 0; }
  #huntview.game { flex: 1 1 auto; height: auto; min-height: 0; overflow: hidden; grid-template-columns: 272px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px; padding: 8px; }
  #huntview .stage { grid-column: 2; grid-row: 1 / -1; min-height: 0; }
  #huntview .ptabs { display: grid; grid-column: 1; grid-row: 1; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--rule-soft, var(--line)); }
  #huntview .ptabs button { min-height: 34px; padding: 0 2px; background: none; border: 0; color: var(--cream-2, var(--muted)); font: 700 13.5px var(--pixel, var(--sans)); cursor: pointer; }
  #huntview .ptabs button.on { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  #huntview .ptabs button[data-id="log"] { display: none; }
  #huntview > .lcol, #huntview > .rcol { grid-column: 1; grid-row: 2; min-height: 0; overflow: hidden; max-height: none; flex-direction: column; }
  /* Team (and Log, which the field shows on a tablet): the team. Trainer: card, pass, boosts, quests. Auto, Chat: the right panel. */
  #huntview:is([data-ptab="auto"], [data-ptab="chat"]) > .lcol { display: none; }
  #huntview:not([data-ptab="auto"], [data-ptab="chat"]) > .rcol { display: none; }
  #huntview:not([data-ptab="trainer"]) .lcol > :not(#teamlist) { display: none !important; }
  #huntview[data-ptab="trainer"] .lcol > #teamlist { display: none; }
  #huntview #teamlist { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  #huntview > .rcol > .rtabs { display: none; }
  #huntview[data-ptab="auto"] > .rcol > .feed { display: none; }
  #huntview[data-ptab="chat"] > .rcol > .auto { display: none; }
  #huntview > .rcol > .panel { flex: 1 1 0; min-height: 0; max-height: none; height: auto; overflow: hidden; }
}
/* ---------- Desktop (wider than 1200): the left column takes Team / Trainer tabs instead of scrolling ---------- */
@media (min-width: 1201px) {
  #huntview.game { grid-template-rows: auto minmax(0, 1fr); }
  #huntview .stage { grid-column: 2; grid-row: 1 / -1; min-height: 0; }
  #huntview > .rcol { grid-column: 3; grid-row: 1 / -1; min-height: 0; }
  #huntview .ptabs { display: grid; grid-column: 1; grid-row: 1; grid-template-columns: repeat(2, 1fr); border-bottom: 1px solid var(--rule-soft, var(--line)); }
  #huntview .ptabs button { min-height: 32px; padding: 0 2px; background: none; border: 0; color: var(--cream-2, var(--muted)); font: 700 14px var(--pixel, var(--sans)); cursor: pointer; }
  #huntview .ptabs button.on { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  #huntview .ptabs button:is([data-id="log"], [data-id="auto"], [data-id="chat"]) { display: none; }
  #huntview > .lcol { grid-column: 1; grid-row: 2; min-height: 0; overflow: hidden; max-height: none; }
  #huntview:not([data-ptab="trainer"]) .lcol > :not(#teamlist) { display: none !important; }
  #huntview[data-ptab="trainer"] .lcol > #teamlist { display: none; }
  #huntview #teamlist { flex: 1 1 auto; min-height: 0; overflow: hidden; }
}
/* ---------- Tablet pages (761-1200 px) ---------- */
@media (min-width: 761px) and (max-width: 1200px) {
  /* Map: the map and the area panel side by side, both as tall as the window allows. */
  .mapwrap { grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; align-items: stretch; }
  .mapart { height: calc(100dvh - var(--map-room, 250px)); min-height: 300px; max-height: none; }
  .ap-head { padding: 10px 12px 6px; }
  .ap-cards { gap: 6px; padding: 2px 8px 8px; }
  .hcard { padding: 8px; }
  /* The rate tiles share the card's width with the risk pill: "~348.2 s" broke over two lines at 14.5 px. */
  .hcard .tiles b { font-size: 14px; white-space: nowrap; }
  .ap-foot { padding: 6px 12px 8px; }
  .mhead label { gap: 4px; font-size: 0; }
  .mhead label select { font-size: 13px; }
}
@media (min-width: 761px) and (max-width: 940px) { .mhead .legend { display: none; } }
/* Short tablets and small windows (800x600, 860x585): the Drops row takes the region line's place, as on phones, and the
   area panel's rows keep to one line each, so one hunt card and the way on to the next area fit without the page
   scrolling. The card's "first form" note steps aside, as on short phones (the Bestiary has it), and its button
   takes a smaller label so the creature's name and level stay on one line. */
@media (min-width: 761px) and (max-width: 1200px) and (max-height: 700px) {
  .ap-head .ap-where:has(+ .ap-drops) { display: none; }
  .ap-drops { margin-top: 5px; }
  .hcard .hc-note { display: none; }
  .hcard .hc-top .grow { min-width: 0; }
  .hcard .hc-top .grow > div:first-child > .muted { white-space: nowrap; }
  [data-theme] .hcard .hc-top .btn { flex: none; padding-inline: 8px; font-size: 11px; letter-spacing: .03em; }
  /* The way on: both neighbours' names on one line each, so the visitors line gives way here. */
  .ap-foot p { display: none; }
  .ap-foot .row { flex: 1; flex-wrap: nowrap; justify-content: space-between; min-width: 0; }
  .ap-foot .row .btn { white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .ap-foot .row .ap-next { margin-left: auto; }
}
/* Bag pockets on tablets and short laptops: three across, shorter tiles. */
@media (min-width: 761px) and (max-height: 860px) {
  [data-theme="codex"] .bp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  [data-theme="codex"] .bp-head { margin-bottom: 8px; padding-top: 4px; padding-bottom: 4px; }
  [data-theme="codex"] .bp-head .bp-art { width: 52px; height: 52px; }
  [data-theme="codex"] .bp-head .bp-art :is(img, .bp-ui) { width: 40px; height: 40px; }
  [data-theme="codex"] .bp-head h1 { font-size: 28px; }
  [data-theme="codex"] .bp-card { min-height: 84px; gap: 12px; padding: 8px 12px 8px 14px; }
  [data-theme="codex"] .bp-card .bp-art { width: 64px; height: 64px; overflow: visible; }
  [data-theme="codex"] .bp-card .bp-art :is(img, .bp-ui) { width: 48px; height: 48px; }
  [data-theme="codex"] .bp-card .bp-prop { transform: scale(.72); max-width: none; margin: -100px; }
  [data-theme="codex"] .bp-card .bp-txt { gap: 5px; }
  [data-theme="codex"] .bp-card .bp-nm { font-size: 20px; }
}
@media (min-width: 761px) and (max-width: 900px) and (max-height: 860px) {
  [data-theme="codex"] .bp-card { gap: 8px; padding: 6px 8px 6px 10px; }
  [data-theme="codex"] .bp-card .bp-art { width: 48px; height: 48px; }
  [data-theme="codex"] .bp-card .bp-art :is(img, .bp-ui) { width: 40px; height: 40px; }
  [data-theme="codex"] .bp-card .bp-prop { transform: scale(.55); }
  [data-theme="codex"] .bp-card .bp-nm { font-size: 17px; }
}
@media (min-width: 761px) { [data-theme="codex"] .bs-shop > .fit-pager { grid-column: -2; } }
/* Season pass on a short tablet: the art stays beside the season (narrower), the tier track shorter. */
@media (min-width: 761px) and (max-width: 1200px) and (max-height: 860px) {
  [data-theme="codex"] .pz-hero { grid-template-columns: minmax(0, 1fr) minmax(200px, 34%); }
  [data-theme="codex"] .pz-show { order: 0; min-height: 0; padding-bottom: 46px; }
  [data-theme="codex"] .pz-show-pic { width: 130px; height: 130px; }
  [data-theme="codex"] .pz-main { column-gap: 18px; row-gap: 8px; padding: 10px 14px 12px; }
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 54px 20px 54px; }
  [data-theme="codex"] .pz-track { padding: 6px 12px 8px; }
}
@media (min-width: 761px) and (max-width: 900px) and (max-height: 860px) {
  [data-theme="codex"] .pz-offers { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  [data-theme="codex"] .pz-offer ul { display: none; }
  [data-theme="codex"] .pz-offer { padding: 6px 10px; }
}
/* Trail on a tablet: the path is a column of faces, so the board and its side panel get the width. */
@media (min-width: 761px) and (max-width: 1279px) {
  .tl-wrap { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  .tl-path { padding: 6px 4px; }
  .tl-stop:not(:last-child)::after { display: none; }
  .tl-stop > button { display: grid; grid-template-columns: 1fr; justify-items: center; padding: 4px 0; position: relative; }
  .tl-stop .tl-txt { display: none; }
  .tl-stop .tl-dot { position: absolute; top: 0; left: 0; transform: scale(.8); transform-origin: top left; }
  .tl-card { grid-template-columns: minmax(0, 1fr) 270px; column-gap: 12px; padding: 10px 12px; }
  .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 330px) * 16 / 9 + 10px)); }
  .tl-card .tn-strip .tn-cd b { display: none; }
  .tl-card .tl-syn { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  /* A long chip in a half-width column wraps its words instead of running over the next column. */
  .tl-card .tl-syn .syn-chip { max-width: 100%; height: auto; min-height: 20px; white-space: normal; line-height: 1.15; }
  .tl-card h4.sec { margin: 6px 0 4px; }
  .tl-card.tl-fight { grid-template-columns: minmax(0, 1fr) 190px; }
}
/* Narrow tablets: a landscape board would crowd the side panel, so the board stands tall, sized from the height. */
@media (min-width: 761px) and (max-width: 940px) {
  .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 400px) * 5 / 6)); }
}
/* A Trail boss stop on a tablet: the ladder's steps in one row, its help link up in the tab row, the matchup in two columns. */
@media (min-width: 761px) and (max-width: 1100px) {
  .tl-boss { position: relative; }
  .tl-boss .ladder-h { position: absolute; top: 10px; right: 12px; margin: 0; }
  .tl-boss .lsteps { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .tl-boss .lstep { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 4px 2px; }
  .tl-boss .lstep .lv { font-size: 12px; white-space: nowrap; }
}
/* The same help link, head and matchup on a short laptop (1366x768 with browser bars). */
@media (min-width: 761px) and (max-width: 1100px), (min-width: 1101px) and (max-height: 760px) {
  .tl-boss { position: relative; }
  .tl-boss .ladder-h { position: absolute; top: 10px; right: 12px; margin: 0; }
  .tl-boss .lhead .grow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .tl-boss .lhead h3 { margin: 0; }
  .tl-boss .est { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
  .tl-boss .est > * { grid-column: 1; }
  .tl-boss .est > .est-team { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
}
@media (min-width: 761px) and (max-width: 940px) {
  .tl-boss .drops { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Trainer overview on a tablet (one column): You, Lifetime, Records and Social take turns, as on a phone. */
@media (min-width: 761px) and (max-width: 1100px) {
  .psec-tabs[data-key="psec-hub"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec[data-key^="psec-hub-"]:not(.on) { display: none; }
}
/* Trainer Friends and Settings on a tablet: their sections take turns too. */
@media (min-width: 761px) and (max-width: 1200px) {
  .psec-tabs:is([data-key="psec-fr"], [data-key="psec-set"]) { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec:is([data-key^="psec-fr-"], [data-key^="psec-set-"]):not(.on) { display: none; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .ph-settings { grid-template-columns: minmax(0, 1fr); }
  .ph-settings .ph-col:not(:has(> .psec.on)) { display: none; }
}
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 720px) { .player-hub .ph-set { padding: 3px 0; } }
/* Chat page on a tablet: as tall as the room under the two-row app bar. */
@media (min-width: 761px) and (max-width: 1200px) { .chatpage { height: calc(100dvh - 250px); min-height: 360px; } }
@media (min-width: 1201px) {
  /* Automation keeps its full height; chat takes what is left under it. */
  #huntview > .rcol > .panel.auto { flex: none; max-height: none; overflow: hidden; }
  #huntview > .rcol > .panel.feed { flex: 1 1 0; min-height: 120px; }
}
/* Tall desktops: the trainer card sits over the team as well. */
@media (min-width: 1201px) and (min-height: 900px) {
  #huntview:not([data-ptab="trainer"]) .lcol > .panel.playercard:not(#teamlist) { display: block !important; }
}
/* Market > Sell: an item's Prices and List sit beside its name on one row. */
@media (max-width: 760px) {
  .mk-sc.two { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .mk-sc.two .mk-art { grid-row: auto; }
  .mk-sc.two .mk-scact { grid-column: 3; flex-wrap: nowrap; }
  .mk-sc .mk-art img { width: 40px; height: 40px; }
  .mk-sells { gap: 6px; }
}
/* Trainer on a short laptop: a smaller portrait, the lifetime tiles four across. */
@media (min-width: 1101px) and (max-height: 760px) {
  .ph-portrait { height: 128px; }
  .ph-portrait img { width: 100px; height: 100px; }
  .ph-id { gap: 4px; padding: 10px 14px; }
  .ph-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ph-tile { padding: 5px 8px; }
  [data-theme="codex"] .ph-tile b { font-size: 17px; }
  .ph-records .ph-rec { padding-top: 4px; padding-bottom: 4px; }
}
@media (min-width: 1101px) and (max-height: 760px) {
  /* Lifetime over Guild and Friends on the left; Records runs down the right. */
  .ph-over { grid-template-columns: minmax(0, .575fr) minmax(0, .575fr) minmax(0, 1fr); align-items: start; }
  .ph-over .ph-life { grid-column: 1 / span 2; grid-row: 1; }
  .ph-over .ph-records { grid-column: 3; grid-row: 1 / span 2; }
  .ph-over .ph-guild { grid-column: 1; grid-row: 2; align-self: stretch; }
  .ph-over .ph-friends { grid-column: 2; grid-row: 2; align-self: stretch; }
}
/* Settings on a short desktop: its sections take turns, as on a tablet. */
@media (min-width: 1201px) and (max-height: 860px) {
  .psec-tabs[data-key="psec-set"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec[data-key^="psec-set-"]:not(.on) { display: none; }
  .ph-settings .ph-col:not(:has(> .psec.on)) { display: none; }
  .ph-settings { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
}
/* Eggs on a short laptop: a smaller egg, tighter odds, and an incubator without its may-hatch faces. */
@media (min-width: 761px) and (max-height: 760px) {
  [data-theme="codex"] .egg-peek { grid-template-columns: 100px minmax(0, 1fr); padding: 10px 14px; row-gap: 6px; }
  [data-theme="codex"] .egg-stage { min-height: 100px; }
  [data-theme="codex"] .egg-odds { gap: 2px; }
  [data-theme="codex"] .egg-odds li { font-size: 13px; line-height: 1.2; }
  [data-theme="codex"] .inc-may { display: none; }
  [data-theme="codex"] .inc-ch { min-height: 0; }
  [data-theme="codex"] .egg-tile { padding-top: 6px; padding-bottom: 6px; }
  [data-theme="codex"] .egg-stage { min-height: 88px; }
  [data-theme="codex"] .egg-hatch { padding-top: 6px; }
  [data-theme="codex"] .eh-grid { margin-top: 4px; }
  [data-theme="codex"] .eh-grid .eh { padding: 3px 2px 4px; gap: 0; }
  [data-theme="codex"] .eh-grid .eh :is(img, .walker) { width: 40px; height: 40px; }
  [data-theme="codex"] .egg-peek .fit-pager { margin-top: 4px; }
}
/* Season pass on a short laptop: the tier track a little shorter. */
@media (min-width: 1201px) and (max-height: 700px) {
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 54px 20px 54px; }
  [data-theme="codex"] .pz-track { padding: 6px 12px 8px; }
  [data-theme="codex"] .pz-track .cp-h { min-height: 22px; }
  [data-theme="codex"] .pz-show { padding-bottom: 44px; }
  [data-theme="codex"] .pz-show-pic { width: 128px; height: 128px; }
  [data-theme="codex"] .pz-main { row-gap: 6px; padding: 8px 16px 10px; }
}
/* Short screens wider than a phone: a slimmer page title and edges, so every page gets about 26 px more room. */
@media (min-width: 761px) and (max-height: 760px) {
  .page-inner { padding-top: 8px; padding-bottom: 8px; }
  [data-theme="codex"] .pagetitle { padding-bottom: 8px; margin-bottom: 6px; }
  [data-theme="codex"] .pagetitle h1 { font-size: 29px; }
}
/* Arena and Trail on a short laptop: the cards' rows a little tighter, the Trail board a little smaller. */
@media (min-width: 761px) and (max-height: 700px) {
  [data-theme="codex"] .ar-ranked .rk-card { gap: 4px; padding-top: 8px; padding-bottom: 8px; }
  .ar-ranked .rk-kv { padding-top: 1px; padding-bottom: 1px; }
}
@media (min-width: 1101px) and (max-height: 700px) {
  .tl-card .tl-board .bv-frame { width: min(100%, max(530px, calc((100vh - 310px) * 16 / 9 + 10px))); }
}
/* Trainer profile on a phone: the trainer beside their name, not above it; tighter panels. */
@media (max-width: 760px) {
  .pf { display: grid; gap: 8px; }
  .pf > .panel { margin: 0; padding: 10px 12px; }
  .pf-hero { flex-direction: row; align-items: center; gap: 12px; }
  .pf-hero .tp-sprite { width: 88px; height: 104px; overflow: hidden; }
  .pf-hero .picon-xl { transform: scale(.62); }
  #page:has(.pf) .pagetitle .meta { display: none; }
  .pf-hero h2 { font-size: 20px; margin-bottom: 2px; }
  .pf-line { margin: 2px 0; font-size: 12.5px; }
  .pf-acts { margin-top: 6px; gap: 6px; }
  .pf .ar-team { gap: 4px; }
  .pf h4 { margin: 0 0 6px; }
  .pf .fr-show { gap: 6px; }
}
/* Profile showcase: vellum tiles (the dark pills hid the names), name over grade and level; two across on a phone. */
.pf .fr-show { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 761px) and (max-width: 1100px) { .pf .fr-show { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Tablets and short laptops: a smaller trainer in the profile head. */
@media (min-width: 761px) and (max-width: 1200px), (min-width: 761px) and (max-height: 760px) {
  .pf-hero .tp-sprite { width: 120px; height: 128px; overflow: hidden; }
  .pf-hero .picon-xl { transform: scale(.75); }
  .pf { gap: 8px; }
  .pf > .panel, .pf .psec > .panel { padding: 10px 14px; }
}
[data-theme="codex"] .pf .show-chip { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px 4px 4px; border: 1px solid var(--rule-soft); border-radius: 6px; background: var(--inlay); color: var(--ink); }
[data-theme="codex"] .pf .show-chip:hover, [data-theme="codex"] .pf .show-chip:focus-visible { border-color: var(--accent); background: var(--inlay-hi); }
.pf .show-chip img { width: 36px; height: 36px; flex: none; }
.pf .sc-t { display: grid; min-width: 0; line-height: 1.2; }
.pf .sc-t b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf .sc-l { display: flex; align-items: center; gap: 4px; font-size: 12px; }
@media (max-width: 760px) {
  .pf .fr-show { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .pf .show-chip { padding: 3px 6px 3px 3px; }
  .pf .sc-t b { font-size: 13px; }
  .pf .psec > .panel { margin: 0; padding: 10px 12px; }
  .pf .psec h4 { display: none; }
  .pf .psec .row.between { justify-content: flex-end; margin-bottom: 6px; }
  .pf .psec-tabs { margin: 0; }
}
/* Trainer > Card: creature names whole in the pick list (one column until there is room for two). */
@media (min-width: 761px) { .ph-picklist { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
/* A phone row has no room for "For sale" beside the name: the dimmed Show says it when tapped. */
@media (max-width: 600px) { .ph-pick-sale { display: none; } }
@media (min-width: 1101px) and (max-width: 1599px) {
  .ph-pick-nm { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 5px; line-height: 1.15; }
  .ph-pick-nm b { grid-column: 1 / -1; }
}
/* Six showcase slots across a laptop: the showcase gets more width. */
@media (min-width: 1101px) and (max-width: 1599px) {
  .ph-show { grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); }
}
/* A filled showcase slot narrower than "‹ Remove ›" (every desktop width, and the window over the yard): Remove becomes
   a cross so the move arrows stay inside the slot instead of spilling over the next one. */
.ph-slot.on { container-type: inline-size; }
.ph-slot-acts { max-width: 100%; justify-content: center; }
/* Each mark centred by the button's own grid, not by a font's baseline; the arrows are fixed squares. */
[data-theme] .ph-slot-acts .btn.tiny { display: inline-grid; place-items: center; box-sizing: border-box; height: 22px; padding-block: 0; }
[data-theme] .ph-slot-acts .btn.tiny[data-act="ph-move"] { width: 20px; padding-inline: 0; }
.ph-slot-acts .ph-si { display: block; }
.ph-slot-acts .ph-x-i { display: none; }
@container (max-width: 132px) {
  [data-theme] .ph-slot-acts .btn.tiny[data-act="ph-show"] { width: 22px; padding-inline: 0; }
  .ph-slot-acts .ph-x-t { display: none; }
  .ph-slot-acts { gap: 2px; }
  .ph-slot-acts .ph-x-i { display: block; }
}
/* The Card tab in the window over the yard (the yard's Showcase) is narrower than the page: below 1680px the identity
   column steps aside (it leads the Overview), so the Companion and Card panels are not covered by the Showcase. */
@media (min-width: 1101px) and (max-width: 1679px) {
  #page.over .player-hub.ph-tab-showcase { grid-template-columns: minmax(0, 1fr); }
  #page.over .player-hub.ph-tab-showcase > .ph-who { display: none; }
}
/* Trainer > Showcase on a tablet: Card, Showcase and Creatures take turns, as on a phone. */
@media (min-width: 761px) and (max-width: 1100px) {
  .psec-tabs[data-key="psec-sc"] { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; }
  .psec[data-key^="psec-sc-"]:not(.on) { display: none; }
  .ph-show { grid-template-columns: minmax(0, 1fr); }
  .ph-show .ph-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: start; }
  .ph-show .ph-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Creature peek on a short phone: tighter rows so the whole card shows without scrolling inside it. */
@media (max-width: 760px) and (max-height: 760px) {
  .peek { padding: 12px 14px 10px; max-height: calc(100vh - 20px); }
  .peek-scrim { padding: 10px; }
  .peek .rpills { margin-top: 8px; }
  .peek .pk-cols { margin-top: 8px; gap: 8px; }
  .peek .pk-st { height: 18px; }
  .peek .movebar { margin-bottom: 4px; }
  .peek .pk-acts { margin-top: 8px; padding-top: 6px; }
}
/* Team builder: its creatures page to fit the dialog (client/teambuilder.ts) instead of scrolling inside it. */
.tb-grid { flex: 0 1 auto; overflow: visible; min-height: 0; }
.tb-grid > .fit-pager { margin-top: 6px; }
/* Trainer popup (client/profilecard.ts): its tabs name each part, so the part's own heading goes; on a phone the
   trainer sits beside their name and showcase cards keep picture, name and level (the rolls show on tap). */
.ppop .psec .ppx-h h4 { display: none; }
.ppop .ppx-h { justify-content: flex-end; }
.ppop .psec-tabs { margin: 0; }
@media (max-width: 760px) {
  .ppop-layer { place-items: center; }
  .ppop .ppop-body { gap: 10px; padding: 10px 12px 12px; }
  .ppop .ppx-head { grid-template-columns: auto minmax(0, 1fr); justify-items: stretch; text-align: left; gap: 10px; padding: 8px 10px; }
  .ppop :is(.ppx-name, .ppx-lv, .ppx-acts) { justify-content: flex-start; }
  .ppop .ppx-title { justify-self: start; }
  .ppop .ppx-mons { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ppop .ppx-mon { padding: 6px 4px; gap: 3px; }
  .ppop .ppx-mon .rpills { display: none; }
  .ppop .ppx-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ppop .ppx-tile { padding: 6px 4px; }
  .ppop .ppx-tile b { font-size: 17px; }
  .ppop .ppx-tile span { font-size: 10.5px; }
  .ppop .ppx-mon-pic { width: 60px; height: 56px; }
  .ppop .ppx-mon-pic :is(.walker, img) { width: 52px; height: 52px; }
  .ppop .ppx-mon-name b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ppop .ppx-mon-name { max-width: 100%; display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; }
  /* Bonuses: the pills keep icon and total on one line, faded sources keep icon and total, the stat's gloss goes. */
  .ppop .hb-pill .hb-pn, .ppop .hb-src.off .hb-sl { display: none; }
  .ppop .ppx-head > .picon { grid-row: auto; }
  .ppop .ppx-head > .hb-pills { grid-column: 1 / -1; margin-top: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ppop .hb-pill { justify-content: center; padding: 2px 3px; }
  .ppop .hb-row { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "ic nm tot" "src src src"; padding: 5px 10px 6px 8px; row-gap: 3px; column-gap: 8px; }
  .ppop .hb-ic { width: 26px; height: 26px; }
  .ppop .hb-ri { width: 20px; height: 20px; }
  .ppop .hb-tot { font-size: 19px; }
  .ppop .hb-src { font-size: 12px; line-height: 17px; }
  .ppop .hb-worn { gap: 6px; }
  .ppop .hb-gear { gap: 2px; }
  .ppop .hb-slot { gap: 1px; padding: 3px 1px; }
  .ppop .hb-sock { width: 32px; height: 32px; }
  .ppop .hb-sock .hb-gi { width: 28px; height: 28px; }
  .ppop .hb-gt b { font-size: 11px; }
  .ppop .hb-src { padding: 1px 4px 1px 2px; gap: 3px; }
  .ppop .hb-srcs { gap: 3px; }
  .ppop .hb-nm b { font-size: 14px; }
}
/* A short phone: a trainer with a title and companion still fits the popup's Stats tab. */
@media (max-width: 760px) and (max-height: 760px) {
  .ppop .ppop-body { gap: 8px; }
  .ppop .ppx-sec { gap: 6px; }
  .ppop .ppx-tile { padding: 4px; gap: 1px; }
  .ppop .ppx-prog > div { padding: 3px 10px; }
  .ppop .hb { gap: 6px; }
  .ppop .hb-row { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "nm src tot"; padding: 4px 8px; column-gap: 6px; }
  .ppop .hb-ic { display: none; }
  .ppop .hb-nm b { font-size: 13px; letter-spacing: .02em; }
  .ppop .hb-tot { font-size: 17px; }
  .ppop .hb-src .hb-sl { display: none; }
  .ppop .hb-note { display: none; }
}
/* Market > Prices on a phone: Price table and Recent sales are tabs (client/market-view.ts), so their headings go. */
@media (max-width: 760px) {
  .psec[data-key^="psec-mkpx-"] > h4.sec { display: none; }
  .psec[data-key^="psec-mkpx-"] .pt-stats { row-gap: 4px; }
}
@media (max-width: 760px) {
  .psec[data-key="psec-mkpx-recent"] .mk-tape[data-fit-x] { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
}
/* Trail on a phone: each side's synergy chips wrap in one line after its name, so a full team's four chips don't
   stack four rows deep (a Lv 820 trainer's Team tab ran 70 px over). */
@media (max-width: 760px) {
  .tl-card .tl-syn { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .tl-card .tl-syn > div { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 4px; text-align: left; }
  .tl-card .tl-syn > div > b { flex: none; margin-right: 2px; font-size: 13px; }
  .tl-card .tl-syn .syn-chips { display: contents; }
  .tl-card .tl-syn .syn-chips > * { font-size: 11px; padding-block: 1px; }
}
/* A short phone's Trail team: level only on each card (power shows in the team builder and on the board). */
@media (max-width: 760px) and (max-height: 700px) {
  .tl-card .tn-strip .tn-pw { display: none; }
  .tl-card .tn-strip .tn-cd { padding: 3px 2px; }
  .tl-card .tn-strip .tn-cd img { width: 32px; height: 32px; }
  .tl-card .tn-strip .tn-slot.empty .tn-cd { min-height: 56px; }
  .tl-card .tl-syn, .tl-card .tl-syn > div { gap: 2px 4px; }
}
/* Dialogs (client/dialog.ts) never run past the screen: the body takes the room left and its lists page to fit. */
.dialog { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); overflow: hidden; }
.dialog > .body { flex: 0 1 auto; min-height: 0; overflow: hidden; }
.dialog .picker, .dialog .picker.alp { max-height: none; overflow: visible; }
.dialog .body .fit-pager { margin-top: 6px; }
/* Trail on a short laptop (1366x657, 1280x720): the side column's synergy chips wrap after each side's name, the
   headings and the locked line tighten, so a Lv 820 trainer's full team, chips, reward and buttons fit beside the
   board (they ran 50-75 px over). */
/* (Up to 860 tall: a desktop window just over 800 still keeps the full page title, so the side column stays compact too.) */
@media (min-width: 761px) and (max-height: 860px) {
  .tl-card .tl-syn { grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 4px; }
  .tl-card .tl-syn > div { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 4px; text-align: left; }
  .tl-card .tl-syn > div > b { flex: none; margin-right: 2px; font-size: 13px; }
  .tl-card .tl-syn .syn-chips { display: contents; }
  .tl-card .tl-syn .syn-chips > * { font-size: 11.5px; padding-block: 1px; }
  .tl-card .tl-who .picon-lg { display: none; }
  .tl-card .tl-who h3 { margin-bottom: 2px; font-size: 20px; }
  .tl-card .tn-strip .tn-pw { display: none; }
  .tl-card h4.sec { margin: 6px 0 2px; }
  .tl-card .rewards { row-gap: 2px; }
  .tl-card .lentry { margin-top: 6px; padding-top: 6px; }
  .tl-card .lentry { flex-wrap: nowrap; align-items: center; }
  .tl-card .lentry > .muted { flex: 1 1 auto; min-width: 0; font-size: 12.5px; line-height: 1.3; }
  .tl-card .lentry > .muted:empty { display: none; }
  .tl-card .lentry > .btn { flex: none; }
}
@media (min-width: 1280px) and (max-height: 860px) {
  .tl-card:not(.tl-fight) { grid-template-columns: minmax(0, 1fr) 360px; }
}
/* A Trail trainer's Team row with all three buttons (Use hunt team, Load team, Change team): the title takes its own
   line and the buttons share the next one at one size, so none runs past the card. */
@media (min-width: 761px) {
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) { flex-wrap: wrap; row-gap: 6px; }
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > h4 { flex-basis: 100%; }
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > .spacer { display: none; }
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > .btn { flex: 1 1 0; min-width: 0; justify-content: center; }
}
/* A Trail boss stop (client/trail.ts bossDetail): the boss and its team are one card like a trainer's. Wider than a
   phone the Team tab hides and its board sits beside the boss; the Boss Ladder tab hides the card. */
.tl-bcard:not(:has(> .psec.on)) { display: none; }
@media (min-width: 761px) {
  .psec-tabs[data-key="psec-tlboss"] button[data-id="tlboss:team"] { display: none; }
  .tl-boss:has([data-key="psec-tlboss-team"].on) .psec-tabs button[data-id="tlboss:boss"] { color: var(--cream, var(--ink)); box-shadow: inset 0 -2px 0 var(--gilt, var(--accent)); }
  .tl-bcard > .psec.all { display: contents; }
}
/* Just over 800 tall the page title is full size, so the board gives up a few pixels of height to it. */
@media (min-width: 1280px) and (min-height: 801px) and (max-height: 860px) {
  .tl-card .tl-board .bv-frame { width: min(100%, max(530px, calc((100vh - 330px) * 16 / 9 + 10px))); }
}
/* Tablets and small laptops: the Team buttons stay on the title's row, a size smaller. */
@media (min-width: 761px) and (max-width: 1279px) {
  .tl-card .tn-sec { gap: 4px; }
  .tl-card .tn-sec .btn.small { font-size: 12px; padding: 0 7px; min-height: 26px; height: 26px; }
}
@media (min-width: 761px) and (max-width: 1279px) and (max-height: 800px) {
  .tl-card:not(.tl-fight) { grid-template-columns: minmax(0, 1fr) 290px; }
  .tl-card .lentry { flex-wrap: wrap; row-gap: 4px; }
  .tl-card .lentry > .muted { flex-basis: 100%; }
  .tl-card h4.sec { margin: 4px 0 2px; }
  .tl-card .tl-syn { margin-top: 2px; }
  .tl-card .lentry { margin-top: 4px; padding-top: 4px; }
}
@media (min-width: 941px) and (max-width: 1279px) and (max-height: 800px) {
  .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 345px) * 16 / 9 + 10px)); }
}
/* 941-989 wide the board's column is under 520 px, so it draws tall (client/boardview.ts): size it like a narrow tablet's. */
@media (min-width: 941px) and (max-width: 989px) {
  .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 400px) * 5 / 6)); }
}
/* A Trail fight on a tablet: a slimmer HP meter leaves the board 520+ px, so it draws wide and fits the height. */
@media (min-width: 761px) and (max-width: 1279px) {
  .tl-fight .bv-wrap.with-meter { grid-template-columns: minmax(0, 1fr) 112px; }
}
/* Under ~1010 wide the meter waits (as on short phones), so the board keeps its full column and draws wide. */
@media (min-width: 761px) and (max-width: 1009px) {
  .tl-fight .bv-meter { display: none; }
  .tl-fight .bv-wrap.with-meter { grid-template-columns: minmax(0, 1fr); }
  .tl-fight .tl-board .bv-frame { width: min(100%, calc((100vh - 400px) * 16 / 9 + 10px)); }
}
/* Short tablets and laptops: the fight's synergy lines wait (as on phones), so the board and its meter fit. */
@media (min-width: 761px) and (max-width: 1279px) and (max-height: 800px), (min-width: 761px) and (max-height: 700px) {
  .tl-fight .bv-chips { display: none; }
}
@media (min-width: 1280px) and (max-height: 700px) {
  .tl-fight .tl-board .bv-frame { width: min(100%, max(530px, calc((100vh - 325px) * 16 / 9 + 10px))); }
}
/* Under ~890 wide the column is under 520 px, so the board draws tall: size it from the height. */
@media (min-width: 761px) and (max-width: 889px) {
  .tl-fight .tl-board .bv-frame { width: min(100%, calc((100vh - 400px) * 5 / 6)); }
}
@media (min-width: 761px) and (max-width: 889px) and (min-height: 801px) {
  .tl-fight .tl-board .bv-frame { width: min(100%, calc((100vh - 475px) * 5 / 6)); }
}
/* Halls ranking: a small trainer face per row, so a page holds more of the 50. */
.hl-rank .hl-who .picon-md { transform: scale(.6); margin: -12px -2px -12px -10px; vertical-align: middle; }
.hl-rank td { padding-top: 3px; padding-bottom: 3px; }
/* A locked Trail trainer on a phone: the "takes challengers from Lv …" line sits beside the button, not above it. */
@media (max-width: 760px) {
  .tl-card .lentry { flex-wrap: nowrap; align-items: center; gap: 8px; }
  .tl-card .lentry > .muted { flex: 1 1 auto; min-width: 0; font-size: 12px; line-height: 1.25; }
  .tl-card .lentry > .muted:empty { display: none; }
  .tl-card .lentry > .btn { flex: none; }
}
/* A short phone's Trail team with five members: faces and levels only (names show in the team builder and on the board). */
@media (max-width: 760px) and (max-height: 700px) {
  .tl-card .tn-strip .tn-cd b { display: none; }
  .tl-card .tl-syn > div > b { font-size: 12px; }
}
@media (max-width: 760px) and (max-height: 660px) {
  .tl-card .tn-strip .tn-cd img { width: 30px; height: 30px; }
  .tl-card .rewards { font-size: 12.5px; }
  [data-theme="codex"] .tl-card h4.sec { font-size: 17px; line-height: 1.1; }
  .tl-card .tl-syn .syn-chips > * { font-size: 10.5px; padding-inline: 5px; }
  .tl-card .tl-syn > div { gap: 2px 3px; }
  .tl-card .rewards { column-gap: 8px; }
}
/* Starter picker on a phone (client/starterpick.ts): a two-element starter's tags (Kitling: Flame + Stone) shrink to
   fit its card, wrapping only on the narrowest phones, and the portrait never runs past the card (320-393 px ran over). */
@media (max-width: 560px) {
  .sp-cards > .sp-card, [data-theme] .sp-cards > .sp-card { min-width: 0; padding-inline: 3px; }
  /* The double-detail still (128 px) at its own size, cropped to the creature, so it stays sharp; half size on the narrowest phones. */
  .sp-art { width: min(96px, 100%); height: 112px; }
  .sp-art img { width: 96px; max-width: 100%; height: 112px; object-fit: none; }
  .sp-els { flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; }
  .sp-els > .el, [data-theme] .sp-els > .el { font-size: 10.5px; padding-inline: 4px; letter-spacing: 0; }
}

@media (max-width: 359px) {
  .sp-art { width: min(80px, 100%); height: 80px; }
  .sp-art img { width: 64px; height: 64px; object-fit: fill; }
}

/* The player screen's title picker (client/player-hub.ts pickTitle): the worn title as one button, every title in a dialog with how it was earned. */
.ph-title { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.ph-title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-title > i { font-style: normal; font-size: 10px; opacity: .7; }
.dialog .tt-pick .tt-card { min-height: 46px; }
.dialog .tt-pick .tt-card .grow { display: grid; gap: 1px; }
.dialog .tt-pick .tt-card .muted { font-size: 12px; line-height: 1.25; }
.dialog .tt-pick .tt-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Hunt › Trainer when the column runs short, on any screen (client/ui.ts fitTrainer adds these one at a time). */
#huntview .lcol.fit-stmini .startersum .st-list li:not(.next) { display: none; }
#huntview .lcol.fit-tight .questsum { gap: 2px; padding-top: 6px; padding-bottom: 6px; }
#huntview .lcol.fit-tight .questsum .qs-row { min-height: 19px; }
#huntview .lcol.fit-tight .questsum .qs-row.qs-hour .btn { min-height: 24px; height: 24px; }
#huntview .lcol.fit-nochest .questsum .qs-chest { display: none; }
#huntview .lcol.fit-nochips .playercard .bchips { display: none; }
/* Last of all the next-unlock line (the level's hover and the Trainer page have it too). */
#huntview .lcol.fit-nonext .playercard .pc-next { display: none; }
#huntview .lcol.fit-stclaim .startersum:has(.btn) .st-list { display: none; }
#huntview .lcol.fit-noperks .playercard .perk:not(.on) { display: none; }
/* Phones: Firstborn stays (as a half-width tile beside the event) while numbers are left. It no longer has a top bar
   pill (Cole 11-13), so this row is where phone players see it. */
@media (max-width: 760px) { #huntview .lcol.fit-noperks .playercard .perk-firstborn:not(.on) { display: grid; } }
#huntview .lcol.fit-qdone .questsum:has(.q-claimbtn) .qs-row.done:not(.qs-hour) { display: none; }
#huntview .lcol.fit-noss .statsum .ss-open { display: none; }
#huntview .lcol.fit-qfold .questsum .qs-row:not(.qs-hour) { display: none; }
#huntview .lcol.fit-nosock .statsum .hb-worn { display: none; }
@media (max-width: 760px) { #huntview .lcol.fit-tight .questsum .qs-head { padding-bottom: 3px; } }
/* Narrow phones: the Claim button shows just "Claim", so it never covers the card's title (rewards show on the Quests page). */
@media (max-width: 400px) {
  #huntview .questsum .q-claimbtn > :not(b) { display: none; }
}
/* New trainer's look step on short phones (375x548 Safari with bars, 320x568): Continue fell off the bottom.
   Smaller preview, tighter rows. */
@media (max-width: 520px) and (max-height: 720px) {
  .lp-pick .lp-body { padding-top: 2px; }
  .lp-pick .lookpk { margin: 0 0 6px; gap: 8px; }
  .lp-pick .lk-big { width: 88px; height: 88px; }
  .lp-pick .lk-dirs img { width: 28px; height: 28px; }
  .lp-pick .lk-opts { gap: 6px; }
  .lp-pick .lk-row { gap: 3px; }
  .lp-pick .lk-fitname { margin-top: 0; font-size: 12px; }
}
@media (max-width: 520px) and (max-height: 600px) {
  .lp-pick .lk-hair button { height: 28px; }
  .lp-pick .lk-sw button { width: 26px; height: 26px; }
  .lp-pick .lk-fits button { width: 36px; height: 36px; }
  .lp-pick .lk-fits img { margin: -8px 0 0 -14px; }
}
/* Short phones: the hunt card is one slim line (creature, level, speed, risk; the matchup is in the hunt list) so the scene stays in view;
   it covered about half of it, the first catch included (Cole picked this 2026-11-05). */
@media (max-width: 760px) and (max-height: 720px) {
  #huntview .huntcard { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 3px 10px 4px; width: auto; }
  #huntview .huntcard .what { flex: none; flex-wrap: nowrap; gap: 4px; margin: 0; white-space: nowrap; }
  #huntview .huntcard .what img { width: 22px; height: 22px; }
  [data-theme] #huntview .huntcard .what b { font-size: 17px; }
  #huntview .huntcard .what .el { display: none; }
  #huntview .huntcard .facts { flex-wrap: nowrap; gap: 4px; margin: 0; min-width: 0; overflow: hidden; font-size: 12px; white-space: nowrap; }
  #huntview .huntcard .facts:not(.early) > :nth-child(-n+2) { display: none; }
  /* The next-catch row joins the line: the button with its creature's picture, and the × (the count is in the hunt list). */
  #huntview .huntcard .hc-next { flex: 1 1 auto; min-width: 0; margin: 0; padding-right: 0; gap: 4px; justify-content: flex-end; }
  /* The button keeps its size: on a 320 px phone the row squeezed it to a sliver ("ES" of Quests). */
  #huntview .huntcard .hc-next .btn { flex: none; }
  #huntview .huntcard .hc-next .goal, #huntview .huntcard .hc-next .hc-nm { display: none; }
  /* The card's fold sits on this line too and puts the row away with the rest, so the × steps aside for room. */
  #huntview .huntcard .hc-next .hc-x { display: none; }
}
/* The phone More menu (client/ui.ts menu-more): its 16 pages, Admin, daily reward and Log out ran 900+ px tall and
   off the top of a 664 px phone, hiding Quests, Season pass, Shop and Market. Two columns, capped at the screen. */
@media (max-width: 760px) {
  .phone-only .menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; column-gap: 4px; row-gap: 0;
    max-height: calc(100dvh - 86px); overflow: hidden; box-sizing: border-box; }
  .phone-only .menu a, .phone-only .menu > button, .phone-only .menu .locked { min-width: 0; min-height: 40px; white-space: nowrap; }
  .phone-only .menu > p { grid-column: 1 / -1; }
  .phone-only .menu > p { margin: 4px 10px; }
}
@media (max-width: 760px) and (max-height: 600px) {
  .phone-only .menu a, .phone-only .menu > button, .phone-only .menu .locked { min-height: 34px; padding-block: 4px; }
}
/* Phone playtest fixes (2026-11-05). */
@media (max-width: 760px) {
  /* The title's flourish hangs under the title itself, not under the button row that wraps below it. */
  [data-theme="codex"] .pagetitle { background: none; padding-bottom: 0; }
  [data-theme="codex"] .pagetitle h1 { padding-bottom: 7px; background: url(themes/codex/flourish.svg) left bottom / 160px 8px no-repeat; }
  /* Throw at: "Until I have one" fits its select. */
  #huntview .auto .grp.now { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); column-gap: 8px; }
  [data-theme] #huntview .auto .grp.now .line select { max-width: 74%; padding: 0 20px 0 6px; font-size: 12px; letter-spacing: 0; }
  /* The region map: a locked area shows its ring and lock only, so the names of the areas you can hunt stay readable. */
  .mnode:has(.lock):not(.on) .lbl { display: none; }
}
/* Narrow phones: Throw at and Heal below each put their name over their choice, so neither choice is cut short. */
@media (max-width: 430px) {
  #huntview .auto .grp.now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #huntview .auto .grp.now .line { display: flex; flex-direction: column; align-items: stretch; gap: 1px; margin: 0; font-size: 11.5px; line-height: 1.2; }
  [data-theme] #huntview .auto .grp.now .line select { max-width: none; min-width: 0; width: 100%; margin-left: 0; height: 30px; min-height: 30px; }
}
/* Short phones (320x568 cut three Automation rows): the two VIP-only rows, which only link to the shop, step aside. */
@media (max-width: 760px) and (max-height: 600px) {
  #huntview .auto .adv.vip-row { display: none; }
  #huntview .auto .adv-h { height: 28px; }
  [data-theme] #huntview .auto .phead { padding-top: 2px; padding-bottom: 5px; }
  [data-theme] #huntview .auto .phead h4 { font-size: 17px; }
  [data-theme] #huntview .auto .grp.now .line select { height: 28px; min-height: 28px; }
  #huntview .auto .grp.now { padding-bottom: 0; }
  #huntview .auto .grp.now .ainuse { margin: 3px 0 0; }
  [data-theme] #huntview .auto .ainuse > * { height: 26px; min-height: 0; padding-top: 0; padding-bottom: 0; }
}
/* Short screens with an Automation section open (Auto-favorite ran 95 px over at 375x548, 31 px in the itch frame):
   the panel title steps aside, the slider's label row goes (the tick under the thumb names the grade) and the switches
   sit two to a row, closer together. */
@media (max-height: 640px) {
  #huntview .auto:has(.adv.open) .phead { display: none; }
  #huntview .auto .gslide .gs-top { display: none; }
  #huntview .auto .gslide input[type=range][data-gslide] { height: 28px; min-height: 28px; }
  #huntview .auto .adv.open :is(.autofav, .sellkeep, .favsel) .line, #huntview .auto .adv.open .adv-b > .line { margin: 0; min-height: 32px; }
  [data-theme] #huntview .auto .adv.open .favsel .line select { height: 30px; min-height: 30px; }
  [data-theme] #huntview .auto .adv.open .adv-b > .line select { height: 30px; min-height: 30px; }
}
@media (max-width: 760px) and (max-height: 640px) {
  #huntview .auto .adv.open .autofav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
}
/* Computers: the rail is too narrow for two switches a row, so the rows close up instead. */
@media (min-width: 761px) and (max-height: 640px) {
  #huntview .auto .adv.open .autofav { display: grid; gap: 0; }
  #huntview .auto .adv.open :is(.autofav, .sellkeep) .line, #huntview .auto .adv.open .adv-b > .line { min-height: 28px; }
  #huntview .auto .adv.open .toggle { transform: scale(.85); transform-origin: left center; margin-right: -4px; }
}
/* Short computer windows (the itch frame, 964x596): with a section open, the two VIP rows (links to the shop) step aside. */
@media (min-width: 761px) and (max-height: 720px) {
  #huntview .auto:has(.adv.open) .adv.vip-row { display: none; }
}
/* Very short windows (500 px): an open section takes the panel, the always-on settings above it return when it closes. */
@media (max-height: 540px) {
  #huntview .auto:has(.adv.open) .grp.now { display: none; }
}
/* Quests on a phone: a finished set's leftovers (Last week, Yesterday, Last hour) are one line, since the Claim button
   above lists and takes them (This week ran 21-63 px over with last week's chest waiting). */
@media (max-width: 760px) {
  .q-past { flex-wrap: nowrap; margin: 6px 0 0; padding: 4px 10px; white-space: nowrap; }
  .q-past > :not(b, .muted) { display: none; }
  .q-past .muted { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
@media (max-width: 760px) and (max-height: 660px) {
  .q-chest > .chest { margin-top: 4px; }
  .q-day > .q-list { margin-top: 4px; }
  [data-theme] .q-claim .q-claimbtn { padding-top: 3px; padding-bottom: 3px; min-height: 0; }
  .q-claim { margin-bottom: 6px; }
}
/* Quests on short phones (320x568 This week ran ~65 px over): tighter rows, the claim's rewards and the chest track's
   reward stacks shrink a step. */
@media (max-width: 760px) and (max-height: 600px) {
  [data-theme] .q-list .q-row { padding-top: 3px; padding-bottom: 3px; row-gap: 1px; }
  .q-day .q-list { gap: 3px; }
  .q-day > .cp-h { margin-bottom: 0; }
  [data-theme] .q-claim .q-claimbtn .rw { font-size: 11px; }
  [data-theme] .q-claim .q-claimbtn .rw img { width: 14px; height: 14px; }
  .q-claim .q-claimbtn { column-gap: 6px; line-height: 1.15; }
  [data-theme] .q-chest .chest { padding-bottom: 44px; }
  [data-theme] .q-chest .cn-rw img { width: 15px; height: 15px; }
  [data-theme] .q-chest .cn-rw .rw { font-size: 10px; line-height: 1.1; }
  .q-chest { margin-top: 4px; }
  .q-past { margin-top: 4px; }
}
@media (max-width: 760px) and (max-height: 560px) {
  .q-day.q-week > .cp-h { display: none; }
  [data-theme] .q-chest .chest { padding-bottom: 40px; }
}
@media (max-width: 760px) {
  /* Market > History on a phone: who sold to whom and when under the name, the amount at right. */
  .mk-board.mh-board .mk-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "art what price"; padding-top: 5px; padding-bottom: 5px; }
  .mk-board.mh-board .mk-row .mk-by { display: none; }
  .mk-board.mh-board .mk-row .mk-art { width: 38px; height: 38px; }
  .mk-board.mh-board .mk-row .mk-art img { max-width: 36px; max-height: 36px; }
  .mk-board.mh-board .mk-row .mk-art:not(.crt) img { width: 24px; height: 24px; }
  .mk-board.mh-board .mk-row .mk-sub { display: block; max-height: 18px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .mh-board .mh-ago { display: inline; }
}
/* A field shorter than the scene tools' column (about 225 px): zoom moves into a second column beside the lower
   buttons (under the hunt card), so − no longer hangs over the tabs or the away card's close button. */
@media (max-width: 760px) and (max-height: 724px) {
  #huntview .fieldtools { grid-template-columns: 32px 32px; grid-auto-flow: row; }
  #huntview .fieldtools > * { grid-column: 2; }
  #huntview .fieldtools .ft-gap { display: none; }
  #huntview .fieldtools [data-key="zi"] { grid-column: 1; grid-row: 3; }
  #huntview .fieldtools [data-key="zo"] { grid-column: 1; grid-row: 4; }
}

/* A Trail boss stop on a tablet or desktop (client/trail.ts bossDetail): the board on the left like a trainer stop;
   beside it the boss, the matchup, the Team row, drops, the first-clear prize and the fight button, in that order.
   The board already shows the team, so the matchup's faces step aside; drops are icons and chances (a hover names
   them) unless the screen is tall enough for their names. */
@media (min-width: 761px) {
  .tl-boss .tl-bcard .lhead { order: 1; display: flex; align-items: center; gap: 12px; }
  .tl-boss .tl-bcard .lhead > img, .tl-boss .tl-bcard .lhead .bosspic { width: 52px; height: 52px; }
  .tl-boss .tl-bcard .lhead .grow { display: block; }
  .tl-boss .tl-bcard .lhead h3 { margin: 0 0 4px; }
  .tl-boss .tl-bcard .est { order: 2; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 8px 0 0; padding: 6px 8px; }
  .tl-boss .tl-bcard .est > * { grid-column: 1; grid-row: auto; }
  .tl-boss .tl-bcard .est-top { gap: 8px; flex-wrap: nowrap; }
  .tl-boss .tl-bcard .est-team { display: none; }
  .tl-boss .tl-bcard .tn-sec { order: 3; margin: 10px 0 4px; }
  .tl-boss .tl-bcard .tl-syn { order: 4; }
  .tl-boss .tl-bcard .drops { order: 5; display: flex; flex-wrap: nowrap; gap: 4px; margin: 10px 0 0; }
  .tl-boss .tl-bcard .drop { flex: 1 1 0; min-width: 0; grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 4px 2px; text-align: center; }
  .tl-boss .tl-bcard .drop img { grid-row: auto; width: 24px; height: 24px; }
  .tl-boss .tl-bcard .drop b { display: none; }
  .tl-boss .tl-bcard .drop .pct { font-size: 12px; }
  .tl-boss .tl-bcard .tl-bfirst { order: 6; }
  .tl-boss .tl-bcard .tl-bfirst h4.sec { margin: 10px 0 4px; }
  .tl-boss .tl-bcard > .lentry { order: 7; flex-wrap: nowrap; align-items: center; gap: 6px; }
  .tl-boss .tl-bcard > .lentry .lkey { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tl-boss .tl-bcard > .lentry > .btn { flex: none; }
}
@media (min-width: 761px) and (min-height: 861px) {
  .tl-boss .tl-bcard .drops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .tl-boss .tl-bcard .drop { grid-template-columns: 24px minmax(0, 1fr); column-gap: 6px; justify-items: start; padding: 4px 6px; text-align: left; }
  .tl-boss .tl-bcard .drop img { grid-row: span 2; }
  .tl-boss .tl-bcard .drop b { display: block; font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
@media (min-width: 761px) and (max-height: 720px) { .tl-boss .tl-bcard .tl-syn { display: none; } }
/* The boss stop's tab row sits above its card, so its board gives up that row's height next to a trainer stop's
   (the same steps as the .tl-card board rules above, 45 px more room). */
@media (min-width: 761px) { .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, max(480px, calc((100vh - 335px) * 16 / 9 + 10px))); } }
@media (min-width: 761px) and (max-width: 1279px) { .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 375px) * 16 / 9 + 10px)); } }
@media (min-width: 941px) and (max-width: 1279px) and (max-height: 800px) { .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 390px) * 16 / 9 + 10px)); } }
@media (min-width: 1101px) and (max-height: 700px) { .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 355px) * 16 / 9 + 10px)); } }
@media (min-width: 1280px) and (min-height: 801px) and (max-height: 860px) { .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 375px) * 16 / 9 + 10px)); } }
@media (min-width: 761px) and (max-width: 940px), (min-width: 941px) and (max-width: 989px) { .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 420px) * 5 / 6)); } }
/* Below 1280 wide the key shows as its icon and count (its name on hover), so the fight button keeps its row. */
@media (min-width: 761px) and (max-width: 1279px) { .tl-boss .tl-bcard > .lentry .lkey-n { display: none; } }
/* Tablets and small laptops under 800 tall: with all three Team buttons the row of buttons stands for the title. */
@media (min-width: 761px) and (max-width: 1279px) and (max-height: 800px) { .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > h4 { display: none; } }
/* Beside the docked chat column (public/style.css, 1360 px and wider) the page is as wide as a 1050-1280 px window:
   the Trail takes its small-laptop layout above (path as a column of faces, slimmer side panel, board sized from the
   height), so its board stays wide and the stop fits without scrolling. 1650 px and wider keep the full layout. */
@media (min-width: 1360px) and (max-width: 1649px) {
  body[data-dock="open"] .tl-wrap { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  body[data-dock="open"] .tl-path { padding: 6px 4px; }
  body[data-dock="open"] .tl-stop:not(:last-child)::after { display: none; }
  body[data-dock="open"] .tl-stop > button { display: grid; grid-template-columns: 1fr; justify-items: center; padding: 4px 0; position: relative; }
  body[data-dock="open"] .tl-stop .tl-txt { display: none; }
  body[data-dock="open"] .tl-stop .tl-dot { position: absolute; top: 0; left: 0; transform: scale(.8); transform-origin: top left; }
  body[data-dock="open"] .tl-card { grid-template-columns: minmax(0, 1fr) 270px; column-gap: 12px; padding: 10px 12px; }
  body[data-dock="open"] .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 330px) * 16 / 9 + 10px)); }
  body[data-dock="open"] .tl-card .tn-strip .tn-cd b { display: none; }
  body[data-dock="open"] .tl-card .tl-syn { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  body[data-dock="open"] .tl-card .tl-syn .syn-chip { max-width: 100%; height: auto; min-height: 20px; white-space: normal; line-height: 1.15; }
  body[data-dock="open"] .tl-card h4.sec { margin: 6px 0 4px; }
  body[data-dock="open"] .tl-card.tl-fight { grid-template-columns: minmax(0, 1fr) 190px; }
  body[data-dock="open"] .tl-card .tn-sec { gap: 4px; }
  body[data-dock="open"] .tl-card .tn-sec .btn.small { font-size: 12px; padding: 0 7px; min-height: 26px; height: 26px; }
  body[data-dock="open"] .tl-fight .bv-wrap.with-meter { grid-template-columns: minmax(0, 1fr) 112px; }
  body[data-dock="open"] .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 375px) * 16 / 9 + 10px)); }
  body[data-dock="open"] .tl-boss .tl-bcard > .lentry .lkey-n { display: none; }
}
@media (min-width: 1360px) and (max-width: 1649px) and (max-height: 800px) {
  body[data-dock="open"] .tl-card:not(.tl-fight) { grid-template-columns: minmax(0, 1fr) 290px; }
  body[data-dock="open"] .tl-card .lentry { flex-wrap: wrap; row-gap: 4px; margin-top: 4px; padding-top: 4px; }
  body[data-dock="open"] .tl-card .lentry > .muted { flex-basis: 100%; }
  body[data-dock="open"] .tl-card h4.sec { margin: 4px 0 2px; }
  body[data-dock="open"] .tl-card .tl-syn { margin-top: 2px; }
  body[data-dock="open"] .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 345px) * 16 / 9 + 10px)); }
  body[data-dock="open"] .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 390px) * 16 / 9 + 10px)); }
  body[data-dock="open"] .tl-fight .bv-chips { display: none; }
  body[data-dock="open"] .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > h4 { display: none; }
}
/* A short window: a boss stop's board keeps the short-desktop size (wide), as without the column. */
@media (min-width: 1360px) and (max-width: 1649px) and (max-height: 700px) {
  body[data-dock="open"] .tl-boss .tl-bcard .tl-board .bv-frame { width: min(100%, calc((100vh - 355px) * 16 / 9 + 10px)); }
}
/* On a phone the tab already says Team: with all three buttons they take the row, each as wide as its words. */
@media (max-width: 760px) {
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) { flex-wrap: nowrap; gap: 6px; }
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > h4, .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > .spacer { display: none; }
  .tl-card .tn-sec:has(> .btn ~ .btn ~ .btn) > .btn { flex: 1 1 auto; min-width: 0; justify-content: center; white-space: nowrap; }
}
/* The smallest phones (320x568): a trainer's Team tab keeps the team, the prize and the button; synergy lines step aside. */
@media (max-width: 760px) and (max-height: 600px) { .tl-card:not(.tl-bcard) .tl-syn { display: none; } }
/* A boss stop on a phone: the fight button sits under the Team tab's board too, so the board leaves it room. */
@media (max-width: 760px) { .tl-boss .tl-bcard { --bv-room: 600px; } .tl-boss .tl-bcard > .lentry { margin-top: 6px; padding-top: 6px; } }
@media (max-width: 760px) and (max-height: 760px) { .tl-boss .tl-bcard { --bv-room: 510px; } .tl-boss .tl-bcard .tl-syn { display: none; } }
@media (max-width: 760px) and (max-height: 600px) { .tl-boss .tl-bcard { --bv-room: 500px; } .tl-boss .tl-bcard .est-team { display: none; } .tl-boss .tl-bcard .lhead > img { display: none; } .tl-boss .tl-bcard .lhead .grow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; } .tl-boss .tl-bcard .lhead h3 { margin: 0; } }
@media (max-width: 420px) { .tl-boss .tl-bcard > .lentry .lkey-n { display: none; } }
/* 320 wide the Trail's help link would take a line of its own under the title; Help still has it. */
@media (max-width: 340px) { #page:has(.tl-wrap) #pagehead .pagetitle > a.link { display: none; } }
/* A boss's first-clear prize on a phone: one line, its title beside the prize. Short phones leave the matchup's
   faces to the Team tab. */
@media (max-width: 760px) {
  .tl-boss .tl-bfirst { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; margin-top: 8px; }
  .tl-boss .tl-bfirst h4.sec { margin: 0; font-size: 16px; }
  .tl-boss .tl-bfirst .rewards { margin: 0; }
}
@media (max-width: 760px) and (max-height: 700px) { .tl-boss .tl-bcard:has(.tl-bfirst) .est-team { display: none; } }
@media (max-width: 760px) and (max-height: 600px) {
  .tl-boss .tl-bcard:has(.tl-bfirst) .est-weak { display: none; }
  .tl-boss .tl-bcard .est-top { flex-wrap: nowrap; gap: 8px; }
  .tl-boss .tl-bcard .est-top .verdict { flex: none; }
  .tl-boss .tl-bcard .est-pow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .tl-boss .tl-bcard .drop { padding: 2px; }
  .tl-boss .tl-bcard .drop img { width: 20px; height: 20px; }
  .tl-boss .tl-bcard .tl-bfirst { margin-top: 4px; }
  .tl-boss .tl-bcard { padding-top: 6px; padding-bottom: 6px; }
  .tl-boss .tl-bcard .est { margin-top: 6px; }
  .tl-boss .tl-bcard > .lentry { margin-top: 4px; padding-top: 4px; }
}
/* A boss fight on its Trail stop, wider than a phone: the board sized from the screen's height (never under 530 px
   wide, where it would draw tall). Once the replay ends the result and Done / Fight again sit under a smaller board,
   or on screens under 860 tall take the board's place, as on a phone; Replay brings the board back. */
@media (min-width: 761px) {
  .tl-bossfight .bv-frame { width: min(100%, max(530px, calc((100vh - 385px) * 16 / 9 + 10px))); box-sizing: border-box; margin: 0 auto; }
  .tl-bossfight:has(> .bv-after:not([hidden])) .bv-frame { width: min(100%, max(530px, calc((100vh - 580px) * 16 / 9 + 10px))); }
  .tl-bossfight .bv-cv { width: 100%; }
  .tl-bossfight .boss-replay { margin-bottom: 8px; }
  .tl-bossfight .bossres { gap: 12px; padding: 8px 12px; margin-bottom: 0; align-items: center; }
  .tl-bossfight .bossres > img { width: 48px; height: 48px; }
  .tl-bossfight .bossres h3 { margin-bottom: 4px; }
  .tl-bossfight > .lentry { margin-top: 8px; padding-top: 8px; }
}
@media (min-width: 761px) and (max-height: 860px) {
  .tl-bossfight:has(> .bv-after:not([hidden])) :is(.bv-frame, .bv-meter) { display: none; }
  .tl-bossfight:has(> .bv-after:not([hidden])) .bv-wrap.with-meter { grid-template-columns: minmax(0, 1fr); }
}
/* With Replay beside the fight button the key shows as its icon and count at every width. */
@media (min-width: 761px) { .tl-boss .tl-bcard > .lentry:has([data-act="trail-boss-watch"]) .lkey-n { display: none; } }
/* The Boss Ladder tab on short phones (320x568, 375x548 with Safari's bars): steps, matchup, Repeat and the key each
   on one tight row, so the tab fits without scrolling. */
@media (max-width: 760px) and (max-height: 600px) {
  .tl-boss .lsteps { gap: 2px; }
  .tl-boss .lstep { min-height: 24px; height: 24px; padding: 0 2px; }
  .tl-boss .lstep .lv { font-size: 11px; white-space: nowrap; letter-spacing: -.01em; }
  .tl-boss .ladder { gap: 4px; }
  .tl-boss .lstep-detail { padding-top: 6px; padding-bottom: 6px; }
  .tl-boss .lstep-detail .est { margin-top: 0; padding: 4px 8px; }
  .tl-boss .lstep-detail .est-top { flex-wrap: nowrap; gap: 8px; }
  .tl-boss .lstep-detail .est-top .verdict { flex: none; }
  .tl-boss .lstep-detail .est-pow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .tl-boss .lstep-detail .drops { margin-top: 4px; }
  .tl-boss .lstep-detail .drop { padding: 2px; }
  .tl-boss .lstep-detail .drop img { width: 20px; height: 20px; }
  .tl-boss .lstep-detail .lentry { margin-top: 3px; padding-top: 3px; row-gap: 3px; }
  .tl-boss .lrepeat { flex-wrap: nowrap; gap: 6px; font-size: 12px; }
  [data-theme="codex"] .tl-boss .lrepeat input[type=number] { width: 44px; min-height: 32px !important; height: 32px !important; padding: 0 4px; }
  .tl-boss .lrepeat .btn { flex: none; }
  .tl-boss .lstep-detail .lentry .btn, .tl-boss .lstep-detail .lentry .lkey { min-height: 32px; height: 32px; }
  .tl-boss .lrepeat input[type=checkbox] { width: 18px; height: 18px; }
  .tl-boss .lrepeat .lstop { min-height: 32px; }
  .tl-boss .lstep-detail { margin-top: 0; }
}
@media (max-width: 420px) { .tl-boss .lstep-detail .lentry .lkey { font-size: 0; gap: 4px; } .tl-boss .lstep-detail .lentry .lkey b { font-size: 13px; } }

/* ---------- The hunt's overlays size to the scene (client/hud.ts mountStageFit sets .stage[data-sz]) ----------
   In a small window (itch.io's 860x585 frame, 800x600, a short laptop, a tablet) the hunt card and the log covered most
   of the scene (Cole 2026-11-07). l: the full card. m: a slimmer card. s: one line. The log shows fewer lines on a short
   scene and folds to its tabs with the chevron. Phones (760 and under) keep their own layout. */
.combatlog .lg-tabs { align-items: center; }
.combatlog .lg-min { display: grid; place-items: center; flex: none; width: 24px; height: 24px; margin-left: auto; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }
.combatlog .lg-min:hover { color: var(--ink); background: var(--inlay-hi, var(--panel-3)); }
.combatlog .lg-min svg { width: 14px; height: 14px; transition: transform .15s; }
.combatlog.min .lg-min svg { transform: rotate(180deg); }
.combatlog.min { width: auto; cursor: pointer; }
[data-theme="codex"] .combatlog.min { padding-bottom: 6px; }
[data-theme="codex"] .combatlog.min .lg-tabs { padding-bottom: 0; margin-bottom: 0; background: none; }
.combatlog.min .lg-tabs button:not(.lg-min) { box-shadow: none; background: none; }
@media (max-width: 760px) { .combatlog .lg-min { display: none; } }
@media (min-width: 761px) {
  /* Medium scene: the same card, tighter. */
  #huntview .stage[data-sz="m"] .huntcard { width: auto; max-width: min(340px, calc(100% - 64px)); padding: 3px 10px 6px; }
  [data-theme] #huntview .stage[data-sz="m"] .huntcard .crumb { font-size: 11.5px; }
  #huntview .stage[data-sz="m"] .huntcard .what { margin-top: 1px; gap: 6px; }
  #huntview .stage[data-sz="m"] .huntcard .what img { width: 26px; height: 26px; }
  [data-theme] #huntview .stage[data-sz="m"] .huntcard .what b { font-size: 19px; }
  [data-theme] #huntview .stage[data-sz="m"] .huntcard .facts { margin-top: 2px; font-size: 12.5px; }
  [data-theme] #huntview .stage[data-sz="m"] .huntcard .seg { margin-top: 5px; padding-top: 5px; }
  [data-theme] #huntview .stage[data-sz="m"] .huntcard .seg button { height: 26px; font-size: 12.5px; padding: 0 8px 0 3px; }
  #huntview .stage[data-sz="m"] .huntcard .seg button img { width: 20px; height: 20px; }
  /* Small scene: one line. The wild, its speed and risk, and this area's other hunts as icons. */
  #huntview .stage[data-sz="s"] .huntcard { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; width: auto; max-width: calc(100% - 64px); padding: 3px 8px 4px; }
  #huntview .stage[data-sz="s"] .huntcard .hc-top, #huntview .stage[data-sz="s"] .huntcard .what .el { display: none; }
  #huntview .stage[data-sz="s"] .huntcard .what { flex: none; flex-wrap: nowrap; gap: 5px; margin: 0; white-space: nowrap; }
  #huntview .stage[data-sz="s"] .huntcard .what img { width: 22px; height: 22px; }
  [data-theme] #huntview .stage[data-sz="s"] .huntcard .what b { font-size: 17px; }
  [data-theme] #huntview .stage[data-sz="s"] .huntcard .facts { flex-wrap: nowrap; gap: 4px; margin: 0; min-width: 0; font-size: 12px; white-space: nowrap; }
  #huntview .stage[data-sz="s"] .huntcard .facts:not(.early) > :nth-child(-n+2) { display: none; }
  #huntview .stage[data-sz="s"] .huntcard .facts .narrow-only { display: none; }
  [data-theme] #huntview .stage[data-sz="s"] .huntcard .seg { flex-wrap: nowrap; gap: 3px; margin: 0; padding: 0; background: none; }
  [data-theme] #huntview .stage[data-sz="s"] .huntcard .seg button { width: 28px; height: 26px; padding: 0; justify-content: center; }
  #huntview .stage[data-sz="s"] .huntcard .seg button span { display: none; }
  #huntview .stage[data-sz="s"] .huntcard .seg button img { width: 22px; height: 22px; }
  /* The log and the session pill share the bottom: the pill drops its rates so the log keeps room to read. */
  #huntview .stage[data-sz="s"] .session.pill-mode .sp-rate { display: none; }
  #huntview .stage:is([data-sz="m"], [data-sz="s"]) .combatlog { max-width: calc(100% - 40px - var(--pillw, 250px)); }
  #huntview .stage[data-sz="s"] .combatlog { --pillw: 130px; width: 440px; }
  #huntview .stage .combatlog.min { width: auto; }
  [data-theme] #huntview .stage:is([data-sz="m"], [data-sz="s"]) .combatlog { font-size: 13px; }
  [data-theme] #huntview .stage:is([data-sz="m"], [data-sz="s"]) .combatlog > div:not(.lg-tabs) { padding-block: 3px; }
  #huntview .stage:is([data-sz="m"], [data-sz="s"]) .combatlog.catches { max-height: calc(100% - 80px); }
}

/* Short computer windows (the itch.io frame, 800x600): the nav's Hunt tab returns to the hunt, so pages skip the hunt
   strip and keep its 44 px, as phones do. */
@media (min-width: 761px) and (max-height: 640px) {
  .app > .strip { display: none !important; }
}
@media (min-width: 761px) and (max-height: 640px) {
  /* Ranks: the board list's buttons slimmer, so all eight show. */
  [data-theme="codex"] .lb-menu { gap: 4px; }
  [data-theme="codex"] .lb-menu button { min-height: 0; padding-block: 3px; }
  [data-theme="codex"] .lb-menu button img { width: 26px; height: 26px; }
  /* Season pass: shorter tier cards and offer rows, so the track's pager stays on screen. */
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 54px 22px 54px; }
  [data-theme="codex"] .pz-main { row-gap: 6px; padding: 8px 16px 10px; }
  [data-theme="codex"] .pz-offer { gap: 3px; padding: 7px 10px 8px; }
  [data-theme="codex"] .pz-offer ul { font-size: 12.5px; line-height: 1.15; }
}
@media (min-width: 761px) and (max-height: 600px) {
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 44px 20px 44px; }
  [data-theme="codex"] .pz-col img { max-height: 26px; }
  [data-theme="codex"] .pz-offer { padding-block: 4px; }
  [data-theme="codex"] .pz-offers { gap: 4px; }
  [data-theme="codex"] .pz-main { row-gap: 10px; padding-block: 4px 6px; }
  [data-theme="codex"] .pz-season .ps-emblem { width: 36px; height: 36px; }
}
@media (max-width: 760px) {
  /* Your listings: count, sort and Sell on one line. */
  .mk-slots { gap: 8px; }
  .mk-slots > span:first-child { white-space: nowrap; }
  .mk-minesort > span { display: none; }
  .mk-minesort { flex: 1 1 auto; min-width: 0; }
  .mk-minesort select { width: 100%; max-width: 160px; }
  .mk-slots > .btn { white-space: nowrap; }
}
/* Short phones with many offers on the player card: the rows pair up as picture and name, so the quests keep their room. */
#huntview .lcol.fit-perkgrid .playercard .perks { grid-template-columns: 1fr 1fr; }
#huntview .lcol.fit-perkgrid .playercard .perk { grid-template-columns: 22px minmax(0, 1fr); column-gap: 6px; }
#huntview .lcol.fit-perkgrid .playercard .perk :is(.perk-fx, em, .perk-cta) { display: none; }
/* A running event says what it gives ("+10% XP") rather than "Server boost": it has no top bar pill any more (Cole 11-13). */
#huntview .lcol.fit-perkgrid .playercard .perk-event b { display: none; }
#huntview .lcol.fit-perkgrid .playercard .perk-event .perk-fx { display: block; font-weight: 700; }
.psec-tabs .psec-lock { width: 10px; height: 12px; margin-right: 5px; vertical-align: -1px; opacity: .75; }
/* Automation (Khan's report 2026-11-10: Auto-restock ran off the panel on a phone): a section too tall for the panel
   takes it whole (the title, the always-on settings and the other rows step aside), the order shows Seals or Potions
   under two tabs, and what is still too long pages. client/hud.ts fitAuto sets data-tight and data-one. */
#auto[data-tight]:has(.adv.open) :is(.phead, .grp.now, .adv:not(.open)) { display: none !important; }
#auto[data-tight] .advs { border-top: 0; }
.ord-tabs { display: none; }
#auto[data-one] .ord-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 4px 0 2px; }
.ord-tabs button { height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font: 600 12.5px var(--sans); cursor: pointer; }
.ord-tabs button.on { border-color: var(--gold, var(--accent)); color: var(--ink); background: var(--panel-3); }
#auto[data-one="seals"] .uo[data-uo="potions"], #auto[data-one="potions"] .uo[data-uo="seals"] { display: none; }
#auto .adv-b .fit-pager { height: 30px; margin: 2px 0 0; }
#auto .adv-b .fit-pager .btn { min-height: 28px; height: 28px; }
/* Auto-restock: one short line per item under a column head, the coin floor before the list. */
.rs-keep { gap: 2px; margin: 4px 0 0; }
.rs-kh { font-size: 11.5px; }
.rs-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 3px 10px; }
.auto .line.rs-row { min-height: 0; margin: 0; }
#auto .rs-row input, #auto .rs-floor input { width: 64px !important; max-width: 64px; height: 28px !important; min-height: 28px !important; padding: 0 6px; font-size: 13px; }
#auto .rs-floor { flex-wrap: nowrap; white-space: nowrap; }
#auto .rs-floor input { width: 72px !important; max-width: 72px; }
.rs-top { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; }
.rs-top .line { gap: 6px; }
.rs-top > .line { margin: 2px 0; }
/* Seals or Potions: the tabs and the list's "Best first" share one row. */
#auto[data-one] .adv.open .adv-b { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
#auto[data-one] .uo { display: contents; }
#auto[data-one] .usesort { margin: 0; }
#auto[data-one] .usesort > span { display: none; }
#auto[data-one] :is(.uselist, .ord-tabs ~ .uo .fit-pager) { grid-column: 1 / -1; }
#auto[data-one] .uselist { margin-top: 4px; }
#auto[data-tight] .uselist { gap: 2px; }
#auto[data-tight] .uselist li { min-height: 33px; height: 33px; }
/* All sections closed and the panel still too tall: the title steps aside, then the rows sit two to a line. */
#auto[data-snug] .phead { display: none; }
#auto[data-snug="2"] .advs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#auto[data-snug="2"] .adv { border-top: 1px solid var(--rule-soft, var(--line)); min-width: 0; }
#auto[data-snug="2"] .adv:nth-child(even) { border-left: 1px solid var(--rule-soft, var(--line)); }
#auto[data-snug="2"] .adv:not(.vip-row) .adv-h .now { display: none; }
#auto[data-snug="2"] .adv-h { padding: 0 6px 0 10px; gap: 6px; }
@media (max-width: 340px) { [data-theme] #auto[data-snug="2"] .adv-h { font-size: 13px; } }
#auto[data-snug="2"] .adv-h .nm { overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 761px) and (max-width: 1100px) {
  /* Your listings on a small desktop (800-1100 wide): name, count and price on top, when it ends and the buttons under
     them, so the four buttons never run off the board's right edge. */
  .mk-board.mine .mk-row { grid-template-columns: 46px minmax(0, 1fr) auto auto; grid-template-areas: "art what mid price" "art by act act"; gap: 2px 10px; }
  .mk-board.mine .mk-row .mk-what { grid-area: what; } .mk-board.mine .mk-row .mk-mid { grid-area: mid; }
  .mk-board.mine .mk-row .mk-by { grid-area: by; align-self: center; } .mk-board.mine .mk-row .mk-price { grid-area: price; }
  .mk-board.mine .mk-row .mk-act { grid-area: act; gap: 4px; align-items: center; }
  .mk-board.mine .mk-row .mk-act .btn { min-width: 0; height: 28px; min-height: 28px; padding: 0 10px; }
  .mk-board.mine .mk-row .mk-art { align-self: center; }
}
/* Short screens: the Companion panel's portrait shrinks so the "On your card" switches under it fit. */
@media (min-width: 761px) and (max-height: 760px) {
  .ph-comp .picon-xl { zoom: .6; }
  .player-hub .ph-look .ph-set { padding: 5px 0; }
}
/* Trainer > Showcase below desktop: an empty column (its sections are on other sub-tabs) takes no room. */
@media (max-width: 1100px) { .ph-show .ph-col:not(:has(> .psec.on)) { display: none; } }
@media (max-width: 760px) and (max-height: 700px) { .player-hub .ph-look .ph-set { padding: 3px 0; } }
/* Small desktop windows (itch-size 800x600, 860x585): the region map is as cramped as on a phone, so locked areas show
   their ring and lock only there too and the names of the places you can hunt stay readable. */
@media (max-width: 900px), (max-height: 640px) {
  .mnode:has(.lock):not(.on) .lbl { display: none; }
}
/* Small desktop windows: the map fits a box about 370 x 290 px, too small for twenty full labels. Smaller rings, and
   names only; the picked area and the one you hunt in keep their rate, and hovering a ring shows its own. */
@media (min-width: 761px) and (max-width: 1100px), (min-width: 761px) and (max-height: 640px) {
  .mnode .ring { width: 36px; height: 36px; border-width: 2px; }
  .mnode .ring img { width: 30px; height: 30px; }
  .mnode .lbl { padding: 1px 5px 2px; }
  .mnode .lbl b { font-size: 11px; }
  .mnode:not(.on, .here, :hover) .lbl span { display: none; }
  .mnode { transform: translate(-50%, -18px); }
  .mnode:hover { z-index: 9 !important; }
}
/* Short laptop windows (1366x657): the map's 480 px floor ran the page 1 px past the window. */
@media (min-width: 1201px) and (max-height: 690px) { .mapart { height: max(320px, calc(100dvh - 210px)); } }
/* There the region switch sits in a bar over the map instead of on it, where it covered the top-left areas. */
@media (min-width: 761px) and (max-width: 1100px) {
  .mapbox > .winset { grid-row: 1; position: static; margin: 0; padding: 4px 6px; border-radius: 0; }
  /* The painted map fills the box down to the area panel's foot (it left a strip of bare sea under it). */
  .mapbox { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .mapbox > .mapscroll { min-height: 0; }
  .mapart { height: 100%; min-height: 260px; }
}
/* The narrowest phones: the trainer's action buttons already take three rows, so the bonus pills give way (the
   Bonuses tab has every number). */
@media (max-width: 340px) {
  .ppop .ppx-head > .hb-pills { display: none; }
  .ppop .ppx-acts { gap: 4px; }
  .ppop .ppx-acts .btn { padding-inline: 7px; font-size: 11px; letter-spacing: .02em; }
  .ppop .psec-tabs button { font-size: 12.5px; padding-inline: 2px; letter-spacing: 0; }
}
/* Phones and short windows: worn slots keep the socket and its grade; the name is on the item card a tap opens. */
@media (max-width: 420px), (max-height: 640px) {
  .ppop .hb-gt { display: none; }
  .ppop .hb-slot { padding: 4px 1px; }
}
@media (max-width: 760px) and (max-height: 600px) {
  .ppop .hb-row { padding-block: 3px; }
}
/* After a Trail fight the three buttons (Done, Fight again, Next) wrap inside the card's side column, never past its edge. */
.tl-card.tl-fight .lentry { flex-wrap: wrap; row-gap: 6px; }
/* Trail in a short window (itch sizes and short laptops): the effect chips keep their icon and count, the words
   are on hover; under 1280 wide the board stands tall and small, so the side column takes the room it leaves.
   (A landscape board sized from this height comes out under 520 px, where client/boardview.ts draws it tall.) */
@media (min-width: 761px) and (max-height: 700px) {
  .tl-card:not(.tl-bcard) .tl-syn .syn-b:not(.syn-fx) { display: none; }
  .tl-card:not(.tl-bcard) .tl-syn .syn-fx { font-size: 0; }
}
@media (min-width: 761px) and (max-width: 1279px) and (max-height: 700px) {
  .tl-card:not(.tl-bcard):not(.tl-fight) { grid-template-columns: minmax(0, 1fr) 430px; }
}
@media (min-width: 941px) and (max-width: 1279px) and (max-height: 700px) {
  .tl-card .tl-board .bv-frame { width: min(100%, calc((100vh - 345px) * 5 / 6)); }
}
@media (min-width: 890px) and (max-width: 1009px) and (max-height: 686px) {
  .tl-fight .tl-board .bv-frame { width: min(100%, calc((100vh - 400px) * 5 / 6)); }
}
/* The Training result (a replay with its fight stats) fits the window at every size.
   Wider than a phone: the board is sized from the height left under the page's own rows (--tr-room, measured at the
   end of a fight, when the winner line is up). It never goes under 520 px wide (there it would draw tall), so as the
   window gets shorter the effect chips, then the title rows, the winner line (the board says it too) and the blow
   list step aside. The stats rows are a little lower so the end table is never taller than the board beside it. */
@media (min-width: 761px) {
}
@media (min-width: 761px) and (max-height: 800px) {
  .tr-result .bv-mpic, .tr-result .bv-mpic :is(.walker, img) { width: 22px; height: 22px; }
  .tr-result .bv-meter { gap: 4px; } .tr-result .bv-mcol { gap: 2px; }
}
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 739px) { .tr-result { --tr-room: 380px; } .tr-result .bv-chips { display: none; } }
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 675px) { .tr-result { --tr-room: 300px; } .tr-result > .row.between, .tr-result .fb-end { display: none; } }
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 600px) { .tr-result { --tr-room: 268px; } .tr-result details.ar-log { display: none; } }
@media (min-width: 1101px) { .tr-result { --tr-room: 500px; } }
@media (min-width: 1101px) and (max-height: 795px) { .tr-result { --tr-room: 430px; } .tr-result .bv-chips { display: none; } }
@media (min-width: 1101px) and (max-height: 725px) {
}
@media (min-width: 1101px) and (max-height: 635px) { .tr-result { --tr-room: 300px; } .tr-result .fb-end { display: none; } }
/* A phone: the fight alone while it plays (no live meter, no chips); the end table goes under the board, and takes
   the board's place on a short phone (as a ranked match does). */
@media (max-width: 760px) {
  .tr-page .tr-result { --bv-room: 328px; } .tr-page .tr-result:has(.bv-table) { --bv-room: 452px; }
}
@media (max-width: 760px) and (max-height: 700px) { .tr-result .bv-wrap:has(.bv-table) .bv-frame { display: none; } }

/* The Bag with more than twelve pockets (Update 1.1 adds Gear, Materials and the Nursery): four across in a short
   window, and three small standing cards across on the narrowest phones, so the front page never scrolls. */
@media (min-width: 761px) and (max-height: 700px) {
  [data-theme="codex"] .bp-grid.many { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  [data-theme="codex"] .bp-grid.many .bp-card { gap: 8px; padding: 6px 8px 6px 10px; }
  [data-theme="codex"] .bp-grid.many .bp-card .bp-art { width: 48px; height: 48px; }
  [data-theme="codex"] .bp-grid.many .bp-card .bp-art :is(img, .bp-ui) { width: 40px; height: 40px; }
  [data-theme="codex"] .bp-grid.many .bp-card .bp-prop { transform: scale(.55); }
  [data-theme="codex"] .bp-grid.many .bp-card .bp-nm { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  [data-theme="codex"] .bp-grid.many .bp-card .bp-txt { min-width: 0; }
}
@media (max-width: 760px) and (max-height: 700px), (max-width: 340px) {
  [data-theme="codex"] .bp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  [data-theme="codex"] .bp-card { --rx: 0px; --ry: 3px; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; gap: 2px; min-height: 0; padding: 5px 3px 6px; text-align: center; }
  [data-theme="codex"] .bp-card .bp-art { width: 34px; height: 34px; }
  [data-theme="codex"] .bp-card .bp-art img, [data-theme="codex"] .bp-card .bp-art .bp-ui { width: 32px; height: 32px; }
  [data-theme="codex"] .bp-card .bp-prop { transform: scale(.45); }
  [data-theme="codex"] .bp-card .bp-txt { align-items: center; gap: 2px; max-width: 100%; }
  [data-theme="codex"] .bp-card .bp-nm { font-size: 13.5px; }
  [data-theme="codex"] .bp-card .bp-pill { font-size: 10.5px; padding: 0 5px; }
}
/* (And phones under 600 px tall, 375x548 Safari with its bars: the Skins pocket sat under the bottom bar.) */
@media (max-width: 340px), (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] .bp-head { gap: 8px; margin-bottom: 5px; padding: 2px 8px 2px 6px; }
  [data-theme="codex"] .bp-head h1 { font-size: 22px; }
  [data-theme="codex"] .bp-head .bp-sub { font-size: 12px; }
  [data-theme="codex"] .bp-head .bp-art { width: 34px; height: 34px; }
  [data-theme="codex"] .bp-head .bp-art img, [data-theme="codex"] .bp-head .bp-art .bp-ui { width: 30px; height: 30px; }
  [data-theme="codex"] .bp-grid { gap: 4px; }
  [data-theme="codex"] .bp-card { padding: 3px 3px 4px; gap: 1px; }
  [data-theme="codex"] .bp-card .bp-art { width: 28px; height: 28px; }
  [data-theme="codex"] .bp-card .bp-art img, [data-theme="codex"] .bp-card .bp-art .bp-ui { width: 28px; height: 28px; }
  [data-theme="codex"] .bp-card .bp-txt { gap: 1px; }
}
/* The egg shop on the smallest phones (320 x 568, and 375 x 548 under Safari's bars): shorter egg tiles and odds rows, so the picked egg's card fits. */
@media (max-width: 340px), (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] .egg-tile { padding: 3px 3px 4px; gap: 1px; }
  [data-theme="codex"] .egg-tile .egg-ic { width: 40px; height: 40px; }
  [data-theme="codex"] .egg-peek { padding: 8px; row-gap: 4px; }
  [data-theme="codex"] .egg-peek h3, [data-theme="codex"] .egg-peek .row.between b:first-child { font-size: 19px; }
  [data-theme="codex"] .egg-odds { gap: 0; }
  [data-theme="codex"] .egg-odds li { font-size: 12.5px; line-height: 1.15; }
  [data-theme="codex"] .egg-pills .pill { font-size: 11px; padding: 0 5px; }
}

/* Hunt Team tab on computers and tablets, when the team would be cut off (ui.ts fitTeam): the trainer card goes
   (it is on the Trainer tab), the lead's roll pills fold into one short row, the others drop their pills, then sit two by two. */
#huntview:not([data-ptab="trainer"]) .lcol.fit-nopc > .panel.playercard:not(#teamlist) { display: none !important; }
#huntview .lcol.fit-tlead .slot.lead .rpills:not(.m) { display: none; }
#huntview .lcol.fit-tlead .slot.lead .lead-mini { display: block; }
#huntview .lcol.fit-tslim #teamlist .slot.bench { grid-template-columns: 28px minmax(0, 1fr); padding: 4px 8px 5px; margin-bottom: 4px; }
#huntview .lcol.fit-tslim #teamlist .slot.bench :is(img, .walker) { width: 28px; height: 28px; }
#huntview .lcol.fit-tslim #teamlist .slot.bench .rpills.m { display: none; }
#huntview .lcol.fit-tgrid #teamlist .slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0 8px; }
#huntview .lcol.fit-tgrid #teamlist .slot { margin: 0; }
#huntview .lcol.fit-tgrid #teamlist .slot:is(.lead, .empty) { grid-column: 1 / -1; }
#huntview .lcol.fit-tgrid #teamlist .slot.bench .peek-btn { display: none; }
#huntview .lcol.fit-tgrid #teamlist .slot.bench .r1 .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#huntview .lcol.fit-tgrid #teamlist .slot.bench .r1 .lv { display: none; }
/* The Halls editor's creature tab has the room for its moves on most phones (the Team page gives them a tab of their own). */
@media (max-width: 760px) and (max-height: 760px) and (min-height: 640px) {
  .hl-ed .hl-mem .tm-moves { display: table; }
}
/* Arena line-ups: a hunt team's second copy of a species sits out; one line says so (client/arena.ts lineupsHtml). */
.ar-dupnote { margin: 4px 0 0; font-size: 13px; }
.ar-dup { font-size: 13px; white-space: nowrap; }
/* The scene's tool column is a grid whose empty cells (beside the map and home buttons on short phones) sat over the hunt
   card's right end and ate its taps, the next-catch × included (2026-11-12). Only the buttons take taps. */
#huntview .fieldtools { pointer-events: none; }
#huntview .fieldtools > * { pointer-events: auto; }
/* Two by two, a fallen creature's word wraps tight beside its Revive rather than cut off. */
#huntview .lcol.fit-tgrid #teamlist .slot.bench .ko { display: block; min-width: 0; font-size: 11.5px; line-height: 1.1; white-space: normal; }
#huntview .lcol.fit-tgrid #teamlist .slot.bench .ko-line { gap: 3px; }
#huntview .lcol.fit-tgrid #teamlist .slot.bench .ko-rv.ko-ic { padding: 0 1px; }
#huntview .lcol.fit-tgrid #teamlist .slot.bench .ko-rv.ko-ic img { width: 13px; height: 13px; }
/* The hunt card's fold (client/hud.ts toggleHuntCardFold): phones only. Folded, it is a small pill with the wild's name and
   level at the top left, the rest of the scene clear (players 2026-11-12: the card covered 30% of the hunt). */
/* The fold control every hunt overlay shares: the log's chevron (.combatlog .lg-min), same size, ink and hover. */
.fold-btn { display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted, #8a7a5a); cursor: pointer; }
.fold-btn:hover, .fold-btn:focus-visible { color: var(--ink, #2a2016); background: var(--inlay-hi, rgba(0,0,0,.06)); }
.fold-ic { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.huntcard .hc-fold { margin-left: 2px; }
#huntview .huntcard.folded { display: flex; align-items: center; right: auto; width: auto; max-width: calc(100% - 64px); padding: 3px 4px 3px 8px; }
#huntview .huntcard.folded :is(.hc-top, .facts, .seg, .hc-next) { display: none; }
#huntview .huntcard.folded .what { flex: none; flex-wrap: nowrap; gap: 5px; margin: 0; white-space: nowrap; }
#huntview .huntcard.folded .what img { width: 22px; height: 22px; }
[data-theme] #huntview .huntcard.folded .what b { font-size: 15px; }
#huntview .huntcard.folded .what .el { display: none; }
#huntview .huntcard.folded .hc-fold { margin-left: 4px; }
/* The session pill: the summary opens the panel, the chevron after a hairline folds it to the clock. */
/* Wider screens only: phones hide the session in the scene and show it in the Log tab (style.css). */
@media (min-width: 761px) { .session.pill-mode { display: flex; align-items: center; } }
.session.pill-mode .s-fold { margin: 0 4px 0 0; position: relative; }
.session.pill-mode .s-fold::before { content: ''; position: absolute; left: -3px; top: 5px; bottom: 5px; width: 1px; background: var(--rule-soft, rgba(0,0,0,.15)); }
.session.pill-mode .spill { padding-right: 9px; }
.session.pill-mode.folded .spill { display: inline-flex; align-items: center; gap: 5px; padding-left: 11px; padding-right: 7px; }
.session.pill-mode.folded .fold-ic { color: var(--muted, #8a7a5a); }
.session .h .s-fold { margin-left: 2px; }
/* The narrowest phones on the one-line card: the next-catch button is its creature's picture alone. */
@media (max-width: 340px) and (max-height: 720px) {
  [data-theme] #huntview .huntcard .hc-next .btn { font-size: 0; gap: 0; padding: 0 5px; }
}
/* Wider screens: the fold sits in the card's top-right corner, level with the area name, so a long creature name never
   pushes it onto a row of its own (Cole 2026-11-13). Phones keep it beside the name (their top row is hidden). */
@media (min-width: 761px) {
  #huntview .huntcard:not(.folded) .hc-fold { position: absolute; top: 7px; right: 8px; margin: 0; }
  #huntview .huntcard:not(.folded) .hc-top { padding-right: 28px; }
}
/* A Buy the purse can't cover says how short (client/bagshop.ts): one line, the coin icon inline. */
.bs-go { white-space: nowrap; }
.bs-go .bs-goc { width: 14px; height: 14px; margin: 0 2px 0 5px; vertical-align: -2px; }
.bs-go .bs-buyw { display: none; }
/* A phone's card has no room for it: the button stays Buy (greyed) and the total turns red. */
@media (max-width: 760px) { .bs-go .bs-shortby { display: none; } .bs-go .bs-buyw { display: inline; } }
[data-theme="codex"] .bs-total.short .coinv { color: #a3301f; }
/* Bestiary search and filters, beside the count. */
.dex-filt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dex-filt input { width: 150px; }
.dex-filt input, .dex-filt select { height: 30px; font-size: 13px; }
.dex-none { grid-column: 1 / -1; padding: 18px 4px; }
@media (max-width: 760px) { .dex-filt { flex: 1 1 100%; } .dex-filt input { flex: 1 1 110px; width: auto; min-width: 0; } .dex-filt select { flex: 0 1 auto; min-width: 0; } }

/* Tournaments › History (Jonny 11-17): your events as rows, newest first; a running one on top with a Live tag.
   Tap a row for its bracket. And the live strip over Events while your match runs. */
.tn-hist { padding: 12px; margin-bottom: 12px; }
.tn-hist h4 { margin: 0 0 8px; }
.tn-hist .actions { display: flex; gap: 6px; margin: 4px 0 10px; }
.tn-hlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tn-hrow { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-left: 3px solid var(--tc); border-radius: 10px; background: var(--panel-2); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tn-hrow:hover { border-color: color-mix(in srgb, var(--tc) 60%, var(--line)); border-left-color: var(--tc); }
.tn-hrow.live { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tc) 45%, transparent) inset; }
.tn-hrow .tn-emblem { width: 40px; height: 35px; }
.tn-hrow img.tn-emblem { image-rendering: auto; }
.tn-hmain { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.tn-hmain b { font-size: 14px; }
.tn-hmain small { flex-basis: 100%; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-hfin { display: flex; flex-direction: column; align-items: flex-end; text-align: right; min-width: 0; }
.tn-hfin b { font-size: 13px; }
.tn-hfin small { color: var(--muted); font-size: 11.5px; }
.tn-hfin.gold b { color: var(--gold, #e7b74a); }
.tn-hfin.out b { color: var(--muted); font-weight: 600; }
.tn-hfin > .tn-livetag { display: none; }
.tn-hgo { font-size: 20px; color: var(--muted); line-height: 1; }
.tn-livetag { display: inline-block; padding: 2px 6px; border-radius: 6px; background: #c0392b; color: #fff; font: 700 10px/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.tn-event .tn-back { margin-right: 4px; }
.tn-livepill { display: inline-flex; align-items: center; gap: 7px; margin: -4px 0 -4px 14px; padding: 3px 10px 3px 5px; line-height: 1.2; border: 1px solid color-mix(in srgb, var(--tc) 70%, #000); border-radius: 999px; background: linear-gradient(180deg, #2c2433, #1b1620); color: #f3e7cf; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 30%, transparent); animation: tn-live-glow 2.4s ease-in-out infinite; }
.tn-livepill:hover { background: linear-gradient(180deg, #382d40, #231c29); }
.tn-livepill .tn-lpw { color: #cbbd9f; font-size: 12px; }
.tn-livepill .tn-lpgo { font-size: 16px; line-height: 1; color: #cbbd9f; }
@keyframes tn-live-glow { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 55%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tn-livepill { animation: none; } }
@media (max-width: 760px) {
  .tn-tix > span { display: none; }
  .tn-livepill { margin-left: 8px; padding: 3px 8px 3px 4px; gap: 5px; }
  .tn-livepill .tn-lpw, .tn-livepill .tn-lpgo { display: none; }
}
@media (max-width: 520px) {
  .tn-hist { padding: 10px; }
  .tn-hist h4 { margin-bottom: 6px; }
  .tn-hlist { gap: 5px; }
  .tn-hrow { grid-template-columns: auto minmax(0, 1fr) minmax(0, max-content); gap: 7px; padding: 4px 8px 4px 4px; }
  .tn-hrow .tn-emblem { width: 30px; height: 26px; }
  .tn-hmain { flex-wrap: nowrap; display: grid; grid-template-columns: auto auto; justify-content: start; }
  .tn-hmain b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tn-hmain small { grid-column: 1 / -1; font-size: 11.5px; }
  .tn-hfin { max-width: 9.5em; }
  .tn-hfin b { font-size: 12px; line-height: 1.2; }
  .tn-hfin small { display: none; }
  .tn-hgo { display: none; }
  .tn-livetag { font-size: 9px; padding: 1px 5px; align-self: center; }
  .tn-hmain > .tn-livetag { display: none; }
  .tn-hfin > .tn-livetag { display: inline-block; align-self: flex-end; margin-bottom: 2px; }
  .pagetitle:has(.tn-livepill) [data-act="tn-refresh"] { display: none; }
}
.tn-rs { display: none; }

/* An opened bracket on a phone or a short window: no horizontal scroll (the columns share the width), a one-line
   match banner, no "Bracket" heading. */
@media (max-width: 760px), (max-height: 700px) {
  .tn-event > h4 { display: none; }
  .tn-event .tn-mb { margin-top: 8px; padding: 6px 8px; }
  .tn-event .tn-mb .bv-btn { min-height: 32px; padding: 0 12px; }
  .tn-bracket { overflow: visible; padding-bottom: 0; margin-top: 8px; }
  .tn-col { flex: 1 1 0; min-width: 0; }
  .tn-col h5 { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tn-m { padding: 4px 6px; font-size: 12px; min-width: 0; }
  .tn-m span b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tn-m span small { display: none; }
  .tn-event .ar-l-head { flex-wrap: wrap; row-gap: 2px; }
}
@media (max-width: 520px) {
  .tn-event { padding: 10px; }
  .tn-event .ar-l-head h3 { font-size: 16px; }
  .tn-event .ar-l-head > .muted { flex-basis: 100%; font-size: 12px; }
  .tn-rgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .tn-rounds { flex-wrap: nowrap; gap: 3px; margin-bottom: 6px; }
  .tn-rounds .btn { flex: 1 1 0; min-width: 0; padding-left: 4px; padding-right: 4px; }
  .tn-rl { display: none; }
  .tn-rs { display: inline; }
  .tn-bracket { gap: 6px; }
}

/* Events is where Tournaments opens now (Jonny 11-17): on a desktop window up to 800 tall with the Launch Cup up
   (and the hunt bar above the page), the three cards take the slim banner row and the Launch Cup a lower banner,
   so every card ends inside the window. */
@media (min-width: 1101px) and (max-height: 800px) {
  [data-theme="codex"] .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-hero { flex-direction: row; justify-content: center; gap: 12px; padding: 6px 12px; text-align: left; }
  [data-theme="codex"] .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-hero .tn-emblem, [data-theme="codex"] .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-hero img.tn-emblem { width: 56px; height: 49px; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-hero .tn2-name { align-items: flex-start; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-hero .tn2-kicker { margin: 0; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-hero h3 { font-size: 22px !important; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-tt { display: none; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2:not([data-tier="launch"]) .tn2-body { gap: 6px; padding: 8px 12px; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-prizes { gap: 2px; font-size: 13px; line-height: 1.3; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-fact { padding-top: 3px; padding-bottom: 3px; }
  .tn2-cards:has(.tn2[data-tier="launch"]) { gap: 10px; }
  .tn2[data-tier="launch"] .tn2-body { padding-top: 6px; padding-bottom: 6px; row-gap: 4px; }
  .tn2[data-tier="launch"] .tn2-hero .tn-emblem, .tn2[data-tier="launch"] .tn2-hero img.tn-emblem { width: 72px; height: 63px; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-chips { display: none !important; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn2-rules { display: block; margin: 0; color: var(--bad, #8a2a1c); font-size: 12px; line-height: 1.3; text-align: center; }
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn-in { margin: 0; font-size: 13px; }
  .tn2[data-tier="launch"] .tn2-rules { grid-column: 2; grid-row: 1; text-align: left !important; }
  /* Past champions are in History now. */
  .tn2-cards:has(.tn2[data-tier="launch"]) .tn-last { display: none; }
  .tn2[data-tier="launch"] .tn2-facts { gap: 3px; }
  [data-theme="codex"] .tn2[data-tier="launch"] .tn2-fact { padding-top: 2px; padding-bottom: 2px; }
}
/* itch's 860x585 frame: the Launch Cup card ended 2 px under the window. */
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 600px) { .tn2-prizes { gap: 2px; } }
.tn-rounds .btn.on { background: var(--tc); border-color: color-mix(in srgb, var(--tc) 70%, #000); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
/* The narrowest phones: the hunt card stops short of the scene tools, so its line keeps the speed and leaves the risk word, which no longer fits. */
@media (max-width: 340px) {
  #huntview .huntcard .facts:not(.early) > :nth-child(n+4) { display: none; }
}
/* Narrow pack cards: the gem price shows the sale price alone (the card price above it shows the cut). */
@media (min-width: 761px) and (max-width: 1100px) { [data-theme="codex"] .btn.dp-gem .dp-was { display: none; } }
/* Wider screens: the sale band shares the Starter Pack / Diamonds tab row (alone on a desktop, where those tabs hide). */
@media (min-width: 761px) {
  [data-theme="codex"] .dp-bar:has(.dp-sale) { display: flex; align-items: center; gap: 16px; margin: 0 0 10px; }
  [data-theme="codex"] .dp-bar:has(.dp-sale) .psec-tabs { flex: none; margin-bottom: 0; }
  [data-theme="codex"] .dp-bar .dp-sale { order: 1; flex: 1 1 auto; margin: 0; }
}
/* The sale band on a short window (itch 860x585, 800x600): one slim row, so the packs and their note still fit. */
@media (min-width: 761px) and (max-height: 720px) {
  [data-theme="codex"] .dp-sale { gap: 10px; margin: 0 0 4px; padding: 3px 12px 3px 3px; }
  [data-theme="codex"] .dp-sale-pct { min-width: 0; height: 26px; padding: 0 8px; font-size: 15px; }
  [data-theme="codex"] .dp-sale-txt b { font-size: 15px; }
  [data-theme="codex"] .dp-sale-what { display: none; }
  [data-theme="codex"] .dp-sale-end { font-size: 12px; }
}
/* The smallest phones (568 px tall): the Season pass card ran under the bottom bar by about 20 px. */
@media (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] .pz-main { row-gap: 4px; padding: 6px 12px 8px; }
  [data-theme="codex"] .pz-season .ps-emblem { width: 36px; height: 36px; }
  [data-theme="codex"] #page[data-view="pass"] .pagetitle { padding-bottom: 4px; margin-bottom: 4px; }
}
/* Map area panel on a short phone (640-700 px tall): the way on to the next area ran under the bottom bar. The hunt
   card's "first form" note steps aside (the Bestiary has it) and the rows around the card get slimmer. */
@media (max-width: 760px) and (max-height: 700px) {
  .hcard .hc-note { display: none; }
  .ap-head { padding-top: 6px; padding-bottom: 4px; }
  .ap-better { margin-bottom: 6px; padding-block: 4px; }
  [data-theme] .ap-foot .btn { min-height: 32px; }
  .ap-foot { padding-top: 4px; padding-bottom: 6px; }
}
/* The smallest phones (568 px tall, or 548 under Safari's bars): on the area tab the lead and rate pickers step aside
   (they colour the map), and the map itself may come down to 180 px so the region switch stays on screen. */
@media (max-width: 760px) and (max-height: 600px) {
  #pane > div:has(> nav.psec-tabs > button.on:nth-child(2)) > .mhead > :is(label, .seg:not(.mview)) { display: none; }
  .hcard .hc-sub > .muted { display: none; }
  .hcard .tiles { margin-top: 4px; }
  .ap-cards { padding-bottom: 4px; }
  .ap-drops { margin-top: 2px; }
  .mapart { min-height: 180px; }
}
@media (max-width: 340px) and (max-height: 600px) { .mapart { --map-room: 366px; } }
/* Phones under 600 px tall: the Shop's title row steps aside (its tabs and the lit Shop tab below say where you are),
   so the picked egg's Incubate button stays on screen; the Bag's pockets sit a little closer. */
@media (max-width: 760px) and (max-height: 600px) {
  #page[data-view="shop"] #pagehead > .pagetitle:not(.has-ph-back) { display: none; }
  [data-theme="codex"] .bp-grid.many { gap: 3px; }
  [data-theme="codex"] .bp-grid.many .bp-card { padding-top: 2px; padding-bottom: 3px; }
}
/* Season pass on phones under 600 px tall: Premium+'s Unlock button sat under the bottom bar. The two offers stand
   side by side with smaller type (each button keeps its own row), and the title's diamond count, which the top bar
   shows too, steps aside. */
@media (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] #page[data-view="pass"] .pagetitle .coinv.big { display: none; }
  [data-theme="codex"] .pz-offers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  [data-theme="codex"] .pz-offer { gap: 5px; padding: 8px 8px 9px; align-content: start; grid-template-rows: auto 1fr auto; }
  [data-theme="codex"] .pz-offer-h { flex-wrap: wrap; row-gap: 2px; }
  [data-theme="codex"] .pz-offer-h b { font-size: 17px; }
  [data-theme="codex"] .pz-offer-h .coinv { font-size: 14px; }
  [data-theme="codex"] .pz-offer ul { gap: 2px; align-content: start; font-size: 12px; line-height: 1.2; }
  [data-theme="codex"] .pz-offer-h > b img { display: none; }
  [data-theme="codex"] .pz-offer.best .pz-offer-h { margin-top: 8px; }
  [data-theme="codex"] .pz-offer li::before { margin-right: 3px; font-size: 9px; }
  [data-theme="codex"] .pz-offer .btn { min-height: 34px; padding-inline: 6px; }
}
/* Bestiary on a phone: the caught count and My Bestiary / All sprites share the first row, the search and filters
   take the second, so the grid keeps a row more (the 568 px phones had their pager under the bottom bar). */
@media (max-width: 760px) {
  .dex-head { row-gap: 6px; }
  .dex-head .dex-count { order: 0; }
  .dex-head .dexall-seg { order: 1; margin: 0 0 0 auto; }
  .dex-head .dex-filt { order: 2; }
}
@media (max-width: 340px) {
  .dex-head .dex-count { font-size: 12px; }
  .dex-head .dexall-seg .btn { padding-inline: 8px; font-size: 11px; letter-spacing: .02em; }
  .dex-filt { gap: 4px; }
  .dex-filt input { flex-basis: 80px; }
  .dex-filt select { font-size: 12px; padding-left: 6px; padding-right: 20px; }
}
/* Phones under 600 px tall: slimmer page edges and title row on every page (about 12 px back for the content). */
@media (max-width: 760px) and (max-height: 600px) {
  .page-inner { padding-top: 4px; padding-bottom: 4px; }
  [data-theme="codex"] .pagetitle { padding-bottom: 4px; margin-bottom: 4px; }
  [data-theme="codex"] .calc input[type=number], [data-theme="codex"] .calc select { min-height: 26px; height: 26px; }
}
@media (max-width: 760px) and (max-height: 600px) {
  [data-theme="codex"] .pz-col, [data-theme="codex"] .pz-col.ms, [data-theme="codex"] .pz-col.hero, [data-theme="codex"] .pz-lab { grid-template-rows: 48px 20px 48px; }
  [data-theme="codex"] .calc h5 { margin: 4px 0 1px; }
}
/* 360x640: the Bag's last row of pockets ran 1 px under the bottom bar. */
@media (max-width: 760px) and (max-height: 700px) { [data-theme="codex"] .bp-grid.many { row-gap: 4px; } }
