/* ==========================================================================
   Cape Clash — Modern Home Screen
   Implements docs/specs/HOME-SPEC.md as a *decorator skin* built by
   public/js/home.js (global CapeHome).

   SAFETY VALVE: every rule below is scoped under `#capeHome`, the container
   home.js builds fresh inside `#menu`. Delete this <link> (or home.js never
   runs) and the original menu buttons/text — kept in the DOM, only hidden via
   `.legacyMenuUI` — reappear with zero other changes needed.

   Load order: in <head>, after index.html's own inline <style> block, so the
   var() fallbacks below only ever fire when this sheet is used standalone
   (see public/homelab.html).
   ========================================================================== */

/* The Shop is owned by the main document, but shares the Home palette. Keep its
   visual treatment in a separate scoped sheet so Home's decorator stays legible. */
@import url('./shop-presentation.css');
@import url('./home-city.css');

#capeHome,.ch-bgdepth{
  /* existing six are declared by index.html's own <style> and are NOT
     redefined here: --ink --paper --pow --red --panel --panel2 */
  --ch-cyan:#46d5ed;
  --ch-purp:#a999ed;
  --ch-dimbg:#406585;
  --ch-body:#e3f1ff;
  --ch-body2:#c3e2f5;
  --ch-stroke:#437fa6;
  --ch-surface:#123f65;
  --ch-surface-light:#205d88;
  --ch-ink:#082b49;
  /* shared "framed illustration" language: the hero stage and every
     mode-card's art window use these two values so the page reads as one
     style rather than two different treatments of a picture. */
  --ch-frame-radius:12px;
  --ch-frame-border:1px solid #b8e5ff80;
}

#capeHome{
  width:100%;
  max-width:460px;
  display:flex;
  flex-direction:column;
  /* QA W7R3-4: at 390x844 with a full 4-chest vault (the tallest normal-profile
     stack: topbar + showcase + records + PLAY + chest row + carousel + rail +
     footer, 8 children / 7 gaps), the column ran 4.7px past the fold and
     clipped #chRail's bottom edge. This breakpoint is ABOVE the existing
     max-height:700px compact rule (which already has margin to spare), so the
     8px trimmed here only ever shaves the tall-phone case - it comes out of
     the column gap, never out of a tap target. */
  gap:12px;
  padding-top:var(--sa-top,env(safe-area-inset-top,0px));
  padding-bottom:var(--sa-bottom,env(safe-area-inset-bottom,0px));
  box-sizing:border-box;
}
#capeHome *{box-sizing:border-box;}
/* `hidden` must always win: .ch-chip/.ch-encourage/.ch-lineupEmpty set an explicit
   display, which out-specifies the UA's [hidden]{display:none} and left empty
   record pills visible on a brand-new profile (HOME-SPEC.md 4.3). */
#capeHome [hidden]{display:none !important;}
/* NOTE: this rule is SCOPED. Any node that gets portalled out of #capeHome (the NEW DAY
   banner is the one that does) loses it, and its own class-level `display` then beats the
   UA's [hidden]{display:none} - that is exactly how the banner became a permanent ghost
   in QA wave 8 (W8R3-1). Portalled nodes carry their own `[hidden]` rule; see .ch-newday. */
#capeHome button{font-family:inherit;color:inherit;}
#capeHome button:focus-visible{outline:3px solid var(--pow,#ffd23f);outline-offset:2px;}

/* the original menu chrome: kept in the DOM (still `.click()`-able from
   script), only ever hidden with CSS — see HOME-SPEC.md §3.2 */
.legacyMenuUI{display:none !important;}

/* --------------------------------------------------------------- top bar */
.ch-utilitybar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:44px;
}
/* 1.0b: the brand remains top-left when the earned Passport is ready. Utilities
   yield their text width rather than hiding the logo or clipping phone edges. */
#capeHome .ch-utilitybar .ch-wordmark{flex:0 0 clamp(88px,25vw,112px);width:clamp(88px,25vw,112px);min-width:88px;min-height:44px;padding:0;}
#capeHome .ch-utilitybar .ch-wordmark .ch-logo{width:100%;height:auto;max-width:100%;}
#capeHome .ch-utilitybar .ch-wordmark-svg{width:100%;min-width:0;max-width:100%;height:auto;}
#capeHome .ch-utilitybar .ch-purse{flex:1 1 auto;min-width:0;flex-direction:column;align-items:stretch;gap:3px;}
#capeHome .ch-utilitybar .ch-lvl,#capeHome .ch-utilitybar .ch-coins{justify-content:center;max-width:100%;padding:2px 5px;font-size:11px;}
#capeHome .ch-utilitybar .ch-topbar-icons{flex:0 0 auto;gap:5px;}
@media(max-width:340px){#capeHome .ch-utilitybar{gap:4px;}#capeHome .ch-utilitybar .ch-wordmark{flex-basis:88px;}#capeHome .ch-utilitybar .ch-lvl,#capeHome .ch-utilitybar .ch-coins{padding:2px 3px;gap:3px;font-size:10px;}}
.ch-topbar{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(110px,.64fr);
  align-items:center;gap:10px;width:100%;padding:2px 0;
}
/* The wordmark is the only ELASTIC item in the top bar: the purse (LV + coins + the trophy
   band name) and the two 44px icon buttons all size to their content, and the logo takes
   whatever is left. Before the loop-signals pass it was a hard 150px, which squeezed the
   purse down to 70px and clipped "18 ROOKIE" to "18 RO...". min-width:0 + max-width:100%
   on the SVG is what lets it give way instead; height:auto keeps it in proportion. */
/* WAVE-9 HOTFIX: min-width, not min-width:0. The elastic-logo idea was right but it had
   no FLOOR, so every chip added to the top bar in waves 8-9 came straight out of the
   wordmark until it was a 21x4px smear. The logo now reserves 132px (120px of art + the
   12px of tap padding) and the PURSE is the item that yields (flex:0 1 auto below) - the
   purse's chips already ellipsize, the logo cannot. */
.ch-wordmark{
  background:none;border:0;cursor:pointer;padding:12px 6px;line-height:1;  /* >=44px tap target */
  display:flex;align-items:center;flex:0 1 auto;min-width:132px;
}
.ch-wordmark-svg{width:150px;min-width:120px;max-width:100%;height:auto;display:block;overflow:visible;}
@media (max-width:374px){ .ch-wordmark{min-width:112px;} .ch-wordmark-svg{width:128px;min-width:100px;} }
.ch-topbar-icons{display:flex;align-items:center;gap:6px;flex:0 0 auto;}
/* meta purse: player LEVEL + banked coins, sat between the wordmark and the
   icon buttons. Read-only for now - nothing SPENDS coins yet (shop is future).
   Stacked, not in a row: a 390px top bar already carries a 150px wordmark and
   two 44px buttons, and a side-by-side purse pushed the icons off the edge. */
/* The purse is a <button> (it opens the PROFILE screen), so it has to shed the UA
   button chrome and inherit the page's own type and colour. */
/* loop-signals pass: the quest tally moved OFF the purse and onto the new PROFILE rail
   chip (.ch-railBadge below), which is a 48px tap target that actually opens the quest
   list - so the purse loses both the badge and the 18px bottom margin that was reserving
   room for it, and spends that room on the trophy chip instead. Net height is a wash. */
.ch-purse{display:flex;flex-direction:row;align-items:center;gap:8px;margin-right:0;min-height:44px;
  background:none;border:0;padding:0;font:inherit;color:inherit;cursor:pointer;text-align:right;
  position:relative;flex:0 1 auto;min-width:0;}
  /* sizes to its widest chip (the trophy chip included, now that it is content-sized);
     the wordmark - already min-width:0;max-width:100% - is the element that yields. */
.ch-purse:active{transform:translateY(1px);}
/* The earned identity keeps its own row; the logo remains in the utility row. */
#capeHome .ch-passport-door{grid-column:1;grid-row:1;min-width:0;width:100%;padding:0;margin:0;border:0;background:none;color:inherit;text-align:left;cursor:pointer;min-height:76px}
#capeHome .ch-passport-door[hidden],#capeHome .ch-wordmark[hidden]{display:none}
#capeHome .ch-passport-door:focus-visible{outline:3px solid #74c0fc;outline-offset:2px;border-radius:10px}
#capeHome .ch-topbar .ch-wordmark{grid-column:1;grid-row:1;min-width:0;max-width:100%;}
#capeHome .ch-topbar .ch-metarow{grid-column:2;grid-row:1;min-width:0;}
#capeHome .ch-utilitybar .ch-topbar-icons.cc3 .ch-iconbtn{width:44px;min-width:44px;}
/* The Home passport is a compact calling card, not the full profile page. Its
   earned illustration, frame, title and all three badge slots remain visible. */
#capeHome #chPassport .cppCard[data-compact=true]{
  display:grid;grid-template-columns:minmax(0,1fr);gap:2px 6px;max-width:none;padding:7px 8px;
}
#capeHome #chPassport .cppBrand{grid-column:1 / -1;margin:0;padding-bottom:2px;font-size:11px;line-height:12px;}
#capeHome #chPassport .cppIdentity{grid-column:1 / -1;min-height:34px;}
#capeHome #chPassport .cppName{font-size:17px;line-height:19px;}
#capeHome #chPassport .cppMeta{grid-column:1 / -1;margin:0;font-size:8px;line-height:11px;}
#capeHome #chPassport .cppBadges{grid-column:1 / -1;grid-row:4;align-items:center;margin:0;gap:2px;}
#capeHome #chPassport .cppBadgeSlot{min-height:26px;height:26px;}
#capeHome #chPassport .cppStats{grid-column:1 / -1;grid-row:5;align-items:center;gap:3px;}
#capeHome #chPassport .cppStat{padding:2px 3px;}
/* These two facts get the card's width instead of splitting a fixed 76px beside
   three badges. Keep the labels and values readable; never hide or compress them. */
#capeHome #chPassport .cppStatLabel{font-size:8px;line-height:9px;letter-spacing:.2px;}
#capeHome #chPassport .cppStatValue{font-size:12px;line-height:13px;}
/* Clash ladder chip: the count + the band name, tinted with the band's own colour through
   --chBand (set by renderTrophies from records().bandColor). Deliberately smaller type than
   the LV / coins chips - it is the third line in a top bar that already carries a 150px
   wordmark and two 44px buttons, and the BAND NAME is the part that has to fit ("MAIN
   EVENT" is the longest). It clips rather than pushing the icon buttons off a 360px edge. */
/* width:auto, not 100%: the chip was slaved to the purse column, and the purse column is
   sized by the LV and coins chips - so a three-digit coin balance clipped a nine-character
   band label ('18 RO...') while a four-digit one rendered fifteen characters comfortably.
   The chip now contributes its OWN max-content to the column and stretches to match it. */
/* W13 FIX1: both pills are content-sized but neither pinned flex-shrink, so the DEFAULT
   shrink:1 squeezed the trophy pill before .ch-metarow's flex-wrap was ever allowed to do
   its job - and the guard below (a last-resort ellipsis) fired on the normal case, eating
   the final E of "0 ROOKIE" on a 360px phone. flex:0 0 auto makes the row WRAP instead,
   which is exactly what the .ch-metarow comment says it is for. */
