/* =============================================================================
   tier-lists.css — the two tier lists (/tier-list/ and /treasure-tier-list/)
   on the design system
   -----------------------------------------------------------------------------
   Linked after design-system.css by both pages, and before each page's own
   styles.css. Everything here is built from the system's --th-* tokens; the
   only colours of its own are the TIER TONES, which no other page has.

   WHAT IS HERE
     1  Tier tones (SS..D), as rgb triplets + a badge
     2  The page header: the system's framed header (design-system.css
        section 5) and what the tier lists change about it, plus the ladder
     3  The toolbar (.tl-toolbar): the finder, tier jumps, the count; sticky
     4  Tier bands: the system's band head with a tier badge in front
     5  Tiles: one ranked thing (a cookie, a treasure) as art + name, and the
        preview it opens (assets/js/collapsible-cards.js)
     L  Light theme

   Every rule leads with .th, so nothing reaches outside the root.
   ========================================================================== */

/* ---------- 1 · tier tones ---------- */
/* The ranking's own colours, one per letter, as a HOT-TO-COLD ramp: the
   order every tier list reader already knows (red at the top, cold at the
   bottom), so a tier reads as high or low before its letter does. SS is the
   one that burns (crimson into magenta), then orange, gold, green, blue and
   slate. Each tone is two stops: --tl-tier (the edges, washes and rules) and
   --tl-tier-2 (the deep end of a badge's gradient). Dark letters clear 4.8:1
   on BOTH stops of every tone, so the badge needs no light twin; and nothing
   uses a tone as text on the ground, so the light theme keeps them as they
   are. (Retuned 2026-10-26 from rose / amber / violet / sky / mint / slate,
   whose A and B read as the site's own violet and the Water element.) */
.th .tier-tone-SS { --tl-tier: 255, 77, 109; --tl-tier-2: 236, 52, 160; }
.th .tier-tone-S { --tl-tier: 255, 140, 56; --tl-tier-2: 247, 104, 40; }
.th .tier-tone-A { --tl-tier: 252, 200, 64; --tl-tier-2: 240, 166, 36; }
.th .tier-tone-B { --tl-tier: 108, 206, 124; --tl-tier-2: 52, 178, 120; }
.th .tier-tone-C { --tl-tier: 80, 178, 245; --tl-tier-2: 64, 132, 232; }
.th .tier-tone-D { --tl-tier: 168, 174, 192; --tl-tier-2: 128, 136, 158; }
.th { --tl-tier: 168, 174, 192; --tl-tier-2: 128, 136, 158; --tl-tier-ink: #1d1206; }

/* the badge: the tier's letters on its tone. The letters come from data-tier
   through ::before where the badge sits inside a heading (the heading's text
   already names the tier); elsewhere they are the badge's own text. */
.th .tier-badge { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 50%), linear-gradient(160deg, rgb(var(--tl-tier)), rgb(var(--tl-tier-2))); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 0 18px rgba(var(--tl-tier), 0.35); color: var(--tl-tier-ink); font-family: "CookieRun KR", "Outfit", sans-serif; font-size: 19px; line-height: 1; letter-spacing: -0.02em; text-shadow: none; }
.th .tier-badge[data-tier]::before { content: attr(data-tier); }

/* ---------- 2 · the page header ---------- */
/* The design system's framed page header (design-system.css section 5, the
   hubs' header promoted 2026-10-26), with what the tier lists change about it:
   the picture behind the frame is the page cookie's own portrait blurred
   into a colour field on the right (the hubs have battle art; a portrait
   drawn edge to edge reads as a cut-off face), a title long enough to need a
   smaller size, and ONE side panel, the tier ladder, a little wider than a
   hub's because its rows carry a name, faces and a count. */
.th.tl-page { --th-panel-w: 340px; }
.th .tl-head .th-hub-head-clip { background: var(--th-surface-sunk); }
.th .tl-head .th-hub-head-art { inset: auto; right: -6%; top: -30%; width: 70%; height: 160%; object-fit: cover; object-position: 50% 30%; filter: blur(38px) saturate(1.4); opacity: 0.75; }
.th .tl-head .th-hub-title { font-size: 44px; line-height: 1.04; }
.th .tl-head .th-hub-lede a, .th .tl-head .th-hub-facts a, .th .tl-ladder-panel .th-hub-panel-foot a { color: var(--th-link); font-weight: 600; }
.th .tl-head .th-hub-lede a:hover, .th .tl-head .th-hub-facts a:hover, .th .tl-ladder-panel .th-hub-panel-foot a:hover { text-decoration: underline; }
.th .tl-head .th-hub-facts strong { color: var(--th-ink); font-weight: 700; }
.th .tl-head .th-hub-emblem { max-width: 330px; object-fit: contain; object-position: 50% 100%; }

