/* =============================================================================
   cookie-dex/grid.css — the Cookie-Dex GRID's own components (proposal §2)
   -----------------------------------------------------------------------------
   Linked last on /cookie-dex/ (proposal §2.1):
     shared-shell.css -> design-system.css -> styles-art-dials.css -> dex.css
     -> grid.css
   Built ONLY from the system's --th-* tokens and dex.css's atoms and tokens.
   Where this file needs a value of its own it is a SIZE, or a --dex-* token
   declared once in G0. Every rule leads with .th (or body.th-page for page
   chrome); light rules lead with :root[data-theme="light"], never change a
   border width and name the state they style. Layout is container queries on
   .th; the only viewport queries are page chrome (the sticky offsets, the
   short-screen header) - the Comfy banner's own 699/700 query lives in dex.css.

   SECTIONS
     G0  page tokens, [hidden], the skip link
     G1  dex-head: the framed header, the emblem, "New this update"
     G2  dex-coll: the Your collection panel (desktop) / binder strip (phone)
     G3  dex-toolbar
     G4  dex-results: the results line (sticky on phones)
     G5  dex-facets: the Filters panel, in flow
     G6  the Compact grid and the BAND TILE
     G7  the banded layouts: Comfy (always) and Compact with full heads (F2)
     G9  dex-collectbar: Collection mode
     G10 the A–Z directory band
     G11 phones (<=700 container), the narrowest phones, short screens
     G12 forced colours, reduced motion
     G13 menus (Sort, Undo)
     G14 dex-settings: Collection settings, in flow
     G15 states: empty result, load error, loading reservation
     G16 Collection mode on the tiles
     G17 the sync chip
     G18 display settings, pressed states, small pieces
     G8  the Quick look (1b); G8b the Breakdown band; G8c the search combobox;
         G9b Collection mode's tap modes
     L   light theme
   ========================================================================== */


/* ---------- G0 · page tokens ---------- */
.th.dex-index {
  /* the grid's column gap, restated from dex.css D5 so a band tile can size
     its corner from the cell width (calc below) */
  --dex-gap-x: 14px;
  /* the Your collection panel: 380 at >=1200 (six 58px ring columns, so
     "Collected" and "Promotion" never touch), 352 below (G1 mid width) */
  --dex-coll-w: 380px;
  /* the emblem (the page's LCP, 300 x 300) and how far it breaks out of the
     frame's top, as Arena's emblem breaks out of its art */
  --dex-emblem: 300px;
  --dex-emblem-lift: 26px;
}
/* one cell of the Compact grid, from the .th container's width and the
   stated column count (declared where dex.css states --dex-cols) */
.th .dex-tiles { --dex-cell: calc((100cqw - (var(--dex-cols, 8) - 1) * var(--dex-gap-x)) / var(--dex-cols, 8)); }
/* the global [hidden] guarantee (PC §0.7): nothing on the page outranks it */
.th.dex-index [hidden] { display: none !important; }
.th .dex-skip:focus { position: fixed; z-index: 300; left: 16px; top: 12px; width: auto; height: auto; margin: 0; padding: 10px 16px; clip: auto; border-radius: 999px; background: var(--th-gold-btn); color: var(--th-on-gold); font-weight: 700; white-space: nowrap; }
/* a text button styled as the system link */
.th .dex-linkbtn { display: inline-block; padding: 2px 0; border: 0; background: none; font: inherit; font-weight: 600; line-height: 20px; color: var(--th-link); vertical-align: baseline; }
.th .dex-linkbtn b { color: inherit; }
.th .dex-linkbtn:hover { text-decoration: underline; }


/* ---------- G1 · dex-head: the framed header ---------- */
/* The hub header's shape (gold frame, corner gems, inset rings) on
   --th-surface-1, lit by the emblem cookie's RARITY (--th-rc-rgb) and its
   element, never battle art. */
.th .dex-head { position: relative; margin-top: calc(6px + var(--dex-emblem-lift)); border-radius: 22px; border: 1px solid var(--th-gold-line); background: var(--th-surface-1); box-shadow: inset 0 0 0 4px rgba(var(--th-abyss-rgb), 0.55), inset 0 0 0 5px var(--th-gold-faint), var(--th-shadow-2); }
.th .dex-head-clip { position: absolute; inset: 0; border-radius: 21px; overflow: hidden; pointer-events: none; }
/* the bottom corner gems (the system draws the top pair; the hub's own sheet
   places the bottom pair, which this page does not link) */
.th .dex-head > .th-orn--bl { bottom: -5px; left: 40px; }
.th .dex-head > .th-orn--br { bottom: -5px; right: 40px; }
.th .dex-head-glow { position: absolute; inset: 0; background:
    radial-gradient(380px 300px at calc(100% - var(--dex-coll-w) - 230px) 62%, rgba(var(--th-rc-rgb), 0.34), rgba(var(--th-rc-rgb), 0) 72%),
    radial-gradient(300px 240px at calc(100% - var(--dex-coll-w) - 200px) 30%, rgba(var(--th-el), 0.24), rgba(var(--th-el), 0) 72%),
    radial-gradient(620px 300px at 0% 0%, rgba(var(--th-m-rgb), 0.08), rgba(var(--th-m-rgb), 0) 70%),
    linear-gradient(180deg, var(--th-surface-1) 0%, var(--th-ground) 100%); }
.th .dex-head-in { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) var(--dex-coll-w); gap: 18px; align-items: stretch; padding: 16px 16px 16px 32px; }
.th .dex-head-copy { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: min(600px, calc(100% - var(--dex-emblem) - 20px)); padding: 2px 0; }
.th .dex-head-title { margin-top: 6px; font-size: 46px; line-height: 1; text-shadow: var(--th-heading-shadow), 0 0 30px rgba(var(--th-m-rgb), 0.3); }
.th .dex-head-lede { margin-top: 9px; max-width: 540px; font-size: 15px; line-height: 1.5; color: var(--th-ink-2); }
.th .dex-head-row { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.th .dex-head-facts { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 13.5px; color: var(--th-ink-3); }
.th .dex-head-facts b { color: var(--th-ink); font-weight: 700; }
/* the emblem: the newest released cookie's full-body art (the LCP), standing
   between the copy and the panel and breaking out of the frame's top */
.th .dex-head-emblem { position: absolute; z-index: 1; top: calc(-1 * var(--dex-emblem-lift)); right: calc(var(--dex-coll-w) + 34px); width: var(--dex-emblem); height: calc(var(--dex-emblem) - 24px); object-fit: contain; object-position: 50% 30%; filter: drop-shadow(0 16px 22px rgba(var(--th-abyss-rgb), 0.7)) drop-shadow(0 0 26px rgba(var(--th-rc-rgb), 0.22)); pointer-events: none; }
/* "New this update": the current block's cookies; pressing it applies the
   filter. Never empty (with no cookie in the block it reads "Newest: …"). */
.th .dex-newline { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-height: 44px; padding: 4px 14px 4px 6px; border: 0; border-radius: 999px; background: var(--th-btn-bg); color: var(--th-ink); text-align: left; transition: background-color 0.15s ease; }
.th .dex-newline:hover { background: var(--th-btn-hover); }
.th .dex-newline:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .dex-newline-k { font-size: 10.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--th-gold); }
.th .dex-newline-faces { display: inline-flex; flex: none; padding-left: 2px; }
.th .dex-newline-faces .th-face { border-radius: 50%; }
.th .dex-newline-faces .th-face + .th-face { margin-left: -6px; box-shadow: 0 0 0 2px var(--th-surface-2); }
.th .dex-newline-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.th .dex-newline-tx b { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .dex-newline-tx > span { font-size: 12px; color: var(--th-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .dex-newline-tx .th-dot { padding: 0 4px; }
.th .dex-newline-ic { width: 15px; height: 15px; color: var(--th-btn-icon); margin-left: 4px; }


/* ---------- G2 · dex-coll: Your collection ---------- */
/* Drawn for everyone, at the SAME fixed height in every auth state (the
   unreserved 116-147px shift retires, GC §9). */
.th .dex-coll { position: relative; z-index: 2; display: flex; flex-direction: column; min-width: 0; padding: 10px 14px 8px 16px; border-radius: 16px; background: var(--th-glass); border: 1px solid var(--th-gold-line); box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.3), inset 0 0 0 4px var(--th-gold-faint); }
.th .dex-coll-head { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-right: -4px; }
.th .dex-coll-k { margin: 0 auto 0 0; font: 700 12px/1 "Outfit", system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--th-gold); text-shadow: none; }
.th .dex-gear.th-btn { width: 36px; height: 36px; flex: none; }
.th .dex-gear svg { width: 17px; height: 17px; }
/* the sync chip: Synced · Saving… · This device only · Not synced · Retry */
.th .dex-sync { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--th-ink-2); background: var(--th-btn-track); white-space: nowrap; }
.th .dex-sync svg { width: 13px; height: 13px; stroke-width: 2.4; }
.th .dex-sync[data-sync="synced"] svg { color: var(--th-own); }
.th .dex-sync[data-sync="local"] svg { color: var(--th-gold); stroke-width: 2; }
.th .dex-sync[data-sync="failed"] { color: var(--th-down); }
.th .dex-coll-big { margin-top: 2px; display: flex; align-items: baseline; gap: 7px; }
.th .dex-coll-big > b { font: 700 28px/1 "CookieRun KR", "Outfit", sans-serif; color: var(--th-heading); text-shadow: var(--th-heading-shadow); }
.th .dex-coll-big > span { font-size: 14px; font-weight: 600; color: var(--th-ink-2); }
.th .dex-info { align-self: center; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--th-ink-3); }
.th .dex-info:hover { background: var(--th-btn-bg); color: var(--th-ink); }
.th .dex-info svg { width: 16px; height: 16px; }
.th .dex-coll-line { margin-top: 5px; font-size: 13px; line-height: 1.45; color: var(--th-ink-3); }
.th .dex-coll-line > b { color: var(--th-ink); font-weight: 700; }
.th .dex-coll-line .th-dot { padding: 0 5px; }
.th .dex-coll-line .dex-linkbtn { font-size: 13px; }
.th .dex-coll-signin { display: inline-block; padding: 4px 0; line-height: 16px; font-weight: 700; color: var(--th-link); }
.th .dex-coll-signin:hover { text-decoration: underline; }
.th .dex-coll-meter { margin-top: 9px; }
.th .dex-rings { margin-top: 8px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 3px; }
.th .dex-rings .dex-ringbtn { min-width: 0; padding: 4px 0 3px; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--th-ink-3); }
.th .dex-coll-note { margin-top: 10px; display: flex; align-items: flex-start; gap: 7px; padding-top: 9px; border-top: 1px dashed var(--th-line-2); font-size: 12.5px; line-height: 1.4; color: var(--th-ink-3); }
.th .dex-coll-note svg { width: 15px; height: 15px; margin-top: 1px; color: var(--th-gold); }
.th .dex-coll-note a { color: var(--th-link); font-weight: 600; }
/* the guest panel keeps the signed-in panel's height: its note takes the room
   the "fully maxed · dormant" line and the rings' second sense would */
.th .dex-coll.is-guest .dex-rings { margin-top: 9px; }
/* the phone binder strip (G11) is hidden on a wide container */
.th .dex-binder { display: none; }


/* ---------- G3 · dex-toolbar ---------- */
.th .dex-toolbar { position: sticky; top: var(--th-sticky-top); z-index: 20; margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 56px; padding: 8px; border-radius: 16px; background: var(--th-surface-1); border: 1px solid var(--th-line-2); box-shadow: var(--th-shadow-1); }
.th .dex-tb-search { flex: 1 1 300px; min-width: 240px; }
.th .dex-tb-effect { flex: 0 1 260px; min-width: 200px; }
.th .dex-toolbar .dex-field { min-height: 40px; }
.th .dex-tb-filters { flex: none; }
.th .dex-tb-filters > summary { list-style: none; cursor: pointer; }
.th .dex-tb-filters > summary::-webkit-details-marker { display: none; }
.th .dex-tb-filters[open] > summary { color: var(--th-sel-ink); background: var(--th-sel-bg); box-shadow: var(--th-sel-shadow); }
.th .dex-tb-filters[open] > summary svg { color: currentColor; }
.th .dex-tb-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 800; color: var(--th-on-gold); background: var(--th-gold-fill); }
.th .dex-tb-seg button { height: 32px; }
.th .dex-tb-fav.th-btn { flex: none; }
.th .dex-tb-fav img { width: 20px; height: auto; }
.th .dex-tb-fav[aria-pressed="true"] { background: var(--th-sel-bg); }
.th .dex-tb-collect { flex: none; }
/* the two-row toolbar's line break (below a 1240px container only) */
.th .dex-tb-break { display: none; }
/* while the mode is on, its button is a selected chip, not gold */
.th .dex-collect-btn.is-on { color: var(--th-sel-ink); background: var(--th-sel-bg); box-shadow: var(--th-sel-shadow); }
.th .dex-collect-btn.is-on svg { color: currentColor; }
/* the status-effect chip strip: a full-width row of the toolbar while the
   field is in use or a selection is narrowing the grid (hidden otherwise, so
   idle it costs no height); [data-chip-wrap="effect"] is the specs' hook */