.ch-troph{
  display:flex;align-items:center;justify-content:center;gap:4px;flex:0 0 auto;
  width:100%;max-width:100%;min-height:28px;align-self:stretch;
  background:var(--ch-surface);border:1px solid var(--chBand,var(--ch-stroke));
  border-radius:20px;padding:1px 8px;font-family:'Bangers',cursive;font-size:10.5px;
  letter-spacing:.6px;color:var(--chBand,var(--paper,#fff8e7));line-height:1.25;white-space:nowrap;
}
.ch-troph .ci{width:12px;height:12px;flex:0 0 12px;}
/* last-resort guard only: the purse is content-sized, so this should never actually clip -
   but a future band name longer than MAIN EVENT must degrade, not push the icons off. */
.ch-troph .v{overflow:hidden;text-overflow:ellipsis;min-width:0;}
@media (max-width:374px){ .ch-troph{font-size:9.5px;padding:1px 6px;letter-spacing:.3px;} }
/* SEASON chip (name-season-ui pass, META-SPEC 9.2): shares a row with the trophy chip
   rather than costing the purse a whole extra line. flex-wrap so two content-sized pills
   that don't both fit a narrow purse drop to two lines instead of clipping or overflowing
   the topbar - the purse column itself just grows to match, same as the trophy chip. */
/* WAVE-9 HOTFIX: flex-basis:100% makes this the top bar's WRAPPED SECOND ROW instead of
   the purse's third line, so the full 350px bar width is available to it and neither chip
   can push on the wordmark. justify-content keeps it right-aligned under the purse. */
.ch-metarow{display:flex;flex-direction:column;gap:6px;justify-content:center;align-items:stretch;
  width:100%;max-width:100%;}
.ch-season{
  display:flex;align-items:center;justify-content:center;gap:5px;flex:0 1 auto;
  width:100%;max-width:100%;min-width:44px;min-height:48px;box-sizing:border-box;
  background:linear-gradient(100deg,#174e77,#1d648f);border:1px solid #8acbea80;
  border-radius:12px;padding:5px 11px;font-family:'Bangers',cursive;font-size:12px;
  letter-spacing:.3px;color:var(--paper,#fff8e7);line-height:1.25;white-space:normal;
  cursor:pointer;box-shadow:inset 0 1px 0 #ffffff18,0 2px 0 #082b4970;
}
.ch-season:focus-visible{outline:3px solid var(--paper,#fff8e7);outline-offset:2px;}
.ch-season:active{box-shadow:none;}
.ch-season .ci{width:16px;height:16px;flex:0 0 16px;}
.ch-season-arrow{transform:rotate(180deg);}
.ch-season-copy{min-width:0;display:grid;gap:2px;justify-items:start;text-align:left;}
.ch-season-copy strong{color:#ffdf68;font:400 1.13em/1 'Bangers',cursive;letter-spacing:.045em;}
.ch-season .v{min-width:0;overflow-wrap:anywhere;}
@media (max-width:374px){ .ch-season{font-size:11.5px;padding:5px 7px;letter-spacing:.2px;} }
/* LV chip + its XP bar share one column so the bar is exactly as wide as the chip. */
.ch-lvwrap{display:flex;flex-direction:column;align-items:stretch;gap:2px;}
.ch-lvbar{
  display:block;height:5px;border-radius:4px;overflow:hidden;
  background:rgba(0,0,0,0.45);border:1px solid var(--ch-stroke);
}
.ch-lvbar>i{
  display:block;height:100%;width:0;border-radius:3px;
  background:linear-gradient(90deg,var(--pow,#ffd23f),#fff3b0);
  transition:width .35s ease;
}
.ch-lvbar.is-max>i{background:linear-gradient(90deg,#ffd23f,#ff9f43);}
/* a 68px bar makes 2% of a level about 1px - too thin to read as "started". Any
   non-zero progress gets a 5px nub; a truly empty bar stays empty. */
.ch-lvbar.has-xp>i{min-width:5px;}
@media (prefers-reduced-motion:reduce){ .ch-lvbar>i{transition:none;} }
.ch-lvl,.ch-coins{
  display:flex;align-items:center;gap:5px;
  background:var(--ch-surface);border:1px solid var(--ch-stroke);border-radius:10px;
  padding:3px 9px;font-family:'Bangers',cursive;font-size:13px;letter-spacing:.8px;
  color:var(--paper,#fff8e7);line-height:1.15;white-space:nowrap;
}
.ch-coins{min-width:0;}
.ch-coins .v{min-width:0;overflow:hidden;text-overflow:ellipsis;color:#ffd23f;}   /* W344 E-231: a coin number is always gold */
@media (max-width:374px){
  .ch-utilitybar{gap:6px;}
  .ch-purse{gap:5px;margin-right:0;}
  .ch-lvl,.ch-coins{font-size:11px;padding:2px 5px;gap:4px;}
  .ch-lvbar{height:4px;}
}
.ch-iconbtn{
  width:44px;height:44px;min-width:44px;border-radius:10px;   /* mobile minimum tap target */
  background:linear-gradient(180deg,var(--ch-surface-light),var(--ch-surface));border:1px solid #81b8d780;
  color:var(--ch-body);font-size:17px;display:flex;align-items:center;
  justify-content:center;cursor:pointer;
}
.ch-iconbtn:active{transform:translateY(2px);}

/* ---------------------------------------------------------- hero showcase */
.ch-showcase{
  display:flex;flex-direction:column;align-items:center;gap:7px;width:100%;padding:10px 9px 8px;
  background:radial-gradient(ellipse at 50% 10%,#5ab4d936,transparent 70%),linear-gradient(145deg,#205b83,#123d65);
  border:1px solid #8acbea80;border-radius:16px;box-shadow:inset 0 1px 0 #ffffff20,0 4px 0 #082b4966;
}

.ch-leaderchip{
  display:flex;align-items:center;gap:9px;background:none;
  border:0;border-bottom:1px solid #9fd6ef40;
  border-radius:0;padding:2px 5px 8px;cursor:pointer;text-align:left;
  width:100%;min-height:44px;
}
#capeHome #chLeaderChip{--ch-leader-bust:54px;min-height:44px;padding-block:6px;}
#capeHome #chLeaderChip:focus-visible{outline:2px solid #ffe199;outline-offset:-3px;}
.ch-leaderchip:active{transform:translateY(2px);}
#capeHome #chLeaderChip .ch-leaderchip-icon{
  width:var(--ch-leader-bust);height:var(--ch-leader-bust);padding:1px;border:1px solid #90d9ed;
  border-radius:9px;background:#082b49;box-shadow:0 2px 0 #062949;
}
.ch-leaderchip-icon svg{width:100%;height:100%;display:block;}
.ch-leaderchip-icon img.ch-leaderchip-art{width:100%;height:100%;display:block;object-fit:contain;border-radius:7px;}
.ch-leaderchip-info{display:flex;flex:1;flex-direction:column;min-width:0;gap:2px;}
.ch-leaderchip-top{display:flex;align-items:center;gap:5px;min-width:0;flex-wrap:wrap;}
.ch-leaderchip-action{
  margin-left:auto;padding:2px 5px;border:1px solid #90d9ed;border-radius:5px;
  background:#103858;color:#e5f7ff;font:900 9px/1.1 system-ui,sans-serif;letter-spacing:.45px;
}
/* Keep the existing gold level language, including a real owner-supplied LV 1. */
.ch-leaderchip-lv{
  display:inline-flex;align-items:center;flex:0 0 auto;border-radius:999px;
  padding:1px 7px;background:var(--pow,#ffd23f);color:var(--ink,#1b1430);
  font-family:system-ui,-apple-system,sans-serif;font-size:9.5px;font-weight:900;
  letter-spacing:.4px;font-variant-numeric:tabular-nums;white-space:nowrap;
}
.ch-leaderchip-lv[hidden]{display:none;}
#capeHome #chLeaderChip .ch-leaderchip-name{
  font:20px/1.05 'Bangers',cursive;letter-spacing:.6px;color:#fff5cd;
}
#capeHome #chLeaderChip .ch-leaderchip-passive{
  font-size:11px;line-height:1.2;font-weight:700;color:var(--ch-body);
}
#capeHome #chLeaderChip .ch-leaderchip-recovery{
  display:block;font-size:10px;line-height:1.15;font-weight:700;
  color:#c2e5f5;font-variant-numeric:tabular-nums;
}
#capeHome #chLeaderChip :is(.ch-leaderchip-name,.ch-leaderchip-passive,.ch-leaderchip-recovery){
  white-space:normal;overflow-wrap:anywhere;
}
.ch-leaderchip-recovery[hidden]{display:none;}
@media(max-height:740px){#capeHome #chLeaderChip{--ch-leader-bust:48px;padding-block:5px;}}
html[data-text="large"] #capeHome #chLeaderChip .ch-leaderchip-passive{font-size:13px;}
html[data-text="large"] #capeHome #chLeaderChip .ch-leaderchip-recovery{font-size:12px;}
html[data-text="large"] #capeHome #chLeaderChip .ch-leaderchip-action{font-size:10px;}
/* A ringing phone only competes with the top plate on narrow Home. Let the
   mechanical text run below its reserved corner rather than squeezing every row. */
@media(max-width:374px){
  #capeHome #chLeaderChip .ch-leaderchip-name{font-size:18px;}
  #capeHome #chLeaderChip.ch-has-door{padding-inline-end:10px;}
  #capeHome #chLeaderChip.ch-has-door :is(.ch-leaderchip-top,.ch-leaderchip-name){margin-inline-end:75px;}
  #capeHome #chLeaderChip.ch-has-door .ch-leaderchip-name{
    min-height:35px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;
  }
}

.ch-portraitwrap{
  background:none;border:0;padding:0;cursor:pointer;width:100%;
  display:flex;flex-direction:column;align-items:center;gap:4px;
}
.ch-stage{
  position:relative;width:min(52vw,220px);min-width:140px;aspect-ratio:1/1;
  display:flex;align-items:center;justify-content:center;
  /* No frame here. Borrowing the mode-card's framed-art treatment put a hard
     rectangular panel box inside the round glow (wave-5 art review): the hero
     read as a photo in a slot instead of standing on a lit stage. The stage is
     the glow (.ch-stage-glow), the plinth (.ch-stage-plinth) and the rim light
     alone - no box, no plate, nothing for the silhouette to be cropped by. */
  padding:8px;box-sizing:border-box;background:none;border:0;
}
/* rim-light gradient behind the hero, pulsing slowly (transform+opacity only,
   so it composites on its own layer instead of forcing paint) */
.ch-stage-glow{
  position:absolute;inset:-16%;z-index:0;border-radius:50%;pointer-events:none;
  background:radial-gradient(circle at 50% 42%,rgba(255,210,63,.55) 0%,rgba(255,210,63,.22) 40%,rgba(255,210,63,0) 72%);
  animation:chGlowPulse 4s ease-in-out infinite;
}
/* plinth: a grounded contact shadow so the hero reads as standing on a stage
   rather than floating in the panel */
/* W19 FRONT DOOR. Both faults read as "sticker", not "standing":
   1. THE GAP. bottom:-4% put the ellipse's centre 21px BELOW the boots at 390x844, with a
      6px band of lit stage between shadow and feet. heroMini stops its ink about a tenth of
      the canvas above the box, so the plinth is lifted onto that line - measured centre now
      2.9px high at 390x844, 1.5px low at 360x640. The hero paints over it (sway is z-index
      2, this is 1), the way the comic's contact ellipse works.
   2. THE EDGE. .3 -> 0 across 55-78% of the radius is steep enough to read as a rim, and
      the last 22% of the box was dead. The falloff runs to the edge now. */
.ch-stage-plinth{
  position:absolute;left:50%;bottom:calc(6% + 4px);z-index:1;width:76%;height:15%;
  transform:translateX(-50%);border-radius:50%;pointer-events:none;
  background:radial-gradient(ellipse at center,rgba(0,0,0,.52) 0%,rgba(0,0,0,.40) 36%,
    rgba(0,0,0,.22) 60%,rgba(0,0,0,.08) 82%,rgba(0,0,0,0) 100%);
}
.ch-portrait-sway{
  position:relative;z-index:2;width:100%;height:100%;
  animation:chSway 4.6s ease-in-out infinite;
}
.ch-portrait-canvas{width:100%;height:100%;display:block;}
@keyframes chGlowPulse{
  0%,100%{opacity:.62;transform:scale(1);}
  50%{opacity:1;transform:scale(1.07);}
}
.ch-herolabel{display:flex;flex-direction:column;align-items:center;gap:3px;}
.ch-heroname{
  font-family:'Bangers',cursive;font-size:18px;letter-spacing:1px;
  color:var(--pow,#ffd23f);text-shadow:2px 2px 0 var(--red,#e03131);
}
.ch-heroclass{
  font-size:10px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;
  border-radius:6px;padding:2px 9px;color:#fff;
}
/* WAVE 22 - the plinth's RECORD mark. Stars say how unusual the card is; they lock nothing
   (house rule 1), so this reads as a quiet line under the name, never as a badge that shouts.
   Built by index.html's homeStarsSync(); home.js owns no star state. */
.ch-herostars{display:inline-flex;align-items:center;gap:5px;line-height:0;}
.ch-herorar{font-size:8.5px;font-weight:800;letter-spacing:.9px;line-height:1;color:#b6abdd;}
.ch-herostars .starRow{gap:2px;}
.ch-herostars .ci-svg{width:10px;height:10px;}
.ch-herostars .starRow i{width:10px;height:10px;}
#capeHome.ch-fit-8 .ch-herostars{display:none;}   /* the shortest rung drops decoration first */

.ch-lineupEmpty{
  background:var(--ch-dimbg);color:#cfc8e6;border:3px solid var(--ink,#1b1430);
  border-radius:14px;padding:16px 18px;text-align:center;cursor:pointer;
  width:min(320px,94%);font-family:'Bangers',cursive;font-size:16px;letter-spacing:1px;
  box-shadow:0 5px 0 #34304a;
}
.ch-lineupEmpty:active{transform:translateY(4px);box-shadow:0 1px 0 #34304a;}

@keyframes chSway{
  0%,100%{transform:rotate(-2deg) translateY(0);}
  50%{transform:rotate(2deg) translateY(-4px);}
}
@media (prefers-reduced-motion:reduce){
  .ch-portrait-sway{animation:none;}
  .ch-stage-glow{animation:none;opacity:.85;}
}
/* Paired class half of the query above: body.cc-rm is the in-game REDUCED MOTION
   switch (index.html applyReducedMotion()), which is also true whenever the OS
   asks for it - so the media query is only the pre-boot fallback. */
body.cc-rm .ch-portrait-sway{animation:none;}
body.cc-rm .ch-stage-glow{animation:none;opacity:.85;}

/* ------------------------------------------------------- background depth */
/* Sibling of #capeHome inside #menu (#menu is position:fixed;inset:0, so a
   position:absolute;inset:0 child of it covers the full screen regardless of
   #capeHome's own — shorter, centered — content height). Two gradient layers
   (a soft cyan highlight near the top + a dark vertical base) replace the
   flat ink fill + dot-grid that shows through elsewhere; the faint skyline
   silhouette sits at the very bottom, under the carousel/rail, and drifts up
   to 6px with carousel scroll (home.js updateParallax()). */
.ch-bgdepth{
  position:absolute;inset:0;z-index:-1;overflow:hidden;pointer-events:none;
  background:
    radial-gradient(ellipse 120% 65% at 50% 30%,#2588b880,transparent 72%),
    radial-gradient(circle at 1px 1px,#b6e9ff10 1px,transparent 1.5px),
    linear-gradient(180deg,#14466e 0%,#176c9a 46%,#103958 100%);
  background-size:auto,13px 13px,auto;
}
.ch-bg-skyline{
  position:absolute;left:-3%;right:-3%;bottom:0;height:24%;opacity:.28;
}
.ch-bg-skyline svg{width:100%;height:100%;display:block;}
.ch-bg-skyline svg g{fill:#082c4e;}
.ch-bgdepth[data-holiday-phase]>.ch-bg-skyline,
.ch-bgdepth[data-holiday-phase]>.ch-amb{visibility:hidden;}
.ch-bgdepth[data-holiday-phase] .ch-amb *{animation-play-state:paused !important;}

/* --------------------------------------------------------------- records */
.ch-records{
  display:flex;align-items:center;justify-content:center;gap:10px;
  width:100%;min-height:24px;
}
/* One chip rule everywhere: the ICON keeps its semantic colour (it carries the meaning)
   and the NUMBER is always --paper (it carries the value). Printing both in the same gold
   made the pair read as a single 30px smear with the trophy's thin handles invisible. */
.ch-chip{
  display:flex;align-items:center;gap:6px;background:#103d63c9;
  border:1px solid #8acbea66;border-radius:20px;padding:4px 12px;
  font-family:'Bangers',cursive;font-size:14px;letter-spacing:.5px;color:var(--paper,#fff8e7);
}
.ch-encourage{font-weight:800;color:var(--ch-body2);font-size:12px;text-align:center;}
/* Supporting numbers and saved squads stay available without becoming another
   pair of primary-action panels. The lineup buttons keep their 44px targets. */
#capeHome #chPowerRow{margin-bottom:0;}
#capeHome .ch-powerplate{
  min-height:30px;flex-direction:row;flex-wrap:wrap;gap:3px 10px;padding:3px 8px;
  background:none;border:0;border-radius:0;color:#dcefff;
}
#capeHome .ch-powerplate b{font-size:15px;color:#f0f8ff;}
#capeHome .ch-powerplate i{font-size:10px;opacity:1;}
#capeHome #homeBinder .ccBinderTab{
  position:relative;isolation:isolate;min-width:44px;min-height:44px;padding:5px 10px;font-size:15px;
  border:0;border-radius:9px;background:none;color:#e3f1ff;box-shadow:none;
}
#capeHome #homeBinder{margin:0;}
#capeHome #homeBinder .ccBinderRow{gap:4px;}
#capeHome #homeBinder .ccBinderTab::before{
  content:'';position:absolute;inset:7px;z-index:-1;border:1px solid #8acbea80;border-radius:6px;background:#174e77;
}
#capeHome #homeBinder .ccBinderTab[aria-pressed="true"]{
  color:var(--ch-ink);
}
#capeHome #homeBinder .ccBinderTab[aria-pressed="true"]::before{background:#d9f2ff;border-color:#fff;box-shadow:inset 0 -2px 0 #8acbea;}

/* ------------------------------------------------------ primary PLAY CTA */
/* The one large, unmissable "start playing" button - resumes profile.lastMode
   (home.js MODE_INFO / CapeHome.init's lastMode callback, defaults to Endless
   for a fresh profile). Sits above the carousel; the carousel cards remain
   secondary (browse/pick a different mode), matching the game's existing
   chunky-comic-button language (index.html .bigBtn: gold, ink border, offset
   drop-shadow, translateY press) rather than inventing a new button style. */
.ch-playbtn{
  display:flex;align-items:center;justify-content:center;gap:10px;
  width:min(400px,94%);min-height:56px;margin:0 auto;
  background:linear-gradient(180deg,#ffe577,#ffd23f);color:var(--ch-ink);
  border:2px solid #ffe99e;border-radius:16px;
  box-shadow:0 4px 0 #af791d,0 7px 0 #082b4970;cursor:pointer;padding:8px 18px;
}
#capeHome .ch-playbtn{color:var(--ch-ink);}
.ch-playbtn:active{transform:translateY(4px);box-shadow:0 1px 0 #b8901a;}
.ch-playbtn .ico{font-size:26px;line-height:1;display:flex;flex:none;}
.ch-playbtn-text{display:flex;flex-direction:column;align-items:flex-start;line-height:1.15;min-width:0;}
.ch-playbtn-label{font-family:'Bangers',cursive;font-size:22px;letter-spacing:1.5px;}
/* W13 FIX1: opacity .72 on an 8.6px uppercase line under the biggest button on the screen
   is subtlety where the label needs contrast. .85 across the board. */
.ch-playbtn-sub{
  font-size:11px;font-weight:800;letter-spacing:.3px;text-transform:uppercase;
  opacity:.85;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;
}
@media (max-width:374px){
  .ch-playbtn{min-height:52px;gap:8px;}
  .ch-playbtn-label{font-size:19px;}
  .ch-playbtn-sub{font-size:10px;}
}
/* W13 FRONT DOOR. Every static mode label is 18 characters or fewer ('CO-OP (AI PARTNER)'),
   but the STORY row's label carries a MISSION NAME - 'STORY - THE MAN WHO BOUGHT THE
   BUILDING' is 39 - and the sub-label is a single ellipsised line. At 360px that ellipsis
   ate the end of the mission name, which is the one word the CTA exists to say. home.js
   (setPlaySub) adds .is-long past 20 characters and this steps the type down enough for the
   full string to fit on one line at 360px; the row's height never changes, because the
   label above it still sets the line box. Specificity (0,2,0) beats every plain
   .ch-playbtn-sub rule above, in or out of a media block. */
/* W13 FIX1: stepping the type down did not work - 360x640 hit BOTH media blocks, landed on
   8.6px and STILL ellipsised 'STORY - THE MAN WHO BOUGHT THE BUILDING'. The fix is to stop
   trying to fit 39 characters on one line: .is-long now WRAPS to at most two lines at a
   legible 10.5px and the button grows the ~11px it needs (min-height is a floor, not a cap).
   line-clamp keeps a hypothetical 3-line string from ever pushing the carousel off a short
   phone, and the fit ladder has far cheaper places to pay than the CTA's own words. */
.ch-playbtn-sub.is-long{
  font-size:10.5px;letter-spacing:0;line-height:1.15;white-space:normal;text-overflow:clip;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;
}
@media (max-width:374px){.ch-playbtn-sub.is-long{font-size:9.8px;}}
@media (max-height:700px){.ch-playbtn-sub.is-long{font-size:9.8px;}}

/* Utilities and identity begin at the top on every phone; the existing scroll
   container and fit ladder retain access when the whole column cannot fit. */
#menu.center{justify-content:flex-start;}

/* ------------------------------------------------------------- chest door */
/* docs/specs/META-SPEC.md section 6. WAVE 28, OWNER DIRECTIVE 4: ONE chest element on HOME,
   directly under the PLAY CTA, and it is a DOOR - it always opens the chest page, where every
   count, every free row and OPEN 1/10/ALL actually live. The four-tile preview row is gone: it
   was four near-identical glyphs saying what the page behind them says better, and a brand-new
   player (who owns a starter chest from his first minute) had no idea it was one place.
   The door is ALWAYS on the screen, even at zero, because a player has to know where his chests
   live before he has any - and because the home tour's chest stop needs a real rectangle to ring
   on a fresh save. #chChestFx is still a zero-height layer the door never touches, so the
   fallback host's opening burst and reward pill survive a refresh() mid-animation. */
.ch-chestwrap{position:relative;width:min(400px,94%);margin:0 auto;text-align:center;}
.ch-chestdoor{
  position:relative;display:inline-flex;align-items:center;justify-content:center;gap:9px;
  min-height:48px;padding:6px 20px;cursor:pointer;
  background:linear-gradient(180deg,#246b95,#164d76);border:1px solid #8acbea80;border-radius:12px;
  color:var(--ch-body);font-family:'Bangers',cursive;font-size:17px;letter-spacing:1.3px;
}
.ch-chestdoor-ico{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:center;
  width:34px;height:30px;flex:0 0 34px;border:1px solid #cdeeff88;border-radius:9px;
  background:radial-gradient(ellipse at 50% 0%,#fff4bc35,transparent 72%),linear-gradient(155deg,#286b91,#0c3559);
  box-shadow:0 1px 0 #061a2b,inset 0 0 0 1px #fff8e722;}
.ch-chestdoor-ico .ch-chestdoor-art{position:absolute;z-index:1;inset:-2px;width:calc(100% + 4px);height:calc(100% + 4px);
  object-fit:contain;visibility:hidden;filter:drop-shadow(0 2px 2px #061728bb);pointer-events:none;}
.ch-chestdoor.is-live .ch-chestdoor-art.art-gold.is-loaded,
.ch-chestdoor.is-idle .ch-chestdoor-art.art-silver.is-loaded{visibility:visible;}
.ch-chestdoor.is-live .ch-chestdoor-art.art-gold.is-loaded ~ .ci,
.ch-chestdoor.is-idle .ch-chestdoor-art.art-silver.is-loaded ~ .ci,
.ch-chestdoor.is-live .ch-chestdoor-art.art-gold.is-loaded ~ .ch-chestdoor-dot,
.ch-chestdoor.is-idle .ch-chestdoor-art.art-silver.is-loaded ~ .ch-chestdoor-dot{visibility:hidden;}
.ch-chestdoor:focus-visible{outline:3px solid #fff2bd;outline-offset:3px;}
.ch-chestdoor-dot{width:18px;height:18px;border-radius:5px;background:#5b4f92;display:block;}
.ch-chestdoor-lbl{line-height:1;}
/* NOTHING TO OPEN: the door sits STILL. That is the whole difference - WAVE 28 fix2 took the
   .74 dim off, because a dimmed control with a grey border and grey text is this game's own
   visual language for DISABLED, and the first thing a brand-new player sees is the one place his
   chests live looking switched off. It is never disabled: it always opens the chest page, where
   his free rows are counting. Idle versus live is MOTION (and the count pill), not opacity. */
.ch-chestdoor.is-idle{opacity:1;}
/* SOMETHING TO OPEN: the door blinks. The blink is a RING on ::after - opacity + transform
   only, no box-shadow keyframe (which would repaint the door and its backdrop every frame) and
   nothing on the button's own transform, so :active still presses. Same shape as #tut's glow. */
.ch-chestdoor.is-live{border-color:#d8efff;color:#fff2bd;}
.ch-chestdoor::after{content:'';position:absolute;inset:-5px;border-radius:19px;
  pointer-events:none;border:3px solid rgba(255,210,63,.9);opacity:0;transform:scale(.985);}
.ch-chestdoor.is-live::after{animation:chDoorPulse 1.5s ease-in-out infinite;}
@keyframes chDoorPulse{
  0%,100%{opacity:.30;transform:scale(.985);}
  50%{opacity:1;transform:scale(1.045);}}
.ch-chestdoor:active{transform:translateY(2px);}
/* WAVE 45c (docs/specs/VOICEMAIL-45.md): THE VILLAIN'S VOICEMAIL door. position:fixed keeps
   it out of the fit ladder entirely (see public/js/home.js's own note beside #chVmDoor) -
   HOME already carries five cards, a chest door and six rail chips, and this must cost the
   column NO height at all, present or absent. `hidden` is the plain attribute (matches
   `#capeHome [hidden]{display:none !important}` above), and the blink REUSES chDoorPulse
   (see .ch-chestdoor.is-live::after above) rather than a second keyframe. */
.ch-vmdoor{
  position:fixed;z-index:40;
  /* W47 (QA-BETA-CANDIDATE-W46 L-N8): +10px sat exactly on the top bar's SETTINGS gear, so a tap
     on the gear opened the voicemail. 158px lands in the empty right-hand corner of the hero
     stage, under the leader card, at 360x640 and 390x844 alike. */
  top:calc(var(--sa-top,env(safe-area-inset-top,0px)) + 158px);right:12px;
  width:46px;height:46px;border-radius:50%;padding:0;
  display:flex;align-items:center;justify-content:center;
  background:var(--panel,#241b44);border:2px solid var(--pow,#ffd23f);color:var(--pow,#ffd23f);
  cursor:pointer;
}
.ch-vmdoor-ico{display:flex;align-items:center;justify-content:center;width:24px;height:24px;}
.ch-vmdoor-ico svg{width:24px;height:24px;display:block;}
.ch-vmdoor::after{content:'';position:absolute;inset:-5px;border-radius:50%;
  pointer-events:none;border:3px solid rgba(255,210,63,.9);opacity:0;transform:scale(.985);}
.ch-vmdoor.is-live::after{animation:chDoorPulse 1.5s ease-in-out infinite;}
.ch-vmdoor:active{transform:translateY(2px);}
@media (prefers-reduced-motion:reduce){.ch-vmdoor::after{animation:none;opacity:.85;transform:scale(1);}}
body.cc-rm .ch-vmdoor::after{animation:none;opacity:.85;transform:scale(1);}
/* W67 (FIX PASS 1): the door DOCKS on the leader chip's empty right end (home.js dockVoicemailDoor() sets
   its top/left/size from the chip's own box) instead of its old fixed corner, which sat on the sixth
   lineup card since W54. While it is there the chip keeps that end clear - the door, 8px of margin and
   the caller-ID ticker's overhang - so the name and passive clip with their ellipsis before either. */
.ch-leaderchip.ch-has-door{padding-right:82px;}
.ch-vmdoor.is-docked::after{inset:-3px;}   /* the live ring stays off the season chip above and the lineup below */
.ch-chestShaking{animation:chChestShake 340ms ease;}
@keyframes chChestShake{
  0%,100%{transform:translateX(0) rotate(0);}
  15%{transform:translateX(-3px) rotate(-4deg);}
  32%{transform:translateX(3px) rotate(4deg);}
  49%{transform:translateX(-3px) rotate(-3deg);}
  66%{transform:translateX(2px) rotate(3deg);}
  83%{transform:translateX(-1px) rotate(-1deg);}}
.ch-chestfx{position:relative;height:0;}
.ch-chestReward{
  position:absolute;left:50%;top:6px;transform:translateX(-50%);z-index:6;white-space:normal;
  font-family:'Bangers',cursive;font-size:13px;letter-spacing:.7px;line-height:1.15;
  color:var(--ink,#1b1430);background:var(--pow,#ffd23f);border:2.5px solid var(--ink,#1b1430);
  border-radius:11px;padding:4px 11px;max-width:96%;text-align:center;
  animation:chRewardIn 200ms ease-out;}
.ch-chestReward.bad{background:#ff8787;color:#2a0f0f;}
@keyframes chRewardIn{from{opacity:0;transform:translateX(-50%) translateY(6px);}
  to{opacity:1;transform:translateX(-50%) translateY(0);}}
.ch-chestBurst{position:absolute;left:50%;top:0;width:0;height:0;pointer-events:none;z-index:5;}
.ch-chestBurst i{position:absolute;left:-5px;top:-5px;width:10px;height:10px;border-radius:50%;
  background:#ffd23f;box-shadow:0 0 12px #ffd23f,0 0 4px #fff;opacity:0;
  transform:rotate(var(--a,0deg)) translateY(0) scale(.4);
  animation:chChestSpark 700ms cubic-bezier(.22,.61,.36,1) forwards;animation-delay:var(--d,0ms);}
@keyframes chChestSpark{
  0%{opacity:0;transform:rotate(var(--a,0deg)) translateY(0) scale(.4);}
  14%{opacity:1;transform:rotate(var(--a,0deg)) translateY(-12px) scale(1.15);}
  62%{opacity:1;transform:rotate(var(--a,0deg)) translateY(-48px) scale(.95);}
  100%{opacity:0;transform:rotate(var(--a,0deg)) translateY(-72px) scale(.4);}}
/* REDUCED MOTION. The door still says "something to open" - it just says it with a steady ring
   instead of a blink, which is the rule every other cue in this file follows. */
@media (prefers-reduced-motion:reduce){
  .ch-chestBurst{display:none;}
  .ch-chestReward{animation:none;}
  .ch-chestShaking{animation:none;}
  .ch-chestdoor.is-live::after{animation:none;opacity:.85;transform:scale(1);}
}
body.cc-rm .ch-chestBurst{display:none;}
body.cc-rm .ch-chestReward{animation:none;}
body.cc-rm .ch-chestShaking{animation:none;}
body.cc-rm .ch-chestdoor.is-live::after{animation:none;opacity:.85;transform:scale(1);}

/* ---------------------------------------------------------- mode carousel */
.ch-carouselwrap{width:100%;}
.ch-carouselTrack{position:relative;}
/* right-edge peek gradient: signals "more cards this way" over the partial
   next-card already visible from .ch-carousel's 11% right padding. Sized to
   the track only (not .ch-dots below it), and fades to the same ink tone the
   new background-depth layer settles into near the bottom of the screen.
   Width is a % of the track (not a fixed px) so it scales with the peek,
   which is itself a fraction of carousel width (~28% of track width minus a
   constant gap) - a fixed 34px covered the whole peek on a wide phone but
   left an un-faded, fully legible sliver of card 1's title/hook readable at
   narrower widths (390px was clipped like a cut word; 360px was worse). The
   gradient itself also starts semi-opaque instead of fully transparent, so
   even the earliest, least-covered part of the peek reads as a dimmed
   silhouette of the next card rather than crisp, cut-off text - "a clean
   partial card with a fade", never a legible cropped word. */
.ch-edgefade{
  position:absolute;top:0;right:0;bottom:0;width:26%;pointer-events:none;
  background:linear-gradient(to right,#10395800 0%,#10395866 35%,#103958d9 100%);
}
/* W13 FIX1 - WHY THE INSET IS A SPACER AND NOT PADDING.
   The first card could never be centred. The carousel's side padding was 11% and the card's
   width was 78% - but a flex-basis percentage resolves against the CONTENT box (which the
   padding has already shrunk), so the two numbers are coupled: solving
   padL + cardW/2 = clientWidth/2 with cardW = 0.78*(CW - 2*padL) gives padL = CW/2 for ANY
   card fraction, i.e. no solution at all. centreCard() therefore computed a NEGATIVE
   scrollLeft for card 0, Math.max(0, ...) ate it, and STORY - card 0 since W13 - sat 30px
   left of centre while the dots and PLAY both insisted it was selected.
   Decoupling fixes it: the carousel carries NO horizontal padding, the cards are 61% of the
   full width (215px at 354 - the same size they rendered before), and two dead flex spacers
   supply the inset as calc(19.5% - 12px) = (CW - cardW)/2 - gap, which is exact at EVERY
   width. Card 4 lands on maxScroll by the same symmetry. The old declarations stay first as
   the fallback for a browser that drops the calc(). */
.ch-carousel{
  display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;
  overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;
  padding:4px 11% 10px;
  padding-left:0;padding-right:0;scrollbar-width:none;
}
.ch-carousel::before,.ch-carousel::after{content:'';flex:0 0 calc(19.5% - 12px);}
.ch-carousel::-webkit-scrollbar{display:none;}
.ch-card{
  min-width:0;
  flex:0 0 78%;flex-basis:61%;scroll-snap-align:center;background:var(--ch-surface);color:var(--ch-ink);
  border:2px solid #89c8e7;outline:1px solid #082b49;border-radius:14px;
  padding:18px 14px 16px;min-height:124px;cursor:pointer;text-align:center;position:relative;
  box-shadow:0 5px 0 #b8901a;display:flex;flex-direction:column;align-items:center;gap:7px;
}
/* card-art variant (public/art/home/card-<mode>.jpg): the photo lives in an
   inset ::before window rather than directly on the card's own background,
   so it can carry the exact same framed-illustration treatment as the hero
   stage (.ch-stage above) - var(--ch-frame-border)/var(--ch-frame-radius) -
   instead of just filling the whole comic-panel button edge to edge. The
   card's own accent color (gold/red/cyan/purple) now reads as the mat around
   that inset window. home.js passes the photo URL via the --ch-art custom
   property (see cardHtml()); a card with no art sets no --ch-art and simply
   has no ::before (the CARD_ART lookup already gated the ch-hasArt class).
   z-index:-1 keeps the window under the card's own in-flow content (icon/
   title/hook/stat spans) without needing to touch their stacking - it paints
   above the card's own background/border (stacking order step 1) and below
   all static in-flow content (steps 3-4), which is exactly the classic
   "background image behind text, inside a positioned box" trick. */
.ch-card.ch-hasArt::before{
  content:"";position:absolute;inset:3px;z-index:-1;
  border:var(--ch-frame-border);border-radius:var(--ch-frame-radius);
  background-image:linear-gradient(180deg,#082b4908 0%,#082b4940 38%,#061c3bda 100%),var(--ch-art);
  background-repeat:no-repeat;background-size:cover;background-position:center;
}
/* The poster above lives on a z-index:-1 ::before, which only paints ABOVE the card's
   own gold background while the card is its own STACKING CONTEXT. Until now that
   context arrived by accident, from the entrance animation's leftover
   transform:scale(1) (chPopIn runs with fill-mode `both`). Any rule that cancels that
   animation therefore made the art vanish behind the gold face - which is exactly what
   the reduced-motion block further down does, so the mode cards lost their art for
   anyone whose phone asks for reduced motion. isolation:isolate makes the stacking
   context explicit and permanent, independent of any motion setting. */
.ch-card.ch-hasArt{color:#fff8e7;isolation:isolate;}
.ch-card.ch-hasArt .ch-cardTitle{text-shadow:0 2px 0 rgba(0,0,0,.55),0 0 10px rgba(0,0,0,.35);}
.ch-card.ch-hasArt .ch-cardHook{text-shadow:0 1px 3px rgba(0,0,0,.65);}
.ch-card.ch-hasArt .ch-cardStat{background:rgba(10,7,20,.5);}
/* The carousel card used to carry the SAME gold-lipped slab treatment as the PLAY
   button and sat taller than it, so two gold slabs competed and PLAY did not dominate.
   The card keeps its gold face but its lip is now neutral ink: exactly one gold-lipped
   slab on the screen, and that one is PLAY. */
.ch-card{box-shadow:0 5px 0 rgba(27,20,48,.62);}
.ch-card:active{transform:translateY(4px);box-shadow:0 1px 0 rgba(27,20,48,.62);}
.ch-cardIcon{font-size:30px;line-height:1;height:1em;}
.ch-cardTitle{font-family:'Bangers',cursive;font-size:19px;letter-spacing:1px;}
.ch-cardHook{max-width:100%;font-size:11.5px;font-weight:700;line-height:1.3;}
.ch-cardStat{
  margin-top:1px;font-family:'Bangers',cursive;font-size:13px;letter-spacing:.5px;
  background:rgba(27,20,48,.16);border-radius:20px;padding:3px 11px;
}
.ch-card.ch-red{background:var(--red,#e03131);color:#fff;box-shadow:0 5px 0 #7c1a1a;}
.ch-card.ch-red:active{box-shadow:0 1px 0 #7c1a1a;}
.ch-card.ch-red .ch-cardStat{background:rgba(255,255,255,.2);}
.ch-card.ch-cyan{background:var(--ch-cyan);box-shadow:0 5px 0 #3d96a8;}
.ch-card.ch-cyan:active{box-shadow:0 1px 0 #3d96a8;}
.ch-card.ch-purp{background:var(--ch-purp);box-shadow:0 5px 0 #5f3dc4;}
.ch-card.ch-purp:active{box-shadow:0 1px 0 #5f3dc4;}
.ch-card.ch-purp .ch-cardStat{background:rgba(27,20,48,.22);}
/* front-polish pass: was opacity:.8 (the STORY card was the only "locked slab" card and
   read as a broken/disabled button). It is a real teaser now — full opacity, same solid
   accent fill every other card gets, the 'SOON' pill (cardHtml's cfg.stat==='soon') is
   what says "not yet", not a dimmed, half-there button face. */
.ch-card.ch-dim{background:var(--ch-dimbg);color:#cfc8e6;box-shadow:0 5px 0 #34304a;}
.ch-card.ch-dim:active{box-shadow:0 1px 0 #34304a;}
/* ---- the STORY card (W13 front door) ------------------------------------------------
   STORY is carousel card 0 now, not a 46px strip under the carousel. It is a full mode
   card like its four neighbours - same size, same frame, its own card-story.jpg art in the
   inset window - with two card-specific rules:
     1. a gold left rail, the same "this is a live door, keep going" mark the old strip
        wore (WAVE-12 SLOP-QUICK #5). Absolutely positioned, so it costs no height and
        cannot push the carousel taller.
     2. its hook is the only LIVE one on the screen ('CHAPTER 2 - 9/27 STARS - NEXT: THE MAN
        WHO BOUGHT THE BUILDING'), far longer than a fixed tagline, so it wraps. It gets its
        own slightly smaller type and up to THREE lines - measured against the longest string
        the data can produce (63 characters: the longest chapter name, a 27/27 tally and the
        longest mission name, 'THE MAN WHO BOUGHT THE BUILDING'), which lands on two lines at
        390px and two at 360px, so the clamp is headroom rather than a limit. This
        deliberately out-specifies the compact block's one-line nowrap on .ch-cardHook:
        a truncated mission name is the one thing this card must never print. */
/* W13 FIX1: this card wore --ch-dimbg - the EXACT slate the .ch-dim comment 20 lines up says
   was removed because it "read as a broken/disabled button" - while its neighbour ENDLESS
   carried a thick gold mat. On a first boot PLAY points here and dot 0 is lit, yet STORY was
   the one card on screen that looked switched off and ENDLESS looked selected: the front door
   inverted. It now takes the same gold mat every unaccented card gets (the inset art window
   carries the picture, so the mat is pure signal) and the neutral ink lip from .ch-card above.
   The 4px gold rail is gone with it - at left:7px it sat INSIDE the art frame's 6px inset and
   read as a stray yellow sliver over the artwork, and a gold bar on a gold mat says nothing. */
.ch-card.ch-story{background:#285a85;color:#fff8e7;}
/* TODAY'S CHALLENGE (w16 daily seeded challenge). The second carousel card, and the one
   card with no art file of its own - by design: this wave adds ZERO new image or audio
   payload, so it paints as the solid gold mat plus the ink lip every unaccented card
   already gets. The hook is LIVE (public/js/home.js renderDailyCard) and can run to two
   lines - 'BEST TODAY: WAVE 12 . 84 KOS . CHEST CLAIMED . RESETS IN 07:12' is the longest
   string the data can produce - so it takes the STORY card's multi-line clamp rather than
   the compact one-line nowrap. */
.ch-card.ch-gold{background:#246b95;isolation:isolate;}
/* This is the one mode card with no card-art JPG of its own, and paper text straight on the
   gold mat is unreadable. Rather than invent a second text colour for one card, it borrows
   the EXACT inset window every art card already wears (.ch-card.ch-hasArt::before, same
   inset, same frame border, same radius) with the darkening gradient alone and no photo
   behind it - so it reads as a member of the same set, at zero download cost. isolation is
   copied from .ch-hasArt for the same reason: the window lives on a z-index:-1 ::before and
   needs the card to be its own stacking context whatever the motion setting does. */
.ch-card.ch-gold::before{
  content:"";position:absolute;inset:3px;z-index:-1;
  border:var(--ch-frame-border);border-radius:var(--ch-frame-radius);
  background-image:linear-gradient(145deg,#2f87b0,#153e66 90%);
}
.ch-card.ch-gold .ch-cardTitle{text-shadow:0 2px 0 rgba(0,0,0,.55),0 0 10px rgba(0,0,0,.35);}
.ch-card.ch-gold .ch-cardHook{
  text-shadow:0 1px 3px rgba(0,0,0,.65);
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;
  white-space:normal;overflow:hidden;font-size:10.5px;line-height:1.25;
}
.ch-card.ch-story .ch-cardStat{background:rgba(10,7,20,.45);}
/* THE SELECTION RING. home.js has asserted since W13 that "the centred card wears a thick gold
   selection ring" - no such rule existed, every card had the identical ink border+outline, and
   the only thing that ever said "this one" was a 7px dot. The ring is PAPER, not gold, because
   it has to read on all five accents including the two gold ones. updateDots() toggles
   .is-centre on the same bestIdx it already computes for the dots, so the ring, the dot and
   the PLAY button can never disagree. */
.ch-card.is-centre{outline:2px solid #d8f3ff;outline-offset:2px;}
@media (prefers-reduced-motion:no-preference){
  .ch-card{transition:outline-color .16s linear;}
}
.ch-card.ch-story .ch-cardHook{
  /* W13 FIX1: four lines, not three. The fresh-save line now leads with the owner's no-gates
     promise ahead of 'NEXT: <mission>' (storyCardHook), and three lines cut the mission name -
     which is the one string this card exists to print in full. A returning player's line is
     shorter than it ever was (the chapter title + tally + mission), so the 4th line is pure
     headroom for them. */
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;line-clamp:4;
  white-space:normal;overflow:hidden;font-size:10.5px;line-height:1.25;
}
.ch-soonBadge{position:absolute;top:9px;right:11px;font-size:16px;line-height:1;}

/* WAVE 60a (PVP-60 7.1 option A / 3.3): the CLASH card's honest-labels badge. In-flow (not
   absolute like ch-soonBadge/ch-todayFlag above) and stretched to the card's own width via
   align-self, so its longer text ('REAL PVP - COMING DURING THE BETA') wraps to two lines
   instead of being clipped or forced to overflow a fixed-size corner tag. Sits above the
   card icon in source order (cardHtml()), so it never overlaps it. */
.ch-goldBadge{
  display:block;align-self:stretch;box-sizing:border-box;
  font-family:'Bangers',cursive;font-size:9.5px;letter-spacing:.3px;line-height:1.25;
  color:#e9f8ff;background:#0d426ce6;
  border:1px solid #8acbea80;border-radius:6px;
  padding:3px 6px;text-align:center;
  box-shadow:0 2px 0 rgba(27,20,48,.5);
}

/* W16 FIX1 - THE PIPS ARE PAGINATION, SO THEY HAVE TO BE WHOLE CIRCLES. margin-top:-4px
   (tightened to -8px on the ch-fit-6 rung) pulled the 7px row up behind the card's own
   bottom edge, so at 360x640 all five inactive dots rendered as top-half semicircles - and
   on a 360-wide phone, where STORY is the default card, that strip is the ONLY affordance
   telling the player five more modes (TODAY'S CHALLENGE among them) are one swipe away.
   The row now has its own height and paints above the card; the 8px the fit-6 rung used to
   steal here is taken back from the column gap and the carousel's bottom padding instead. */
.ch-dots{display:flex;justify-content:center;align-items:center;gap:6px;margin-top:0;
  position:relative;z-index:2;min-height:10px;}
.ch-dot{width:7px;height:7px;border-radius:50%;background:var(--ch-stroke);
  transition:background .15s,transform .15s;}
.ch-dot.on{background:var(--pow,#ffd23f);transform:scale(1.3);}
/* UNPLAYED TODAY. The daily card's own pip wears a gold ring until the first run of the day
   is committed (home.js renderDailyCard reads it off the same view model as the hook), so a
   player whose centred card is STORY is still told there is a fresh lane one swipe away.
   It is a SIGNAL, never a gate: the card plays identically with or without it. */
.ch-dot.ch-dot-new{box-shadow:0 0 0 2px var(--pow,#ffd23f);}
/* ...and the card itself carries a small gold TODAY flag while that is true. */
.ch-todayFlag{display:none;position:absolute;top:8px;right:10px;z-index:2;
  font-family:'Bangers',cursive;font-size:10px;letter-spacing:1px;line-height:1;
  color:var(--ink,#1b1430);background:var(--pow,#ffd23f);
  border:2px solid var(--ink,#1b1430);border-radius:6px;padding:2px 6px 3px;
  box-shadow:0 2px 0 rgba(27,20,48,.5);}
.ch-card-new .ch-todayFlag{display:block;}

/* --------------------------------------------- the old coming-soon strip (removed) */
/* W13 FRONT DOOR: the whole .ch-comingSoon / .ch-storyTally block lived here. STORY is
   carousel card 0 now (.ch-card.ch-story above), the strip's markup is gone from
   public/js/home.js, and these rules had nothing left to style. The gold left rail and the
   star tally both survive in the card: the rail as .ch-card.ch-story::after, the tally as
   the '<n>/27 STARS' clause of the card's live hook. */

/* ----------------------------------------------------------- quick rail */
/* SIX chips now (LINEUP / LEADERS / ENCYCLOPEDIA / SHOP / PROFILE / SETTINGS): the row's
   HEIGHT is unchanged - a 6th column costs width, not vertical budget - so the short-phone
   measurements in the compact block below still hold. What had to move is the horizontal
   budget: at 360px the column is (344 - 5x5) / 6 = ~53px, so the gap steps 6 -> 5px and the
   glyph 24 -> 22px, and the long-label size is re-measured so ENCYCLOPEDIA still sits on
   one line inside 53px. Both chips stay well above the 44px tap floor. */
/* W40b (small-screen pass, QA-W39H-EYES-ON item 5): the six-chip bottom nav is now PINNED to
   the bottom of #menu's own scrollport (position:sticky - index.html's .screen sets
   overflow-y:auto on #menu, which is the nearest scrolling ancestor and therefore what a
   sticky descendant sticks against). Measured at 360x640: even at the fit ladder's max level
   (ch-fit-9) #capeHome's scrollHeight was still ~90px over #menu's clientHeight, so LINEUP..
   SETTINGS was reachable only by scrolling - this makes it reachable with ZERO scrolling
   instead, by pinning the rail and letting the topbar/showcase/carousel scroll UNDER it.
   Sticky is a documented no-op the moment the column already fits inside the viewport (a tall
   phone never scrolls #menu, so the rail never leaves its own normal-flow slot) - so this
   changes nothing at 390x844/412x915/768x1024, only at the short phones where it is needed.
   The solid background + top hairline are needed because a stuck element still paints
   wherever it is pinned regardless of what scrolls behind it - the six .ch-railbtn chips
   already carry their own panel fill, but the 5px grid gaps and the row's own edges did not,
   so a card or the dot row scrolling past showed straight through them. The bottom padding
   pays the device's own safe-area inset (the immersive-fullscreen Android shell paints under
   the gesture bar - see index.html's W20 TRUE FULL SCREEN note) so a stuck rail is never
   painted partly under it. */
.ch-rail{
  display:grid;grid-template-columns:repeat(6,1fr);gap:5px;width:100%;
  position:sticky;bottom:0;z-index:6;
  background:#120c24;border-top:1px solid rgba(255,255,255,.08);
  box-shadow:0 -8px 14px -10px rgba(0,0,0,.55);
  padding:8px 0 calc(6px + var(--sa-bottom,env(safe-area-inset-bottom,0px)));
}
.ch-railbtn{
  position:relative;                                  /* anchors .ch-railNew / .ch-railBadge */
  min-height:60px;background:var(--panel,#241b44);border:2px solid var(--ch-stroke);
  border-radius:12px;display:flex;flex-direction:column;align-items:center;
  justify-content:center;gap:3px;color:var(--ch-body);cursor:pointer;font-weight:800;
  letter-spacing:.3px;text-transform:uppercase;padding:11px 1px 4px;overflow:hidden;
}
.ch-railbtn .ico{font-size:22px;line-height:1;display:flex;}
.ch-railbtn .ico .ci{width:22px;height:22px;flex:0 0 22px;}
.ch-railbtn:active{outline:2px solid var(--pow,#ffd23f);transform:translateY(2px);}
/* W13 FIX1: all six rail labels share ONE size now. The step-down class existed for a single
   word - ENCYCLOPEDIA - and half the size is not "the same visual weight": the chip read as a
   caption that had leaked into a button row. The word is CODEX in home.js's RAIL table, which
   fits 8.5px in a 53px column at 360px, so .ch-lbl-sm is gone. */
.ch-railbtn-lbl{font-size:8.5px;}
/* ---- daily-loop markers on a rail chip (docs/specs/META-SPEC.md section 8.2) ----
   NEW = today's shop stock is completely untouched / none of today's quests claimed yet.
   Gold, top-right, tiny: it is a "there is something here" nudge, not a control - the
   whole chip is the tap target, and both markers are pointer-events:none so a press
   anywhere on the chip still forwards to its hidden menu button. */
.ch-railNew,.ch-railBadge{
  position:absolute;top:3px;z-index:1;pointer-events:none;
  font-family:'Bangers',cursive;line-height:1.3;white-space:nowrap;border-radius:20px;
}
/* W14 FIX1: 6.5px is decoration, not a word. 9px in the same pill, and the chip's content
   is nudged down (.ch-railbtn padding above) so the marker stops sitting on the glyph. */
.ch-railNew{
  right:3px;top:2px;padding:0 4px;font-size:9px;letter-spacing:.3px;color:#241a06;
  background:linear-gradient(180deg,#ffd23f,#f59f00);border:1.5px solid var(--ink,#1b1430);
}
/* the claimed/total quest tally (was the purse's .ch-questBadge) - opposite corner from
   NEW so the PROFILE chip can carry both at once without them overlapping. */
.ch-railBadge{
  left:3px;top:2px;padding:0 4px;font-size:9px;letter-spacing:.2px;color:var(--ch-body,#d8d2f0);
  background:var(--panel,#241b44);border:1.5px solid var(--ch-stroke);
}
.ch-railBadge.has-ready{background:linear-gradient(180deg,#ffd23f,#f59f00);
  border-color:var(--ink,#1b1430);color:#241a06;}

/* ---- one-shot NEW DAY banner (docs/specs/META-SPEC.md section 8.2) --------------
   position:fixed on purpose: the home column is height-budgeted down to the pixel on a
   360x640 phone (see the compact block below), so a banner that took part in the layout
   could push the rail off the bottom edge the moment a day rolled over. */
.ch-newday{
  /* z-index 96 clears the daily CHECK-IN card's own scrim (#checkinOv, z-index 95 in
     index.html): both fire on the very same boot after a rollover, and the banner sitting
     BEHIND a dark scrim for its whole 7-second life meant a player only ever saw it on the
     days they had already collected.
     Centred with left:0/right:0 + margin:0 auto on a max-content box, NOT with
     left:50% + translateX(-50%): the entrance keyframe animates `transform`, and with
     animation-fill-mode:both its final translateY(0) REPLACED the centring translate, so
     the pill ended up jammed against the right edge and wrapped onto two lines.
     Anchored 84px off the bottom: that clears the rail row it points at (60px chips plus
     the footer line) instead of sitting on top of the very chips it is advertising, and it
     covers neither the purse nor the check-in card that fires on the very same boot. */
  /* pointer-events:none is not a detail, it is the whole contract (QA wave 8, W8R3-1).
     This pill is position:fixed at z-index 96 across the middle of the home column: as a
     <button> it hit-tested in front of four of the six rail chips and answered every tap
     in that band with PROFILE. A one-shot notice must be INERT - the tap goes straight
     through to the control underneath, and home.js takes the banner away on that tap. */
  pointer-events:none;
  /* W16 FIX1: 84px clears the RAIL, which is what the note above is about - but the
     carousel sits between the rail and the rest of the column, so the pill landed on the
     STORY card at 360x640 and on the page-dot row at 390x844, obscuring for its whole
     7-second life the very content it is congratulating the player for. home.js measures
     the gap from the viewport's bottom edge to the TOP of .ch-carouselwrap at SHOW time
     (newDayAnchor) and writes it onto the pill's own inline `bottom`, so the anchor clears
     the cards as well and the pill lands just under the PLAY CTA. The 84px below is the
     fallback a host that never measures - or a measure that lands high - still gets. */
  position:fixed;left:0;right:0;bottom:84px;margin:0 auto;z-index:96;
  width:max-content;max-width:92vw;
  display:flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap;
  font-family:'Bangers',cursive;font-size:15px;letter-spacing:1px;color:var(--ink,#1b1430);
  background:linear-gradient(180deg,#ffd23f,#f59f00);border:2.5px solid var(--ink,#1b1430);
  border-radius:12px;padding:4px 14px;cursor:pointer;box-shadow:0 3px 0 #b8901a;
  animation:chNewDayIn .3s ease-out both;
}
/* The banner lives on <body>, OUTSIDE `#capeHome [hidden]` (see the note beside that rule):
   without this line `hidden` cannot beat the .ch-newday `display:flex` above it and the
   pill stays painted forever. home.js also removes the node outright, so this is the
   belt to that braces - both, because either one alone was one refactor from failing. */
.ch-newday[hidden]{display:none !important;}
@keyframes chNewDayIn{from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);}}
.ch-newday .ci{width:16px;height:16px;flex:0 0 16px;}
@media (prefers-reduced-motion:reduce){ .ch-newday{animation:none;} }
body.cc-rm .ch-newday{animation:none;}

/* --------------------------------------------------------------- footer */
.ch-footer{font-weight:800;color:var(--ch-body2);text-align:center;font-size:11px;padding:0 8px 2px;}

/* --------------------------------------------------------- entrance (§6.1) */
.ch-enter-drop{animation:chDropIn .3s ease-out both;}
.ch-enter-pop{animation:chPopIn .32s cubic-bezier(.2,1.6,.4,1) both;}
.ch-enter-fade{animation:chFadeIn .28s ease-out both;}
@keyframes chDropIn{from{opacity:0;transform:translateY(-10px);}to{opacity:1;transform:translateY(0);}}
@keyframes chPopIn{from{opacity:0;transform:scale(.82);}to{opacity:1;transform:scale(1);}}
@keyframes chFadeIn{from{opacity:0;}to{opacity:1;}}
@media (prefers-reduced-motion:reduce){
  .ch-enter-drop,.ch-enter-pop,.ch-enter-fade{animation:none !important;opacity:1;transform:none;}
}
body.cc-rm .ch-enter-drop,body.cc-rm .ch-enter-pop,body.cc-rm .ch-enter-fade{
  animation:none !important;opacity:1;transform:none;}

/* ------------------------------------------- compact-height rule (§6.2) */
/* same breakpoint value index.html already uses for the battle HUD */
@media (max-height:700px){
  .ch-footer{display:none;}
  /* (W13 front door: the STORY strip that used to be exempted here no longer exists. STORY
     is carousel card 0, which costs this block nothing - a horizontal carousel is as tall
     with five cards as it was with four. See the fit-ladder block below.) */
  /* The encourage line is decoration; keep the leader's mechanical readouts visible. */
  .ch-encourage{display:none;}
  /* .ch-stage must shrink alongside .ch-portrait-sway (both were already
     compact-only-tuned for .ch-portrait-sway; .ch-stage itself kept its full
     min(52vw,220px) size here even in compact mode) - since .ch-stage now
     carries its own frame border/background (var(--ch-frame-*) above), a
     mismatched, oversized outer frame around a smaller inner portrait would
     both look wrong AND was tall enough on its own, combined with the new
     PLAY button below, to push #capeHome's total height past short phone
     viewports (~640px) - the top of the topbar purse chip was rendering
     off-screen with no way to scroll up to it (a flex `justify-content:center`
     container that overflows centers past BOTH edges, and scrollTop can't go
     negative to reach the clipped top). Shrinking the frame closes that gap
     and removes enough height on its own to fix the clipping; the other
     trims below (tighter PLAY button, tighter gaps) add safety margin. */
  /* SHORT-PHONE BUDGET (QA wave 7). At 360x640 the column has 604px to work with once
     #menu's own padding is paid, and the chest row (which only appears once the player has
     actually earned a chest) costs another 50px - which pushed the whole LINEUP / LEADERS /
     ENCYCLOPEDIA / SHOP / SETTINGS rail off the bottom edge. Every trim below comes out of
     DECORATION (stage size, card padding, gaps), never out of a tap target: .ch-chestdoor and
     .ch-railbtn both hold at or above the 44px floor. */
  .ch-stage{width:min(30vw,120px);min-width:96px;}    /* the base rule's 140px min-width is the tall-phone floor */
  .ch-portrait-sway{width:min(30vw,120px);min-width:96px;}
  .ch-card{padding:9px 12px 9px;gap:5px;min-height:100px;}
  .ch-carousel{padding:2px 11% 6px;padding-left:0;padding-right:0;}
  /* the top/bottom breathing room on the menu screen itself: 18px each side is generous
     framing on a tall phone and pure overflow on a short one. */
  #menu{padding-top:6px;padding-bottom:6px;}
  .ch-cardHook{font-size:10.5px;white-space:normal;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;line-height:1.2;}   /* W326: two lines, never a cut-off "..." (rung 13 is the one-line last resort) */
  .ch-showcase{gap:4px;}
  .ch-playbtn{min-height:46px;padding:4px 14px;}
  .ch-playbtn-label{font-size:18px;}
  .ch-playbtn-sub{font-size:9.5px;}
  /* 44px is the FLOOR, never a target to trim - opening a chest is the most rewarding tap
     in the meta and the door sits right under the PLAY CTA where thumbs already are. The four
     pixels come out of the padding and the glyph, never out of the tap target. */
  .ch-chestdoor{min-height:44px;padding:3px 16px;font-size:15px;gap:7px;}
  .ch-chestdoor-ico{width:22px;height:22px;flex-basis:22px;}
  .ch-chestdoor-ico .ci{width:22px;height:22px;flex:0 0 22px;}
  /* SIX chips (loop-signals pass). The row's HEIGHT is untouched - a 6th column is paid in
     WIDTH - so the 604px short-phone budget above still balances; what is re-measured is the
     per-column glyph/label so a ~53px column at 360px still reads on one line. */
  .ch-railbtn{min-height:48px;}   /* NEVER below 44: this rail is the only way to reach LINEUP/SHOP/PROFILE/SETTINGS */
  .ch-railbtn .ico{font-size:19px;}
  .ch-railbtn .ico .ci{width:19px;height:19px;flex:0 0 19px;}
  .ch-railbtn-lbl{font-size:8px;}
  .ch-railNew{font-size:8.5px;padding:0 3px;}
  .ch-railBadge{font-size:8.5px;padding:0 3px;}
  .ch-railbtn{padding:10px 1px 3px;}
  /* the purse's third line: the trophy chip is the first thing to give up type here,
     because the top bar is the block that clipped off-screen at 360x640 before. */
  /* W13 FIX1: 9px/8px Bangers is decoration, not information - "SEASON 1 - ENDS IN 21 DAYS"
     was unreadable at that size on the phone it was tuned for. With flex:0 0 auto above the
     row wraps rather than clipping, so the type comes back to a legible floor. */
  .ch-troph{font-size:10.5px;padding:0 6px;letter-spacing:.3px;}
  .ch-troph .ci{width:11px;height:11px;flex:0 0 11px;}
  .ch-season{font-size:11.5px;padding:5px 7px;letter-spacing:.2px;}
  .ch-season .ci{width:16px;height:16px;flex:0 0 16px;}
  #capeHome{gap:5px;}
}

/* ----------------------------------------------- height fit ladder (QA wave 8 R2) */
/* The home column is height-budgeted to the pixel, but its content is NOT fixed: the
   chest row only exists once the player owns a chest (and a player owns one from their
   first battle on), the encourage line and the empty-lineup prompt come and go, the
   leader passive can wrap. Round 1 of wave 8 bought room for a full vault by hiding the
   STORY teaser for the rest of the player's life. This measures instead of guessing:
   home.js fitColumn() reads the column against the menu's usable height and adds
   ch-fit-1 .. ch-fit-6 one level at a time, only while it would otherwise overflow.
   Each level gives up DECORATION before the level under it gives up anything:
     1  column gap + card/carousel padding + a smaller tagline
     2  the tagline and the encourage line entirely, a slimmer leader chip
     3  a few pixels of chrome off the showcase gap, PLAY, the records row, the chests
     4  the hero stage
     5  the teaser keeps its row but shrinks to a single slim line
     6  the teaser's row (last resort - it is the only door to STORY on HOME)
   Every rule below can only ever SHRINK what it touches. Levels 1-4 are guarded to tall
   phones so they can never fight the compact max-height:700px block above, whose values
   are already smaller than these; levels 5-6 apply at every size. No tap target drops
   below the 44px floor: .ch-chestdoor, .ch-railbtn, .ch-playbtn and .ch-leaderchip are all
   untouched or trimmed only down to 48px. */
@media (min-height:701px){
  #capeHome.ch-fit-1{gap:7px;}
  #capeHome.ch-fit-1 .ch-card{padding-top:10px;padding-bottom:10px;gap:5px;}
  #capeHome.ch-fit-1 .ch-carousel{padding-top:3px;padding-bottom:7px;}
  #capeHome.ch-fit-1 .ch-footer{font-size:10px;padding-bottom:0;}
  #capeHome.ch-fit-2 .ch-footer{display:none;}        /* the tagline: pure decoration */
  #capeHome.ch-fit-2 .ch-encourage{display:none;}
  #capeHome.ch-fit-2 .ch-leaderchip{padding-top:4px;padding-bottom:4px;}  /* 56px -> 48px */
  #capeHome.ch-fit-2 .ch-leaderchip-icon{width:36px;height:36px;flex:0 0 36px;}
  #capeHome.ch-fit-2 .ch-dots{margin-top:-6px;}
  /* Level 3 is the cheap one: ~14px of chrome spread across four elements, so a column
     that overflows by a handful of pixels (a records chip appearing, a leader passive
     wrapping) never has to reach for the hero art at level 4. Every tap target stays
     well clear of the 44px floor - PLAY 56 -> 52, a chest 52 -> 46. */
  #capeHome.ch-fit-3 .ch-showcase{gap:5px;}
  #capeHome.ch-fit-3 .ch-playbtn{min-height:52px;padding-top:4px;padding-bottom:4px;}
  #capeHome.ch-fit-3 .ch-records{min-height:20px;}
  #capeHome.ch-fit-3 .ch-chestdoor{min-height:46px;}
  /* max-width, never width: it can only ever take pixels off whatever the stage already
     computed to (the compact block's min(30vw,120px) included), never add them. */
  #capeHome.ch-fit-4 .ch-stage{max-width:170px;min-width:0;}
  #capeHome.ch-fit-4 .ch-portrait-sway{max-width:100%;min-width:0;}
}
/* Levels 5-8 (W13 FRONT DOOR re-levelling). They used to be two levels, both entirely about
   the old STORY strip: level 5 slimmed it and level 6 compacted it. The strip is gone -
   STORY is carousel card 0, and a card costs the COLUMN no height at all because the
   carousel is horizontal - so ~53px (the 46px row plus its column gap) came back to the
   budget on every viewport, and these levels now spend their trims on the carousel and the
   showcase instead. They apply at EVERY size (levels 1-4 above are tall-phone-only so they
   can never fight the compact block).

   Nothing here HIDES anything. Every rule only ever shrinks, so PLAY, all five mode cards
   and their peek, the chest row and all six rail chips are still on screen at level 8:
     5  carousel decoration - column gap, card padding, carousel padding, showcase gap
     6  card chrome - the 30px card glyph, the dots row, the chest row down to its 44px floor
     7  type - card title 19 -> 16, hook 11.5 -> 10, PLAY 52 -> 48, the leader chip's art
     8  the hero stage down to a thumbnail, and the records row to its chips
   Tap-target floors are held throughout: .ch-chestdoor and .ch-railbtn never go under 44px,
   .ch-playbtn never under 48px. */
#capeHome.ch-fit-5{gap:3px;}
#capeHome.ch-fit-5 .ch-card{padding-top:6px;padding-bottom:6px;}
#capeHome.ch-fit-5 .ch-carousel{padding-top:1px;padding-bottom:3px;}
#capeHome.ch-fit-5 .ch-showcase{gap:2px;}

#capeHome.ch-fit-6 .ch-cardIcon{font-size:20px;}
#capeHome.ch-fit-6 .ch-card{gap:3px;}
/* W16 FIX1: this rung used to buy its 8px by pulling the dot row behind the card (see the
   .ch-dots note above). It buys the same 8px from the column gap (~5px over six children)
   and the carousel's own bottom padding (3px) instead, and the pips stay whole circles. */
#capeHome.ch-fit-6{gap:2px;}
#capeHome.ch-fit-6 .ch-carousel{padding-bottom:0;}
#capeHome.ch-fit-6 .ch-dots{min-height:8px;}
#capeHome.ch-fit-6 .ch-dot{width:5px;height:5px;}
#capeHome.ch-fit-6 .ch-chestdoor{min-height:44px;}
#capeHome.ch-fit-6 .ch-records{min-height:18px;}

#capeHome.ch-fit-7 .ch-cardTitle{font-size:16px;}
#capeHome.ch-fit-7 .ch-cardHook{font-size:10px;line-height:1.25;}
#capeHome.ch-fit-7 .ch-playbtn{min-height:48px;padding-top:2px;padding-bottom:2px;}
#capeHome.ch-fit-7 .ch-leaderchip{padding-top:2px;padding-bottom:2px;}
#capeHome.ch-fit-7 .ch-leaderchip-icon{width:30px;height:30px;flex:0 0 30px;}
#capeHome.ch-fit-7 .ch-cardIcon{font-size:17px;}

#capeHome.ch-fit-8 .ch-stage{max-width:104px;min-width:0;}
#capeHome.ch-fit-8 .ch-portrait-sway{max-width:100%;min-width:0;}
#capeHome.ch-fit-8 .ch-herolabel{font-size:10px;}
#capeHome.ch-fit-8 .ch-records{min-height:0;}
#capeHome.ch-fit-8 .ch-topbar{gap:4px;}

/* Level 9 (QA-WAVE38-ROUND1 M2). A 360x640 phone still overflowed at level 8 (content has
   grown since this ladder was tuned - the day-1 check-in strip, the reward roads, the
   weekly TWIST card), leaving the bottom nav (LINEUP/LEADERS/CODEX/SHOP/PROFILE/SETTINGS)
   reachable only by scrolling. This is one more rung of the same medicine, spent on the
   carousel card and the rail, which by level 8 still hold their tall-phone padding:
     - the carousel card's own padding/gap and icon size shrink further
     - its hook line clamps to ONE line instead of wrapping to two (the card itself already
       shows the hook lower down when the wave/W-L stat pill appears)
     - the rail button reaches the DOCUMENTED 44px floor (was 48px) - never below it, the
       same floor .ch-chestdoor already sits at from the compact block above
   Nothing is hidden or removed; every tap target held at or above 44px. */
#capeHome.ch-fit-9{gap:1px;}
#capeHome.ch-fit-9 .ch-carousel{padding-top:0;padding-bottom:1px;}
#capeHome.ch-fit-9 .ch-card{padding-top:5px;padding-bottom:5px;gap:2px;}
#capeHome.ch-fit-9 .ch-cardIcon{font-size:16px;}
/* W326: rung 9's one-line hook clamp is retired for the mode cards - a card hook keeps its two lines on every phone (the card's own min-height
   already holds them). The STORY card alone keeps W71's one-line rung, now the LAST rung (storyLineIsOne): its line leads with the whole mission
   name (and takes a second line, .ch-lead2, only when that fits the same card), so a long name never grows the card. */
#capeHome.ch-fit-13 .ch-card.ch-story .ch-cardHook{display:-webkit-box;-webkit-line-clamp:1;line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;}
#capeHome.ch-fit-9 .ch-railbtn{min-height:44px;padding:5px 1px 2px;}
#capeHome.ch-fit-9 .ch-topbar{gap:2px;}
#capeHome.ch-fit-9 .ch-chestdoor{padding:2px 12px;gap:5px;}
/* W71 (docs/notes/W71-fixes.md): on this rung the STORY line leads with 'NEXT: <mission>'; when a long
   mission name does not fit one line, home.js storyLeadFit() lets the line take a SECOND line - only
   while the card stays exactly as tall (the CLASH card sets the row's height). */
#capeHome.ch-fit-9 .ch-card.ch-story .ch-cardHook.ch-lead2{-webkit-line-clamp:2;line-clamp:2;}

/* -------------------------------------------- wide / desktop viewport (§6.3) */
/* W340 E-014 (tablet and fold): the two-column card grid needs height as well as width. On a landscape tablet (1280x800) or an open fold
   (841x701) it pushed PLAY and CHESTS under the bottom bar; a window under 1000 px tall keeps the phone carousel (and the fit ladder that
   makes HOME fit a short phone), and only a tall window lays the cards out as the grid. */
@media (min-width:600px) and (min-height:1000px){
  /* W153 (docs/notes/W153-qa-fixes.md, W143 M-01): the leader chip and the lineup row used to sit side by
     side here (a desktop idea from before the play column). The column is never wider than 460px, so the
     row shrank to a 32x13 sliver and the chip stuck out past the column's left edge. They keep the phone
     stack - chip, then the lineup row, then the saved-lineup tabs - at every window width. */
  .ch-carousel{
    display:grid;grid-template-columns:1fr 1fr;grid-auto-rows:1fr;overflow:visible;
    scroll-snap-type:none;padding:4px 2px 4px;gap:12px;
  }
  /* the two centring spacers are a PHONE-carousel device; in the desktop grid they would
     be two empty grid cells that push the first card into column 2. */
  .ch-carousel::before,.ch-carousel::after{display:none;}
  .ch-card{flex:none;scroll-snap-align:none;}
  .ch-dots{display:none;}
  /* W78 (docs/notes/W77-emulator-qa.md F4): the phone carousel's right-edge fade has no peek card to fade here - every
     card is whole in the grid - and it was drawn over the right-hand cards (TODAY'S CHALLENGE, CLASH) on tablets. */
  .ch-edgefade{display:none;}
}

/* ------------------------------------------- W20: THE PEEK CARD MUST NOT READ AS CUT WORDS.
   .ch-edgefade covers the RIGHT 26% of the track, but the peek card's own copy starts LEFT of
   where that gradient bites, so at 390px the next card still printed "TO...", "A NEW..." and
   "FOR AL..." - legible text sliced mid-word, which reads as a rendering bug rather than as
   "there is more this way".
   The COPY now belongs to the CENTRED card. Every other card keeps its colour, its frame, its
   icon and its art - the whole "more cards" signal - and drops its title, hook and stat pill to
   a silhouette, so no half word is ever readable. A cross-fade on the same 180ms the outline
   ring uses, so a swipe hands the words over instead of blinking them.
   :has() is the guard, not a nicety: until updateDots() has run there is no .is-centre at all,
   and a browser without :has() drops the whole block - both cases land on exactly today's
   picture (every card fully legible) instead of a carousel nobody can read.
   Phone carousel only. At >=600px .ch-carousel is a two-column grid, every card is fully on
   screen and being "centred" means nothing. */
@media (max-width:599.98px){
  .ch-carousel:has(.ch-card.is-centre) .ch-card:not(.is-centre) .ch-cardTitle,
  .ch-carousel:has(.ch-card.is-centre) .ch-card:not(.is-centre) .ch-cardHook,
  .ch-carousel:has(.ch-card.is-centre) .ch-card:not(.is-centre) .ch-cardStat{opacity:.2;}
  .ch-carousel:has(.ch-card.is-centre) .ch-cardTitle,
  .ch-carousel:has(.ch-card.is-centre) .ch-cardHook,
  .ch-carousel:has(.ch-card.is-centre) .ch-cardStat{transition:opacity .18s linear;}
}
@media (prefers-reduced-motion:reduce){
  .ch-cardTitle,.ch-cardHook,.ch-cardStat{transition:none;}
}
body.cc-rm .ch-cardTitle,body.cc-rm .ch-cardHook,body.cc-rm .ch-cardStat{transition:none;}

/* ============================================================ W54: THE LOGO
   Owner 2026-09-24: "the top-left CAPE CLASH is plain text and looks empty". art/ui/
   logo-cape-clash.svg is a 2:1 vector badge (cape + clasp, halftone burst, outlined lettering
   with its own violet rim, so it reads on this dark screen and on a light one). The button keeps
   a 44px+ tap target from the art itself, so its old 12px of vertical padding goes. */
.ch-wordmark:has(.ch-logo){padding:0 4px 0 0;min-width:0;flex:0 0 auto;}
.ch-logo{display:block;width:132px;height:auto;aspect-ratio:2/1;user-select:none;-webkit-user-drag:none;}
.ch-wordmark.ch-logo-motion{position:relative;overflow:hidden;isolation:isolate;}
.ch-logo-sheen{position:absolute;left:0;top:12%;width:27%;height:76%;pointer-events:none;opacity:0;
  background:linear-gradient(90deg,transparent,rgba(255,255,230,.9),transparent);border-radius:40%;}
body.cc-rm .ch-logo-sheen{display:none;}
@media(prefers-reduced-motion:reduce){.ch-logo-sheen{display:none;}}
@media (max-width:374px){ .ch-logo{width:116px;} }
@media (max-height:700px){ .ch-logo{width:118px;} }
#capeHome.ch-fit-8 .ch-logo{width:108px;}

/* ============================================================ W54: THE TEAM
   Owner 2026-09-24: the WHOLE lineup above PLAY, the leader in the bubble above them. The
   leader chip grows a speech-bubble tail and a crown; under it, one comic panel per lineup hero
   (home.js renderTeam()), columns sized by the row itself: repeat(n, minmax(0, cap)) gives six
   heroes equal shares of a 360px phone and lets four stand bigger on a wide one. */
.ch-leaderchip{position:relative;}
.ch-leaderchip::after{display:none;} /* leader and units now share one panel */
.ch-leaderchip-iconwrap{position:relative;display:block;flex:0 0 auto;line-height:0;}
.ch-leaderchip-iconwrap .ch-leaderchip-icon{display:block;}   /* no longer a flex item, so it needs its own box */
.ch-leadercrown{position:absolute;left:-7px;top:-8px;width:18px;height:18px;display:flex;align-items:center;
  justify-content:center;border-radius:50%;background:var(--pow,#ffd23f);border:2px solid var(--ink,#1b1430);
  transform:rotate(-14deg);}
.ch-leadercrown .ci,.ch-leadercrown svg{width:12px;height:12px;display:block;}

.ch-team{gap:0;padding-top:4px;}
.ch-teamrow{
  --n:4;position:relative;display:grid;grid-template-columns:repeat(var(--n),minmax(0,70px));
  justify-content:center;gap:7px;width:100%;padding:0 6px 2px;
}
/* one shared stage under every foot - the plinth idea from the single-hero spotlight, widened */
.ch-teamrow::before{
  content:'';position:absolute;left:4%;right:4%;top:18%;bottom:6px;border-radius:50%;pointer-events:none;
  background:radial-gradient(ellipse at 50% 60%,rgba(255,210,63,.26) 0%,rgba(255,210,63,.10) 45%,rgba(255,210,63,0) 72%);
}
.ch-teamslot{position:relative;display:flex;flex-direction:column;align-items:center;min-width:0;}
.ch-teamfig{
  position:relative;display:block;width:100%;aspect-ratio:1/1;border-radius:12px;overflow:hidden;
  background:
    radial-gradient(circle at 50% 42%,#bcecff40 0%,transparent 70%),
    linear-gradient(180deg,#2b759e 0%,#16456e 100%);
  border:1px solid #b8e5ff80;
  box-shadow:inset 0 3px 0 var(--cls,#7c6ee6),0 3px 0 #082b4970;
}
.ch-teamart{position:absolute;inset:0;width:100%;height:100%;display:block;
  animation:chTeamBob 2.8s ease-in-out infinite;animation-delay:calc(var(--i,0) * -0.47s);}
@keyframes chTeamBob{0%,100%{transform:translateY(1px);}50%{transform:translateY(-3px);}}
.ch-teamlv{
  position:relative;z-index:2;margin-top:-8px;border-radius:999px;padding:0 6px;
  background:#e7f5ff;color:var(--ch-ink);border:1px solid #16456e;
  font-family:system-ui,-apple-system,sans-serif;font-size:9.5px;font-weight:900;line-height:13px;
  letter-spacing:.3px;font-variant-numeric:tabular-nums;white-space:nowrap;
}
.ch-team:active .ch-teamfig{transform:translateY(2px);}
@media (prefers-reduced-motion:reduce){ .ch-teamart{animation:none;} }
body.cc-rm .ch-teamart{animation:none;}
@media (max-height:700px){
  .ch-teamrow{grid-template-columns:repeat(var(--n),minmax(0,60px));gap:6px;}
  .ch-team{padding-top:3px;}
}
@media (min-height:701px){
  #capeHome.ch-fit-4 .ch-teamrow{grid-template-columns:repeat(var(--n),minmax(0,62px));}
}
#capeHome.ch-fit-8 .ch-teamrow{grid-template-columns:repeat(var(--n),minmax(0,50px));gap:5px;}
#capeHome.ch-fit-8 .ch-teamlv{font-size:8.5px;line-height:11px;padding:0 4px;}

/* W78 (docs/notes/W77-emulator-qa.md F5): a window narrower than any phone - a tablet's desktop-style window can be
   dragged down to ~220 px - keeps all six rail words whole (smaller) instead of clipping their first letters. Last in
   the file (and one class more specific) so the short-phone block above cannot put the bigger size back. */
@media (max-width:319.98px){
  .ch-rail{gap:2px;}
  .ch-rail .ch-railbtn{letter-spacing:0;padding-left:0;padding-right:0;}
  .ch-rail .ch-railbtn-lbl{font-size:6.6px;letter-spacing:0;}
}
/* N9 phone QA: 320px minus the existing side padding needs 4px gaps for six 44px taps. */
@media (min-width:320px) and (max-width:340px){
  .ch-rail{gap:4px;}
}

/* ANIMATIONS: SOME (W104 / D23): HOME's idle loops stand still (the door rings stay lit, still); body.cc-some is set by the game script. */
body.cc-some .ch-stage-glow,body.cc-some .ch-portrait-sway,body.cc-some .ch-teamart{animation:none}
body.cc-some .ch-chestdoor.is-live::after,body.cc-some .ch-vmdoor.is-live::after{animation:none;opacity:.85}

/* ==========================================================================================================================================
   W326 HOME FIT (the coordinator's screenshot pass, 2026-10-21; OWNER DECISION D44 section 3 "the home screen is still pretty jarbled up").
   Rungs 10-13 of the fit ladder (home.js FIT_CLASSES). Each changes the LAYOUT, not the size of a tap target: PLAY stays >= 48 px, CHESTS,
   the claim star and every saved-lineup number stay >= 44 px. A taller phone never reaches them (the ladder stops at the first rung that fits).
   ========================================================================================================================================== */
/* 10: CHESTS stands BESIDE PLAY - one action row (the claim star joins it when something is owed), the tallest single saving. */
#capeHome.ch-fit-10{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:8px;align-content:start;}
#capeHome.ch-fit-10 > *{grid-column:1 / -1;min-width:0;}
#capeHome.ch-fit-10 > .ch-playbtn{grid-column:1;width:100%;margin:0;}
/* the action row never grows: a long mission name on PLAY takes its two smaller lines INSIDE the same 50 px (W71's rule for the STORY card, kept for PLAY) */
#capeHome.ch-fit-10 > .ch-playbtn{height:50px;min-height:50px;padding-top:1px;padding-bottom:1px;overflow:hidden;}
#capeHome.ch-fit-10 .ch-playbtn-label{line-height:1.05;}
#capeHome.ch-fit-10 .ch-playbtn-sub.is-long{font-size:9.6px;line-height:1.1;}
#capeHome.ch-fit-10 > .ch-chestwrap{grid-column:2;width:auto;margin:0;display:flex;align-items:stretch;gap:6px;}
#capeHome.ch-fit-10 .ch-chestdoor{flex-direction:column;justify-content:center;gap:1px;min-width:72px;min-height:48px;padding:3px 8px;font-size:12.5px;letter-spacing:.9px;}
#capeHome.ch-fit-10 .ch-chestdoor-ico,#capeHome.ch-fit-10 .ch-chestdoor-ico .ci{width:22px;height:22px;flex:0 0 22px;}
#capeHome.ch-fit-10 .ch-chestfx{position:absolute;left:0;right:0;top:0;}
#capeHome.ch-fit-10 .ccClaimDot{position:relative;right:auto;top:auto;margin:0;align-self:center;flex:0 0 44px;}
/* 11: the right-hand chips, the weekly twist and the come-back hooks slim down (the words never change; they wrap instead of growing tall) */
#capeHome.ch-fit-11 .ch-metarow{gap:4px;}
#capeHome.ch-fit-11 .ch-season{min-height:44px;padding:3px 6px;font-size:10.5px;line-height:1.15;letter-spacing:.1px;gap:4px;}
#capeHome.ch-fit-11 .ch-season .ci{width:13px;height:13px;flex:0 0 13px;}
#capeHome.ch-fit-11 .ch-twist{padding-top:4px;padding-bottom:4px;gap:0;}
#capeHome.ch-fit-11 .ch-twist #chTwistSub{font-size:9.5px;line-height:1.15;}
#capeHome.ch-fit-11 #chHookRow{gap:3px;margin-bottom:0;}
#capeHome.ch-fit-11 .ch-hook{min-height:32px;padding:3px 10px;gap:3px;}
#capeHome.ch-fit-11 .chkTxt{font-size:13px;}
#capeHome.ch-fit-11 .chkBar{height:5px;}
/* 12: the five saved-lineup numbers and the POWER line share one row (numbers left, power right) */
#capeHome.ch-fit-12 .ch-showcase{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:6px;align-items:center;justify-items:center;}
#capeHome.ch-fit-12 .ch-showcase > *{grid-column:1 / -1;}
/* 1.0m RC2 Q4 (J's phone: POWER ran past the card): the numbers and POWER no longer share one row - each gets the full width */
#capeHome.ch-fit-12 .ch-showcase > #homeBinder{grid-column:1 / -1;}
#capeHome.ch-fit-12 .ch-showcase > #chPowerRow{grid-column:1 / -1;width:100%;margin:0;}
#capeHome.ch-fit-12 #homeBinder .ccBinderRow{gap:1px;}
#capeHome.ch-fit-12 #homeBinder .ccBinderTab{padding:5px 8px;}
#capeHome.ch-fit-12 .ch-powerplate{flex-direction:row;flex-wrap:wrap;justify-content:center;gap:0 8px;padding:0 6px;min-width:0;}
#capeHome.ch-fit-12 .ch-powerplate b{font-size:14px;}
/* 13: the last resort - a slimmer leader chip and team row */
#capeHome.ch-fit-13 .ch-leaderchip{min-height:40px;padding-bottom:3px;}
#capeHome.ch-fit-13 .ch-teamrow{grid-template-columns:repeat(var(--n),minmax(0,46px));gap:4px;}
#capeHome.ch-fit-13 .ch-showcase{padding-top:5px;padding-bottom:4px;}
/* W326: the claim star sits level with the CHESTS door (its old vertical centring poked 1 px into PLAY at 390x844) */
#capeHome .ch-chestwrap .ccClaimDot{top:auto;bottom:0;margin-top:0;}
#capeHome.ch-fit-10 .ch-chestwrap .ccClaimDot{bottom:auto;}
/* W326 (the coordinator: "the Home rank chip truncates at 360 px - MAIN EVENT · 28..."): on a narrow phone the rank chip WRAPS (band name, then the count)
   instead of cutting the count off; the badge and icon stay on the first line. */
@media (max-width:374px){
  #capeHome .ch-troph{white-space:normal;flex-wrap:wrap;row-gap:0;line-height:1.1;letter-spacing:.15px;padding:2px 5px;text-align:center;}
  #capeHome .ch-troph .v{overflow:visible;text-overflow:clip;overflow-wrap:normal;}
}

/* ==========================================================================================================================================
   W326 E-001 THE TITLE BEAT, inside the boot cover #ccBoot (index.html markup; public/js/titlecard.js decides FULL / STILL / QUICK; public/js/polish.js
   lifts the cover). From the very first paint: dusk over Cape City, the rays and the POW burst pop, the CAPE CLASH logo slams in, a red cape sweeps
   across, the tagline lands - about 1.2 s - then the poster holds until the game underneath is ready. Transforms and opacity only; every keyframe runs
   ONCE. The three loading dots appear only if the game is still loading after 1.9 s. STILL (reduced motion, battery saver) is the finished poster;
   QUICK (a test harness, an automated browser, a reload in the same session) is the plain cover it always was: the logo and the dots.
   ========================================================================================================================================== */
#ccBoot.ccTitleBoot{overflow:hidden;-webkit-user-select:none;user-select:none;}
#ccBoot .ccTitleSky{position:absolute;inset:0;background:radial-gradient(ellipse 95% 62% at 50% 40%,#3aa6dc 0%,#1d6494 36%,#12325c 68%,#0b1430 100%);
  animation:ccTitleFade .35s ease-out both;}
#ccBoot .ccTitleRays{position:absolute;inset:-30%;background:repeating-conic-gradient(from 0deg at 50% 46%,rgba(255,248,231,.11) 0deg 4deg,transparent 4deg 13deg);
  animation:ccTitleRays 1.3s cubic-bezier(.2,.8,.3,1) .05s both;}
#ccBoot .ccTitleCity{position:absolute;left:-2%;bottom:0;width:104%;height:22%;display:block;animation:ccTitleRise .5s cubic-bezier(.2,.8,.3,1) .1s both;}
#ccBoot .ccTitleStage{position:relative;display:flex;flex-direction:column;align-items:center;width:min(84vw,380px);margin-top:-6vh;
  animation:ccTitleShake .24s steps(3) .52s 1 both;}
#ccBoot .ccTitleBurst{position:absolute;left:50%;top:44%;width:118%;aspect-ratio:1;transform:translate(-50%,-50%) scale(1);
  animation:ccTitleBurst .5s cubic-bezier(.2,1.6,.4,1) .12s both;}
#ccBoot .ccTitleBurst svg{width:100%;height:100%;display:block;}
#ccBoot.ccTitleBoot .ccTitleLogo{position:relative;width:100%;height:auto;display:block;filter:drop-shadow(0 6px 0 rgba(8,4,20,.6));
  animation:ccTitleSlam .52s cubic-bezier(.18,1.4,.4,1) .2s both;}
#ccBoot .ccTitleTag{position:relative;margin-top:4px;font-family:'Bangers',cursive;font-size:clamp(14px,4.6vw,20px);letter-spacing:1.6px;color:#fff8e7;
  text-shadow:2px 2px 0 #1b1430;animation:ccTitleTag .4s ease-out .7s both;}
#ccBoot .ccTitleCape{position:absolute;left:0;top:28%;width:72vw;max-width:440px;transform:translateX(170vw);
  animation:ccTitleCape .8s cubic-bezier(.5,0,.3,1) .4s both;}
#ccBoot .ccTitleCape svg{width:100%;height:auto;display:block;}
#ccBoot.ccTitleBoot .ccBootInk{position:absolute;left:0;right:0;bottom:calc(24% + 10px);justify-content:center;animation:ccTitleFade .3s ease-out 1.9s both;}
@keyframes ccTitleFade{0%{opacity:0;}100%{opacity:1;}}
@keyframes ccTitleRise{0%{transform:translateY(40%);}100%{transform:none;}}
@keyframes ccTitleSlam{0%{transform:scale(2.6) rotate(-8deg);opacity:0;}55%{transform:scale(.92) rotate(2deg);opacity:1;}100%{transform:scale(1) rotate(0);opacity:1;}}
@keyframes ccTitleBurst{0%{transform:translate(-50%,-50%) scale(0) rotate(-30deg);}100%{transform:translate(-50%,-50%) scale(1) rotate(0);}}
@keyframes ccTitleCape{0%{transform:translateX(-120%) skewX(-8deg);}100%{transform:translateX(170vw) skewX(10deg);}}
@keyframes ccTitleRays{0%{transform:rotate(-12deg) scale(.8);opacity:0;}100%{transform:rotate(0) scale(1);opacity:1;}}
@keyframes ccTitleTag{0%{transform:translateY(10px);opacity:0;}100%{transform:none;opacity:1;}}
@keyframes ccTitleShake{0%{transform:translate(3px,-2px);}50%{transform:translate(-3px,2px);}100%{transform:none;}}
/* STILL: the finished poster, no movement (the OS setting is honoured from the first paint; SETTINGS -> ANIMATIONS NONE and BATTERY SAVER from the save) */
#ccBoot.ccTitleStill *,#ccBoot.ccTitleStill .ccBootInk i{animation:none !important;}
#ccBoot.ccTitleStill .ccTitleCape{display:none;}
@media (prefers-reduced-motion:reduce){#ccBoot.ccTitleBoot *{animation:none !important;}#ccBoot.ccTitleBoot .ccTitleCape{display:none;}}
/* QUICK: the plain cover of old - the logo and the dots, nothing else, nothing moving but the dots */
#ccBoot.ccTitleQuick .ccTitleSky,#ccBoot.ccTitleQuick .ccTitleRays,#ccBoot.ccTitleQuick .ccTitleCity,#ccBoot.ccTitleQuick .ccTitleCape,
#ccBoot.ccTitleQuick .ccTitleBurst,#ccBoot.ccTitleQuick .ccTitleTag{display:none;}
#ccBoot.ccTitleQuick .ccTitleStage,#ccBoot.ccTitleQuick .ccTitleLogo{animation:none !important;}
#ccBoot.ccTitleQuick .ccTitleStage{margin-top:0;width:min(250px,68vw);}
#ccBoot.ccTitleQuick .ccBootInk{position:static;animation:none;}

/* ==========================================================================================================================================
   W326 HOME AMBIENCE (OWNER DECISION D44 s.3; E-030's HOME half): Cape City breathes behind HOME - two soft clouds drift across the open sky band
   above the cards and, once per return to HOME, a caped hero streaks across it (home.js ambientReplay). Behind every panel (the background layer),
   transforms only, every animation FINITE, and only on FULL animations with no battery saver - otherwise the clouds simply sit still.
   ========================================================================================================================================== */
.ch-amb{position:absolute;left:0;right:0;top:0;height:min(26vh,190px);pointer-events:none;overflow:hidden;}
.ch-amb-cloud{position:absolute;display:block;width:150px;height:44px;border-radius:44px;opacity:.16;
  background:radial-gradient(circle at 30% 60%,#e6f6ff 0 18px,transparent 19px),radial-gradient(circle at 55% 38%,#e6f6ff 0 24px,transparent 25px),
    radial-gradient(circle at 78% 62%,#e6f6ff 0 16px,transparent 17px),linear-gradient(#e6f6ff,#e6f6ff) center 70%/80% 16px no-repeat;}
.ch-amb-c1{left:8%;top:6px;}
.ch-amb-c2{left:58%;top:58px;width:120px;height:36px;opacity:.11;}
.ch-amb-flyer{position:absolute;left:0;top:18px;width:84px;height:31px;display:block;opacity:0;transform:translateX(-120px);}
.ch-amb-flyer svg{width:100%;height:100%;display:block;}
html[data-anim="full"]:not([data-passport-fx="static"]) .ch-amb-cloud{animation:chAmbDrift 26s ease-in-out 3 alternate both;}
html[data-anim="full"]:not([data-passport-fx="static"]) .ch-amb-c2{animation-duration:34s;animation-delay:-9s;}
html[data-anim="full"]:not([data-passport-fx="static"]) .ch-amb.ch-amb-go .ch-amb-flyer{animation:chAmbFly 3.2s cubic-bezier(.45,.05,.4,1) 1.4s 1 both;}
@keyframes chAmbDrift{0%{transform:translateX(-24px);}100%{transform:translateX(34px);}}
@keyframes chAmbFly{0%{transform:translate(-120px,26px) rotate(-6deg);opacity:0;}12%{opacity:.75;}50%{transform:translate(48vw,4px) rotate(-2deg);}
  88%{opacity:.75;}100%{transform:translate(calc(100vw + 40px),-18px) rotate(-8deg);opacity:0;}}
@media (prefers-reduced-motion:reduce){.ch-amb *{animation:none !important;}}
body.cc-rm .ch-amb *{animation:none !important;}
/* W326: when HOME has to scroll on a very short window, a scroll that brings PLAY into view leaves a little air between it and the bottom bar */
#capeHome .ch-playbtn{scroll-margin-top:10px;scroll-margin-bottom:12px;}

/* Direct mode entrances. Legacy owners stay mounted but cannot drive a visible
   shared Play action. No persistent selection, new timer or animation loop. */
#capeHome .ch-legacyModePicker{display:none!important;}
#capeHome .ch-playDeck{display:grid;gap:8px;width:100%;min-width:0;}
#capeHome .ch-playDeck h2{justify-self:start;margin:0;padding:2px 10px;border-radius:5px;background:var(--ch-ink);color:#fff4d5;font:400 19px/1 Bangers,sans-serif;letter-spacing:1.3px;}
#capeHome .ch-playDeck #chTwist{width:100%;max-width:none;margin:0;}
/* 1.0l RC3 (M): the weekly twist header is never cut. In a half-width tile the NEW TWIST note drops under it, and a long name wraps at spaces. */
#capeHome .ch-twist-top{flex-wrap:wrap;row-gap:1px;}
#capeHome .ch-twist b{flex:1 1 auto;min-width:0;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:normal;word-break:normal;line-height:1.1;}
/* 1.0m RC2 repair (Q8): the sub-line may take a third line instead of losing the prize, and NEW TWIST IN may wrap inside the card on a narrow phone. */
#capeHome .ch-twist #chTwistSub{-webkit-line-clamp:3;min-width:0;overflow-wrap:break-word;}
#capeHome .ch-twist i{max-width:100%;white-space:normal;}
#capeHome .ch-modeDoors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;width:100%;}
#capeHome .ch-modeDoor{position:relative;min-width:0;min-height:102px;border:2px solid #d5eaff;border-radius:18px;padding:7px 5px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;color:#fff8df;box-shadow:0 5px 0 #08182c,0 8px 16px #06132955;text-align:center;overflow:hidden;}
#capeHome .ch-doorStory{background:linear-gradient(155deg,#477fc7,#203c73 72%);}
#capeHome .ch-doorPvp{background:linear-gradient(155deg,#ffdd69,#e4a72b 75%);color:#102643;border-color:#fff0b5;}
#capeHome .ch-doorCoop{background:linear-gradient(155deg,#4eafcf,#175273 75%);}
#capeHome #chStoryDoor .ch-newstamp{position:absolute;top:3px;right:5px;left:auto;width:auto;height:auto;padding:2px 4px;border-radius:4px;background:#a91e3b;color:#fff6dd;font:900 9px/1.2 Nunito,sans-serif;letter-spacing:.2px;pointer-events:none;}
body.ccCtaStory #capeHome #chStoryDoor{border-color:var(--pow,#ffd23f);box-shadow:0 0 0 3px rgba(255,210,63,.55),0 0 20px rgba(255,210,63,.35);}
#capeHome .ch-modeDoor>span{display:block;width:32px;height:32px;}
#capeHome .ch-modeDoor svg{width:100%;height:100%;}
#capeHome .ch-modeDoor strong{font:400 clamp(22px,6vw,30px)/1 Bangers,sans-serif;letter-spacing:.6px;}
#capeHome .ch-modeDoor small{font:800 11px/1.2 Nunito,sans-serif;min-height:14px;}
/* A dismissed Story guide lives in the Play deck while its prompt is present.
   The modal itself and its separate active-call position remain Story-owned. */
#capeHome #chStoryGuideSlot:empty{display:none;}
#capeHome #chStoryGuideSlot .soRoot{position:static;inset:auto;z-index:auto;}
#capeHome #chStoryGuideSlot .soPhone{box-sizing:border-box;position:static;inset:auto;width:100%;min-width:0;max-width:none;
  justify-content:flex-start;gap:10px;text-align:left;overflow-wrap:anywhere;color:#fff4d5;
  background:linear-gradient(105deg,#284367,#142f4b 70%)!important;border-color:#ffdd76!important;box-shadow:0 3px 0 #0d233b;}
#capeHome #chStoryGuideSlot .soPhone svg{width:21px;height:21px;flex-basis:21px;}
#capeHome #chStoryGuideSlot .soPhone::after{content:'›';margin-inline-start:auto;font-size:20px;line-height:1;color:#ffdd76;}
html[data-text="large"] #capeHome #chStoryGuideSlot .soPhone{font-size:15px;}
#capeHome .ch-moreModes{width:100%;min-height:44px;border:1px solid #9ec5e5;border-radius:12px;background:#142f4b;color:#fff4d5;font:900 12px/1.2 Nunito,sans-serif;padding:5px 11px;display:flex;gap:8px;justify-content:space-between;align-items:center;text-align:left;}
#capeHome .ch-moreModesText{display:grid;gap:2px;min-width:0;}
#capeHome .ch-patrolLinks{display:flex;gap:6px;min-width:0;}
#capeHome .ch-patrolLinks>button{flex:1 1 0;min-width:0;}
#capeHome .ch-seasonTicket[hidden]{display:none;}
#capeHome .ch-seasonTicket{justify-content:flex-start;border-color:#e9d09a;background:linear-gradient(112deg,#215450,#143744 69%,#254a52);box-shadow:inset 4px 0 #eacb7c;}
#capeHome .ch-seasonTicket .ch-ticketStar{flex:none;color:#dcfffc;font-size:22px;}
.ch-districtPrint{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:10px 0 14px;gap:4px;padding:7px;border:1px solid #78999d;border-radius:12px;background:#122e39;color:#fff7dc;}
.ch-districtPrint figcaption{grid-column:1/-1;color:#ffdd88;font:900 11px/1.4 Nunito,sans-serif;letter-spacing:.09em;}
.ch-districtPrint canvas{display:block;width:100%;height:auto;border-radius:5px;background:#29516e;}
.ch-districtPrint span{display:block;font:800 11px/1.2 Nunito,sans-serif;margin-top:4px;}
#capeHome .ch-moreModesText small{color:var(--ch-body2);font:800 11px/1.2 Nunito,sans-serif;}
#capeHome .ch-moreModes > [aria-hidden]{font-size:19px;line-height:1;}
html[data-text="large"] #capeHome .ch-modeDoor small,html[data-text="large"] #capeHome .ch-moreModesText small{font-size:13px;}
.ch-modeSheet{position:fixed;inset:0;z-index:180;display:flex;align-items:center;justify-content:center;padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));background:#06152be8;color:#fff5da;overflow:auto;box-sizing:border-box;}
.ch-modePanel{box-sizing:border-box;width:100%;max-width:500px;max-height:100%;overflow:auto;padding:18px;border:2px solid #b4d3ee;border-radius:24px;background:radial-gradient(ellipse at 85% 5%,#396a91 0,transparent 52%),linear-gradient(155deg,#1d4160,#10233d 80%);box-shadow:0 12px 0 #050e20;}
.ch-modePanel h2{font:400 clamp(26px,8vw,39px)/1.08 Bangers,sans-serif;margin:18px 0 8px;letter-spacing:1px;}
.ch-modeIntro,.ch-modeNotice{font:800 14px/1.45 Nunito,sans-serif;margin:0 0 17px;}
.ch-modeBack{min-height:44px;padding:9px 15px;border:1px solid #b9d5ec;border-radius:11px;background:#112a43;color:#fff5da;font:900 14px Nunito,sans-serif;}
.ch-modeChoice{box-sizing:border-box;width:100%;min-height:92px;display:flex;align-items:center;gap:14px;text-align:left;padding:14px 12px;margin:10px 0;border:2px solid #719abc;border-radius:17px;background:linear-gradient(135deg,#234b6b,#102a45);color:#fff8e2;}
.ch-modeChoice[aria-pressed=true]{border-color:#ffdc69;box-shadow:inset 0 0 0 2px #ffdc6933;background:linear-gradient(130deg,#365a73,#162f48);}
.ch-modeChoiceArt{flex:0 0 42px;height:42px;display:block;}.ch-modeChoiceArt svg{width:100%;height:100%;}
.ch-modeChoice>span:last-child{min-width:0;display:flex;flex-direction:column;gap:5px;}
.ch-modeChoice strong{font:400 24px/1.1 Bangers,sans-serif;letter-spacing:.5px;}
.ch-modeChoice small{font:800 13px/1.35 Nunito,sans-serif;}
.ch-modeChoice:disabled{opacity:.55;cursor:not-allowed;}.ch-modeNotice{margin:14px 2px 3px;color:#d5e5f1;}
.ch-modeGo{width:100%;min-height:58px;border:2px solid #fff0b1;border-radius:16px;padding:13px 8px;margin-top:14px;background:linear-gradient(#ffdf76,#f1b93c);color:#132842;font:400 27px/1.1 Bangers,sans-serif;box-shadow:0 5px 0 #956b1a;}
.ch-modeGo:disabled{opacity:.5;box-shadow:none;}#capeHome .ch-modeDoor:focus-visible,#capeHome .ch-moreModes:focus-visible,.ch-modePanel button:focus-visible{outline:3px solid #fff6bc;outline-offset:3px;}
@media(max-width:340px){#capeHome .ch-modeDoors{gap:6px;}#capeHome .ch-modeDoor{min-height:96px;}#capeHome .ch-modeDoor small{font-size:10px;}.ch-modePanel{padding:14px;}.ch-modeChoice{gap:10px;}.ch-modeChoice strong{font-size:22px;}}

/* Illustrated entrances reuse shipped Cape art; the Story mark is an original
   inline open-book icon. Photos stay in framed art slots, never behind copy. */
#capeHome .ch-modeDoor>span.ch-doorIllustration{box-sizing:border-box;flex:0 0 auto;overflow:hidden;border:2px solid #fff1c7;border-radius:8px;box-shadow:0 2px 0 #06162b;}
#capeHome .ch-modeDoor>span.ch-doorBook{width:34px;height:34px;padding:1px;background:linear-gradient(145deg,#f9dfa0,#d9ac50);}
#capeHome .ch-modeDoor>span.ch-doorIllustrationPvp{width:min(56px,62%);height:34px;background-image:linear-gradient(180deg,#06152b08,#06152b78),url('/art/home/card-clash.jpg');background-size:cover;background-position:center 43%;}
#capeHome .ch-modeDoor>span.ch-doorIllustrationCoop{width:min(56px,62%);height:34px;background-image:linear-gradient(180deg,#06152b08,#06152b72),url('/art/home/card-coop.jpg');background-size:cover;background-position:center 48%;}
#capeHome .ch-modeDoor>span.ch-doorIllustrationPvp,#capeHome .ch-modeDoor>span.ch-doorIllustrationCoop{display:grid;place-items:center;background-color:#2a4b6a;}
#capeHome .ch-doorIllustrationPvp svg,#capeHome .ch-doorIllustrationCoop svg{width:25px;height:25px;filter:drop-shadow(0 1px 2px #07172a);}
/* Three compact comic covers, in the existing Play footprint. The art occupies
   its own panel, never the text area, and does not animate or reflow on tap. */
#capeHome .ch-modeDoor{padding:0 0 7px;gap:3px;justify-content:flex-start;border-radius:13px;}
#capeHome .ch-modeDoor>span.ch-doorIllustration{display:flex;align-items:flex-end;justify-content:flex-start;width:100%;height:41px;border:0;border-radius:0;border-bottom:2px solid #13243c;background-size:cover;box-shadow:none;padding:0 0 2px 4px;}
#capeHome .ch-modeDoor>span.ch-doorBook{background:#355e86 linear-gradient(130deg,#28496b,#6cb1db);background-image:linear-gradient(110deg,#152c4866,transparent 62%),url('/art/home/card-story.jpg');background-position:50% 38%;}
#capeHome .ch-modeDoor>span.ch-doorIllustration svg{width:25px;height:25px;padding:2px;border-radius:6px;background:#142b43db;border:1px solid #f5dea4;box-sizing:border-box;}
#capeHome .ch-modeDoor strong{padding:2px 3px 0;}
#capeHome .ch-modeDoor small{padding:0 4px;}
.ch-modeChoiceArt{position:relative;box-sizing:border-box;overflow:hidden;border:2px solid #d5eaff;border-radius:9px;background-position:center;background-size:cover;box-shadow:0 2px 0 #07172a;}
.ch-modeChoiceArt svg{position:relative;z-index:1;filter:drop-shadow(0 1px 2px #07172a);}
.ch-choiceClash .ch-modeChoiceArt,.ch-choiceFourPlayer .ch-modeChoiceArt{flex-basis:64px;height:48px;background-image:linear-gradient(180deg,#07172a08 25%,#07172a72),url('/art/home/card-clash.jpg');background-position:center 44%;}
.ch-choiceCoopHQ .ch-modeChoiceArt,.ch-choiceCoopFriend .ch-modeChoiceArt,.ch-choiceCoopRandom .ch-modeChoiceArt{flex-basis:64px;height:48px;background-image:linear-gradient(180deg,#07172a08 25%,#07172a72),url('/art/home/card-coop.jpg');background-position:center 48%;}
.ch-choiceClash .ch-modeChoiceArt svg,.ch-choiceFourPlayer .ch-modeChoiceArt svg,.ch-choiceCoopHQ .ch-modeChoiceArt svg,.ch-choiceCoopFriend .ch-modeChoiceArt svg,.ch-choiceCoopRandom .ch-modeChoiceArt svg{width:23px;height:23px;margin:4px;}
.ch-choiceClash .ch-modeChoiceArt::after,.ch-choiceFourPlayer .ch-modeChoiceArt::after,.ch-choiceCoopHQ .ch-modeChoiceArt::after,.ch-choiceCoopFriend .ch-modeChoiceArt::after,.ch-choiceCoopRandom .ch-modeChoiceArt::after{position:absolute;right:3px;bottom:3px;padding:2px 4px;border:1px solid #fff1bf;border-radius:5px;background:#07172a;color:#fff5d8;font:900 9px/1 Nunito,sans-serif;letter-spacing:.3px;}
.ch-choiceClash .ch-modeChoiceArt::after{content:'1v1';}.ch-choiceFourPlayer .ch-modeChoiceArt::after{content:'4P';}
.ch-choiceCoopHQ .ch-modeChoiceArt::after{content:'HQ';}.ch-choiceCoopFriend .ch-modeChoiceArt::after{content:'FRIEND';}.ch-choiceCoopRandom .ch-modeChoiceArt::after{content:'OPEN';}
@media(max-width:340px){.ch-choiceClash .ch-modeChoiceArt,.ch-choiceFourPlayer .ch-modeChoiceArt,.ch-choiceCoopHQ .ch-modeChoiceArt,.ch-choiceCoopFriend .ch-modeChoiceArt,.ch-choiceCoopRandom .ch-modeChoiceArt{flex-basis:56px;height:42px;}}
.ch-modePanel .ch-modeChoice.ch-choiceSeasonPractice{
  color:#fff4ce;border-color:#edbf6a;background:linear-gradient(110deg,#114c52,#173940 62%,#20364a);
}
.ch-choiceSeasonPractice .ch-modeChoiceArt{filter:drop-shadow(0 2px 1px #0f273c);}
.ch-modePanel .ch-choiceSeasonPractice small{color:#dbf3ee;}
/* 1.0m RC2 Q8 (J's phone: 'LEVEL 4 - HQ SUPREME ...' cut off): the profile card's level / HQ line wraps instead of being cut, at a readable size */
#capeHome #chPassport .cppMeta{font-size:11px;line-height:14px;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;}
