/* Robot Fight — fight presentation (js/shell/fight-presentation.js): tale of the tape, round break,
   knockdown count, hit / combo pop-ups, plus HUD polish for the round timer and FIGHT / KO calls.
   Same periwinkle ui2027 look as css/fighter-select.css and css/ui-polish.css. */

/* ---------- shared ---------- */
.fp-tape, .fp-break {
  position: fixed; inset: 0; z-index: 16; display: grid; pointer-events: none; opacity: 0;
  font-family: var(--ww-font); color: var(--ww-text); transition: opacity .3s var(--ww-ease);
}
.fp-tape.on, .fp-break.on { opacity: 1; pointer-events: auto; cursor: pointer; }
body.rfs-dimmed .fp-tape, body.rfs-dimmed .fp-break, body.rfs-dimmed .fp-count, body.rfs-dimmed .fp-pops { opacity: 0 !important; pointer-events: none !important; }
.fp-tcard, .fp-bcard {
  background: var(--rf-panel, rgba(22,18,59,.88)); border: 1px solid rgba(92,200,255,.22); border-radius: 18px;
  box-shadow: var(--rf-glow, 0 18px 50px #000a); backdrop-filter: blur(14px) saturate(1.3);
}
.fp-tcard header small, .fp-bhead small, .fp-tside small {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: var(--ww-accent);
}
.fp-tcard header b, .fp-bhead b {
  display: block; margin-top: 4px; font-size: clamp(20px, 2.3vw, 30px); font-weight: 900; font-style: italic; letter-spacing: .1em; text-transform: uppercase;
  background: var(--rf-head, linear-gradient(180deg, #fff 30%, #c8e6ff)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fp-sw { display: inline-block; width: 18px; height: 18px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); box-shadow: 0 0 0 2px rgba(255,255,255,.18); }
.fp-tape kbd, .fp-break kbd { font: 700 10px/1 var(--ww-font); padding: 3px 6px; border-radius: 5px; border: 1px solid rgba(92,200,255,.35); background: rgba(92,200,255,.1); color: #fff; }

/* ---------- tale of the tape ---------- */
body.fp-tape-on #top, body.fp-tape-on #bottom, body.fp-tape-on .rfs-call { opacity: 0 !important; transition: none !important; }
.fp-tape { place-items: end center; padding-bottom: clamp(18px, 4vh, 40px);
  background: linear-gradient(180deg, rgba(0,0,0,.5), transparent 16%, transparent 58%, rgba(10,6,30,.72)); }
.fp-tcard { width: min(760px, 92vw); padding: 16px 22px 12px; text-align: center; transform: translateY(24px); transition: transform .45s var(--ww-ease); }
.fp-tape.on .fp-tcard { transform: none; }
.fp-tgrid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin: 8px 0 6px; }
.fp-tside { padding: 8px 12px; border-radius: 12px; border: 1px solid transparent; transition: background .3s, border-color .3s, box-shadow .3s; }
.fp-tside.p1 { text-align: left; } .fp-tside.p2 { text-align: right; }
.fp-tside.p1 small { color: #8fb0ff; } .fp-tside.p2 small { color: #ff9a9a; }
.fp-tside b { display: block; margin-top: 3px; font-size: clamp(18px, 2vw, 26px); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.fp-tcol { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ww-text-2); }
.fp-tside.hot.p1 { background: rgba(63,125,255,.14); border-color: rgba(63,125,255,.5); box-shadow: 0 0 22px rgba(63,125,255,.25); }
.fp-tside.hot.p2 { background: rgba(255,64,64,.12); border-color: rgba(255,64,64,.5); box-shadow: 0 0 22px rgba(255,64,64,.22); }
.fp-tvs { font-size: 34px; font-weight: 900; font-style: italic; color: transparent;
  background: linear-gradient(90deg, var(--rf-p1, #3f7dff), var(--rf-p2, #ff4040)); -webkit-background-clip: text; background-clip: text; }
.fp-trows { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fp-trows td, .fp-trows th { padding: 3px 10px; border-top: 1px solid rgba(255,255,255,.07); }
.fp-trows td { width: 40%; font-size: 15px; font-weight: 800; }
.fp-trows td:first-child { text-align: left; color: #cfe0ff; } .fp-trows td:last-child { text-align: right; color: #ffd6d6; }
.fp-trows th { font-size: 10px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: var(--ww-text-2); }
.fp-tcard footer, .fp-bcard footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; font-size: 11px; color: var(--ww-text-2); letter-spacing: .06em; }
.fp-tbar { position: relative; flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.fp-tbar > i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--rf-p1, #3f7dff), var(--ww-accent), var(--rf-p2, #ff4040)); }

/* ---------- round break ---------- */
body.fp-break-on .rfs-call { opacity: 0 !important; transition: none !important; }
.fp-break { place-items: center; background: radial-gradient(ellipse at center, rgba(11,8,36,.55), rgba(10,6,30,.82)); }
.fp-bcard { width: min(820px, 94vw); padding: 18px 22px 14px; transform: scale(.96); transition: transform .4s var(--ww-ease); }
.fp-break.on .fp-bcard { transform: none; }
.fp-bhead { text-align: center; }
.fp-bgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.fp-bside { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); }
.fp-bside.p1 { box-shadow: inset 3px 0 0 var(--rf-p1, #3f7dff); } .fp-bside.p2 { box-shadow: inset -3px 0 0 var(--rf-p2, #ff4040); }
.fp-bside.won { border-color: rgba(92,200,255,.4); background: rgba(92,200,255,.07); }
.fp-bside > header { display: flex; align-items: center; gap: 9px; }
.fp-bside > header b { font-size: 16px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.fp-bpips { margin-left: auto; display: flex; gap: 5px; }
.fp-bpips i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(92,200,255,.6); background: rgba(15,12,42,.6); }
.fp-bpips i.won { background: #fff; box-shadow: 0 0 10px rgba(92,200,255,.9); }
.fp-bbody { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin-top: 10px; }
.fp-map { width: clamp(76px, 9vw, 104px); height: auto; filter: drop-shadow(0 6px 14px #000a); }
.fp-pt { fill: var(--c); stroke: rgba(255,255,255,.35); stroke-width: 1; }
.fp-pt.lost { fill: #1d1949; stroke: rgba(255,90,90,.75); stroke-dasharray: 3 2; }
.fp-pt.na { fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.12); }
.fp-stats { display: grid; gap: 4px; margin: 0; font-variant-numeric: tabular-nums; }
.fp-stats div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.fp-stats dt { font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--ww-text-2); }
.fp-stats dd { margin: 0; font-size: 14px; font-weight: 800; }
.fp-bcard footer b { color: #fff; font-variant-numeric: tabular-nums; }

/* ---------- knockdown count ---------- */
.fp-count {
  position: fixed; left: 50%; top: clamp(150px, 26vh, 250px); z-index: 15; transform: translate(-50%, 0); pointer-events: none;
  display: flex; flex-direction: column; align-items: center; opacity: 0; transition: opacity .2s; font-family: var(--ww-font);
}
.fp-count.on { opacity: 1; }
/* Off to the downed robot's side of the screen, clear of the fighters (it sat over the
   downed robot's head and torso in the centre). */
.fp-count.p1 { left: clamp(16px, 5vw, 80px); transform: none; align-items: flex-start; }
.fp-count.p2 { left: auto; right: clamp(16px, 5vw, 80px); transform: none; align-items: flex-end; }
.fp-count.p1, .fp-count.p2 { top: clamp(110px, 20vh, 190px); }
.fp-count.p1 b, .fp-count.p2 b { font-size: clamp(48px, 6vw, 78px); }
.fp-count small { font-size: 12px; font-weight: 800; letter-spacing: .34em; text-transform: uppercase; color: #fff; padding: 4px 12px; border-radius: 999px; background: rgba(15,12,48,.72); border: 1px solid rgba(92,200,255,.35); }
.fp-count.p1 small { border-color: rgba(63,125,255,.7); } .fp-count.p2 small { border-color: rgba(255,64,64,.7); }
.fp-count b {
  font-size: clamp(64px, 9vw, 110px); line-height: 1; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; margin-top: 4px;
  background: linear-gradient(180deg, #fff 35%, #ffd27a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(255,200,110,.5)) drop-shadow(0 6px 16px #000); animation: fp-tick .45s var(--ww-ease) both;
}
@keyframes fp-tick { from { transform: scale(1.6); opacity: 0; } }

/* ---------- hit / combo pop-ups ---------- */
.fp-pops { position: fixed; inset: 0; z-index: 14; pointer-events: none; font-family: var(--ww-font); }
.fp-pop { position: absolute; top: clamp(96px, 15vh, 150px); display: flex; flex-direction: column; animation: fp-pop 1.1s var(--ww-ease) both; }
.fp-pop.p1 { left: clamp(20px, 6vw, 90px); align-items: flex-start; }
.fp-pop.p2 { right: clamp(20px, 6vw, 90px); align-items: flex-end; }
.fp-pop b { font-size: clamp(18px, 2vw, 26px); font-weight: 900; font-style: italic; letter-spacing: .1em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 10px #000; }
.fp-pop.p1 b { text-shadow: 0 0 18px rgba(63,125,255,.8), 0 2px 10px #000; }
.fp-pop.p2 b { text-shadow: 0 0 18px rgba(255,64,64,.8), 0 2px 10px #000; }
.fp-pop.combo b { font-size: clamp(24px, 2.8vw, 36px); background: linear-gradient(180deg, #fff 35%, #ffe08a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 10px #000); text-shadow: none; }
.fp-pop.blk b { font-size: 15px; color: var(--ww-accent); }
.fp-pop span { font-size: 13px; font-weight: 800; color: #ffb4b4; text-shadow: 0 2px 8px #000; font-variant-numeric: tabular-nums; }
@keyframes fp-pop { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* ---------- HUD polish: round timer + FIGHT / KO calls above the robots ---------- */
body.rfs-on .rfs-timer {
  display: grid; place-items: center; min-width: 64px; min-height: 40px; margin: 4px auto 0; padding: 2px 12px;
  font-size: 30px; border-radius: 10px; background: linear-gradient(180deg, rgba(29,26,82,.85), rgba(17,13,48,.9));
  border: 1px solid rgba(92,200,255,.3); box-shadow: 0 6px 18px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.08);
}
body.rfs-on .rfs-timer:empty { display: none; }
.rfs-timer.low { color: #ffb4b4; border-color: rgba(255,90,90,.6); box-shadow: 0 0 18px rgba(255,64,64,.35), inset 0 1px 0 rgba(255,255,255,.08); }
.rfs-call { z-index: 15; top: clamp(70px, 11vh, 120px); }
.rfs-call.fight b, .rfs-call.ko b { animation: fp-title .7s var(--ww-ease) both; }
@keyframes fp-title { 0% { transform: scale(2.2); opacity: 0; letter-spacing: .5em; } 55% { transform: scale(.94); opacity: 1; } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .fp-tcard, .fp-bcard, .fp-count b, .fp-pop, .rfs-call.fight b, .rfs-call.ko b { animation: none !important; transition: none !important; }
}

/* ---------- per-fighter profiles on the tape ---------- */
.fp-tstyle { display: inline-block; margin: 4px 0 0; padding: 2px 9px; border-radius: 99px; font: 800 normal 10px/1.5 var(--ww-font); letter-spacing: .24em; color: #fff; }
.fp-tside.p1 .fp-tstyle { background: rgba(63,125,255,.28); border: 1px solid rgba(63,125,255,.7); }
.fp-tside.p2 .fp-tstyle { background: rgba(255,64,64,.24); border: 1px solid rgba(255,64,64,.7); }
.fp-tside .fp-tcol { display: flex; }
.fp-tside.p2 .fp-tcol { justify-content: flex-end; }
.fp-ttraits { margin-top: 6px; display: grid; gap: 2px; font-size: 11.5px; line-height: 1.35; color: var(--ww-text); }
.fp-ttraits p { margin: 0; }
.fp-ttraits b { font-size: 9.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; margin-right: 4px; }
.fp-ttraits .up b { color: #5be38a; } .fp-ttraits .down b { color: #ff7a6e; }
.fp-trows td.hi { color: #fff; text-shadow: 0 0 14px rgba(92,200,255,.6); }
.fp-trows td.hi::after, .fp-trows td.hi::before { color: #5be38a; font-size: 10px; }
.fp-trows td:first-child.hi::after { content: ' ▲'; }
.fp-trows td:last-child.hi::before { content: '▲ '; }