/* the side panel: the tiers at a glance, each row a jump to its band */
.th .tl-ladder { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.th .tl-ladder-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 36px; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px 4px 5px; border-radius: 12px; transition: background-color 0.15s ease; }
.th .tl-ladder-row:hover { background: var(--th-btn-bg); }
.th .tl-ladder-row:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .tl-ladder-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(160deg, rgb(var(--tl-tier)), rgb(var(--tl-tier-2))); color: var(--tl-tier-ink); font-family: "CookieRun KR", "Outfit", sans-serif; font-size: 15px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16); }
.th .tl-ladder-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--th-ink); }
.th .tl-ladder-faces { display: flex; }
.th .tl-ladder-faces img { width: 26px; height: 26px; margin-left: -7px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 2px var(--th-surface-1); background: var(--th-surface-3); }
.th .tl-ladder-faces img:first-child { margin-left: 0; }
.th .tl-ladder-n { text-align: right; font-size: 13px; color: var(--th-ink-3); }
.th .tl-ladder-n b { color: var(--th-ink); font-size: 15px; }
.th .tl-ladder-panel .th-hub-panel-foot { flex-wrap: wrap; gap: 0 2px; }
.th .tl-ladder-panel .th-hub-panel-foot .th-dot { padding: 0 5px; }

@container th (max-width: 1180px) {
  /* the one panel takes the row under the copy, and the ladder lies down:
     one row of tiers, names and counts only */
  /* the copy keeps the system's 210px clear of the emblem; a wide portrait
     is held to it */
  .th .tl-head .th-hub-emblem { max-width: 200px; }
  .th .tl-head .th-hub-head-in > .tl-ladder-panel { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px; }
  .th .tl-ladder-panel > .th-label { display: none; }
  .th .tl-ladder { flex: 1 1 auto; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
  .th .tl-ladder-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .th .tl-ladder-faces { display: none; }
  .th .tl-ladder-panel .th-hub-panel-foot { flex-basis: 100%; margin-top: 4px; padding-top: 8px; }
}
@container th (max-width: 700px) {
  .th .tl-head .th-hub-head-art { width: 100%; right: -30%; }
  .th .tl-head .th-hub-title { font-size: 31px; }
  .th .tl-head .th-hub-emblem { height: 124px; max-width: 150px; }
  .th .tl-head .th-hub-head-in > .tl-ladder-panel { padding: 8px; gap: 6px; }
  .th .tl-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .th .tl-ladder-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; min-height: 42px; padding: 4px 8px 4px 4px; }
  .th .tl-ladder-badge { width: 30px; height: 30px; font-size: 13.5px; }
  .th .tl-ladder-name { font-size: 13px; }
  .th .tl-ladder-panel .th-hub-panel-foot { padding: 8px 4px 2px; }
}

/* ---------- 3 · toolbar ---------- */
/* sticky under the site header at every width: on a phone the page is many
   screens of portraits, and the finder and the tier jumps are the two things
   a reader reaches for from the middle of it */
