/* ===========================================================================
   Cape Clash — CINEMATICS STYLESHEET
   Companion to public/js/cinematics.js (global CapeCine). Implements the DOM
   half of docs/specs/JUICE-SPEC.md §2 (layer stack), §4 (easing), §6 (budget).

   Rules this file obeys:
   - Only `transform` and `opacity` are animated. Nothing else. Ever.
   - Every major beat is driven per-frame from JS (CapeCine.update), so the
     timelines never desync when requestAnimationFrame is paused. CSS keyframes
     are used ONLY for the tiny fire-and-forget `pop()` micro-animations.
   - Colour tokens fall back to literals, so the sheet works standalone in
     public/cinelab.html as well as inside index.html.
   =========================================================================== */

:root{
  --cine-ink:    var(--ink,   #1b1430);
  --cine-panel:  var(--panel, #241b44);
  --cine-paper:  var(--paper, #fff8e7);
  --cine-pow:    var(--pow,   #ffd23f);
  --cine-red:    var(--red,   #e03131);
  --cine-gold:   #C08B1F;
  --cine-you:    var(--you-blue, #4980D5);
  --cine-foe:    var(--foe-red,  #e03131);
  --cine-frenzy: #ff922b;
  --cine-theme:  #7ee8fa;
  --cine-font:   'Bangers', 'Impact', system-ui, sans-serif;
  --cine-body:   'Nunito', system-ui, -apple-system, sans-serif;
}

/* --------------------------------------------------------------------------
   LAYERS — created once by cinematics.js, never rebuilt.
   #cineFx   z 62 : above #banner (60), below #tut (65) and #over (70)
   #cineRes  z 72 : the self-contained result panel (only when the host has
                    not handed CapeCine an existing #over to drive)
   #cineWipe z 90 : the comic-panel wipe, above everything
   -------------------------------------------------------------------------- */
#cineFx, #cineWipe, #cineRes{
  position:fixed; inset:0; pointer-events:none;
  -webkit-user-select:none; user-select:none;
  -webkit-tap-highlight-color:transparent;
  contain:layout style;
}
#cineFx{ z-index:62; }
#cineRes{ z-index:72; display:flex; align-items:center; justify-content:center; padding:16px; }
#cineWipe{ z-index:90; overflow:hidden; }

/* `.cine-armed` is set by JS only while a SKIPPABLE moment is running, so a tap
   can reach CapeCine.skip() without stealing input the rest of the time.
   `.cine-live` keeps the result panel tappable once its buttons are revealed. */
#cineFx.cine-armed, #cineRes.cine-armed, #cineRes.cine-live{ pointer-events:auto; }
#cineRes.cine-idle{ display:none; }
/* Belt-and-braces: nothing on the fx layer can linger visible while it is idle. */
#cineFx.cine-idle{ visibility:hidden; }

/* --------------------------------------------------------------------------
   M01 — COMIC-PANEL WIPE
   Five skewed vertical panels. JS writes translateX per frame; the skew and
   the halftone live here so the JS only ever touches one property.
   -------------------------------------------------------------------------- */
.cinePanel{
  position:absolute; top:-8%; height:116%;
  will-change:transform;                  /* the only five layers we promote */
  transform:translate3d(-140%,0,0);
  background:var(--cine-ink);
  box-shadow:0 0 0 1px rgba(0,0,0,.35);
}
.cinePanel.alt{ background:var(--cine-panel); }
.cinePanel.halftone{
  background-image:repeating-radial-gradient(circle at 30% 40%,
    rgba(255,255,255,.10) 0 1.6px, transparent 1.6px 6px);
  background-color:var(--cine-panel);
}
/* the `fade` variant (and every reduced-motion wipe) is one opaque sheet */
.cineFade{
  position:absolute; inset:0; opacity:0;
  background:var(--cine-ink);
}

/* --------------------------------------------------------------------------
   Shared centre-stage geometry. Everything that owns the centre of the screen
   is absolutely positioned and centred; JS appends its own transform AFTER
   this translate, so the anchor never drifts.
   -------------------------------------------------------------------------- */
.cineCentre{
  position:absolute; left:50%; top:34%;
  transform:translate3d(-50%,-50%,0);
  transform-origin:50% 50%;
  text-align:center; line-height:1;
  opacity:0;
  /* NOTE: no `display:none` here on purpose — cinematics.js hides every centre
     node with an inline display at build time and clears it to show one, which
     lets #cineBoss keep its own display:flex. */
}

/* --------------------------------------------------------------------------
   M04 — COUNTDOWN NUMERALS  ("3 · 2 · 1 · CLASH!")
   Same type treatment as #banner so it is obviously the same game.
   -------------------------------------------------------------------------- */
#cineCount{
  top:42%;
  font-family:var(--cine-font); letter-spacing:3px;
  color:var(--cine-pow);
  text-shadow:3px 3px 0 var(--cine-red), 6px 6px 0 #00000066;
  font-size:96px;
}
#cineCount.word{ font-size:64px; }

/* --------------------------------------------------------------------------
   M03 — MUTATOR / INFO CARD
   The one thing in the spec that grows instead of slamming: it is an
   information card, not a hit.
   -------------------------------------------------------------------------- */
#cineCard{
  top:30%;
  width:min(320px, 82vw);
  padding:14px 18px 16px;
  background:var(--cine-panel);
  border:3px solid var(--cine-ink);
  outline:3px solid var(--cine-gold);
  border-radius:16px;
  box-shadow:0 14px 34px rgba(0,0,0,.55);
  font-family:var(--cine-body);
}
#cineCard .k{
  font-family:var(--cine-font); font-size:13px; letter-spacing:2px;
  color:var(--cine-gold);
}
#cineCard .n{
  font-family:var(--cine-font); font-size:24px; letter-spacing:2px;
  color:var(--cine-pow); text-shadow:2px 2px 0 var(--cine-red);
  margin:2px 0 4px;
}
#cineCard .d{ font-size:14px; font-weight:800; color:#e3ddf5; line-height:1.4; }

/* --------------------------------------------------------------------------
   M05 / M06 / M10 — WAVE BANNER
   Used only when the host did NOT hand CapeCine an existing #banner element.
   Deliberately identical to index.html's #banner so both paths look the same.
   -------------------------------------------------------------------------- */
#cineBanner{
  top:34%;
  font-family:var(--cine-font); font-size:38px; letter-spacing:3px;
  color:var(--cine-pow);
  text-shadow:3px 3px 0 var(--cine-red), 6px 6px 0 #00000066;
  max-width:92vw;
}

/* --------------------------------------------------------------------------
   M07 — BOSS INTRO RIBBON
   Full-width dark band, gold trim, scalloped ends, DOM portrait on the left.
   -------------------------------------------------------------------------- */
#cineBoss{
  left:0; top:38%; width:100%;
  transform:translate3d(-110%,-50%,0);
  display:flex; align-items:center; gap:12px;
  padding:10px 16px;
  /* TRANSLUCENT: in Co-op / Clash the band sits between the two boards, and an
     opaque panel hid both of them. 78-86% + a blur keeps it legible while the
     boards still read underneath. */
  background:linear-gradient(180deg, rgba(42,32,80,.78) 0%, rgba(27,20,48,.88) 100%);
  border-top:6px solid var(--cine-gold);
  border-bottom:6px solid var(--cine-gold);
  box-shadow:0 10px 30px rgba(0,0,0,.55);
  text-align:left;
  font-family:var(--cine-body);
  /* the name punch scales past the right edge on a 390px phone; clip it here */
  overflow:hidden;
}
@supports ((-webkit-backdrop-filter:blur(4px)) or (backdrop-filter:blur(4px))){
  #cineBoss{ -webkit-backdrop-filter:blur(5px) saturate(1.1); backdrop-filter:blur(5px) saturate(1.1); }
}
#cineBoss::before, #cineBoss::after{
  content:''; position:absolute; top:0; bottom:0; width:18px;
  background:var(--cine-gold);
  clip-path:polygon(0 0, 100% 12%, 60% 50%, 100% 88%, 0 100%);
}
#cineBoss::before{ left:0; }
#cineBoss::after{ right:0; transform:scaleX(-1); }
#cineBossPortrait{
  flex:0 0 auto; width:96px; height:96px; display:block;
  border-radius:14px; background:rgba(0,0,0,.28);
  transform:scale(0); transform-origin:50% 50%;
}
@media (max-width:360px){ #cineBossPortrait{ width:78px; height:78px; } }
#cineBossText{ flex:1 1 auto; min-width:0; overflow:hidden; }
#cineBossName{
  font-family:var(--cine-font); font-size:34px; letter-spacing:2px;
  color:var(--cine-paper); text-shadow:2px 2px 0 #000;
  transform-origin:0% 50%; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis;
}
/* the difficulty tier as a CORNER CHIP on the band, clear of the name plate
   (the ::after scallop owns the right 18px, so the chip stops short of it) */
