/* Full-screen layers that sit on top of everything: the result card, the tuner
   panel, the loading screen, and the cinematic letterbox. */

/* ---------- result ---------- */
#result{
  position:fixed;inset:0;z-index:30;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:6px;background:radial-gradient(60% 60% at 50% 45%,rgba(16,14,12,.55),rgba(16,14,12,.93));
  text-align:center;opacity:0;pointer-events:none;transition:opacity .5s ease;overflow:hidden;
}
#result.show{opacity:1;pointer-events:auto}
/* Overrides the `display:flex` two lines up the same way .big-btn[hidden]
   overrides that class's own `display:flex` in styles/menu.css — an id
   selector's `display` beats the UA [hidden] rule on specificity alone, so
   anything given the attribute needs this restated. src/ui/menu.js is the one
   place that sets it; see the note on #result in index.html. */
#result[hidden]{display:none}
/* A slow bar of light crawls behind the verdict the whole time it is up. */
#result::before{
  content:"";position:absolute;top:0;bottom:0;width:55vw;left:-70vw;
  background:linear-gradient(90deg,transparent,rgba(242,179,61,.10),transparent);
  transform:skewX(-18deg);
}
#result.show::before{animation:resSweep 3.6s ease-in-out .35s infinite}
@keyframes resSweep{0%{left:-70vw}60%,100%{left:130vw}}
#resMethod{
  font-family:var(--display);font-size:clamp(70px,16vw,210px);line-height:.85;text-transform:uppercase;
  position:relative;-webkit-text-stroke:2px #000;
  text-shadow:0 5px 0 #000, 0 0 60px rgba(242,179,61,.35);
}
#result.show #resMethod{animation:resSlam .8s cubic-bezier(.16,1.05,.3,1) both}
@keyframes resSlam{
  0%{opacity:0;transform:scale(3.4) rotate(-8deg);filter:blur(10px)}
  58%{opacity:1;transform:scale(.94) rotate(0);filter:blur(0)}
  74%{transform:scale(1.05)}
  100%{opacity:1;transform:scale(1)}
}
#resWinner{
  font-family:var(--display);font-size:clamp(28px,5.2vw,60px);line-height:1;text-transform:uppercase;
  color:var(--bone);letter-spacing:.04em;position:relative;
}
#result.show #resWinner{animation:resWipe .55s cubic-bezier(.2,.8,.25,1) both .42s}
@keyframes resWipe{
  0%{opacity:0;transform:translateX(-14vw) skewX(-16deg)}
  100%{opacity:1;transform:none}
}
#resDetail{font-size:15px;color:#b0a493;max-width:46ch;line-height:1.7;margin-top:10px;position:relative}
#result.show #resDetail{animation:footUp .5s ease-out both .72s}
.resBtns{display:flex;gap:14px;margin-top:34px;position:relative}
#result.show .resBtns{animation:footUp .5s ease-out both .9s}
.resBtns button{
  font-family:var(--display);font-size:22px;letter-spacing:.06em;text-transform:uppercase;
  padding:12px 30px;border:1px solid #4a4137;border-radius:2px;color:var(--bone);background:#1d1814;
  transition:transform .1s,border-color .12s,background-color .12s,color .12s;
}
.resBtns button:hover{border-color:var(--bone);transform:translateY(-3px)}
.resBtns button:active{transform:translateY(1px)}
.resBtns button.primary{background:var(--bone);color:var(--dark);border-color:var(--bone)}
.resBtns button.primary:hover{background:var(--amber);border-color:var(--amber)}
/* Two ways out, and which one you get depends on where the fight came from.
   CHANGE KIT is the two-player locker room; on the ladder it would land on the
   card, which is where CONTINUE already goes and which now carries its own kit
   picker — two buttons to one screen reads as a mistake. */
#continueBtn{display:none}
#result.campaign #continueBtn{display:block}
#result.campaign #kitBtn{display:none}
/* And the way back into the fight. Down unless the bout kept clips worth
   playing — see `reel` in src/game/match.js — because a button that offers a
   highlights reel of nothing is worse than no button. Tinted amber rather than
   bone so it reads as the one thing here that is not a way out of the card. */
#reelBtn{display:none;border-color:#6a5a34;color:var(--amber)}
#reelBtn:hover{border-color:var(--amber)}
#result.reel #reelBtn{display:block}