.th .dex-effect-strip { flex: 1 1 100%; order: 10; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 2px; }
.th .dex-effect-strip .dex-facet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.th .dex-effect-empty { font-size: 13px; color: var(--th-ink-3); }

@container th (max-width: 1240px) {
  /* two rows, still sticky: search · effect · Filters / segment · ★ · mode */
  .th .dex-toolbar { flex-wrap: wrap; }
  .th .dex-tb-search { flex: 1 1 300px; min-width: 160px; }
  .th .dex-tb-effect { flex: 1 1 220px; min-width: 160px; }
  .th .dex-tb-seg { margin-right: auto; }
  .th .dex-tb-break { display: block; flex: 0 0 100%; height: 0; }
}


/* ---------- G4 · dex-results ---------- */
.th .dex-results { display: flex; align-items: center; gap: 12px; min-height: 36px; margin-top: 10px; padding: 0 2px; }
.th .dex-results-count { flex: none; display: block; font-size: 14px; color: var(--th-ink-3); white-space: nowrap; }
.th .dex-results-count > b { font-size: 15px; color: var(--th-ink); font-weight: 800; }
.th .dex-results-clear { margin-left: 10px; font-size: 13.5px; }
.th .dex-results-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 auto; }
.th .dex-results-chips:empty { flex: 1 1 auto; }
/* an active filter: a real button that drops itself ("Effect: Stun") */
.th .dex-ab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 12px; border: 0; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--th-ink); background: var(--th-btn-bg); white-space: nowrap; }
.th .dex-ab:hover { background: var(--th-btn-hover); }
.th .dex-ab svg { width: 14px; height: 14px; color: var(--th-btn-icon); stroke-width: 2.3; }
.th .dex-results-ctl { flex: none; margin-left: auto; display: flex; align-items: center; gap: 10px; }
.th .dex-sort { position: relative; }
.th .dex-sort-btn.th-btn { gap: 7px; padding: 0 11px 0 12px; }
.th .dex-sort-k { color: var(--th-ink-3); font-weight: 600; }
.th .dex-sort-btn svg:last-child { width: 14px; height: 14px; }
.th .dex-dens button { height: 30px; }


/* ---------- G5 · dex-facets: the Filters panel, in flow ---------- */
/* Opens under the toolbar and pushes the results down (the owner's decision);
   #filterGrid sits OUTSIDE the <details> so it takes the full width. Each
   group is one labelled row; every count is the result size if you pressed
   that chip, given the other groups. */
.th .dex-facets { margin-top: 10px; display: grid; gap: 10px; padding: 14px 16px 12px; border-radius: 16px; background: var(--th-surface-1); border: 1px solid var(--th-line-2); box-shadow: var(--th-shadow-1); }
.th .dex-facet { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: start; gap: 10px; }
.th .dex-facet-head { min-width: 0; padding-top: 12px; }
/* a group's picks by name: a phone draws the art alone (below) */
.th .dex-facet-sel { display: none; }
.th .dex-facet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.th .dex-facet-pair { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 10px 24px; }
.th .dex-facets .dex-chip-ic--ribbon { height: 17px; max-width: 96px; }
/* the Tier row's add-on, Meta Cookies: its own group after the tier chips,
   marked by a gold spark (a divider would start a line wherever it wraps) */
.th .dex-facet-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.th .dex-facet-line > [data-chip-wrap="tier"]:empty { display: none; }
.th .dex-facet-addon[hidden] { display: none; }
.th .dex-facet-addon .dex-chip--text { padding-left: 10px; }
.th .dex-chip-glyph { width: 15px; height: 15px; flex: none; fill: var(--th-gold); stroke: none; }
.th .dex-chip[aria-pressed="true"] .dex-chip-glyph { fill: currentColor; }
.th .dex-facets-foot { display: flex; align-items: center; gap: 16px; margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--th-line); }
.th .dex-facets-note { margin-right: auto; font-size: 12.5px; color: var(--th-ink-3); }
.th .dex-facets-foot .dex-linkbtn { font-size: 13.5px; white-space: nowrap; }
/* "Show N cookies": the selected-chip style, never gold (§6.1) */
.th .dex-show-btn { display: inline-flex; flex: none; align-items: center; gap: 8px; height: 38px; white-space: nowrap; padding: 0 18px 0 15px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--th-sel-ink); background: var(--th-sel-bg); box-shadow: var(--th-sel-shadow); }
.th .dex-show-btn svg { width: 16px; height: 16px; }
.th .dex-show-btn:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 2px; }


/* the Filters panel shows exactly while its disclosure is open: #filterGrid
   sits OUTSIDE the <details> (so it spans the page), and its visibility is the
   disclosure's own state, matched here rather than mirrored by script */
.th.dex-index:not(:has(.filters-details[open])) .dex-facets { display: none; }
/* the middle width: Type and Position each take the row (side by side, Type's
   chips ran two to a line) */
@container th (max-width: 1080px) {
  .th .dex-facet-pair { grid-template-columns: minmax(0, 1fr); }
}


/* ---------- G6 · the Compact grid and the BAND TILE ---------- */
.th .dex-grid { margin-top: 8px; }
/* a band tile takes one cookie tile's footprint and carries the band head's
   own parts: the ribbon, the CookieRun name (never truncated), the count, the
   own meter, the gold rule with its diamond and the collapse toggle. Dashed,
   so it never reads as a cookie. It insets by the tile's ring room so its box
   lines up with the portraits beside it. */
.th .dex-bandtile { --dex-bt-r: calc(var(--dex-cell) * 0.2); position: relative; align-self: stretch; display: flex; flex-direction: column; min-width: 0; margin: 5px 5px 0; padding: 11px 12px 9px; border-radius: var(--dex-bt-r); border: 1px dashed rgba(var(--th-rc-rgb), 0.5); background:
    radial-gradient(120% 70% at 0% 0%, rgba(var(--th-rc-rgb), 0.2), rgba(var(--th-rc-rgb), 0) 70%),
    linear-gradient(180deg, var(--th-surface-1), var(--th-surface-sunk)); }
.th .dex-bandtile.is-complete { border-style: solid; border-color: rgba(var(--th-own-rgb), 0.45); background:
    radial-gradient(120% 70% at 0% 0%, rgba(var(--th-rc-rgb), 0.2), rgba(var(--th-rc-rgb), 0) 70%),
    radial-gradient(90% 60% at 100% 100%, rgba(var(--th-own-rgb), 0.1), rgba(var(--th-own-rgb), 0) 70%),
    linear-gradient(180deg, var(--th-surface-1), var(--th-surface-sunk)); }
/* a RARITY band's tile carries its rarity bolder: the corner wash reaches
   further in and starts stronger (owner's call, 2026-11-06); every other
   band kind keeps the quieter wash above */
.th .dex-bandtile[class*=" r-"] { background:
    radial-gradient(150% 115% at 0% 0%, rgba(var(--th-rc-rgb), 0.4), rgba(var(--th-rc-rgb), 0.17) 45%, rgba(var(--th-rc-rgb), 0) 84%),
    linear-gradient(180deg, var(--th-surface-1), var(--th-surface-sunk)); }
.th .dex-bandtile.is-complete[class*=" r-"] { background:
    radial-gradient(150% 115% at 0% 0%, rgba(var(--th-rc-rgb), 0.4), rgba(var(--th-rc-rgb), 0.17) 45%, rgba(var(--th-rc-rgb), 0) 84%),
    radial-gradient(90% 60% at 100% 100%, rgba(var(--th-own-rgb), 0.1), rgba(var(--th-own-rgb), 0) 70%),
    linear-gradient(180deg, var(--th-surface-1), var(--th-surface-sunk)); }
.th .dex-bt-top { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.th .dex-bt-ribbon { height: 18px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; filter: drop-shadow(0 2px 3px rgba(var(--th-abyss-rgb), 0.6)); }
.th .dex-bt-name { font-size: 17px; line-height: 1.08; overflow-wrap: normal; word-break: keep-all; }
/* a band with no ribbon names its kind above the name (Letter, Update, Tier,
   Progress), as the system band head's kicker chip does */
.th .dex-bt-k { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--th-gold); line-height: 1; }
.th .dex-bt-n { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; font: 700 26px/1 "CookieRun KR", "Outfit", sans-serif; color: var(--th-heading); text-shadow: var(--th-heading-shadow); }
.th .dex-bt-n > span { font-size: 0.62em; color: var(--th-ink-3); text-shadow: none; }
.th .dex-bt-sub { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 9px; font-size: 12px; line-height: 1.3; color: var(--th-ink-3); }
.th .dex-bt-sub b { color: var(--th-ink); font-weight: 700; }
.th .dex-bt-sub .th-dot { padding: 0 4px; }
.th .dex-bt-done { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--th-own-ink); }
/* a filled gem, never a checkmark (the owner's rule: the green frame is the signal) */
.th .dex-bt-done > i { width: 6px; height: 6px; transform: rotate(45deg); background: var(--th-own); }
.th .dex-bt-short { display: none; }
.th .dex-bt-meter { margin-top: 8px; }
.th .dex-bt-fan { margin-top: 7px; display: flex; align-items: center; }
.th .dex-bt-fan .th-face { margin-left: -6px; box-shadow: 0 0 0 1.5px var(--th-surface-1); }
.th .dex-bt-fan .th-face:first-child { margin-left: 0; }
.th .dex-bt-fan i { margin-left: 4px; font-style: normal; font-size: 12px; font-weight: 700; color: var(--th-ink-3); }
.th .dex-bt-shown { margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--th-ink-2); }
.th .dex-bt-foot { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 28px; }
/* the band head's gold rule with its diamond, along the tile's foot */
.th .dex-bt-rule { position: relative; flex: 1; height: 1px; margin-left: 5px; background: linear-gradient(90deg, var(--th-gold-line), rgba(var(--th-m-rgb), 0)); }
.th .dex-bt-rule::before { content: ""; position: absolute; left: -5px; top: -4px; width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--th-gold); background: var(--th-surface-sunk); }
.th .dex-bt-tog { display: grid; place-items: center; width: 28px; height: 28px; flex: none; padding: 0; border: 0; border-radius: 50%; background: var(--th-btn-bg); color: var(--th-btn-icon); }
.th .dex-bt-tog:hover { background: var(--th-btn-hover); }
.th .dex-bt-tog:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .dex-bt-tog svg { width: 15px; height: 15px; }
/* Collection mode: the toggle row becomes "Collect all N" (add-only) */
.th .dex-bt-collect.th-btn { width: 100%; height: 30px; padding: 0 8px; font-size: 12.5px; gap: 5px; }
.th .dex-bt-collect.th-btn:disabled { color: var(--th-ink-3); cursor: default; }
/* the ribbon-alone option (N2, the owner's call): the ribbon is the name */
.th .dex-bandtile--ribbon .dex-bt-ribbon { height: 22px; }
/* signed out with nothing tracked: the count is the band's size */
.th .dex-bt-n--plain > b { font-weight: 700; }
/* focus mode (a Quick look open): band tiles step back with the art */
.th [data-look-open] .dex-bandtile { opacity: 0.55; filter: saturate(0.4); transition: opacity 0.18s ease, filter 0.18s ease; }
.th [data-look-open] .dex-bandtile:is(:hover, :focus-within) { opacity: 1; filter: none; }


/* ---------- G7 · the banded layouts (Comfy; Compact with full heads) ---------- */
/* full system bands with alternating strips (.th-bands > .th-band, design
   system section 7). The rarity ribbon PNG stands where the kicker chip does. */
.th .dex-bands { margin-top: 4px; }
.th .dex-band-ribbon { align-self: center; height: 20px; width: auto; flex: none; filter: drop-shadow(0 2px 3px rgba(var(--th-abyss-rgb), 0.6)); }
.th .dex-band-meter { width: 110px; flex: none; }
.th .dex-band .dex-banners, .th .dex-band .dex-tiles { margin-top: 2px; }
.th .dex-band > .th-more { margin-top: 16px; }
/* Comfy banners break out of their top: give each band's first row the room */
.th .dex-band .dex-banners { padding-top: 10px; }


/* ---------- G8 · the Quick look (1b, proposal §2.9) ---------- */
/* A full-width grid item after the pressed tile's row (placed by app.js from
   the stated column count), a caret at the tile. Desktop (>=1080 container)
   is three columns, Stage | answer | Your progress, ~300px tall; the middle
   width puts progress under the two; a phone keeps it within 60% of the
   viewport: a 96 x 112 Stage beside the name, the build clamped to two lines,
   the progress tray, then the actions. Every colour is a system token; the
   one gold control is "Open full profile" (§6.1). */