#cineBossTier{
  position:absolute; top:4px; right:24px; z-index:2;
  font-family:var(--cine-font); font-size:11px; letter-spacing:1.6px;
  color:var(--cine-pow);
  padding:1px 8px; border-radius:9px;
  background:rgba(12,8,26,.72); border:2px solid currentColor;
  text-shadow:1px 1px 0 #000; pointer-events:none;
}
@media (max-width:360px){ #cineBossTier{ font-size:10px; right:22px; padding:1px 6px; } }
#cineBossAbil{
  font-size:13px; font-weight:800; letter-spacing:1px; color:#d8d2f0;
  margin-top:3px; opacity:0;
}

/* --------------------------------------------------------------------------
   M18 / M19 — RESULT TITLE RIBBON
   -------------------------------------------------------------------------- */
#cineTitle{
  left:0; top:26%; width:100%;
  transform:translate3d(0,-50%,0);
  padding:8px 0;
  font-family:var(--cine-font); font-size:52px; letter-spacing:4px;
  text-align:center; color:var(--cine-paper);
  text-shadow:3px 3px 0 #000;
  border-top:6px solid var(--cine-gold);
  border-bottom:6px solid var(--cine-gold);
  background:var(--cine-you);
}
#cineTitle.lose{ background:#5a1f2b; color:var(--cine-red); }