/* ---------- tuner ---------- */
#tuner{
  position:fixed;top:0;right:0;bottom:0;width:250px;z-index:40;overflow-y:auto;
  background:rgba(12,10,9,.94);border-left:1px solid #2c261f;padding:12px 14px 40px;
  transform:translateX(100%);transition:transform .22s ease;font-size:11.5px;
}
#tuner.open{transform:none}
#tuner h3{margin:0 0 4px;font-family:var(--display);font-size:20px;text-transform:uppercase;letter-spacing:.03em}
#tuner p{margin:0 0 12px;color:#8b7f6f;line-height:1.5}
.tr{margin-bottom:9px}
.tr label{display:flex;justify-content:space-between;color:#b6a998;margin-bottom:3px}
.tr label i{font-style:normal;color:var(--amber)}
.tr input{width:100%;accent-color:var(--amber)}

/* ---------- loading screen ---------- */
#boot{
  position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;
  background:radial-gradient(120% 90% at 50% 40%,#2a1f18 0%,#0d0b09 62%),var(--dark);
  text-align:center;padding:24px;overflow:hidden;
  transition:opacity .5s ease;
}
/* Scanlines and a slow rolling band: the CRT the game wishes it was on. */
#boot::before{
  content:"";position:absolute;inset:0;pointer-events:none;
  background:repeating-linear-gradient(180deg,rgba(0,0,0,.36) 0 1px,transparent 1px 3px);
  mix-blend-mode:multiply;
}
#boot::after{
  content:"";position:absolute;left:0;right:0;height:22%;pointer-events:none;
  background:linear-gradient(180deg,transparent,rgba(255,255,255,.045),transparent);
  animation:crtRoll 5.5s linear infinite;
}
@keyframes crtRoll{0%{top:-25%}100%{top:105%}}
/* Chromatic split done in text-shadow: two offset ghosts either side of the
   word, red and blue, pulsing with the glow. Cheaper and less fragile than
   stacking pseudo-elements behind a painted background. */
#boot h1{
  font-family:var(--display);font-size:clamp(52px,13vw,120px);margin:0;
  text-transform:uppercase;letter-spacing:.02em;position:relative;
  animation:bootTitle 2.6s ease-in-out infinite;
}
@keyframes bootTitle{
  0%,100%{text-shadow:-3px 1px 0 rgba(180,39,31,.75), 3px -1px 0 rgba(46,94,142,.75), 0 3px 0 #000, 0 0 26px rgba(242,179,61,.18)}
  50%{text-shadow:-5px 2px 0 rgba(180,39,31,.85), 5px -2px 0 rgba(46,94,142,.85), 0 3px 0 #000, 0 0 58px rgba(242,179,61,.5)}
}
#boot p{margin:0;color:#a2957f;font-size:13px;max-width:52ch;line-height:1.7;position:relative}
#boot code{background:#1d1814;border:1px solid #322b24;border-radius:2px;padding:2px 6px;color:var(--bone)}
#boot.gone{opacity:0;pointer-events:none}
#boot.dead{display:none}
/* A loading bar that fills on a loop — it reports nothing, it just makes the
   wait feel like a wait in an arcade rather than a hang. */
#bootBar{
  position:relative;width:min(340px,70vw);height:9px;background:#1b1713;border:1px solid #4a4137;
  transform:skewX(-20deg);overflow:hidden;
}
#bootBar i{
  position:absolute;inset:0;transform-origin:left center;
  background:linear-gradient(90deg,var(--red),var(--amber));
  animation:bootFill 1.5s cubic-bezier(.5,0,.5,1) infinite;
}
@keyframes bootFill{0%{transform:scaleX(0)}70%{transform:scaleX(1)}100%{transform:scaleX(1);opacity:.2}}
#bootTag{
  font-family:var(--display);font-size:15px;letter-spacing:.28em;text-transform:uppercase;color:var(--amber);
  animation:stamFlash .9s steps(2,end) infinite;position:relative;
}

/* ---------- opening cinematic ---------- */
#cine{
  position:fixed;inset:0;z-index:45;pointer-events:none;opacity:0;transition:opacity .4s ease;
}
#cine.on{opacity:1}
#cine .bar{position:absolute;left:0;right:0;height:11vh;background:#000}
#cine .bar.t{top:0}
#cine .bar.b{bottom:0}
#cineSkip{
  position:absolute;right:18px;bottom:calc(11vh + 14px);font-size:11px;letter-spacing:.16em;
  text-transform:uppercase;color:#8b7f6f;animation:stamFlash 1.6s steps(2,end) infinite;
}
#cineName{
  position:absolute;left:0;right:0;bottom:calc(11vh + 40px);text-align:center;
  font-family:var(--display);font-size:clamp(18px,3vw,34px);letter-spacing:.22em;
  text-transform:uppercase;color:#c9bda9;text-shadow:0 3px 0 rgba(0,0,0,.8);opacity:0;
}
#cineName.on{animation:cineName 2.2s ease-out forwards}
@keyframes cineName{
  0%{opacity:0;letter-spacing:.6em}
  25%{opacity:1;letter-spacing:.22em}
  75%{opacity:1}
  100%{opacity:0}
}