.th .dex-look { --dex-look-stage-w: 260px; grid-column: 1 / -1; position: relative; display: grid; grid-template-columns: var(--dex-look-stage-w) minmax(0, 1fr) minmax(0, 380px) 32px; grid-template-rows: auto 1fr auto; grid-template-areas: "stage id prog close" "stage build prog ." "stage acts acts acts"; gap: 12px 24px; min-width: 0; margin: 4px 0 6px; padding: 16px 18px 16px 16px; border-radius: 20px; border: 1px solid var(--th-gold-line); background:
    radial-gradient(420px 260px at 130px 70%, rgba(var(--th-rc-rgb, 120, 128, 150), 0.12), rgba(var(--th-rc-rgb, 120, 128, 150), 0) 72%),
    var(--th-surface-1);
  box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.3), inset 0 0 0 4px var(--th-gold-faint), var(--th-shadow-2);
  scroll-margin-top: calc(var(--th-sticky-top) + var(--dex-toolbar-h, 72px) + 14px); scroll-margin-bottom: 14px; }
.th .dex-look:focus { outline: none; }
.th .dex-look:focus-visible { outline: 3px solid var(--th-focus-color); outline-offset: 3px; }
.th .dex-look-main { display: contents; }
/* the caret: a rotated square whose top-left edges point up at the tile */
.th .dex-look-caret { position: absolute; z-index: 1; top: -9px; left: clamp(18px, calc(var(--dex-caret-x, 50%) - 8px), calc(100% - 34px)); width: 16px; height: 16px; transform: rotate(45deg); background: var(--th-surface-1); border-top: 1px solid var(--th-gold-line); border-left: 1px solid var(--th-gold-line); pointer-events: none; }
/* the close button keeps a column of its own at the top right, so it never
   sits on the progress well (a phone floats it over the corner instead) */
.th .dex-look-x { grid-area: close; align-self: start; justify-self: end; margin-left: -14px; }
/* the Stage: the hero WebP, contained (no dials), on the position lane's lit
   platform over the rarity's light; the same file the profile's Stage draws */
.th .dex-look-stage { grid-area: stage; position: relative; overflow: hidden; min-height: 268px; border-radius: 16px; background:
    radial-gradient(70% 60% at 50% 70%, rgba(var(--th-rc-rgb, 120, 128, 150), 0.42), rgba(var(--th-rc-rgb, 120, 128, 150), 0) 72%),
    radial-gradient(52% 30% at 50% 92%, rgba(var(--th-el), 0.3), rgba(var(--th-el), 0) 72%),
    var(--th-surface-sunk);
  box-shadow: inset 0 0 0 1px var(--th-line-2); }
.th .dex-look-stage .dex-plat { bottom: 7%; width: 72%; z-index: 1; }
.th .dex-look-art { position: absolute; z-index: 2; left: 4%; top: 3%; width: 92%; height: 86%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 8px 12px rgba(var(--th-abyss-rgb), 0.55)); }
.th .dex-look-art.is-missing { display: none; }
.th .dex-look-ini { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; font: 700 44px/1 "CookieRun KR", "Outfit", sans-serif; color: var(--th-ink-3); visibility: hidden; }
.th .dex-look-stage:has(.dex-look-art.is-missing) .dex-look-ini { visibility: visible; }
.th .dex-look-stage.is-dark-art .dex-look-art { filter: drop-shadow(0 0 1px rgba(236, 228, 255, 0.95)) drop-shadow(0 0 10px rgba(var(--th-el), 0.9)) brightness(1.18); }
/* the answer: kicker, the name (the profile link), the fact chips */
.th .dex-look-id { grid-area: id; min-width: 0; padding-top: 4px; }
.th .dex-look-k { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--th-ink-3); }
.th .dex-look-ribbon { display: block; height: 18px; width: auto; filter: drop-shadow(0 2px 3px rgba(var(--th-abyss-rgb), 0.6)); }
.th .dex-look-name { margin-top: 8px; font-size: 30px; line-height: 1.05; text-wrap: balance; }
.th .dex-look-name a { color: var(--th-heading); text-decoration: none; }
.th .dex-look-name a:hover { color: var(--th-gold); }
.th .dex-look-name a:focus-visible { outline: 2px solid var(--th-focus-color); outline-offset: 3px; border-radius: 6px; }
.th .dex-look-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.th .dex-look-fact { display: inline-flex; align-items: baseline; gap: 7px; min-height: 30px; padding: 6px 12px 5px; border-radius: 999px; background: var(--th-btn-track); font-size: 13.5px; line-height: 1.2; }
.th .dex-look-fact dt { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--th-ink-3); }
.th .dex-look-fact dd { margin: 0; font-weight: 700; color: var(--th-ink); }
.th .dex-look-fact-sub { font-weight: 600; color: var(--th-ink-2); }
/* the build line: the toppings and tart lead, the beascuit follows */
.th .dex-look-build { grid-area: build; display: flex; align-items: baseline; gap: 10px; min-width: 0; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--th-wash); border: 1px solid var(--th-line); font-size: 14px; line-height: 1.45; color: var(--th-ink-2); }
.th .dex-look-build .th-label { flex: none; }
.th .dex-look-build b { color: var(--th-ink); font-weight: 700; }
.th .dex-look-build.is-empty .dex-look-build-tx { color: var(--th-ink-3); }
/* the actions: gold Open full profile, the guide, ‹ › through your list */
/* the actions row runs the full width under the progress panel (owner's
   layout, 2026-10-27), so the walk sits at the frame's far right on the same
   line as Open full profile and Read the guide instead of a row of its own */