.th .tl-toolbar { position: sticky; top: var(--th-sticky-top); z-index: 20; margin-top: 18px; display: flex; align-items: center; gap: 10px 14px; padding: 8px 10px; border-radius: 999px; background: var(--th-surface-1); border: 1px solid var(--th-line-2); box-shadow: var(--th-shadow-1); }
.th .tl-toolbar[hidden] { display: none; }
.th .tl-find { position: relative; display: flex; align-items: center; flex: 1 1 280px; max-width: 420px; min-width: 0; }
.th .tl-jump { flex: none; }
.th .tl-find svg { position: absolute; left: 14px; width: 17px; height: 17px; color: var(--th-ink-3); pointer-events: none; }
.th .tl-find input { width: 100%; min-width: 0; height: 40px; padding: 0 14px 0 40px; border-radius: 999px; border: 1px solid var(--th-line-2); background: var(--th-field-bg); font-size: 14.5px; color: var(--th-ink); }
.th .tl-find input::placeholder { color: var(--th-ink-3); opacity: 1; }
.th .tl-find input:focus { outline: none; border-color: var(--th-focus-color); box-shadow: var(--th-focus-ring); }
.th .tl-find input::-webkit-search-cancel-button { cursor: pointer; }
.th .tl-jump { display: flex; align-items: center; gap: 6px; min-width: 0; }
.th .tl-jump-tier { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 999px; background: rgba(var(--tl-tier), 0.16); color: var(--th-ink); font-family: "CookieRun KR", "Outfit", sans-serif; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(var(--tl-tier), 0.55); transition: background-color 0.15s ease; }
.th .tl-jump-tier:hover { background: rgba(var(--tl-tier), 0.32); }
.th .tl-jump-more { display: inline-flex; align-items: center; height: 36px; padding: 0 13px; border-radius: 999px; background: var(--th-btn-bg); font-size: 13.5px; font-weight: 600; color: var(--th-ink); white-space: nowrap; transition: background-color 0.15s ease; }
.th .tl-jump-more:hover { background: var(--th-btn-hover); }
.th .tl-jump-tier:focus-visible, .th .tl-jump-more:focus-visible { outline: 3px solid var(--th-btn-focus); outline-offset: 0; }
.th .tl-toolbar-count { margin-left: auto; padding-right: 6px; font-size: 13.5px; color: var(--th-ink-3); white-space: nowrap; }
.th .tl-toolbar-count b { color: var(--th-ink); }
@container th (max-width: 900px) {
  .th .tl-jump-more { display: none; }
}
@container th (max-width: 700px) {
  .th .tl-toolbar { gap: 8px; margin-top: 14px; padding: 6px; }
  .th .tl-find { flex: 1 1 0; max-width: none; }
  .th .tl-find input { height: 40px; font-size: 16px; }
  .th .tl-jump { gap: 4px; }
  .th .tl-jump-tier { min-width: 34px; height: 34px; font-size: 13px; }
  .th .tl-toolbar-count { display: none; }
}
@container th (max-width: 340px) {
  .th .tl-jump-tier { min-width: 30px; height: 32px; padding: 0 3px; }
}

/* ---------- 4 · tier bands ---------- */
/* anchors land under the sticky site header AND the toolbar */
.th .tier-band, .th .tier-band .th-band-name, .th [id^="tier-"], .th [id^="treasure-"], .th .th-band-name { scroll-margin-top: calc(var(--th-sticky-top) + 76px); }
.th .tier-band .th-band-head { gap: 16px; }
.th .tier-band .th-band-name { display: flex; align-items: center; gap: 14px; font-size: 24px; overflow: visible; }
.th .tier-band-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.th .tier-band .th-band-rule { background: linear-gradient(90deg, rgba(var(--tl-tier), 0.6), rgba(var(--tl-tier), 0)); }
.th .tier-band .th-band-rule::before { border-color: rgb(var(--tl-tier)); }
.th .tier-section-count { margin-left: 8px; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--th-ink); background: rgba(var(--tl-tier), 0.18); border: 1px solid rgba(var(--tl-tier), 0.5); }
.th .tier-section-count[hidden], .th .tier-band-toggle[hidden], .th .tier-band-body[hidden] { display: none; }
.th .tier-band.is-collapsed .th-band-head { margin-bottom: 0; }
.th .tier-band.is-collapsed .tier-band-toggle svg { transform: rotate(180deg); }
.th .tl-band-lede { max-width: 760px; margin: -4px 0 16px 2px; font-size: 14.5px; line-height: 1.55; color: var(--th-ink-2); }
.th .tl-band-lede a { color: var(--th-link); font-weight: 600; }
.th .tl-band-lede a:hover { text-decoration: underline; }
@container th (max-width: 700px) {
  /* the badge leads the name on its own line; the description under it */
  .th .tier-band .th-band-head { grid-template-areas: "name name name name" "meta meta meta meta" "rule rule count tog"; row-gap: 6px; }
  .th .tier-band .th-band-name { margin-top: 0; font-size: 21px; gap: 12px; }
  .th .tier-band .th-band-meta { margin-top: 0; }
  .th .tier-band .tier-badge { width: 40px; height: 40px; font-size: 17px; }
  .th .tier-band .th-band-rule { margin-top: 4px; }
}

