/* ═══════════════════════════════════════════════════════════
   THE FIGHT SCREEN (combat-design lane U; js/fight-screen.js)
   Jake's approved design: V7 on the Opps Fight Screen canvas.
   The role colours are the Opps design system's (SPRAY blaze orange, FLANK
   azure, DUCK smoke lilac): ink and a 1px edge only, never a fill, and
   always with the role's icon and word. The tokens live in css/00-base.css;
   outside the fight they colour only the role icon beside a weapon's label.
   ═══════════════════════════════════════════════════════════ */

.fs {
  --fs-controls: 144px;   /* the buttons' block: the scene runs to its top edge, as V7 does */
}
.fs-spray { --role: var(--spray); --role-edge: var(--spray-edge); }
.fs-flank { --role: var(--flank); --role-edge: var(--flank-edge); }
.fs-duck  { --role: var(--duck);  --role-edge: var(--duck-edge); }

/* Full screen, not a modal: the overlay IS the screen while you fight. */
.overlay.fs {
  background: var(--bg); backdrop-filter: none;
  flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: 14px; overflow: hidden;
  padding: 16px 18px calc(22px + env(safe-area-inset-bottom, 0px));
}
.fs [hidden] { display: none !important; }
.fs > *:not(.fs-scene):not(.fs-scrim) { position: relative; z-index: 1; }
.fs-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── the scene ── */
.fs-scene { position: absolute; left: 0; right: 0; top: 0; bottom: var(--fs-controls); overflow: hidden; }
.fs-scene > svg { display: block; width: 100%; height: 100%; }
.fs-fade { position: absolute; left: 0; right: 0; pointer-events: none; }
.fs-fade.top { top: 0; height: 200px; background: linear-gradient(180deg, var(--bg) 20%, rgba(11,11,12,0)); }
.fs-fade.bottom { bottom: 0; height: 130px; background: linear-gradient(0deg, var(--bg) 8%, rgba(11,11,12,0)); }