.th .dex-look-acts { grid-area: acts; align-self: end; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.th .dex-look-build { align-self: start; }
.th .dex-look-open svg, .th .dex-look-guide svg { width: 17px; height: 17px; }
.th .dex-look-walk { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; }
.th .dex-look-pos { font-size: 12.5px; font-weight: 600; color: var(--th-ink-3); white-space: nowrap; }
.th .dex-look-step.th-btn { gap: 5px; max-width: 13em; }
.th .dex-look-step svg { width: 15px; height: 15px; flex: none; }
.th .dex-look-step-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th .dex-look-step:disabled { opacity: 0.45; cursor: default; }
/* Your progress: lib/dex-progress.js's compact form, in its own well */
.th .dex-look-prog { grid-area: prog; align-self: start; min-width: 0; padding: 12px; border-radius: 16px; background: var(--th-surface-sunk); border: 1px solid var(--th-line-2); }
.th .dex-look.is-entering { animation: dex-look-in 0.2s ease-out both; }
@keyframes dex-look-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* the middle width: Stage beside the answer, progress under both */
@container th (max-width: 1080px) {
  .th .dex-look { --dex-look-stage-w: 210px; grid-template-columns: var(--dex-look-stage-w) minmax(0, 1fr) 32px; grid-template-rows: auto auto auto auto; grid-template-areas: "stage id close" "stage build build" "stage acts acts" "prog prog prog"; gap: 12px 18px; }
  .th .dex-look-stage { min-height: 236px; }
  .th .dex-look-name { font-size: 26px; }
}
/* phones (<=700 container): the 60% budget (proposal §2.9) */
@container th (max-width: 700px) {
  .th .dex-look { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "stage id" "build build" "prog prog" "acts acts"; gap: 10px 12px; margin: 2px 0 4px; padding: 10px; border-radius: 18px; scroll-margin-top: calc(var(--dex-phone-top, var(--tcb-header-height, 51px)) + 52px); }
  .th .dex-look-stage { min-height: 0; height: 112px; border-radius: 12px; }
  .th .dex-look-stage .dex-plat { width: 80%; bottom: 5%; }
  .th .dex-look-art { top: 2%; height: 90%; }
  .th .dex-look-ini { font-size: 26px; }
  .th .dex-look-x { position: absolute; z-index: 3; top: 6px; right: 6px; margin: 0; }
  .th .dex-look-id { padding: 0 40px 0 0; }
  .th .dex-look-k { gap: 2px 8px; font-size: 11px; letter-spacing: 0.08em; }
  .th .dex-look-ribbon { height: 14px; }
  .th .dex-look-name { margin-top: 4px; font-size: 19px; }
  /* the facts as two short lines of text, not chips */
  .th .dex-look-facts { gap: 0 10px; margin-top: 5px; }
  .th .dex-look-fact { min-height: 0; padding: 0; background: none; font-size: 12.5px; gap: 5px; }
  .th .dex-look-fact dt { font-size: 11px; letter-spacing: 0.06em; }
  .th .dex-look-build { padding: 7px 10px; font-size: 13px; line-height: 1.35; }
  .th .dex-look-build-tx { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .th .dex-look-prog { padding: 8px; border-radius: 14px; }
  .th .dex-look-acts { flex-wrap: nowrap; gap: 6px; }
  .th .dex-look-open.th-btn { flex: 1 1 auto; justify-content: center; height: 44px; min-width: 0; }
  .th .dex-look-guide.th-btn { width: 44px; height: 44px; padding: 0; justify-content: center; flex: none; }
  .th .dex-look-guide > span, .th .dex-look-step-tx, .th .dex-look-pos { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th .dex-look-walk { margin-left: 0; gap: 6px; }
  .th .dex-look-step.th-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
}
/* the 320 phone: the kicker keeps its ribbon (the words are in the facts and
   the tile's own name), so the name block stays beside the Stage */
@container th (max-width: 340px) {
  .th .dex-look-k > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th .dex-look-name { font-size: 17px; }
}
@media (max-height: 560px) {
  .th .dex-look { scroll-margin-top: 12px; }
}


/* ---------- G8b · the Breakdown band (1b, proposal §2.12) ---------- */
/* In place under the header, pushing the page down (never a modal); the
   panel shape the settings use. */
/* The Breakdown opener: a full-width bar at the panel's foot, under the rings
   it breaks down (owner, 2026-10-27: tucked into the "% complete" line it was
   only found by someone looking for it). It costs the panel one 32px row. */
.th .dex-bd-bar { margin-top: 8px; display: flex; align-items: center; gap: 7px; width: 100%; min-height: 32px; padding: 0 10px 0 11px; border: 0; border-radius: 999px; background: var(--th-btn-bg); color: var(--th-ink); font-size: 12.5px; font-weight: 700; text-align: left; }
.th .dex-bd-bar:hover { background: var(--th-btn-hover); }
.th .dex-bd-bar:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .dex-bd-bar svg { flex: none; width: 15px; height: 15px; color: var(--th-btn-icon); }
.th .dex-bd-bar-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--th-ink-3); }
.th .dex-bd-bar .dex-bd-pill-chev { margin-left: auto; transition: transform 0.16s ease; }
.th .dex-bd-bar[aria-expanded="true"] { color: var(--th-sel-ink); background: var(--th-sel-bg); box-shadow: var(--th-sel-shadow); }
.th .dex-bd-bar[aria-expanded="true"] svg, .th .dex-bd-bar[aria-expanded="true"] .dex-bd-bar-sub { color: currentColor; }
.th .dex-bd-bar[aria-expanded="true"] .dex-bd-pill-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .th .dex-bd-bar .dex-bd-pill-chev { transition: none; } }
.th .dex-breakdown { position: relative; margin-top: 12px; padding: 16px 18px 14px; border-radius: 18px; background: var(--th-surface-1); border: 1px solid var(--th-gold-line); box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.3), inset 0 0 0 4px var(--th-gold-faint), var(--th-shadow-1); }
.th .dex-bd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.th .dex-bd-head h2 { font-size: 20px; }
.th .dex-bd-head h2:focus { outline: none; }
.th .dex-bd-seg button { height: 32px; }
.th .dex-bd-x { margin-left: auto; }
.th .dex-bd-note { margin-top: 10px; font-size: 13.5px; color: var(--th-ink-2); }
.th .dex-bd-pips { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.th .dex-bd-pip { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 9px 10px 10px; border-radius: 12px; border: 1px dashed rgba(var(--th-rc-rgb, 120, 128, 150), 0.5); background: radial-gradient(120% 80% at 0% 0%, rgba(var(--th-rc-rgb, 120, 128, 150), 0.18), rgba(var(--th-rc-rgb, 120, 128, 150), 0) 70%), var(--th-surface-sunk); color: var(--th-ink); text-align: left; }
.th .dex-bd-pip:hover { border-style: solid; }
.th .dex-bd-pip:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .dex-bd-pip.is-complete { border-style: solid; border-color: rgba(var(--th-own-rgb), 0.5); }
.th .dex-bd-ribbon { display: block; height: 16px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.th .dex-bd-pip-n { font: 700 18px/1 "CookieRun KR", "Outfit", sans-serif; color: var(--th-ink-3); }
.th .dex-bd-pip-n b { color: var(--th-heading); }
.th .dex-bd-pip .dex-meter { width: 100%; }
.th .dex-bd-tablewrap { margin-top: 14px; }
.th .dex-bd-table :is(th, td) { vertical-align: middle; }
.th .dex-bd-table tbody th, .th .dex-bd-table tfoot th { color: var(--th-ink); }
.th .dex-bd-link { display: inline-flex; align-items: center; gap: 8px; margin: -4px -7px; padding: 4px 7px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; }
.th .dex-bd-link:hover { background: var(--th-btn-bg); color: var(--th-link); text-decoration: underline; text-underline-offset: 3px; }
.th .dex-bd-link:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .dex-bd-ic { width: 20px; height: 20px; flex: none; object-fit: contain; }
.th .dex-bd-ic--ribbon { width: auto; height: 15px; max-width: 80px; }
.th .dex-bd-table .dex-bd-total :is(th, td) { border-top: 1px solid var(--th-line-3); }
.th .dex-bd-all { font-weight: 800; color: var(--th-ink); }
.th .dex-bd-list { display: none; }
.th .dex-bd-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--th-line-2); font-size: 12.5px; line-height: 1.45; color: var(--th-ink-3); }
@container th (max-width: 1080px) {
  .th .dex-bd-pips { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
/* phones: one row per group, Collected and a meter, tapping through */
@container th (max-width: 700px) {
  .th .dex-breakdown { padding: 12px 10px 10px; }
  .th .dex-bd-head h2 { font-size: 18px; width: calc(100% - 52px); }
  .th .dex-bd-x { position: absolute; top: 8px; right: 8px; }
  .th .dex-bd-seg { width: 100%; }
  .th .dex-bd-seg button { flex: 1 1 0; height: 44px; justify-content: center; padding: 0 6px; }
  .th .dex-bd-pips, .th .dex-bd-tablewrap { display: none; }
  .th .dex-bd-list { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
  .th .dex-bd-list .dex-bd-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name n" "meter meter"; gap: 6px 10px; width: 100%; min-height: 52px; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--th-surface-sunk); }
  .th .dex-bd-list-name { grid-area: name; display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--th-ink); font-weight: 700; }
  .th .dex-bd-list-n { grid-area: n; font-weight: 600; color: var(--th-ink-3); }
  .th .dex-bd-list-n b { color: var(--th-ink); }
  .th .dex-bd-list .dex-meter { grid-area: meter; }
  .th .dex-bd-list .dex-bd-link:hover { text-decoration: none; color: inherit; background: var(--th-surface-2); }
}


/* ---------- G8c · the name search's combobox (1b, proposal §11) ---------- */
.th .dex-combo { position: relative; }
.th .dex-combo > .dex-field { width: 100%; }
.th .dex-combo-list { position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; border-radius: 14px; background: var(--th-surface-1); border: 1px solid var(--th-line-3); box-shadow: var(--th-shadow-pop); }
.th .dex-combo-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 10px 5px 6px; border-radius: 10px; cursor: pointer; }
.th .dex-combo-opt:hover, .th .dex-combo-opt[aria-selected="true"] { background: var(--th-surface-3); }
.th .dex-combo-opt[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--th-btn-focus); }
.th .dex-combo-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.th .dex-combo-tx b { font-size: 14px; font-weight: 700; color: var(--th-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .dex-combo-tx small { font-size: 12px; color: var(--th-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ---------- G9b · Collection mode's tap modes (1b, proposal §2.10) ---------- */
.th .dex-cb-modes { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.th .dex-cb-modes .th-seg button { height: 32px; padding: 0 12px; }


/* ---------- G9 · dex-collectbar: Collection mode ---------- */
/* In flow and sticky, NEVER fixed to the bottom (Grow, the consent message and
   the safe areas live there; CR G17). */
.th .dex-collectbar { position: sticky; top: calc(var(--th-sticky-top) + var(--dex-toolbar-h, 72px) + 6px); z-index: 19; margin-top: 10px; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 7px 8px 7px 16px; border-radius: 16px; background:
    linear-gradient(90deg, rgba(var(--th-own-rgb), 0.14), rgba(var(--th-own-rgb), 0.04) 60%),
    var(--th-surface-1);
  border: 1px solid rgba(var(--th-own-rgb), 0.45); box-shadow: var(--th-shadow-1); }
.th .dex-cb-title { display: flex; align-items: center; gap: 9px; min-width: 0; margin-right: auto; font-size: 14px; }
.th .dex-cb-title b { font-weight: 800; color: var(--th-heading); white-space: nowrap; }
.th .dex-cb-gem { width: 8px; height: 8px; flex: none; transform: rotate(45deg); background: var(--th-own); box-shadow: 0 0 10px rgba(var(--th-own-rgb), 0.7); }
.th .dex-cb-sub { color: var(--th-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .dex-cb-changes { margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--th-line-2); font-size: 13.5px; color: var(--th-ink-3); white-space: nowrap; }
.th .dex-cb-changes b { color: var(--th-ink); font-weight: 800; }
.th .dex-cb-view { font-weight: 700; color: var(--th-ink-2); }
.th .dex-cb-changes .th-dot { padding: 0 5px; }
.th .dex-cb-undo { display: inline-flex; gap: 2px; }
.th .dex-cb-undo .th-btn:first-child { border-radius: 999px 6px 6px 999px; }
.th .dex-cb-undo .th-btn:last-child { border-radius: 6px 999px 999px 6px; width: 30px; }
.th .dex-cb-all.th-btn { flex: none; }
.th .dex-cb-done.th-btn { flex: none; }
/* tiles in the mode: the whole tile is one target; the name link is inert */
.th [data-collecting] .dex-tile .dex-tile-art { cursor: pointer; }
.th [data-collecting] a.dex-tile-name { pointer-events: none; }


/* ---------- G10 · the A–Z directory (generator-owned, a closed band) ---------- */
.th .dex-az-bands { margin-top: 26px; }
/* the page's last band: no band padding under it (the route's own 44px and
   the footer card's margin are the ending; N4 measured ~115px of ground) */
.th .dex-az-bands > .th-band.dex-az { padding-bottom: 0; }
.th .dex-az-details > summary { list-style: none; cursor: pointer; margin-bottom: 0; padding: 8px 10px 8px 16px; border-radius: 14px; border: 1px dashed var(--th-line-3); background: var(--th-wash); }
.th .dex-az-details > summary::-webkit-details-marker { display: none; }
.th .dex-az-details > summary .th-band-name { font-size: 19px; }
.th .dex-az-details[open] > summary .th-band-toggle svg { transform: rotate(180deg); }
.th .dex-az-list { margin-top: 14px; columns: 6; column-gap: 24px; font-size: 13.5px; }
.th .dex-az-list li { break-inside: avoid; padding: 2px 0; }
.th .dex-az-list a { display: inline-block; padding: 3px 0; color: var(--th-ink-2); }
.th .dex-az-list a:hover { color: var(--th-link); text-decoration: underline; }


/* ---------- mid width (<=1180 container): the emblem drops ---------- */
@container th (max-width: 1180px) {
  .th .dex-head-emblem { display: none; }
  .th .dex-head-copy { max-width: 560px; }
  .th .dex-head-glow { background:
      radial-gradient(420px 260px at 40% 40%, rgba(var(--th-rc-rgb), 0.18), rgba(var(--th-rc-rgb), 0) 72%),
      radial-gradient(620px 300px at 0% 0%, rgba(var(--th-m-rgb), 0.08), rgba(var(--th-m-rgb), 0) 70%),
      linear-gradient(180deg, var(--th-surface-1) 0%, var(--th-ground) 100%); }
  .th .dex-head { --dex-emblem-lift: 0px; margin-top: 14px; }
}
@container th (max-width: 1199px) {
  .th .dex-head { --dex-coll-w: 352px; }
}


/* ---------- G11 · phones (<=700 container) ---------- */
@container th (max-width: 700px) {
  /* header: a title block (the emblem floats right, the hub phone's way) */
  .th .dex-head { margin-top: 14px; border-radius: 20px; }
  .th .dex-head-clip { border-radius: 19px; }
  .th .dex-head-glow { background:
      radial-gradient(200px 170px at calc(100% - 64px) 64px, rgba(var(--th-rc-rgb), 0.34), rgba(var(--th-rc-rgb), 0) 72%),
      radial-gradient(160px 140px at calc(100% - 64px) 40px, rgba(var(--th-el), 0.24), rgba(var(--th-el), 0) 72%),
      linear-gradient(180deg, var(--th-surface-1) 0%, var(--th-ground) 100%); }
  .th .th-orn--tl, .th .th-orn--bl { left: 26px; }
  .th .th-orn--tr, .th .th-orn--br { right: 26px; }
  .th .dex-head-in { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 12px; }
  .th .dex-head-copy { display: block; max-width: none; padding: 0 4px; }
  /* the emblem stands INSIDE the frame at the top right, beside the title
     block, clear of the corner gem (the hub phone's emblem; absolute, so it
     never moves the flow). The title row keeps clear of it. */
  .th .dex-head { --dex-emblem: 84px; }
  .th .dex-head-emblem { display: block; top: 12px; right: 12px; width: var(--dex-emblem); height: var(--dex-emblem); object-position: 50% 0; }
  .th .dex-head-copy .th-kicker, .th .dex-head-title { padding-right: calc(var(--dex-emblem) + 4px); }
  .th .dex-head-copy .th-kicker { display: flex; font-size: 11px; letter-spacing: 0.12em; }
  .th .dex-head-copy .th-kicker .th-label-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th .dex-head-copy .th-kicker .th-label-short { display: inline; }
  .th .dex-head-title { margin-top: 4px; font-size: 30px; }
  /* the lede and the facts line belong to the wide header; the phone keeps
     the title, the new cookies and the binder strip (proposal §2.2) */
  .th .dex-head-lede, .th .dex-head-facts { display: none; }
  .th .dex-head-row { margin-top: 9px; }
  .th .dex-newline { min-height: 44px; padding: 3px 12px 3px 4px; gap: 8px; }
  .th .dex-newline-long, .th .dex-newline-ic { display: none; }
  .th .dex-newline-tx b { font-size: 13px; }
  .th .dex-newline-faces .th-face { width: 30px; height: 30px; }
  /* Your collection becomes the BINDER STRIP: the Full ring, "24 of 181
     collected" and the sync dot, then the gold Collection mode pill. A tap on
     the ring or text expands the full panel in place. */
  .th .dex-coll { padding: 0; border: 0; background: none; box-shadow: none; }
  .th .dex-coll-head, .th .dex-coll-body { display: none; }
  .th .dex-coll.is-open .dex-coll-body { display: block; }
  .th .dex-binder { display: flex; align-items: center; gap: 8px; }
  .th .dex-binder-sum { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px 0 0; border: 0; border-radius: 999px; background: var(--th-btn-track); color: var(--th-ink); text-align: left; }
  .th .dex-binder-sum:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
  .th .dex-binder-sum .dex-ring { --s: 44px; }
  .th .dex-binder-sum .dex-ring::before { background: var(--th-surface-2); }
  .th .dex-binder-tx { display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; line-height: 1.2; color: var(--th-ink-2); white-space: nowrap; }
  .th .dex-binder-tx b { color: var(--th-ink); font-weight: 800; }
  .th .dex-binder-tx > span { font-size: 11.5px; color: var(--th-ink-3); overflow: hidden; text-overflow: ellipsis; }
  .th .dex-binder-tx > span:first-child { font-size: 15px; font-weight: 600; color: var(--th-ink-3); }
  .th .dex-binder-tx > span:first-child b { font-size: 16px; }
  .th .dex-sync-dot { width: 9px; height: 9px; flex: none; margin-left: auto; border-radius: 50%; background: var(--th-own); box-shadow: 0 0 0 3px rgba(var(--th-own-rgb), 0.18); }
  .th .dex-sync-dot[data-sync="local"] { background: var(--th-gold); box-shadow: 0 0 0 3px var(--th-gold-faint); }
  .th .dex-binder .dex-collect-btn { height: 44px; padding: 0 15px; flex: none; font-size: 14px; }
  .th .dex-binder .dex-collect-btn.is-on { padding: 0 16px; }
  /* toolbar: NOT sticky; three rows: search + Filters / effect / segment + ★ */
  .th .dex-toolbar { position: relative; top: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "search filters" "effect effect" "strip strip" "seg fav"; gap: 6px 8px; margin-top: 8px; padding: 6px; }
  .th .dex-tb-search { grid-area: search; min-width: 0; }
  .th .dex-tb-effect { grid-area: effect; min-width: 0; }
  .th .dex-effect-strip { grid-area: strip; min-width: 0; }
  .th .dex-effect-strip .dex-facet-chips { position: relative; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .th .dex-tb-filters { grid-area: filters; }
  .th .dex-tb-filters > summary.th-btn { height: 44px; padding: 0 14px; }
  .th .dex-tb-seg { grid-area: seg; display: flex; margin: 0; }
  .th .dex-tb-seg button { flex: 1 1 0; justify-content: center; height: 44px; padding: 0 8px; font-size: 14px; }
  .th .dex-tb-fav { grid-area: fav; }
  .th .dex-tb-fav.th-btn { width: 48px; height: 48px; }
  .th .dex-toolbar .dex-field { min-height: 44px; }
  .th .dex-toolbar .dex-field input { height: 38px; }
  .th .dex-tb-seg { padding: 2px; }
  .th .dex-tb-fav img { width: 24px; }
  .th .dex-tb-collect { display: none; }
  .th .dex-tb-break { display: none; }
  /* results: the STICKY element (44px under the site header), so the count,
     the active chips, Sort and density are always in reach */
  .th .dex-results { position: sticky; top: var(--dex-phone-top, var(--tcb-header-height, 51px)); z-index: 18; gap: 8px; min-height: 44px; margin-top: 8px; padding: 0; }
  /* its ground is a pseudo-element spread to the window's edges and cut by
     its OWN clip-path, so the Sort menu that drops out of the line is never
     clipped (a clip-path on the line itself clipped its descendants) */
  .th .dex-results::before { content: ""; position: absolute; z-index: -1; inset: 0 0 -6px; background: var(--th-ground); box-shadow: 0 0 0 100vmax var(--th-ground); clip-path: inset(0 -100vmax 0); pointer-events: none; }
  /* the stuck line keeps 6px of ground and a hairline under it, so what
     scrolls beneath never shows a sliver of text; shadows spread it to the
     window's edges without widening the page */
  .th .dex-results::after { content: ""; position: absolute; left: 0; right: 0; top: calc(100% + 6px); height: 1px; background: var(--th-line-2); box-shadow: 0 0 0 100vmax var(--th-line-2); clip-path: inset(0 -100vmax); pointer-events: none; }
  .th .dex-results-count { font-size: 13px; gap: 8px; }
  .th .dex-results-count > b { font-size: 14px; }
  .th .dex-results-chips { position: relative; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .th .dex-results-chips::-webkit-scrollbar { display: none; }
  .th .dex-ab { height: 36px; }
  .th .dex-results-ctl { gap: 6px; }
  .th .dex-sort-btn.th-btn { width: 44px; height: 44px; padding: 0; }
  .th .dex-sort-btn > span, .th .dex-sort-btn > svg:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th .dex-sort-btn > svg:first-child { width: 18px; height: 18px; }
  .th .dex-dens { padding: 0; border: 0; }
  .th .dex-dens button { height: 44px; min-width: 44px; padding: 0 11px; justify-content: center; }
  .th .dex-dens button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* facets: nothing scrolls sideways (2026-11-06). The four groups with art
     are a grid of art-only cells (icon over count; the word stays the
     chip's accessible name, and the head names what is picked); the word
     groups wrap as smaller chips */
  .th .dex-facets { padding: 12px 12px 0; gap: 12px; }
  .th .dex-facet { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .th .dex-facet-pair { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .th .dex-facet-head { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; }
  .th .dex-facet-sel { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 700; color: var(--th-ink); }
  .th .dex-facets .dex-facet-chips { gap: 6px; }
  .th .dex-facets .dex-chip { flex: 1 1 auto; justify-content: center; min-height: 36px; padding: 0 6px 0 11px; font-size: 13px; gap: 6px; }
  .th .dex-facets .dex-chip-n { min-width: 20px; height: 20px; padding: 0 5px; font-size: 11.5px; }
  .th .dex-facets .dex-chip-tail { display: none; }
  .th .dex-facet-line { gap: 6px; }
  .th .dex-facet-line > [data-chip-wrap="tier"] { flex: 1 1 auto; }
  .th .dex-facets :is([data-chip-wrap="element"], [data-chip-wrap="rarity"], [data-chip-wrap="type"], [data-chip-wrap="position"]) { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .th .dex-facets [data-chip-wrap="rarity"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .th .dex-facets [data-chip-wrap="position"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .th .dex-facets :is([data-chip-wrap="element"], [data-chip-wrap="rarity"], [data-chip-wrap="type"], [data-chip-wrap="position"]) .dex-chip { flex-direction: column; justify-content: center; gap: 2px; min-width: 0; min-height: 48px; padding: 5px 2px 4px; border-radius: 14px; }
  .th .dex-facets :is([data-chip-wrap="element"], [data-chip-wrap="type"], [data-chip-wrap="position"]) .dex-chip:not(.dex-chip--text) .filter-chip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th .dex-facets :is([data-chip-wrap="element"], [data-chip-wrap="type"], [data-chip-wrap="position"]) .dex-chip-ic { width: 24px; height: 24px; }
  .th .dex-facets [data-chip-wrap="position"] .dex-chip-ic { width: 32px; height: 23px; }
  .th .dex-facets .dex-chip-ic--ribbon { width: 100%; height: 15px; max-width: none; }
  .th .dex-facets :is([data-chip-wrap="element"], [data-chip-wrap="rarity"], [data-chip-wrap="type"], [data-chip-wrap="position"]) .dex-chip-n { height: 15px; min-width: 0; padding: 0 5px; font-size: 11px; }
  .th .dex-facets [data-chip-wrap="rarity"] .dex-chip { min-height: 40px; gap: 3px; padding-inline: 4px; }
  .th .dex-facets [data-chip-wrap="tier"] .dex-chip { gap: 4px; padding: 0 3px 0 9px; font-size: 12.5px; }
  .th .dex-facets [data-chip-wrap="tier"] .dex-chip-n { min-width: 18px; padding: 0 4px; }
  /* Position: the head beside its three cells, which line up with the
     right half of the six-cell grid above */
  .th .dex-facet-pair > .dex-facet:last-child { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 6px; }
  .th .dex-facet-pair > .dex-facet:last-child .dex-facet-head { flex-direction: column; gap: 3px; }
  /* the foot stays in reach while the groups scroll past (the panel is
     taller than a phone's screen); the how-counts-work note is the
     desktop's */
  .th .dex-facets-foot { position: sticky; bottom: 0; z-index: 2; justify-content: space-between; gap: 14px; margin: 0 -12px; padding: 10px 12px 10px 14px; border-radius: 0 0 15px 15px; background: var(--th-surface-1); box-shadow: 0 -8px 14px -10px rgba(var(--th-abyss-rgb), 0.55); }
  .th .dex-facets-note { display: none; }
  .th .dex-show-btn { height: 44px; }
  /* the grid: band tiles at phone scale */
  .th .dex-grid { margin-top: 8px; }
  .th .dex-bandtile { margin: 4px 4px 0; padding: 7px 7px 6px; border-radius: calc(var(--dex-cell) * 0.18); }
  .th .dex-bt-top { gap: 3px; }
  .th .dex-bt-ribbon { height: 12px; }
  .th .dex-bandtile--ribbon .dex-bt-ribbon { height: 15px; }
  .th .dex-bt-name { font-size: 13px; line-height: 1.05; }
  .th .dex-bt-k { display: none; }
  .th .dex-bt-n { padding-top: 2px; font-size: 20px; }
  .th .dex-bt-sub { margin-top: 1px; font-size: 11px; line-height: 1.2; }
  .th .dex-bt-sub .th-dot { display: none; }
  .th .dex-bt-sub > span + span { display: none; }
  .th .dex-bt-meter { margin-top: 4px; }
  .th .dex-bt-fan { display: none; }
  .th .dex-bt-shown { font-size: 11px; }
  .th .dex-bt-foot { margin-top: 3px; min-height: 16px; }
  .th .dex-bt-rule { margin-left: 4px; }
  /* the toggle's glyph stays small; its hit area is 44px */
  .th .dex-bt-tog { position: relative; width: 20px; height: 20px; background: none; }
  .th .dex-bt-tog::after { content: ""; position: absolute; inset: -12px; }
  .th .dex-bt-tog svg { width: 13px; height: 13px; }
  .th .dex-bt-collect.th-btn { height: 26px; padding: 0 4px; font-size: 11px; gap: 3px; }
  .th .dex-bt-collect.th-btn svg { width: 12px; height: 12px; }
  .th .dex-bt-collect.th-btn::after { content: ""; position: absolute; inset: -10px -4px; }
  .th .dex-bt-long { display: none; }
  .th .dex-bt-short { display: inline; }
  /* banded layouts: the ribbon takes the kicker's place in the phone head */
  .th .dex-band-head .th-band-id > .dex-band-ribbon { grid-area: k; justify-self: start; height: 16px; }
  .th .dex-band-head .dex-band-meter { grid-area: meta; justify-self: end; width: 72px; margin-top: 2px; }
  .th .dex-band .dex-banners { padding-top: 6px; }
  /* Collection mode on a phone: the sticky results line BECOMES the bar, two
     rows while the mode is on */
  .th .dex-collectbar { top: var(--dex-phone-top, var(--tcb-header-height, 51px)); z-index: 18; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "title undo done" "modes modes modes" "all all all"; gap: 8px; min-height: 0; margin-top: 8px; padding: 8px; border-radius: 16px; }
  .th .dex-cb-title { grid-area: title; flex-direction: column; align-items: flex-start; gap: 0; padding-left: 6px; font-size: 14px; line-height: 1.25; }
  .th .dex-cb-title .dex-cb-gem { display: none; }
  .th .dex-cb-sub { display: none; }
  .th .dex-cb-changes { margin: 0; padding: 0; border: 0; font-size: 12.5px; }
  .th .dex-cb-changes .th-dot { padding: 0 4px; }
  .th .dex-cb-undo { grid-area: undo; }
  .th .dex-cb-undo .th-btn { height: 44px; }
  .th .dex-cb-undo .th-btn:last-child { width: 44px; }
  .th .dex-cb-done.th-btn { grid-area: done; height: 44px; padding: 0 18px; }
  .th .dex-cb-all.th-btn { grid-area: all; height: 44px; width: 100%; }
  .th .dex-cb-modes { grid-area: modes; display: flex; min-width: 0; }
  .th .dex-cb-modes .th-seg { flex: 1 1 auto; display: flex; }
  .th .dex-cb-modes .th-seg button { flex: 1 1 0; justify-content: center; height: 44px; padding: 0 6px; }
  .th[data-collecting] .dex-results { display: none; }
  /* the A–Z: two columns */
  .th .dex-az-list { columns: 2; column-gap: 16px; font-size: 13.5px; }
  .th .dex-az-list li { padding: 4px 0; }
}
/* narrow phones: four ribbons to a row would draw them under 9px tall */
@container th (max-width: 340px) {
  .th .dex-facets [data-chip-wrap="rarity"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* The phone's compact controls sit directly beneath the measured shell. */
@media (max-width: 700px) {
  .th.dex-index { --dex-phone-top: var(--tcb-header-height, 51px); }
}
/* the binder strip's line names the panel's state in the head copy above it:
   on the phone the line reads "24 of 181 collected" + "9.8% complete · Synced" */
@container th (max-width: 360px) {
  .th .dex-bt-name { font-size: 12px; }
  /* 360-375 phones: the strip keeps "24/181" whole beside the gold pill */
  .th .dex-binder-sum { gap: 8px; padding-right: 10px; }
  .th .dex-binder .dex-collect-btn { padding: 0 12px; gap: 6px; }
}
/* the 320 phone: with a filter on, the count's "Clear" pushed Sort and the
   density switch 7px past the window; each active chip drops itself and the
   Filters panel keeps its Clear, so the line gives that word up there */
@container th (max-width: 300px) {
  .th .dex-results-clear { display: none; }
}
/* the narrowest phones: a Comfy band head's Collapse keeps its icon and hides
   its word (still the button's accessible name), or the head row overruns */
@container th (max-width: 400px) {
  .th .dex-band-head .th-band-toggle > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th .dex-band-head .th-band-toggle { padding: 0 9px; }
}
/* only the 320 phone (a 288px container) wraps the binder strip; 360-430
   phones keep it one 44px row (critique 1, M1: a 360px query caught the 358px
   container at 390, 375 and 360 and cost the first screen a row) */
@container th (max-width: 300px) {
  /* the 320 phone: a smaller emblem, so the kicker and the title keep one line each */
  .th .dex-head { --dex-emblem: 64px; }
  .th .dex-head-title { font-size: 27px; }
  .th .dex-binder { flex-wrap: wrap; }
  .th .dex-binder-sum { flex-basis: 100%; }
  .th .dex-binder .dex-collect-btn { flex: 1 1 100%; }
}
/* short screens (1366 x 657, 1280 x 720, 200% zoom): the header collapses to
   one row, so a full row of tiles is still on screen */
@media (max-height: 760px) and (min-width: 701px) {
  .th.dex-index { --dex-emblem-lift: 0px; }
  .th .dex-head-emblem, .th .dex-head-lede, .th .dex-head-facts { display: none; }
}
/* landscape phones: nothing sticks below 560px of height (CR G8) */
@media (max-height: 560px) {
  .th .dex-toolbar, .th .dex-results, .th .dex-collectbar { position: relative; top: auto; }
}


/* ---------- G13 · menus (Sort ▾, Undo ▾) ---------- */
/* .dex-menu (dex.css) anchored under its button; on phones it drops below
   the sticky results line and stays inside the window */
.th .dex-sort, .th .dex-cb-undo { position: relative; }
.th .dex-sort-menu { min-width: 236px; }
.th .dex-menu[role="menu"] .dex-menu-item[aria-checked] .dex-menu-check { width: 16px; height: 16px; }
.th .dex-cb-undo .dex-menu { min-width: 200px; }
@container th (max-width: 700px) {
  .th .dex-sort-menu { right: -54px; max-width: calc(100cqw - 8px); }
}


/* ---------- G14 · dex-settings: Collection settings, in flow ---------- */
/* The gear opens this panel directly under the header and pushes the page
   down: no body-level modal, no scroll lock (proposal §2.11). Display on the
   left (switches, the same unscoped preference), bulk actions on the right
   (each arms on the first press and runs on a second within 4s). */
.th .dex-settings { position: relative; margin-top: 12px; padding: 16px 18px 14px; border-radius: 18px; background: var(--th-surface-1); border: 1px solid var(--th-gold-line); box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.3), inset 0 0 0 4px var(--th-gold-faint), var(--th-shadow-1); }
.th .dex-settings-head { display: flex; align-items: center; gap: 12px; }
.th .dex-settings-head h2 { margin-right: auto; font-size: 20px; }
.th .dex-settings-grid { margin-top: 10px; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 18px 32px; }
.th .dex-settings-half > .th-label { display: block; margin-bottom: 8px; }
.th .dex-settings-switches { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.th .dex-settings-switches .dex-switch { width: 100%; justify-content: flex-start; background: none; padding-left: 0; }
.th .dex-settings-switches .dex-switch:hover { background: var(--th-btn-bg); }
.th .dex-settings-switches .dex-switch[aria-disabled="true"] { opacity: 0.55; cursor: default; }
.th .dex-settings-note { margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--th-ink-3); }
.th .dex-settings-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.th .dex-settings-group h4 { font: 700 13px/1.2 "Outfit", system-ui, sans-serif; color: var(--th-ink-2); margin-bottom: 6px; }
.th .dex-settings-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.th .dex-settings-acts .th-btn { min-height: 34px; font-size: 13px; }
.th .dex-settings-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--th-line-2); font-size: 12.5px; color: var(--th-ink-3); }
.th .dex-settings-status { margin-top: 8px; min-height: 18px; font-size: 13.5px; font-weight: 600; color: var(--th-ink-2); }
.th .dex-gear[aria-expanded="true"] { color: var(--th-sel-ink); background: var(--th-sel-bg); }
@container th (max-width: 860px) {
  .th .dex-settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@container th (max-width: 520px) {
  .th .dex-settings { padding: 14px 12px 12px; }
  .th .dex-settings-groups { grid-template-columns: minmax(0, 1fr); }
  .th .dex-settings-acts .th-btn { min-height: 44px; }
}


/* ---------- G15 · states: empty result, load error, loading ---------- */
.th .dex-empty { margin-top: 12px; }
.th .dex-empty .th-season-empty-acts .active-badge { font: inherit; }
/* the grid reserves one screen while it is drawn by script (CLAUDE.md, the
   layout-shift reservation): the content below starts under the fold */
.th #cookieGrid[data-pending] { min-height: 100vh; min-height: 100svh; }
/* the panel's numbers before the stores are read: drawn at final size */
.th .dex-coll[data-pending] .dex-rings, .th .dex-coll[data-pending] .dex-coll-line { opacity: 0.55; }


/* ---------- G16 · Collection mode on the tiles ---------- */
/* a "+" disc on a NOT-collected tile only; a collected tile's ring is its
   signal (no checkmark anywhere) */
/* (which disc shows is the tap mode's: dex-discs carry [data-on], dex.css D3) */
.th .dex-tile.is-collecting .dex-tile-art { cursor: pointer; }
.th .dex-tile.is-collecting .dex-tile-art:focus-visible .dex-art { outline: 3px solid var(--th-focus-color); outline-offset: 2px; }
/* the collected ring draws in on collect (180ms) */
.th .dex-tile.is-ring-in .dex-tile-frame::before { clip-path: none; animation: dex-ring-in 0.18s ease-out both; }
@keyframes dex-ring-in { from { clip-path: inset(0 0 100% 0); opacity: 0.2; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
/* a banner is a <button> in the mode: the anchor's box, not a button's */
.th button.dex-banner { display: block; appearance: none; -webkit-appearance: none; }
.th .dex-band-collect.th-btn { flex: none; }
.th .dex-bt-live { font-weight: 700; color: var(--th-gold); }


/* ---------- G17 · the results' live count, the sync chip, skip link ---------- */
.th .dex-sync[data-sync="saving"] svg { color: var(--th-gold); animation: dex-spin 1s linear infinite; }
.th .dex-sync[data-sync="failed"] { cursor: pointer; border: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--th-down); background: rgba(255, 154, 160, 0.12); }
.th .dex-sync[data-sync="failed"] svg { color: currentColor; }
@keyframes dex-spin { to { transform: rotate(360deg); } }
.th .dex-sync-dot[data-sync="failed"] { background: var(--th-down); box-shadow: 0 0 0 3px rgba(255, 154, 160, 0.2); }
.th .dex-sync-dot[data-sync="saving"] { background: var(--th-gold); }
@media (prefers-reduced-motion: reduce) {
  .th .dex-sync[data-sync="saving"] svg { animation: none; }
  .th .dex-tile.is-ring-in .dex-tile-frame::before { animation: none; }
}


/* ---------- G18 · display settings, pressed states, small pieces ---------- */
/* the settings' display half: CSS-only gates on body attributes (the same
   attributes as before), so nothing re-renders when one flips */
body[data-hide-level-badges="true"] .th :is(.dex-tile, .dex-banner-slot) .dex-lv,
body[data-hide-collection-ui="true"] .th :is(.dex-tile, .dex-banner-slot) .dex-lv { display: none; }
body[data-hide-promotion-badges="true"] .th :is(.dex-promo, .dex-banner-promo),
body[data-hide-collection-ui="true"] .th :is(.dex-promo, .dex-banner-promo) { display: none; }
body[data-hide-candy-badges="true"] .th :is(.dex-candy, .dex-banner-candy),
body[data-hide-collection-ui="true"] .th :is(.dex-candy, .dex-banner-candy) { display: none; }
/* "New this update": its static placeholder keeps its room until the data
   fills it (no shift), and pressed it reads as the selected chip */
.th .dex-newline[data-pending] { visibility: hidden; }
.th .dex-newline[aria-pressed="true"] { color: var(--th-sel-ink); background: var(--th-sel-bg); box-shadow: var(--th-sel-shadow); }
.th .dex-newline[aria-pressed="true"] :is(.dex-newline-tx > span, .dex-newline-k, .dex-newline-ic) { color: inherit; }
/* a ring whose view is applied */
.th .dex-ringbtn[aria-pressed="true"] { background: var(--th-btn-bg); color: var(--th-ink); box-shadow: inset 0 0 0 1.5px var(--th-gold-line); }
.th .dex-linkbtn[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 3px; }
/* the weights caption under the big number */
.th .dex-coll-weights { margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--th-ink-3); }
.th .dex-info[aria-expanded="true"] { color: var(--th-gold); }
/* the A–Z band's toggle word */
.th .dex-az-details .dex-az-hide { display: none; }
.th .dex-az-details[open] .dex-az-show { display: none; }
.th .dex-az-details[open] .dex-az-hide { display: inline; }
.th .dex-az-copy { margin-top: 12px; font-size: 13.5px; color: var(--th-ink-3); }
.th .dex-az-details > summary .th-band-name { font: 700 19px/1.15 "CookieRun KR", "Outfit", sans-serif; color: var(--th-heading); }
/* a collapsed Comfy band: its head as the dashed row, nothing under it */
.th .dex-band.th-band--collapsed .dex-band-head { margin-bottom: 0; }
/* the band tile's toggle when the band is collapsed, and its fan of faces */
.th .dex-bandtile.is-collapsed { border-style: dashed; }
@container th (max-width: 700px) {
  /* the full panel opens in place under the binder strip */
  .th .dex-coll.is-open .dex-coll-head { display: flex; margin-top: 10px; order: 1; }
  .th .dex-coll.is-open .dex-coll-body { order: 2; }
  .th .dex-coll.is-open .dex-coll-body { padding: 0 2px 4px; }
  .th .dex-coll.is-open .dex-binder-sum { background: var(--th-btn-hover); }
}
:root[data-theme="light"] .th .dex-coll-weights { color: var(--th-ink-3); }


/* ---------- G12 · forced colours, reduced motion ---------- */
@media (forced-colors: active) {
  .th .dex-bandtile { border: 1px dashed CanvasText; }
  .th .dex-look, .th .dex-breakdown, .th .dex-combo-list { border: 1px solid CanvasText; }
  .th .dex-look-caret { border-color: CanvasText; }
  .th .dex-combo-opt[aria-selected="true"] { background: SelectedItem; color: SelectedItemText; forced-color-adjust: none; }
  .th .dex-bd-pip { border: 1px dashed CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  .th [data-look-open] .dex-bandtile { transition: none; }
  .th .dex-look.is-entering { animation: none; }
}


/* ============================================================================
   L · LIGHT THEME
   ========================================================================== */
/* the header: a white frame lit by the emblem's rarity wash */
:root[data-theme="light"] .th .dex-head { background: var(--th-surface-1); box-shadow: inset 0 0 0 4px rgba(var(--th-abyss-rgb), 0.55), inset 0 0 0 5px var(--th-gold-faint), var(--th-shadow-2); }
:root[data-theme="light"] .th .dex-head-glow { background:
    radial-gradient(380px 300px at calc(100% - var(--dex-coll-w) - 230px) 62%, var(--th-rc-wash), rgba(var(--th-ground-rgb), 0) 72%),
    radial-gradient(300px 240px at calc(100% - var(--dex-coll-w) - 200px) 30%, rgba(var(--th-el), 0.12), rgba(var(--th-el), 0) 72%),
    radial-gradient(620px 300px at 0% 0%, rgba(var(--th-m-rgb), 0.1), rgba(var(--th-m-rgb), 0) 70%),
    linear-gradient(180deg, var(--th-surface-1) 0%, var(--th-ground) 100%); }
:root[data-theme="light"] .th .dex-head-title { text-shadow: none; }
:root[data-theme="light"] .th .dex-head-emblem { filter: drop-shadow(0 12px 16px rgba(var(--th-stage-floor-rgb), 0.28)); }
:root[data-theme="light"] .th .dex-coll { box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.6), inset 0 0 0 4px var(--th-gold-faint), 0 2px 0 var(--th-ledge); }
:root[data-theme="light"] .th .dex-coll-big > b { text-shadow: none; }
:root[data-theme="light"] .th .dex-ring::before { background: var(--th-surface-1); }
/* band tiles: white, dashed in the rarity's ink */
:root[data-theme="light"] .th .dex-bandtile { border-color: color-mix(in srgb, var(--th-rc-ink) 45%, transparent); background:
    radial-gradient(120% 70% at 0% 0%, var(--th-rc-wash), rgba(var(--th-ground-rgb), 0) 72%),
    var(--th-surface-1);
  box-shadow: 0 2px 0 var(--th-ledge); }
:root[data-theme="light"] .th .dex-bandtile.is-complete { border-color: rgba(var(--th-own-rgb), 0.45); }
:root[data-theme="light"] .th .dex-bandtile[class*=" r-"] { background:
    radial-gradient(150% 115% at 0% 0%, rgba(var(--th-rc-rgb), 0.3), rgba(var(--th-rc-rgb), 0.12) 45%, rgba(var(--th-rc-rgb), 0) 84%),
    var(--th-surface-1); }
:root[data-theme="light"] .th .dex-bt-ribbon, :root[data-theme="light"] .th .dex-band-ribbon { filter: drop-shadow(0 1px 2px rgba(var(--th-stage-floor-rgb), 0.35)); }
:root[data-theme="light"] .th .dex-bt-n { text-shadow: none; }
:root[data-theme="light"] .th .dex-bt-rule::before { background: var(--th-surface-1); }
:root[data-theme="light"] .th .dex-bt-fan .th-face { box-shadow: 0 0 0 1.5px var(--th-surface-1); }
/* Collection mode */
:root[data-theme="light"] .th .dex-collectbar { background: linear-gradient(90deg, rgba(var(--th-own-rgb), 0.1), rgba(var(--th-own-rgb), 0.02) 60%), var(--th-surface-1); }
/* the results line on a phone: sticky on the lilac ground */
@container th (max-width: 700px) {
  :root[data-theme="light"] .th .dex-binder-sum .dex-ring::before { background: var(--th-surface-3); }
}
/* the Quick look: a white panel, the Stage lit by the pastel rarity wash */
:root[data-theme="light"] .th .dex-look { background: radial-gradient(420px 260px at 130px 70%, var(--th-rc-wash, #ece4f8), rgba(255, 255, 255, 0) 72%), var(--th-surface-1); box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.6), inset 0 0 0 4px var(--th-gold-faint), var(--th-shadow-2); }
:root[data-theme="light"] .th .dex-look-stage { background: radial-gradient(70% 60% at 50% 70%, var(--th-rc-wash, #ece4f8), rgba(255, 255, 255, 0) 76%), radial-gradient(52% 30% at 50% 92%, rgba(var(--th-el), 0.16), rgba(var(--th-el), 0) 72%), #ffffff; box-shadow: inset 0 0 0 1px var(--th-line-2); }
:root[data-theme="light"] .th .dex-look-stage.is-dark-art { background: radial-gradient(70% 70% at 50% 60%, rgba(var(--th-el), 0.9), rgba(var(--th-el), 0.35) 62%, rgba(var(--th-el), 0.12) 84%), #ffffff; }
:root[data-theme="light"] .th .dex-look-art { filter: drop-shadow(0 8px 12px rgba(var(--th-stage-floor-rgb), 0.24)); }
:root[data-theme="light"] .th .dex-look-ribbon, :root[data-theme="light"] .th .dex-bd-ribbon { filter: drop-shadow(0 1px 2px rgba(var(--th-stage-floor-rgb), 0.35)); }
:root[data-theme="light"] .th .dex-look-prog { background: var(--th-surface-2); }
:root[data-theme="light"] .th .dex-look-name a:hover { color: var(--th-link); }
/* the Breakdown */
:root[data-theme="light"] .th .dex-breakdown { box-shadow: inset 0 0 0 3px rgba(var(--th-abyss-rgb), 0.6), inset 0 0 0 4px var(--th-gold-faint), 0 2px 0 var(--th-ledge); }
:root[data-theme="light"] .th .dex-bd-pip { border-color: color-mix(in srgb, var(--th-rc-ink, #5f527a) 45%, transparent); background: radial-gradient(120% 80% at 0% 0%, var(--th-rc-wash, #ece4f8), rgba(255, 255, 255, 0) 72%), #ffffff; box-shadow: 0 2px 0 var(--th-ledge); }
:root[data-theme="light"] .th .dex-bd-pip.is-complete { border-color: rgba(var(--th-own-rgb), 0.5); }
:root[data-theme="light"] .th .dex-bd-pip-n b { text-shadow: none; }
@container th (max-width: 700px) {
  :root[data-theme="light"] .th .dex-bd-list .dex-bd-link { background: var(--th-surface-2); }
}


/* ---------- G15 · card view and Collection mode (owner's design, 2026-11-02) ----------
   The Cookie-Dex is a reference first and a collection second, so the
   collection's CONTROLS live behind one switch, Collection mode
   (lib/dex-collection-mode.js, session-wide, mirrored on
   <body data-collection-mode>). Outside it ("card view") the header keeps one
   small "Your collection" pill, the toolbar is search, Filters, the settings
   gear and the switch, band tiles are the band's size, and the Quick look is
   the cookie and its words with the reader's progress drawn as art on it.
   Inside it everything the collection needs is on screen: the panel with its
   rings, the bar with its tap toggles and views, the Quick look's progress.
   This section is appended last and overrides the sections above it; every
   rule is keyed on the mode or on markup that exists only for it. */

/* the header in card view: the panel folds to ONE pill (the binder strip's
   summary at every width); pressing it turns Collection mode on. The emblem
   gets the room the panel had. */
body:not([data-collection-mode="true"]) .th .dex-head { --dex-coll-w: 250px; }
body:not([data-collection-mode="true"]) .th .dex-coll { align-self: end; padding: 0; border: 0; background: none; box-shadow: none; }
body:not([data-collection-mode="true"]) .th .dex-coll-head,
body:not([data-collection-mode="true"]) .th .dex-coll-body { display: none; }
body:not([data-collection-mode="true"]) .th .dex-binder { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
body:not([data-collection-mode="true"]) .th .dex-binder-sum { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0 16px 0 0; border: 0; border-radius: 999px; background: var(--th-glass); box-shadow: inset 0 0 0 1px var(--th-line-2); color: var(--th-ink); text-align: left; cursor: pointer; }
body:not([data-collection-mode="true"]) .th .dex-binder-sum:hover { box-shadow: inset 0 0 0 1px var(--th-gold-line); }
body:not([data-collection-mode="true"]) .th .dex-binder-sum:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
body:not([data-collection-mode="true"]) .th .dex-binder-sum .dex-ring { --s: 44px; }
body:not([data-collection-mode="true"]) .th .dex-binder-tx { display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; line-height: 1.2; color: var(--th-ink-2); white-space: nowrap; }
body:not([data-collection-mode="true"]) .th .dex-binder-tx b { color: var(--th-ink); font-weight: 800; }
body:not([data-collection-mode="true"]) .th .dex-binder-tx > span { font-size: 11.5px; color: var(--th-ink-3); }
body:not([data-collection-mode="true"]) .th .dex-binder-tx > span:first-child { font-size: 15px; font-weight: 600; }
body:not([data-collection-mode="true"]) .th .dex-sync-dot { display: none; }
/* desktop: the toolbar carries the switch, so the pill stands alone */
@container th (min-width: 701px) {
  .th .dex-binder .dex-mode-btn { display: none; }
}

/* the toolbar: search, the status-effect search (a core lookup, kept in sight:
   the owner's rule that a filter in a closed disclosure is one nobody finds),
   Filters, the gear, the switch. Collected / Missing and Favourites only moved
   into the Collection mode bar. */
.th .dex-tb-gear.th-btn { flex: none; width: 40px; height: 40px; padding: 0; }
.th .dex-tb-gear svg { width: 18px; height: 18px; }
.th .dex-tb-gear[aria-expanded="true"] { color: var(--th-sel-ink); background: var(--th-sel-bg); box-shadow: var(--th-sel-shadow); }
.th .dex-tb-collect.th-btn { flex: none; }



/* the Collection mode bar: the tap TOGGLES (any combination) and the views */
.th .dex-collectbar { flex-wrap: wrap; row-gap: 8px; }
.th .dex-tap-togs { display: inline-flex; gap: 6px; }
.th .dex-tap-tog { --t: var(--th-own-rgb); display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px 0 9px; border: 0; border-radius: 999px; background: var(--th-btn-bg); color: var(--th-ink-2); font: 600 13.5px/1 "Outfit", system-ui, sans-serif; cursor: pointer; }
.th .dex-tap-tog:hover { background: var(--th-btn-hover); }
.th .dex-tap-tog:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .dex-tap-tog--favorite { --t: 195, 162, 255; }
.th .dex-tap-tog--max { --t: 240, 205, 126; }
.th .dex-tap-box { display: grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--th-line-3); }
.th .dex-tap-box svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.th .dex-tap-tog[aria-pressed="true"] { color: var(--th-heading); background: rgba(var(--t), 0.16); box-shadow: inset 0 0 0 1.5px rgb(var(--t)); }
.th .dex-tap-tog[aria-pressed="true"] .dex-tap-box { background: rgb(var(--t)); box-shadow: none; color: var(--th-ground); }
.th .dex-tap-tog[aria-pressed="true"] .dex-tap-box svg { opacity: 1; }
.th .dex-cb-views { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.th .dex-cb-views .dex-tb-seg button { height: 32px; }
.th .dex-cb-views .dex-tb-fav.th-btn { width: 36px; height: 36px; }

/* settings: the switches read "Show …"; progress has four sub-switches; the
   bulk actions are Collection mode's */
.th .dex-settings-sub { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: -2px 0 2px; padding-left: 22px; border-left: 1px solid var(--th-line-2); }
.th .dex-settings-switches .dex-switch small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; line-height: 1.35; color: var(--th-ink-3); }
.th .dex-settings-switches .dex-switch { white-space: normal; }
.th .dex-settings-switches .dex-switch > span:last-child { flex: 1 1 auto; min-width: 0; text-align: left; }
.th .dex-switch--sub { font-size: 13.5px; }
.th .dex-settings-bulk-off { margin-top: 0; }
body:not([data-collection-mode="true"]) .th .dex-settings-bulk > :not(.dex-settings-bulk-off) { display: none; }
body[data-collection-mode="true"] .th .dex-settings-bulk-off { display: none; }

/* the Quick look: the switch beside the close button; the progress well only
   in Collection mode; a larger Stage in card view */
.th .dex-look { grid-template-columns: var(--dex-look-stage-w) minmax(0, 1fr) minmax(0, 380px) auto; }
.th .dex-look-top { grid-area: close; align-self: start; justify-self: end; display: flex; align-items: center; gap: 8px; }
.th .dex-look-top .dex-look-x { margin: 0; }
.th .dex-look-mode.th-btn { height: 36px; font-size: 13.5px; }
body:not([data-collection-mode="true"]) .th .dex-look { --dex-look-stage-w: 320px; grid-template-columns: var(--dex-look-stage-w) minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; grid-template-areas: "stage id close" "stage build build" "stage acts acts"; }
body:not([data-collection-mode="true"]) .th .dex-look-stage { min-height: 320px; }
body:not([data-collection-mode="true"]) .th .dex-look-prog { display: none; }
/* the rarity ribbon leads, larger; type · position · element under the name */
.th .dex-look-ribbon { height: 26px; }
.th .dex-look-traits { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 10px 0 0; font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--th-ink-2); }
.th .dex-look-traits > span { display: inline-flex; align-items: center; gap: 7px; }
.th .dex-look-traits img { width: 26px; height: 26px; object-fit: contain; }
.th .dex-look-traits .dex-look-pos-w { color: var(--th-lane-ink, var(--th-ink-2)); }
/* the reader's progress as art on the Stage (sizes stated: the tile's cqw
   sizes have no container here) */
.th .dex-look-tl { position: absolute; z-index: 3; top: 10px; left: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.th .dex-look-tl .dex-lv { height: 24px; padding: 0 9px; font-size: 13px; }
.th .dex-look-el img { width: 30px; height: 30px; box-shadow: 0 0 0 2px var(--th-surface-1); }
.th .dex-look-el img + img { margin-left: -8px; }
.th .dex-look-candy { z-index: 3; top: 6px; right: 6px; width: 72px; }
.th .dex-look-candy b { margin-top: -14px; font-size: 12px; }
.th .dex-look-promo { z-index: 3; bottom: 10px; width: 78%; height: 42px; }
.th .dex-look-promo[data-promotion-shape="star-row"] { height: 30px; }
body[data-hide-level-badges="true"] .th .dex-look-tl .dex-lv,
body[data-hide-collection-ui="true"] .th .dex-look-tl .dex-lv { display: none; }

@container th (max-width: 1080px) {
  .th .dex-look { grid-template-columns: var(--dex-look-stage-w) minmax(0, 1fr) auto; }
  body:not([data-collection-mode="true"]) .th .dex-look { --dex-look-stage-w: 240px; grid-template-areas: "stage id close" "stage build build" "stage acts acts"; }
  body:not([data-collection-mode="true"]) .th .dex-look-stage { min-height: 260px; }
}

@container th (max-width: 700px) {
  /* the toolbar: search · Filters · the gear, then the effect search and its
     chips (the binder strip in the header carries the switch on a phone) */
  .th .dex-toolbar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "search filters gear" "effect effect effect" "strip strip strip"; }
  .th .dex-tb-gear { grid-area: gear; }
  .th .dex-tb-gear.th-btn { width: 44px; height: 44px; }
  /* card view: the pill fills the strip beside the switch */
  body:not([data-collection-mode="true"]) .th .dex-binder { justify-content: stretch; }
  body:not([data-collection-mode="true"]) .th .dex-binder-sum { flex: 1 1 auto; padding-right: 12px; }
  .th .dex-binder .dex-mode-btn { height: 44px; flex: none; }
  /* the bar: title, Undo, Done / the tap toggles / the views / Collect shown */
  .th .dex-collectbar { grid-template-areas: "title undo done" "modes modes modes" "views views views" "all all all"; }
  .th .dex-cb-modes { flex-wrap: nowrap; }
  .th .dex-tap-togs { flex: 1 1 auto; display: flex; }
  .th .dex-tap-tog { flex: 1 1 0; justify-content: center; height: 44px; padding: 0 8px; }
  .th .dex-cb-views { grid-area: views; display: flex; min-width: 0; }
  .th .dex-cb-views .dex-tb-seg { grid-area: auto; flex: 1 1 auto; display: flex; }
  .th .dex-cb-views .dex-tb-seg button { flex: 1 1 0; justify-content: center; height: 44px; padding: 0 6px; }
  .th .dex-cb-views .dex-tb-fav { grid-area: auto; }
  .th .dex-cb-views .dex-tb-fav.th-btn { width: 44px; height: 44px; }
  .th .dex-cb-modes > .th-label, .th .dex-cb-views > .th-label { display: none; }
  /* the Quick look: the switch (icon only) and the close button float top-right */
  .th .dex-look-top { position: absolute; z-index: 3; top: 6px; right: 6px; gap: 6px; }
  .th .dex-look-top .dex-look-x { position: static; }
  .th .dex-look-mode.th-btn { width: 52px; height: 36px; padding: 0; justify-content: center; }
  .th .dex-look-mode .dex-mode-tx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* only the ribbon's row makes room for them; the name runs full width under it */
  .th .dex-look-id { padding-right: 0; }
  .th .dex-look-k { min-height: 40px; padding-right: 100px; }
  /* the art keeps its card-view size in Collection mode too (owner's call,
     2026-11-05): the mode only adds the progress controls under the build. The
     column has to be restated for the mode, or the desktop columns above (which
     come later in the file than the phone's base rule) widen the art. */
  .th .dex-look { grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "stage id" "build build" "prog prog" "acts acts"; }
  body:not([data-collection-mode="true"]) .th .dex-look { grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "stage id" "build build" "acts acts"; }
  .th .dex-look-stage, body:not([data-collection-mode="true"]) .th .dex-look-stage { min-height: 0; height: 128px; }
  .th .dex-look-ribbon { height: 18px; }
  .th .dex-look-traits { gap: 2px 10px; margin-top: 4px; font-size: 11.5px; letter-spacing: 0.04em; }
  .th .dex-look-traits img { width: 18px; height: 18px; }
  .th .dex-look-tl { top: 5px; left: 5px; gap: 3px; }
  .th .dex-look-tl .dex-lv { height: 17px; padding: 0 5px; font-size: 10px; }
  .th .dex-look-el img { width: 20px; height: 20px; }
  .th .dex-look-candy { width: 40px; top: 2px; right: 2px; }
  .th .dex-look-candy b { font-size: 9.5px; margin-top: -9px; }
  .th .dex-look-promo { height: 22px; bottom: 4px; }
  .th .dex-look-promo[data-promotion-shape="star-row"] { height: 16px; }
}
/* the narrow phones: three controls share the toolbar's first row, so the
   search field may shrink to nothing and Filters keeps its icon and its count
   (the word stays its accessible name) */
@container th (max-width: 700px) {
  .th .dex-toolbar .dex-tb-search, .th .dex-toolbar .dex-tb-search .dex-field, .th .dex-toolbar .dex-tb-search input { min-width: 0; }
  .th .dex-toolbar .dex-tb-search input { width: 100%; }
}
@container th (max-width: 400px) {
  .th .dex-tb-filters > summary.th-btn { gap: 4px; padding: 0 12px; }
  .th .dex-tb-filters > summary > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------------------------------------------------------------- the Quick
   look on a PHONE (owner's calls, 2026-11-05): the art carries no level or
   element badge (the traits beside it name the element), the traits are their
   icons alone (the words stay for screen readers and as each icon's title),
   and the tier fact drops its "Tier" label and leads with the tier as the
   profile's gold tier chip. Above the phone the tier chip is drawn as the
   words it always was. */
.th .dex-look-tier { font: inherit; }
@container th (max-width: 700px) {
  .th .dex-look-tl { display: none; }
  .th .dex-look-traits { gap: 4px 10px; margin-top: 6px; }
  .th .dex-look-traits img { width: 26px; height: 26px; }
  .th .dex-look-trait-tx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .th .dex-look-fact[data-fact="tier"] dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .th .dex-look-fact[data-fact="tier"] { align-items: center; }
  .th .dex-look-fact[data-fact="tier"] dd { display: inline-flex; align-items: center; gap: 6px; }
  .th .dex-look-tier { display: inline-grid; place-items: center; min-width: 24px; height: 20px; padding: 0 5px; border-radius: 6px; font: 700 12.5px/1 "CookieRun KR", "Outfit", sans-serif; color: var(--th-on-gold); background: var(--th-gold-soft-fill); box-shadow: inset 0 -1px 0 rgba(120, 70, 10, 0.35); }
  .th .dex-look-tier-sep { display: none; }
}
/* Below ~342px of .th (360-375px phones and the 320 floor) the Collection mode
   switch and the close button (90px) and the widest rarity ribbon (~106px)
   do not fit side by side in the column beside the art, and the switch sat on
   the ribbon. There the ribbon takes its own line under the two controls,
   which costs ~18px of height rather than shrinking either. The pair (82px
   once the switch is the close button's size, below) needs 194px of column,
   which a 340px .th gives (a 375px phone, 343, keeps the one row). */
@container th (max-width: 342px) {
  .th .dex-look-k { min-height: 0; padding-right: 0; padding-top: 38px; }
}

/* The phone's look, round 3 (owner's calls, 2026-11-05): the Collection mode
   switch is the close button's height (32px, a smaller knob, less padding),
   and the tier is a chip beside the name with no words; the tier fact stays
   in the facts list for screen readers only. A long name wraps with its chip. */
@container th (max-width: 700px) {
  .th .dex-look-mode.th-btn { width: 44px; height: 32px; }
  .th .dex-look-mode .dex-mode-knob { width: 30px; height: 18px; border-radius: 9px; }
  .th .dex-look-mode .dex-mode-knob::after { width: 14px; height: 14px; }
  .th .dex-look-mode.is-on .dex-mode-knob::after, .th .dex-look-mode[aria-pressed="true"] .dex-mode-knob::after { left: 14px; }
  .th .dex-look-k { padding-right: 88px; }
  .th .dex-look-name[data-tier]::after { content: attr(data-tier) / ""; display: inline-grid; place-items: center; vertical-align: 0.12em; margin-left: 5px; min-width: 23px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 5px; font: 700 11.5px/1 "CookieRun KR", "Outfit", sans-serif; letter-spacing: 0; text-shadow: none; white-space: nowrap; color: var(--th-on-gold); background: var(--th-gold-soft-fill); box-shadow: inset 0 -1px 0 rgba(120, 70, 10, 0.35); }
  .th .dex-look-fact[data-fact="tier"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .th .dex-look-facts:not(:has(.dex-look-fact:not([data-fact="tier"]))) { margin: 0; }
}

/* ---------------------------------------------------------------- the Quick
   look above the phone, round 2 (owner's calls, 2026-11-06). */
/* A wide animation canvas is scaled back to its still's size from the foot of
   the art box (`fit` in lib/profile-animations.js); the stage clips its wings. */
.th .dex-look-stage.is-animated .dex-look-art { transform-origin: 50% 100%; scale: var(--dex-look-anim-s, 1); translate: 0 var(--dex-look-anim-y, 0%); }
/* The in-game build is the profile's compact frame (lib/build-answer.js, its
   look in dex.css); a phone keeps the one-line build. While the builds index
   loads the frame holds the height it will have. */
.th .dex-look-frame { grid-area: build; align-self: start; min-width: 0; margin: 0; }
.th .dex-look-frame.is-pending { min-height: 98px; }
.th .dex-look-frame.is-text { grid-template-columns: minmax(0, 1fr); }
/* the Quick look's frame reads the recipe, then the bonus effect tips (with
   the In-game build link), then the beascuit (owner's call, 2026-11-06); the
   profile's frame keeps its own order */
.th .dex-look-frame .dexp-bea { order: 1; }
/* the beascuit's effects wrap rather than end in an ellipsis: the frame is
   narrower here than on the profile, and they are the line's point */
.th .dex-look-frame .dexp-bea { align-items: flex-start; }
.th .dex-look-frame .dexp-bea img { margin-top: 0; }
.th .dex-look-frame .dexp-bea > span { white-space: normal; line-height: 1.4; }
/* The tier sits beside the name: above the phone as the profile's tier chip,
   the gold badge and the modes it is ranked for (owner's call, 2026-11-06); a
   phone draws the badge alone as the name's ::after. Either way the tier fact
   stays in the facts list for screen readers only. */
.th .dex-look-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; }
.th .dex-look-title .dex-look-name { margin-top: 0; }
.th .dex-look-tierchip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px 0 5px; border-radius: 999px; background: var(--th-btn-bg); font: 700 14px/1 "Outfit", system-ui, sans-serif; color: var(--th-ink-2); white-space: nowrap; }
.th .dex-look-tierchip.is-bare { padding: 0 5px; }
.th .dex-look-tierchip .dex-look-tier { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; box-sizing: border-box; border-radius: 7px; font: 700 15px/1 "CookieRun KR", "Outfit", sans-serif; color: var(--th-on-gold); background: var(--th-gold-soft-fill); box-shadow: inset 0 -1px 0 rgba(120, 70, 10, 0.35); }
@container th (min-width: 701px) {
  .th .dex-look-build { display: none; }
  .th .dex-look-fact[data-fact="tier"] { position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .th .dex-look-facts:not(:has(.dex-look-fact:not([data-fact="tier"]))) { margin: 0; }
}
@container th (max-width: 700px) {
  .th .dex-look-frame { display: none; }
  .th .dex-look-title { display: block; margin-top: 4px; }
  .th .dex-look-tierchip { display: none; }
}
/* card view on a wide screen: the frame is a full-width row under the name,
   from the art's edge to the look's, and takes the height the art gives it
   (owner's call, 2026-11-06), with a larger wheel and words to fill it */
@container th (min-width: 1081px) {
  body:not([data-collection-mode="true"]) .th .dex-look { grid-template-rows: auto 1fr auto; }
  body:not([data-collection-mode="true"]) .th .dex-look-frame { align-self: stretch; grid-template-columns: 100px minmax(0, 1fr); gap: 20px; padding: 14px 22px 14px 18px; }
  body:not([data-collection-mode="true"]) .th .dex-look-frame.is-text { grid-template-columns: minmax(0, 1fr); }
  body:not([data-collection-mode="true"]) .th .dex-look-frame :is(.dexp-answer-art-wrap, .dexp-answer-art) { width: 100px; height: 100px; }
  body:not([data-collection-mode="true"]) .th .dex-look-frame .dexp-answer-tx { gap: 7px; }
  body:not([data-collection-mode="true"]) .th .dex-look-frame .dexp-recipe { font-size: 18.5px; }
  body:not([data-collection-mode="true"]) .th .dex-look-frame :is(.dexp-bea, .dexp-targets) { font-size: 14.5px; }
  /* the beascuit's art takes the height the stretched row has to spare, at
     the size of two lines of text, so the look is no taller for it */
  body:not([data-collection-mode="true"]) .th .dex-look-frame .dexp-bea { align-items: center; gap: 10px; margin-top: 2px; }
  body:not([data-collection-mode="true"]) .th .dex-look-frame .dexp-bea img { width: 46px; height: 46px; filter: drop-shadow(0 3px 5px rgba(var(--th-abyss-rgb), 0.45)); }
  body:not([data-collection-mode="true"]) .th .dex-look-frame .dexp-answer-k.th-link { font-size: 13.5px; }
}
/* Collection mode: the progress well sits beside the name only where the
   name column still holds a name on one line (1340px of .th; the Dex is at
   most 1392). Narrower it goes under the look, as it does up to 1080, rather
   than squeezing the name, its traits and the build into a ~170px column
   between the well and the Collection mode switch (2026-11-06). */
@container th (min-width: 1081px) and (max-width: 1339px) {
  body[data-collection-mode="true"] .th .dex-look { grid-template-columns: var(--dex-look-stage-w) minmax(0, 1fr) auto; grid-template-rows: auto auto auto auto; grid-template-areas: "stage id close" "stage build build" "stage acts acts" "prog prog prog"; }
}
/* beside the well the frame is narrow, so it folds as the profile's does
   where it is narrow (the tart's repeated topping, "Legendary"/"Beascuit")
   with a smaller wheel */
@container th (min-width: 1340px) {
  body[data-collection-mode="true"] .th .dex-look-frame { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; padding: 10px 14px 10px 12px; }
  body[data-collection-mode="true"] .th .dex-look-frame :is(.dexp-answer-art-wrap, .dexp-answer-art) { width: 58px; height: 58px; }
  body[data-collection-mode="true"] .th .dex-look-frame .dexp-fold { display: none; }
  body[data-collection-mode="true"] .th .dex-look-frame .dexp-recipe { font-size: 15px; }
  body[data-collection-mode="true"] .th .dex-look-frame .dexp-targets { gap: 2px 12px; }
  /* the tips wrap in this narrow frame, so the link leaves their row and ends
     the frame, under the beascuit */
  body[data-collection-mode="true"] .th .dex-look-frame .dexp-answer-foot { display: contents; }
  body[data-collection-mode="true"] .th .dex-look-frame .dexp-answer-k { order: 2; justify-self: start; }
}