/* ---------- the purse ---------- */
/* The earnings breakdown inside the result card. Campaign only: a two-player
   bout pays nobody, so it gets the plain verdict it has always had, and which
   one you see is the same `campaign` class that picks the buttons.

   It sits between the detail line and the buttons, which is where the eye
   already is by the time the numbers start landing — the card reads method,
   winner, what happened, what it paid, what now. */
#purse{display:none}
#result.campaign #purse{
  display:flex;flex-direction:column;align-items:center;gap:2px;
  margin-top:clamp(10px,2vh,20px);position:relative;
  min-width:min(340px,80vw);
}
#result.show.campaign #purse{animation:footUp .5s ease-out both .78s}
.purse-kicker{
  margin:0 0 6px;font-size:10px;letter-spacing:.34em;text-transform:uppercase;
  color:var(--amber);opacity:.7;
}
#purseLines{display:flex;flex-direction:column;gap:1px;width:100%}

/* One row per line of the breakdown, built by src/ui/purse.js. The label runs
   left, the figure runs right, and a leader rule joins them so a short label
   and a long one still read as the same row — the trick a bill of costs has
   used since before any of this was on a screen. */
.purse-line{
  display:flex;align-items:baseline;gap:8px;width:100%;
  font-size:12.5px;letter-spacing:.06em;
  /* Hidden until its turn. The reveal is one line at a time and the numbers
     tick up as each lands, so a row that arrived early would give the total
     away before the count got to it. */
  opacity:0;transform:translateY(6px);
}
.purse-line.in{animation:purseLineIn .32s cubic-bezier(.2,1.05,.32,1) forwards}
@keyframes purseLineIn{
  0%{opacity:0;transform:translateY(6px)}
  100%{opacity:1;transform:none}
}
.purse-line .pl-label{color:rgba(232,225,211,.72);white-space:nowrap}
.purse-line .pl-rule{
  flex:1 1 auto;height:1px;background:rgba(232,225,211,.14);transform:translateY(-3px);
}
.purse-line .pl-amt{
  font-family:var(--display);font-size:17px;letter-spacing:.04em;
  font-style:normal;white-space:nowrap;
}
.purse-line.up .pl-amt{color:var(--coin-up)}
.purse-line.down .pl-amt{color:var(--coin-down)}
/* A deduction gets a shove as it lands as well as a colour. Losing money should
   not arrive on the same beat as earning it. */
.purse-line.down.in{animation:purseLineDown .34s cubic-bezier(.36,.07,.19,.97) forwards}
@keyframes purseLineDown{
  0%{opacity:0;transform:translate(7px,6px)}
  60%{opacity:1;transform:translate(-3px,0)}
  100%{opacity:1;transform:none}
}

/* The running total, which is counting the whole time the lines are landing. */
.purse-total{
  margin:8px 0 0;display:flex;align-items:center;gap:8px;width:100%;
  justify-content:flex-end;
  padding-top:7px;border-top:1px solid rgba(232,225,211,.20);
  font-family:var(--display);font-size:clamp(24px,3.6vw,34px);letter-spacing:.05em;
  color:var(--coin);
}
.purse-total-lbl{
  margin-right:auto;font-family:var(--ui);font-size:10px;letter-spacing:.28em;
  text-transform:uppercase;color:rgba(232,225,211,.45);
}
.purse-total .coin{width:14px;height:14px}
.purse-total i{font-style:normal}
/* A kick on the frame the last line lands, so the total is the thing that ends
   the sequence rather than just the thing at the bottom of it. */
.purse-total.bump{animation:pursePop .42s cubic-bezier(.2,1.3,.4,1)}
@keyframes pursePop{
  0%{transform:scale(1)}
  34%{transform:scale(1.13)}
  100%{transform:scale(1)}
}
.purse-bank{
  margin:5px 0 0;display:flex;align-items:center;gap:6px;
  font-size:10.5px;letter-spacing:.2em;text-transform:uppercase;
  color:rgba(232,225,211,.42);
}
.purse-bank .coin{width:8px;height:8px}
.purse-bank i{font-style:normal;color:rgba(232,225,211,.68)}