.fs .st-a { stop-color: #0b0b0c; } .fs .st-b { stop-color: #121218; } .fs .st-c { stop-color: #1b1b21; }
.fs .st-clear { stop-color: #0b0b0c; stop-opacity: 0; }
.fs .st-pool { stop-color: #2e2e38; stop-opacity: .9; } .fs .st-lamp { stop-color: #d8d6d0; stop-opacity: .07; }
.fs .st-vig { stop-color: #08080a; stop-opacity: .85; }
.fs .sc-kerb { stroke: #26262e; stroke-width: 2; fill: none; }
.fs .sc-lane { stroke: #1f1f27; stroke-width: 3; fill: none; stroke-linecap: round; }
.fs .sc-pole { stroke: #1f1f27; stroke-width: 4; fill: none; }
.fs .sc-string { stroke: #33333d; stroke-width: 1.5; fill: none; }
.fs .sc-fold { stroke: #17171d; stroke-width: 2; fill: none; }
.fs .sc-seam { stroke: #141419; stroke-width: 2; fill: none; }
.fs .sc-rim-opp { stroke: var(--border-danger); stroke-width: 1.6; fill: none; stroke-linecap: round; }
.fs .sc-rim-you { stroke: var(--gold-deep); stroke-width: 2; fill: none; stroke-linecap: round; opacity: .75; }
.fs .sc-fig { transform-box: fill-box; transform-origin: 50% 100%; }

/* What each side did: SPRAY recoils and fires, FLANK steps wide, DUCK drops. */
.fs .shot { opacity: 0; }
.fs .shot path { stroke: var(--role); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.fs .shot.on { animation: fs-shot .45s ease-out .12s both; }
@keyframes fs-shot { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.fs .act-you-spray { animation: fs-rec-you .4s ease-out; }
@keyframes fs-rec-you { 30% { transform: translate(-6px, 6px); } }
.fs .act-you-flank { animation: fs-you-flank .7s ease-in-out; }
@keyframes fs-you-flank { 35%, 65% { transform: translateX(38px); } }
.fs .act-you-duck { animation: fs-you-duck .8s ease-in-out; }
@keyframes fs-you-duck { 30%, 70% { transform: translateY(54px); } }
.fs .act-opp-spray { animation: fs-rec-opp .4s ease-out; }
@keyframes fs-rec-opp { 30% { transform: translate(4px, -4px); } }
.fs .act-opp-flank { animation: fs-opp-flank .7s ease-in-out; }
@keyframes fs-opp-flank { 35%, 65% { transform: translateX(-34px); } }
.fs .act-opp-duck { animation: fs-opp-duck .8s ease-in-out; }
@keyframes fs-opp-duck { 30%, 70% { transform: translateY(22px) scaleY(.86); } }
/* whoever took damage is knocked back: no shake, no red flash */
.fs .hit-opp { animation: fs-hit-opp .5s ease-out .32s both; }
@keyframes fs-hit-opp { 30% { transform: translate(12px, -3px) rotate(5deg); } }
.fs .hit-you { animation: fs-hit-you .5s ease-out .32s both; }
@keyframes fs-hit-you { 30% { transform: translate(-12px, 10px); } }

/* damage floats off whoever was hit (SVG text, so it sits on the figure) */
.fs .fs-dmg { opacity: 0; font: 30px var(--display); letter-spacing: .5px; fill: var(--text); text-anchor: middle; }
.fs .fs-dmg.is-crit { font-size: 40px; }
.fs .fs-dmg.is-glance { font-size: 22px; fill: var(--text-mid); }
.fs .fs-dmg.is-you { fill: var(--danger); }
.fs .fs-dmg.is-you.is-glance { fill: var(--text-mid); }
.fs .fs-dmg.on { animation: fs-float 1.4s ease-out .36s both; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes fs-float {
  0% { opacity: 0; transform: translateY(10px) scale(.7); }
  14% { opacity: 1; transform: translateY(0) scale(1.12); }
  28% { transform: scale(1); }
  100% { opacity: 0; transform: translateY(-36px); }
}

/* the outcome lands on the road between you */
.fs-burst {
  position: absolute; left: 18px; right: 18px; top: 55%; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; opacity: 0;
}
.fs-burst.on { animation: fs-burst 1.6s cubic-bezier(.2,.9,.3,1.25) .3s both; }
.fs-burst-title { font: 46px/.95 var(--display); letter-spacing: 1px; text-transform: uppercase; color: var(--text-mid); }
.fs-burst.win .fs-burst-title { color: var(--success); }
.fs-burst.lose .fs-burst-title { color: var(--danger); }
.fs-burst-sub { font: 500 13px/1.35 var(--ui); color: var(--text-bright); max-width: 300px; }
@keyframes fs-burst {
  0% { opacity: 0; transform: scale(.55); }
  14% { opacity: 1; transform: scale(1.08); }
  24% { transform: scale(1); }
  82% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ── the round: pips, the last round, the (i) ── */
.fs-top { display: flex; align-items: center; gap: 12px; }
.fs-round { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.fs-round-row { display: flex; justify-content: space-between; align-items: baseline; }
.fs-label { font: 500 10px/1.2 var(--ui); letter-spacing: 2px; text-transform: uppercase; color: var(--text-label); }
.fs-sd { font: 700 10px/1 var(--ui); letter-spacing: 1.5px; text-transform: uppercase; color: var(--danger); }
.fs-pips { display: flex; gap: 6px; }
.fs-pips i { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--track); }
.fs-pips i.done { background: var(--text-mid); }
.fs-pips i.now { background: var(--text); }
.fs-pips i.sd.now { background: var(--danger); }
.fs-info {
  flex: none; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--r-icon);
  color: var(--text-bright); cursor: pointer; transition: border-color .16s;
}
.fs-info:hover { border-color: var(--border-gold); }
/* 44px to the finger, whatever the pill looks like (contract: hit targets) */
.fs-info, .fs-x, .fs-btn { position: relative; }
.fs-info::before, .fs-x::before, .fs-btn::before { content: ''; position: absolute; }
.fs-info::before { inset: -3px; }
.fs-x::before { inset: -8px; }
.fs-btn::before { inset: -4px 0; }

/* ── the tell: no panel, it floats in the sky ── */
.fs-tellbox { min-height: 64px; display: flex; flex-direction: column; justify-content: center; }
.fs-tell { display: flex; align-items: center; gap: 12px; animation: fs-in .22s ease-out both; }
.fs-mark {
  flex: none; width: 42px; height: 42px; border-radius: var(--r-pill); gap: 2px;
  border: 1px solid var(--role-edge, var(--border-strong)); color: var(--role, var(--text-mid));
  display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.fs-mark .fs-ico { width: 20px; height: 20px; }
.fs-mark > span { display: flex; color: var(--role); }
.fs-mark.is-split .fs-ico { width: 15px; height: 15px; }
.fs-tell-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fs-kind { font: 500 10px/1.2 var(--ui); letter-spacing: 2px; text-transform: uppercase; color: var(--text-label); }
.fs-tell-text { font: 20px/1.1 var(--display); letter-spacing: .5px; text-transform: uppercase; color: var(--text); }
.fs-tell-text em { font-style: normal; color: var(--role, var(--text)); }
.fs-tell.is-hidden .fs-tell-text { color: var(--text-mid); }
.fs-vs { display: flex; align-items: center; gap: 10px; animation: fs-in .22s ease-out both; }
.fs-or { font: 500 10px/1 var(--ui); letter-spacing: 2px; text-transform: uppercase; color: var(--text-label); }
.fs-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 8px;
  border-radius: var(--r-pill); border: 1px solid var(--role-edge, var(--border-strong)); background: var(--surface-deep);
  color: var(--role, var(--text-mid)); font: 700 11px/1 var(--ui); letter-spacing: 1px; text-transform: uppercase;
}
.fs-tag .fs-ico { width: 14px; height: 14px; }
@keyframes fs-in { 0% { opacity: 0; transform: scale(.94); } 100% { opacity: 1; transform: none; } }

/* ── Health: name, number and bar float on the scene ── */
.fs-hp { display: flex; flex-direction: column; gap: 6px; width: 176px; }
.fs-hp.opp { padding-top: 4px; }               /* V7: its block starts 150px down */
.fs-hp.you { align-self: flex-end; width: 150px; padding-bottom: 8px; }   /* V7: 50px above the buttons */
.fs-hp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fs-hp-name { font: 14px/1.1 var(--display); letter-spacing: 1px; text-transform: uppercase; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-hp-name.opp { color: var(--danger); }
.fs-hp-v { flex: none; font: 500 12px/1.2 var(--ui); color: var(--text-mid); }
.fs-meter { height: 7px; border-radius: var(--r-pill); background: var(--track); overflow: hidden; }
.fs-meter i { display: block; height: 100%; border-radius: var(--r-pill); transition: width .4s; }
.fs-meter i.health { background: var(--success); }
.fs-meter i.enemy { background: var(--danger); }
.fs-spacer { flex: 1; }

/* ── the buttons: three stadium pills in fixed places, then QUICK FIGHT and RUN ── */
.fs-controls { display: flex; flex-direction: column; gap: 8px; }
.fs-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fs-act {
  min-height: 76px; padding: 10px 8px 9px; border-radius: var(--r-pill);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--surface-raised); border: 1px solid var(--role-edge); color: var(--role);
  cursor: pointer; transition: border-color .16s, background .16s;
}
.fs-act:hover { border-color: var(--role); }
.fs-act-role { display: inline-flex; align-items: center; gap: 5px; font: 15px/1 var(--display); letter-spacing: 1px; }
.fs-act-sub { font: 500 11px/1.2 var(--ui); color: var(--text-mid); text-align: center; }
.fs-act-hint { font: 700 10px/1.1 var(--ui); letter-spacing: 1px; text-transform: uppercase; }
.fs-act-hint:empty { display: none; }
.fs-act-hint.win { color: var(--success); }
.fs-act-hint.lose { color: var(--danger); }
.fs-act-hint.trade, .fs-act-hint.mixed { color: var(--text-mid); }
.fs-act.is-picked { border-color: var(--role); background: var(--surface-deep); }
.fs-act.is-suggest { outline: 2px solid var(--gold); outline-offset: 2px; }
.fs-act:disabled { background: var(--bg-disabled); border-color: var(--border-disabled); color: var(--text-disabled); cursor: not-allowed; }
.fs-act:disabled .fs-act-sub { color: var(--text-disabled); }
.fs-act.is-picked:disabled { border-color: var(--role); background: var(--surface-deep); color: var(--role); }
.fs-alt { display: flex; gap: 8px; }
.fs-btn {
  flex: 1; min-height: 36px; padding: 11px 20px; border-radius: var(--r-pill); cursor: pointer;
  font: 13px/1 var(--display); letter-spacing: 1px; text-transform: uppercase;
  background: var(--surface-raised); border: 1px solid var(--border-strong); color: var(--text);
  transition: border-color .16s;
}
.fs-btn:hover { border-color: var(--border-gold); }
.fs-btn:disabled { background: var(--bg-disabled); border-color: var(--border-disabled); color: var(--text-disabled); cursor: not-allowed; }

/* ── the (i) sheet and the result panel ── */
.fs-scrim { position: absolute; inset: 0; z-index: 5; background: rgba(6,6,8,.72); display: flex; animation: fs-fade-in .2s ease-out both; }
.fs-scrim.center { align-items: center; justify-content: center; padding: 18px; }
@keyframes fs-fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
.fs-sheet {
  margin-top: auto; width: 100%; padding: 18px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  background: var(--overlay-fill); border: 1px solid var(--border-gold); border-bottom: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--modal-shadow);
  display: flex; flex-direction: column; gap: 14px; animation: fs-sheet .26s ease-out both;
}
@keyframes fs-sheet { 0% { transform: translateY(40px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.fs-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.fs-sheet-title { font: 19px/1.1 var(--display); letter-spacing: 2px; color: var(--text); }
.fs-x {
  flex: none; width: 28px; height: 28px; padding: 0; border-radius: var(--r-pill); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-raised); border: 1px solid var(--border-strong); color: var(--text-mid);
}
.fs-x .fs-ico { width: 14px; height: 14px; }
.fs-tri { display: block; width: 210px; margin: 0 auto; }
.fs-tri .node { fill: var(--bg); stroke: var(--role-edge); stroke-width: 1; }
.fs-tri .glyph { fill: none; stroke: var(--role); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fs-tri .word { fill: var(--role); font: 15px var(--display); letter-spacing: 1px; text-anchor: middle; }
.fs-tri .edge { stroke: var(--text-label); stroke-width: 1.5; fill: none; marker-end: url(#fs-ah); }
.fs-tri .beats { fill: var(--text-label); font: 500 9px var(--ui); letter-spacing: 1.5px; text-transform: uppercase; text-anchor: middle; }
.fs-rule { margin: 0; font: 400 13px/1.5 var(--ui); color: var(--text-mid); }
.fs-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; font: 500 13px/1.3 var(--ui); color: var(--text-bright); cursor: pointer; }
.fs-switch input { width: 18px; height: 18px; accent-color: var(--gold); }
.fs-panel {
  width: min(340px, 100%); padding: 20px 16px 16px; text-align: center;
  background: var(--overlay-fill); border: 1px solid var(--border-gold); border-radius: var(--r-panel); box-shadow: var(--modal-shadow);
  display: flex; flex-direction: column; align-items: center; gap: 10px; animation: fs-in .22s ease-out both;
}
.fs-panel .fs-btn { width: 100%; margin-top: 4px; }
.fs-result-title { font: 44px/1 var(--display); letter-spacing: 1px; text-transform: uppercase; color: var(--text-mid); }
.fs-result-title.win { color: var(--success); }
.fs-result-title.lose { color: var(--danger); }
.fs-result-money { font: 500 16px/1.2 var(--ui); color: var(--gold); }
.fs-result-line { font: 400 13px/1.45 var(--ui); color: var(--text-mid); }

@media (prefers-reduced-motion: reduce) {
  .fs .shot.on, .fs .sc-fig, .fs .fs-dmg.on, .fs-tell, .fs-vs, .fs-scrim, .fs-sheet, .fs-panel { animation: none; }
  .fs .shot.on, .fs .fs-dmg.on { opacity: 1; }
  .fs-burst.on { animation: none; opacity: 1; }
  .fs-meter i { transition: none; }
}