/* ---------- 5 · tiles ---------- */
/* One ranked thing: its art filling the tile, its name under it. The <li> is
   the SLOT that holds the row open while an open card is lifted out of flow
   (collapsible-cards.js), so it is position: relative and the card inside is
   what moves. --tl-peek is how far an open card reaches past its tile on a
   desktop: the details column. app.js reads it to decide which tiles open
   leftwards (data-tl-flip). */
.th .tier-grid { --tl-peek: 340px; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px 12px; }
.th .tier-grid--icons { --tl-peek: 320px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 10px; }
.th .tier-grid > li { position: relative; min-width: 0; }
.th .tier-grid > li[hidden] { display: none; }

.th .tier-cookie { position: relative; z-index: 1; display: block; height: 100%; border-radius: 16px; background: var(--th-surface-1); border: 1px solid var(--th-line); box-shadow: inset 0 2px 0 rgba(var(--tl-tier), 0.55), var(--th-shadow-1); transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.th .tier-cookie-summary { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; padding: 8px 8px 10px; text-align: center; }
.th .tier-cookie-summary[role="button"] { cursor: pointer; }
.th .tier-cookie:has(a[data-collapsible-link]) { cursor: pointer; }
.th .tier-cookie:hover { transform: translateY(-2px); border-color: rgba(var(--tl-tier), 0.55); }
/* the portrait: the system's face atom, filling the tile */
.th .tier-face { width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; background: radial-gradient(circle at 50% 40%, rgba(var(--th-el), 0.35), rgba(var(--th-el), 0) 70%), var(--th-surface-3); }
.th .tier-face .th-face-ini { font-size: 22px; }
.th .tier-face .th-face-el { --th-face-el-scale: 0.24; right: 4px; bottom: 4px; min-width: 18px; min-height: 18px; box-shadow: 0 0 0 2px var(--th-surface-1); }
.th .tier-cookie-name { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; width: 100%; }
/* a name is a card name, so it is in the display face (design/SYSTEM.md, Type) */
.th .tier-cookie-label { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-family: "CookieRun KR", "Outfit", sans-serif; font-size: 13.5px; font-weight: 700; line-height: 1.22; letter-spacing: 0.1px; color: var(--th-ink); text-shadow: none; overflow-wrap: break-word; }
.th a.tier-cookie-label:hover { text-decoration: underline; }
.th .tier-cookie-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.th .tier-mode { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--th-ink-2); background: var(--th-btn-bg); }
.th .tier-mode-arena { color: var(--th-m-ink); background: rgba(var(--th-m-rgb), 0.16); }
.th .tier-mode-pve { color: #a8e6ff; background: rgba(71, 168, 255, 0.16); }
.th .tier-mode-early { color: var(--th-gold); background: var(--th-gold-faint); }
.th .tier-grid--icons .tier-cookie-summary { gap: 6px; padding: 6px 6px 8px; }
.th .tier-grid--icons .tier-cookie-label { font-size: 12.5px; }
.th .tier-grid--icons .tier-face { border-radius: 10px; }

/* the preview: closed it is not drawn at all */
.th .tier-cookie-details { display: none; }
.th .tier-cookie.is-expanded { position: absolute; z-index: 15; top: 0; left: 0; width: calc(100% + var(--tl-peek)); height: auto; display: grid; grid-template-columns: calc(100% - var(--tl-peek)) minmax(0, 1fr); grid-template-areas: "art details"; align-items: start; transform: none; border-color: rgba(var(--tl-tier), 0.7); background: var(--th-ob-1); box-shadow: var(--th-shadow-pop); }
.th .tier-cookie.is-expanded > .tier-cookie-summary { grid-area: art; height: auto; }
.th .tier-cookie.is-expanded > .tier-cookie-details { grid-area: details; display: flex; flex-direction: column; gap: 10px; min-width: 0; align-self: stretch; padding: 12px 14px 14px; border-left: 1px solid var(--th-line); text-align: left; }
/* a tile near the right edge opens leftwards, so the portrait stays where it
   was and the details unfold over the tiles to its left */
.th [data-tl-flip] > .tier-cookie.is-expanded { left: auto; right: 0; grid-template-columns: minmax(0, 1fr) calc(100% - var(--tl-peek)); grid-template-areas: "details art"; }
.th [data-tl-flip] > .tier-cookie.is-expanded > .tier-cookie-details { border-left: 0; border-right: 1px solid var(--th-line); }
.th .tier-cookie-facts { font-size: 12.5px; font-weight: 600; color: var(--th-ink-3); }
.th .tier-cookie-facts .th-dot { padding: 0 5px; }
.th .tier-cookie-note { font-size: 14px; line-height: 1.5; color: var(--th-ink); }
.th .tier-cookie-note a { color: var(--th-link); font-weight: 600; }
.th .tier-cookie-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.th .tier-cookie-stats:empty { display: none; }
.th .tier-stat { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 9px; border-radius: 999px; background: var(--th-btn-bg); font-size: 12.5px; line-height: 1.25; }
.th .tier-stat dt { font-weight: 700; color: var(--th-ink-3); }
.th .tier-stat dd { font-weight: 700; color: var(--th-ink); }
.th .tier-stat--comps { background: rgba(var(--th-m-rgb), 0.14); }
.th .tier-stat--boss { background: rgba(208, 100, 255, 0.14); }
/* the cue that the card goes somewhere: the one gold line in it */
.th .tier-cookie-link { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 4px; font-size: 13.5px; font-weight: 700; color: var(--th-link); }
.th .tier-cookie-link svg { width: 15px; height: 15px; stroke-width: 2.2; transition: transform 0.15s ease; }
.th .tier-cookie:hover .tier-cookie-link svg { transform: translateX(3px); }

/* compact: on a phone a tile is too narrow to read an open card in, so the
   open card spans its grid (collapsible-cards.js reads this flag) with the
   portrait as a column on its left */
@media (max-width: 700px) {
  body.th-page { --collapsible-compact: 1; }
}
@media (max-width: 700px) {
  .th .tier-cookie.is-expanded, .th [data-tl-flip] > .tier-cookie.is-expanded { left: 0; right: auto; grid-template-columns: 104px minmax(0, 1fr); grid-template-areas: "art details"; }
  .th [data-tl-flip] > .tier-cookie.is-expanded > .tier-cookie-details { border-right: 0; border-left: 1px solid var(--th-line); }
  .th .tier-cookie.is-expanded > .tier-cookie-details { padding: 10px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .th .tier-cookie, .th .tier-cookie:hover { transition: none; transform: none; }
  .th .tier-cookie:hover .tier-cookie-link svg { transform: none; }
}

/* ---------- L · light theme ---------- */
:root[data-theme="light"] .th .tl-head .th-hub-head-art { filter: blur(38px) saturate(1.3); opacity: 0.22; }
:root[data-theme="light"] .th .tl-ladder-faces img { box-shadow: 0 0 0 2px #ffffff; }
:root[data-theme="light"] .th .tl-toolbar { box-shadow: 0 3px 0 var(--th-ledge), 0 14px 24px -18px rgba(76, 40, 150, 0.4); }
:root[data-theme="light"] .th .tier-cookie { box-shadow: inset 0 2px 0 rgba(var(--tl-tier), 0.7), 0 3px 0 var(--th-ledge); }
:root[data-theme="light"] .th .tier-cookie.is-expanded { box-shadow: 0 3px 0 var(--th-ledge), 0 24px 40px -16px rgba(60, 30, 110, 0.38); }
:root[data-theme="light"] .th .tier-face { background: radial-gradient(circle at 50% 40%, rgba(var(--th-el), 0.28), rgba(var(--th-el), 0) 70%), var(--th-surface-3); }
:root[data-theme="light"] .th .tier-face .th-face-el { box-shadow: 0 0 0 2px #ffffff; }
:root[data-theme="light"] .th .tier-mode-arena { color: #a2361d; background: rgba(var(--th-m-rgb), 0.13); }
:root[data-theme="light"] .th .tier-mode-pve { color: #155a9c; background: rgba(71, 168, 255, 0.14); }
:root[data-theme="light"] .th .tier-section-count { background: rgba(var(--tl-tier), 0.2); }
:root[data-theme="light"] .th .tl-jump-tier { background: rgba(var(--tl-tier), 0.2); box-shadow: inset 0 0 0 1px rgba(var(--tl-tier), 0.8); }
:root[data-theme="light"] .th .tl-jump-tier:hover { background: rgba(var(--tl-tier), 0.36); }
:root[data-theme="light"] .th .tier-stat--boss { background: rgba(160, 60, 220, 0.1); }