/* --------------------------------------------------------------------------
   M18 / M19 / M20 — SELF-CONTAINED RESULT PANEL
   Only used when the host has no #over of its own to drive.
   -------------------------------------------------------------------------- */
#cineRes .cineResCard{
  background:var(--cine-panel);
  border:3px solid var(--cine-ink);
  outline:3px solid var(--cine-red);
  border-radius:16px; padding:22px 24px; text-align:center;
  max-width:340px; width:100%;
  font-family:var(--cine-body);
  transform:translate3d(0,40%,0); opacity:0;
  box-shadow:0 18px 40px rgba(0,0,0,.6);
}
#cineRes.win .cineResCard{ outline-color:var(--cine-you); }
/* WIN: gold parchment silhouette with a 7px gold trim and ribbon tails (bible S5) */
#cineRes.cine-win .cineResCard{
  position:relative;
  background:linear-gradient(180deg,#3d3118 0%, #261c3c 52%, #1a1230 100%);
  outline:0;
  box-shadow:inset 0 0 0 7px var(--cine-gold), inset 0 0 0 10px var(--cine-ink),
             0 0 44px rgba(255,210,63,.32), 0 16px 38px rgba(0,0,0,.6);
}
#cineRes.cine-win .cineResCard::before,
#cineRes.cine-win .cineResCard::after{
  content:''; position:absolute; top:30px; height:32px; width:34px; z-index:-1;
  background:linear-gradient(180deg,#ffd23f,#f59f00);
  border:3px solid var(--cine-ink);
}
#cineRes.cine-win .cineResCard::before{ left:-26px; clip-path:polygon(0 0,100% 0,100% 100%,0 100%,36% 50%); }
#cineRes.cine-win .cineResCard::after{ right:-26px; clip-path:polygon(0 0,100% 0,64% 50%,100% 100%,0 100%); }
#cineRes.cine-win .cineResTitle{ color:#ffe89b; }
#cineRes .cineResTitle{
  font-family:var(--cine-font); font-size:38px; letter-spacing:2px;
  text-shadow:3px 3px 0 #000; color:var(--cine-red);
}
#cineRes.win .cineResTitle{ color:#9be15d; }
#cineRes .cineResText{ margin:8px 0 14px; font-weight:700; color:#d8d2f0; font-size:14px; }
#cineRes .cineResStats{
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px; margin:0 0 16px;
}
.cineStat{
  background:#1d1736; border:2px solid #4a3d85; border-radius:10px;
  padding:7px 5px; text-align:center;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07);
  opacity:0; transform:translate3d(0,14px,0) scale(.92);
}
.cineStat b{
  display:block; font-family:var(--cine-font); color:var(--cine-pow);
  font-size:20px; letter-spacing:1px; line-height:1;
}
.cineStat span{
  display:block; color:#bdb3d8; font-size:9px; font-weight:800;
  letter-spacing:.7px; margin-top:3px;
}
/* --------------------------------------------------------------------------
   M18.5 — THE REWARD BEAT
   One row: label + chip + stars, revealed BEFORE the tally starts. The host
   reuses these class names on its own #overReward node.
   -------------------------------------------------------------------------- */
