/* fight.css — the D-Lo and J-Nova fights. Owned by lead. Spec: docs/FIGHT_SPEC.md
 *
 * Arcade grammar, house palette. The bars slant in toward the centre the way a fighting
 * game's do, the round card lands big and leaves, and the two thumb pads are the whole
 * interface — this has to be playable one-handed on a phone by someone who has never
 * played a fighting game.
 */

.fgt {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  /* Light touch only — the 3D behind is the picture, and a heavy scrim here was
     turning a lit room into a basement. */
  /* No warm scrim. It was tinting the whole student union orange — the set has its own
     colour and the overlay's job is contrast for the HUD, nothing else. */
  background: radial-gradient(100% 82% at 50% 62%, transparent 54%, rgba(4, 3, 8, .46));
  animation: fgt-in .4s cubic-bezier(.22, 1, .36, 1) both;
}
.fgt-out { animation: fgt-outa .5s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes fgt-in   { from { opacity: 0; transform: scale(1.03); } }
@keyframes fgt-outa { to   { opacity: 0; transform: scale(.98); } }

/* --- health bars ---------------------------------------------------------- */
.fgt-hud {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 16px; padding: 18px 22px 0;
}
.fgt-side { display: flex; flex-direction: column; gap: 6px; }
.fgt-right { align-items: flex-end; }
.fgt-name { font-size: 11px; font-weight: 800; letter-spacing: .26em; color: #cfc6bb; }

/* Both bars drain toward the middle, like the genre does. */
.fgt-bar {
  height: 16px; width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .22);
  overflow: hidden; transform: skewX(-22deg);
}
.fgt-bar i {
  display: block; height: 100%; float: left;
  background: linear-gradient(90deg, #ffd76a, #ff8a3d);
  transition: width .18s cubic-bezier(.22, 1, .36, 1);
}
.fgt-bar-foe i {
  float: right;
  background: linear-gradient(90deg, #ff6a3d, #c8102e);
}
.fgt-bar.is-hit { animation: fgt-bar-hit .19s ease-out; }
@keyframes fgt-bar-hit {
  0%, 100% { filter: none; }
  35% { filter: brightness(2.6) saturate(.2); box-shadow: 0 0 26px #fff; }
}

.fgt-mid {
  font-size: 10px; letter-spacing: .34em; font-weight: 800;
  color: rgba(255, 255, 255, .5); white-space: nowrap;
}

/* --- hit meter ------------------------------------------------------------ */
.fgt-meter {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px 0; margin: 0 auto; width: min(420px, 74vw);
}
.fgt-meter span {
  font-size: 9px; font-weight: 800; letter-spacing: .3em; color: #8d8474;
}
.fgt-meter-bar {
  flex: 1; height: 7px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  overflow: hidden; transform: skewX(-22deg);
}
.fgt-meter-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #9fe8ff, #ff2d6f);
  transition: width .2s cubic-bezier(.22, 1, .36, 1);
}
/* Charged: the takedown is available and the player must not miss that. */
.fgt.is-charged .fgt-meter-bar { border-color: #ffd76a; box-shadow: 0 0 20px rgba(255, 176, 32, .6); }
.fgt.is-charged .fgt-meter span { color: #ffd76a; }
.fgt.is-charged .fgt-meter-label::after { content: ' READY'; }
.fgt.is-charged .fgt-pad-strike {
  border-color: #ffd76a;
  box-shadow: 0 0 26px rgba(255, 176, 32, .45);
  animation: fgt-pulse 1.1s ease-in-out infinite;
}
@keyframes fgt-pulse { 50% { background: rgba(255, 215, 106, .22); } }

.fgt-test-takedown {
  position: absolute;
  z-index: 18;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 1px solid #e6c454;
  border-radius: 999px;
  background: rgba(8, 7, 5, .82);
  color: #f5dc78;
  font: 800 9px/1 system-ui, sans-serif;
  letter-spacing: .18em;
  white-space: nowrap;
  cursor: pointer;
}

/* --- centre --------------------------------------------------------------- */
.fgt-stage { flex: 1; position: relative; }

/* A single-frame contact flash makes phone-sized strikes readable without hiding the
 * character animation. Power carries a warmer, heavier flare. */
.fgt-impact {
  position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 57%, rgba(255,255,255,.78), rgba(159,232,255,.12) 20%, transparent 52%);
}
.fgt-impact.is-on { animation: fgt-impact .11s ease-out; }
.fgt-impact.is-power { background: radial-gradient(circle at 50% 57%, #fff 0, rgba(255,215,106,.74) 12%, rgba(255,70,55,.22) 30%, transparent 60%); }
.fgt-impact.is-on.is-power { animation-duration: .17s; }
@keyframes fgt-impact { 0% { opacity: 1; transform: scale(.84); } 100% { opacity: 0; transform: scale(1.08); } }

.fgt-tutorial {
  position: absolute; z-index: 14; inset: 31% 18px auto;
  display: grid; place-items: center; gap: 10px; text-align: center;
  padding: 18px 16px; opacity: 0; transform: translateY(10px);
  background: rgba(5,5,9,.76); border-block: 1px solid rgba(255,215,106,.46);
  pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.fgt-tutorial.is-on { opacity: 1; transform: translateY(0); }
.fgt-tutorial small { color: #c9a227; font-size: 9px; letter-spacing: .38em; }
.fgt-tutorial strong { color: #fff3c1; font-size: clamp(18px, 4.5vw, 34px); letter-spacing: .12em; text-shadow: 0 2px 16px #000; }

/* Final-round winner card. The name uses the same foil-stamped serif language as the
 * title and chapter cards, so a match ends as part of Mr. Illustrious rather than with a
 * generic fighting-game label. */
.fgt-winner {
  position: absolute;
  inset: 42% 0 auto;
  z-index: 12;
  display: grid;
  place-items: center;
  gap: 5px;
  opacity: 0;
  transform: scale(.86);
  pointer-events: none;
  transition: opacity .32s ease, transform .55s cubic-bezier(.2, 1, .3, 1);
  text-align: center;
}
.fgt-winner.is-on { opacity: 1; transform: scale(1); }
.fgt-winner small {
  color: rgba(255, 247, 214, .74);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5em;
  text-shadow: 0 2px 10px #000;
}
.fgt-winner strong {
  padding-left: .08em;
  font-family: Didot, "Bodoni MT", "Playfair Display", "Hoefler Text", Garamond, Georgia, serif;
  font-size: clamp(52px, 13vw, 112px);
  line-height: .92;
  letter-spacing: .08em;
  color: #e6c454;
  background: linear-gradient(177deg, #7b5815, #f5dc78 38%, #fff6cf 49%, #c99b25 68%, #6a4a0f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 5px 0 #3e2808) drop-shadow(0 12px 24px rgba(0, 0, 0, .92));
}

/* The big announcements: FIGHT! and K.O. */
.fgt-card {
  position: absolute; top: 26%; left: 0; right: 0; text-align: center;
  font-size: clamp(44px, 12vw, 130px); font-weight: 900;
  letter-spacing: .06em; line-height: 1;
  color: #fff; opacity: 0; pointer-events: none;
  text-shadow: 0 0 40px rgba(0, 0, 0, .9);
}
.fgt-card.is-on { animation: fgt-card 1.1s cubic-bezier(.22, 1, .36, 1); }
@keyframes fgt-card {
  0%   { opacity: 0; transform: scale(2.2) rotate(-6deg); }
  18%  { opacity: 1; transform: scale(1) rotate(-3deg); }
  76%  { opacity: 1; transform: scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: scale(.9) rotate(-3deg); }
}
.fgt-card-fight { color: #ffd76a; text-shadow: 0 0 50px rgba(255, 176, 32, .9), 0 6px 0 #7a3b00; }
.fgt-card-ko    { color: #ff5c74; text-shadow: 0 0 60px rgba(200, 16, 46, .95), 0 6px 0 #4a0010; }
.fgt-card-lose  { color: #9aa3b2; text-shadow: 0 0 40px rgba(0, 0, 0, .9); }

.fgt-judge {
  position: absolute; top: 15%; left: 0; right: 0; text-align: center;
  font-size: clamp(20px, 3.8vw, 40px); font-weight: 900; letter-spacing: .1em;
  animation: fgt-j .3s cubic-bezier(.22, 1, .36, 1);
  pointer-events: none;
}
@keyframes fgt-j { from { transform: scale(.7); opacity: 0; } }
.fgt-perfect { color: #ffd76a; text-shadow: 0 0 26px rgba(255, 176, 32, .85); }
.fgt-good    { color: #9fe8ff; text-shadow: 0 0 20px rgba(0, 229, 255, .6); }
.fgt-miss    { color: #ff5c74; text-shadow: 0 0 20px rgba(200, 16, 46, .75); }

/* The telegraph. This is the read — it has to be unmissable. */
.fgt-tell {
  position: absolute; bottom: 16%; left: 0; right: 0; text-align: center;
  font-size: clamp(15px, 2.6vw, 24px); font-weight: 900; letter-spacing: .34em;
  color: #9fe8ff; opacity: 0;
  text-shadow: 0 0 24px rgba(0, 229, 255, .7);
  pointer-events: none;
  transition: opacity .1s ease;
}
.fgt-tell.is-on { opacity: 1; animation: fgt-tell .5s ease-in-out infinite alternate; }
.fgt-tell.is-heavy { color: #ff5c74; text-shadow: 0 0 26px rgba(200, 16, 46, .8); }
@keyframes fgt-tell { to { transform: scale(1.07); } }

/* --- dialogue ------------------------------------------------------------- */
.fgt-sub {
  position: absolute; top: 30%; left: 50%; transform: translateX(-50%);
  width: min(680px, 88vw); text-align: center;
  font-size: 15px; line-height: 1.55;
  color: #efe9e2; text-shadow: 0 2px 14px rgba(0, 0, 0, .95);
  pointer-events: none; opacity: 0;
}
.fgt-sub b {
  display: block; font-size: 10px; font-weight: 800; letter-spacing: .28em;
  color: #ff8a3d; margin-bottom: 5px;
}
.fgt-sub i { color: #c9c1ba; font-style: italic; }
.fgt-sub-in { animation: fgt-sub 5s cubic-bezier(.22, 1, .36, 1) forwards; }
@keyframes fgt-sub {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.fgt-help {
  text-align: center; padding: 0 0 10px;
  font-size: 10px; letter-spacing: .22em; font-weight: 700;
  color: rgba(255, 255, 255, .34);
}

.fgt-hurt { animation: fgt-shake .22s; }
@keyframes fgt-shake {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(-10px, 3px); }
  70% { transform: translate(10px, -3px); }
}

/* --- two pads, always on screen ------------------------------------------- */
.fgt-pads { display: flex; gap: 12px; justify-content: center; padding: 0 18px 26px; }
.fgt-pad {
  flex: 1 1 0; max-width: 150px;
  aspect-ratio: 1 / .5;
  display: grid; place-items: center; gap: 2px;
  font-size: clamp(26px, 5.5vw, 40px); font-weight: 900; line-height: 1;
  color: #efe9e2;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease, border-color .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.fgt-pad b { display: block; font-size: 1em; line-height: 1; }
.fgt-pad span {
  display: block; font-size: 10px; font-weight: 800; letter-spacing: .24em;
  color: rgba(255, 255, 255, .55);
}
.fgt-pad.is-hit { background: rgba(255, 138, 61, .5); transform: scale(.94); }
.fgt-pad-strike { border-color: rgba(255, 138, 61, .45); }
.fgt-pad-power { border-color: rgba(255, 76, 92, .58); background: rgba(120, 16, 30, .12); }

.fgt-advanced .fgt-pads { display: none !important; }
.fgt-advanced .fgt-help {
  margin: 0 auto 24px;
  padding: 10px 18px;
  color: rgba(255,255,255,.76);
  border: 1px solid rgba(159,232,255,.25);
  background: rgba(4,3,8,.55);
}

@media (hover: none), (pointer: coarse) {
  .fgt-help { display: block; font-size: 8px; padding-inline: 12px; }
  .fgt-pad { backdrop-filter: none !important; }
}

@media (max-width: 640px) {
  .fgt-hud { gap: 8px; padding: 12px 12px 0; }
  .fgt-name { font-size: 9px; letter-spacing: .16em; }
  .fgt-bar { height: 12px; }
  .fgt-mid { font-size: 8px; letter-spacing: .18em; }
  .fgt-meter { width: min(300px, 84vw); }
}

@media (prefers-reduced-motion: reduce) {
  .fgt, .fgt-out, .fgt-card, .fgt-judge, .fgt-hurt, .fgt-tell { animation: none; }
  .fgt-card.is-on { opacity: 1; }
}

/* The stat HUD shares these corners with the health bars. */
body.fgt-active .mi-hud { opacity: 0; pointer-events: none; }

/* Standalone fight-test result. This route is intentionally outside Arcade Mode so a
 * tester can replay one bout without changing story progress or unlock state. */
.fight-test-result {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 35%, rgba(82, 10, 18, .42), rgba(3, 3, 5, .94) 62%);
  color: #f4ead0;
  text-align: center;
}
.fight-test-card {
  width: min(440px, 92vw);
  padding: 42px 28px 34px;
  border: 1px solid rgba(201, 162, 39, .56);
  background: rgba(7, 6, 7, .92);
  box-shadow: 0 24px 90px #000, inset 0 0 50px rgba(201, 162, 39, .06);
}
.fight-test-card small { color: #c9a227; letter-spacing: .32em; }
.fight-test-card h2 { margin: 10px 0 6px; font: 700 clamp(42px, 11vw, 72px)/1 Georgia, serif; }
.fight-test-card p { margin: 0 0 26px; color: #bdb5a8; font-size: 12px; letter-spacing: .08em; }
.fight-test-card button,
.fight-test-card a {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 15px 16px;
  border: 1px solid #c9a227;
  background: #c9a227;
  color: #090806;
  font: 800 12px/1 system-ui, sans-serif;
  letter-spacing: .18em;
  text-decoration: none;
  cursor: pointer;
}
.fight-test-card a { margin-top: 12px; border-color: rgba(201, 162, 39, .45); background: transparent; color: #d8c786; }