.resReward{
  display:flex; align-items:center; justify-content:center; gap:8px;
  /* bottom margin bumped 10px -> 24px (front-polish pass): the .rwStars caption row below
     is absolutely positioned (out of flow, so it can't push .resReward taller itself) and
     needs the extra room so it doesn't crowd the CHEST pill / stat tiles under it. */
  flex-wrap:wrap; margin:2px 0 24px; opacity:0; min-height:26px;
}
.resReward:empty{ display:none; }
.resReward .rwLabel{
  font-family:var(--cine-font); font-size:12px; letter-spacing:2px; color:var(--cine-gold);
}
.resReward .rwChip{
  font-family:var(--cine-font); font-size:17px; letter-spacing:1px; line-height:1;
  color:#2a1a06; background:linear-gradient(180deg,#ffd23f,#f59f00);
  border:2px solid var(--cine-ink); border-radius:999px; padding:4px 13px 3px;
  box-shadow:0 3px 0 rgba(0,0,0,.42);
}
.resReward .rwChip.best{ background:linear-gradient(180deg,#b8f277,#4caf50); }
/* the earnings chip (coins + XP): dark plate so it reads as a receipt, not a prize */
.resReward .rwEarn{
  display:inline-flex; align-items:center; gap:5px;
  background:linear-gradient(180deg,#3a2f66,#241b44); color:var(--cine-pow);
  border:2px solid rgba(255,210,63,.45);
}
.resReward .rwEarn span{ font-family:var(--cine-font); letter-spacing:1px; }
/* W10-cleanup / QA item 1: a lab session (S.debugLab || isLabSession()) never banks
   coins/XP, so the integrator swaps reward.earn for this muted label instead of a real
   number - a QA screenshot must never read a payout that was never applied. */
.resReward .rwEarn .labMuted{ color:#9d94c2; font-style:italic; letter-spacing:.4px; }
/* The star grade is the SCORE, so it always gets its own centred row rather than being
   the last item on whatever line the earnings chips happened to leave room on (a mode with
   no trophies chip used to jam the three stars against the pill's right edge).
   COLUMN PITCH (W10R1): each <i> is a fixed 90px column and the gap is 6px, so the three
   captions sit on a 96px pitch with an 88px caption box - nothing can collide at any label
   length, at any viewport. 90*3 + 6*2 = 282px, inside a 360px phone. */
.resReward .rwStars{ display:flex; gap:6px; align-items:flex-start; flex:0 0 100%; justify-content:center; }
.resReward .rwStars i{
  font-style:normal; font-size:18px; line-height:1; display:inline-block;
  color:#3a3357; position:relative; width:90px; text-align:center;
  transition:color 140ms linear;
}
/* The lit/unlit POP lives on the glyph wrapper, never on the column: scaling the <i> scaled
   its ::after caption's BOX too (the old counter-scale(1.6129) painted a 62px caption 100px
   wide on a 40px pitch and every unlit caption bled into its neighbours). */
.resReward .rwStars i .rwStarIco{
  display:block; width:26px; margin:0 auto; opacity:.55; transform:scale(.62);
  transform-origin:center center;
  transition:transform 200ms cubic-bezier(.2,2,.4,1), opacity 140ms linear;
}
.resReward .rwStars i.on{ color:var(--cine-gold); text-shadow:0 0 10px rgba(255,210,63,.7); }
.resReward .rwStars i.on .rwStarIco{ opacity:1; transform:scale(1); }
/* SVG rating stars (CapeIcons star / star-empty). Both are written into the <i>; the
   empty one is on show until .on lands, so the reveal keeps its pop and its glow. */
/* 26px, not 18px. RARITY is now a FOUR-pip row of 12/16px stars, and the mission card's three
   gold rating stars sat at 18px in the same hue on the screen that arrives immediately after a
   win - one shape carrying two meanings at nearly one size. The rating row keeps its count and
   its CLEARED / KEEP 70% / FULL LIVES captions and simply becomes unmistakably the bigger of
   the two, so a star that is a RECORD never looks like a star that is a SCORE. */
.resReward .rwStars i .ci{ width:26px; height:26px; display:block; }
.resReward .rwStars i .ci-star{ display:none; }
.resReward .rwStars i.on .ci-star-empty{ display:none; }
.resReward .rwStars i.on .ci-star{ display:block; }
/* Star captions: each star is always the SAME criterion in the SAME position - index.html's
   endBattle() now passes reward.starFlags:[win, kept 70% lives, reached rank 8] and
   cinematics.js lights starEls[k] from THAT flag rather than from a count, so position N
   really is criterion N (a rank-8 win with leaked lives used to light positions 1-2 and
   claim '70% LIVES'). The caption is NEVER scaled: it is 10px in both states and it is
   88px wide inside a 90px column, so its painted box is its real box. */
.resReward .rwStars i::after{
  content:''; position:absolute; top:100%; left:50%; margin-top:4px;
  width:88px; transform:translateX(-50%); transform-origin:top center;
  transition:color 140ms linear;
  /* 10px, not 6.5px: 6.5px was roughly half the platform minimum (iOS 11pt / Android 12sp)
     and under this game's own 9.5px floor. */
  font-family:var(--cine-font); font-size:10px; font-weight:800; letter-spacing:.3px;
  line-height:1.2; color:#8b83ad; text-transform:uppercase; white-space:normal; text-align:center;
}
.resReward .rwStars i.on::after{ color:var(--cine-gold); }
.resReward .rwStars i:nth-child(1)::after{ content:'WIN'; }
.resReward .rwStars i:nth-child(2)::after{ content:'70% LIVES'; }
.resReward .rwStars i:nth-child(3)::after{ content:'RANK 8'; }
@media (prefers-reduced-motion: reduce){ .resReward .rwStars i,.resReward .rwStars i .rwStarIco{ transition:none; } .resReward .rwStars i::after{ transition:none; } }
html.cine-reduce .resReward .rwStars i,html.cine-reduce .resReward .rwStars i .rwStarIco{ transition:none; }
html.cine-reduce .resReward .rwStars i::after{ transition:none; }

#cineRes .cineResBtns{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
#cineRes .cineResBtns button{
  font-family:var(--cine-font); font-size:20px; letter-spacing:1px;
  padding:8px 20px; border-radius:12px; cursor:pointer;
  color:var(--cine-ink); background:var(--cine-pow);
  border:3px solid var(--cine-ink);
  box-shadow:0 4px 0 rgba(0,0,0,.45);
  opacity:0; transform:scale(.8);
}
#cineRes .cineResBtns button.dim{ background:#4a3d85; color:var(--cine-paper); }

/* M20's critical rule: a button cannot be tapped until its OWN reveal has
   finished. JS removes .cine-locked at the end of each button's beat. */
.cine-locked{ pointer-events:none !important; }

/* --------------------------------------------------------------------------
   pop() MICRO-ANIMATIONS — M13 / M15 / M16
   These are the only CSS keyframes in the system: sub-450 ms, fire and forget,
   never part of a timeline that has to stay in sync with the sim.
   -------------------------------------------------------------------------- */
.cine-squash{ animation:cineSquash .27s cubic-bezier(.2,2,.4,1) both; }
@keyframes cineSquash{
  0%  { transform:scale(1,1); }
  26% { transform:scale(.90,1.10); }
  60% { transform:scale(1.10,.90); }
  100%{ transform:scale(1,1); }
}
.cine-shakeX{ animation:cineShakeX .26s linear both; }
@keyframes cineShakeX{
  0%,100%{ transform:translate3d(0,0,0); }
  16%{ transform:translate3d(-5px,0,0); }  33%{ transform:translate3d(5px,0,0); }
  50%{ transform:translate3d(-4px,0,0); }  66%{ transform:translate3d(4px,0,0); }
  83%{ transform:translate3d(-2px,0,0); }
}
.cine-shakeX.hard{ animation-duration:.34s; }
.cine-pulse{ animation:cinePulse .22s cubic-bezier(.2,2,.4,1) both; }
/* W14 - the result-tile beat. The M19 tally no longer counts up from zero: the number
   is written at its final value when the grid reveals and this is what lands it. 250 ms,
   a touch more overshoot than cinePulse so a static number still reads as an arrival. */
.cine-statpop{ animation:cineStatPop .25s cubic-bezier(.2,2.2,.35,1) both; }
@keyframes cineStatPop{
  0%{ transform:scale(.72); } 60%{ transform:scale(1.12); } 100%{ transform:scale(1); }
}
@media (prefers-reduced-motion:reduce){ .cine-statpop{ animation:none; } }
@keyframes cinePulse{
  0%{ transform:scale(1); } 55%{ transform:scale(1.14); } 100%{ transform:scale(1); }
}
/* M16 — the card flip. Host must set `perspective` on the flipping card's
   PARENT (index.html: #lineupBar{perspective:420px}) or this reads as a squash. */
.cine-flip{
  animation:cineFlip .42s cubic-bezier(.25,1.4,.45,1) both;
  transform-style:preserve-3d; backface-visibility:hidden;
}
@keyframes cineFlip{ from{ transform:rotateY(0deg); } to{ transform:rotateY(360deg); } }
.cine-ring{ animation:cineRing .38s ease-out both; }
@keyframes cineRing{
  0%  { box-shadow:0 0 0 0 rgba(255,210,63,0); }
  45% { box-shadow:0 0 0 8px rgba(255,210,63,.55); }
  100%{ box-shadow:0 0 0 0 rgba(255,210,63,0); }
}

/* --------------------------------------------------------------------------
   HEAD-TO-HEAD RESULT PANEL  (RR-VISUAL-BIBLE section 6)
   Clash only: the rival's panel (red) stacked ABOVE yours (blue) with MATCHED
   rows, the trophies delta + band on the strip between them. The winner's panel
   takes the gold ribbon treatment, the loser's is desaturated. Endless / co-op
   never build this block, so #overH2H stays :empty and collapses; 4-Player
   swaps the two panels for a compact 4-row standings list (.h2hStand).
   Every row is an ordinary tally tile: cinematics.js counts its <b> up.
   -------------------------------------------------------------------------- */
.h2hWrap{ display:flex; flex-direction:column; align-items:stretch; gap:4px;
  width:min(330px,82vw); margin:0 auto; }
.h2hPanel{ position:relative; border:2.5px solid var(--h2h,#4980D5); border-radius:12px;
  background:linear-gradient(180deg, rgba(29,23,54,.96), rgba(20,15,40,.96));
  box-shadow:inset 0 0 0 2px rgba(0,0,0,.45), 0 3px 0 rgba(0,0,0,.35);
  padding:0 0 4px; overflow:hidden; }
.h2hHead{ display:flex; align-items:center; justify-content:space-between; gap:6px;
  padding:2px 8px 3px; background:var(--h2h,#4980D5);
  box-shadow:inset 0 -2px 0 rgba(0,0,0,.35); }
.h2hName{ font-family:var(--cine-font); font-size:15px; letter-spacing:1.4px; line-height:1.15;
  color:#fff8e7; text-shadow:0 2px 0 rgba(0,0,0,.45); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.h2hFlag{ font-family:var(--cine-font); font-size:11px; letter-spacing:1.2px; line-height:1;
  color:#2a1a06; background:linear-gradient(180deg,#ffd23f,#f0a020);
  border:2px solid #120d28; border-radius:999px; padding:1px 8px 0; flex:0 0 auto; }
.h2hRows{ display:block; padding:3px 8px 0; }
.h2hRow{ display:flex; align-items:baseline; gap:8px; padding:1.5px 0; }
.h2hRow + .h2hRow{ border-top:1px solid rgba(255,255,255,.07); }
.h2hLab{ flex:1 1 auto; min-width:0; font-size:10px; font-weight:800; letter-spacing:.7px;
  text-transform:uppercase; color:#9d92bd; line-height:1.25; text-align:left;
  overflow:hidden; text-overflow:ellipsis; }
.h2hCap{ display:block; font-style:normal; font-size:9px; font-weight:800; letter-spacing:.6px;
  color:#6f6798; line-height:1.1; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.h2hRow > b{ flex:0 0 auto; font-family:var(--cine-font); font-size:17px; letter-spacing:1px;
  line-height:1.05; color:#fff8e7; text-shadow:0 2px 0 rgba(0,0,0,.4); text-align:right;
  font-variant-numeric:tabular-nums; }
/* WINNER: gold trim + gold numbers, the same vocabulary as the victory ribbon - but only
   when the winner is YOU. On a defeat the winning panel is ROBO-RIVAL's, and an 18px gold
   glow there made the opponent's box the most celebratory object on the player's loss
   screen. A rival win keeps the WINNER ribbon and a plain neutral border. */
.h2hPanel.win.you{ box-shadow:inset 0 0 0 2px #ffd23f, inset 0 0 0 4px #120d28,
  0 0 18px rgba(255,210,63,.28), 0 3px 0 rgba(0,0,0,.35); }
.h2hPanel.win.you .h2hRow > b{ color:#ffd23f; }
.h2hPanel.win.you .h2hLab{ color:#c3b489; }
.h2hPanel.win:not(.you){ box-shadow:inset 0 0 0 2px #6f6798, inset 0 0 0 4px #120d28,
  0 3px 0 rgba(0,0,0,.35); }
/* LOSER: desaturated, never deleted - the numbers stay perfectly readable. Only YOUR
   panel is dimmed; desaturating the rival's losing panel on a WIN would flatten the
   comparison the card exists to make. */
.h2hPanel.lose.you{ filter:saturate(.5) brightness(.88); opacity:.92; }

/* ---- per-row comparison (RR's signature result beat) ---------------------------
   The two panels sit ~110px apart, so nothing on a row said who led it and a player who
   had just WON could read a card where they were behind on three of four lines. Each row
   now marks itself: the leading value golds and grows a caret, the trailing one greys.
   Both value columns are right-aligned to the same edge so the eye can scan vertically. */
.h2hRow > b{ min-width:74px; text-align:right; }
/* GOLD is reserved for the player's own leads. A rival row that led still gets the caret
   and full-strength paper white, so the comparison is intact - it just does not get the
   game's celebration colour on the player's defeat screen. */
.h2hPanel.you .h2hRow.better > b{ color:#ffd23f; }
.h2hPanel:not(.you) .h2hRow.better > b{ color:#fff8e7; }
.h2hRow.better > b::after{ content:'\25B2'; font-size:9px; margin-left:5px;
  vertical-align:2px; text-shadow:none; }
.h2hRow.worse > b{ color:#9d92bd; }
.h2hPanel.win.you .h2hRow.worse > b{ color:#9d92bd; }

/* the strip between the panels: trophies delta + band */
.h2hMid{ display:flex; align-items:center; justify-content:center; gap:6px;
  padding:1px 0; min-height:20px; }
.h2hMid .ci{ width:16px; height:16px; flex:0 0 16px; }
.h2hMid b{ font-family:var(--cine-font); font-size:17px; letter-spacing:1px; line-height:1;
  color:var(--h2h,#cfd6e6); text-shadow:0 2px 0 rgba(0,0,0,.4); }
.h2hMid.up b{ color:#9be15d; }
.h2hMid.down b{ color:#ff8787; }
.h2hMid i{ font-style:normal; font-size:10px; font-weight:800; letter-spacing:.8px;
  text-transform:uppercase; color:#9d92bd; }

/* 4-PLAYER standings: one compact row per side - place, name, KOs. */
.h2hStand{ display:flex; flex-direction:column; gap:3px; width:min(330px,82vw); margin:0 auto; }
.h2hPlace{ align-items:center; border:2px solid var(--h2h,#4980D5); border-radius:9px;
  background:rgba(29,23,54,.94); padding:2px 9px; box-shadow:0 2px 0 rgba(0,0,0,.32); }
.h2hPlace .h2hLab{ color:#cfc7ee; font-size:11px; }
.h2hPlace > b{ font-size:15px; }
.h2hPos{ flex:0 0 auto; font-family:var(--cine-font); font-size:14px; letter-spacing:.5px;
  line-height:1; color:#120d28; background:var(--h2h,#4980D5); border:2px solid #120d28;
  border-radius:999px; min-width:22px; text-align:center; padding:2px 4px 1px; }
.h2hPlace.you{ box-shadow:inset 0 0 0 2px rgba(255,210,63,.5), 0 2px 0 rgba(0,0,0,.32); }
.h2hPlace.you > b{ color:#ffd23f; }

/* Very short phones: shave the row rhythm, never the numbers. */
@media (max-height:700px){
  .h2hWrap,.h2hStand{ gap:3px; }
  .h2hPanel{ padding-bottom:2px; }
  .h2hRows{ padding:1px 7px 0; }
  .h2hRow{ padding:0; }
  .h2hRow > b{ font-size:14px; }
  .h2hLab{ font-size:9.5px; line-height:1.2; }
  .h2hName{ font-size:13px; }
  .h2hFlag{ font-size:9.5px; padding:1px 6px 0; }
  .h2hHead{ padding:1px 7px 2px; }
  .h2hCap{ display:none; }
  .h2hMid{ min-height:16px; }
  .h2hMid b{ font-size:14px; }
  .h2hMid i{ font-size:9px; }
  .h2hMid .ci{ width:14px; height:14px; flex:0 0 14px; }
  .h2hStand{ gap:2px; }
  .h2hPlace{ padding:0 8px; }
  .h2hPlace .h2hLab{ font-size:10px; }
  .h2hPlace > b{ font-size:13.5px; }
  .h2hPos{ font-size:12px; min-width:19px; padding:1px 4px 0; }
}

/* --------------------------------------------------------------------------
   REDUCED MOTION
   JS already swaps every timeline for its crossfade variant; this block is the
   belt-and-braces half so a stray CSS keyframe can never sneak past. Holds are
   NOT shortened anywhere — read time is accessibility, not decoration.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  .cine-squash, .cine-shakeX, .cine-flip{ animation:none !important; }
  .cine-pulse{ animation-duration:.2s !important; }
  .cinePanel{ will-change:auto; }
}
/* html.cine-reduce is set by index.html's applyReducedMotion() for the ?motion=reduce
   override, the OS preference AND the in-game REDUCED MOTION switch. */
html.cine-reduce .cine-squash,
html.cine-reduce .cine-shakeX,
html.cine-reduce .cine-flip{ animation:none !important; }
html.cine-reduce .cine-pulse{ animation-duration:.2s !important; }
html.cine-reduce .cinePanel{ will-change:auto; }
