/* Character Draft: the 8-bit battle stage. Shared by the two-player game and
   the party TV. The canvas is tiny and scaled up with hard pixel edges; the
   names, health bars, captions and speech sit on top as ordinary text. */

.b8 {
  --b8-ink: #fbf7ef;
  --b8-shadow: #17120e;
  --b8-hp: #5fd068;
  --b8-hp-low: #ef6a4a;
  position: relative;
  width: 100%;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 10px;
  background: #17120e;
  font-family: "Jersey 10", "VT323", ui-monospace, monospace;
  letter-spacing: 0.03em;
  color: var(--b8-ink);
  user-select: none;
  container-type: inline-size;
}
/* The picture itself; the caption and controls sit underneath it. */
.b8__screen { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; }
.b8__stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Health bars along the top, one panel a side. */
.b8__hud {
  position: absolute;
  inset: 1.6cqw 1.6cqw auto;
  display: flex;
  justify-content: space-between;
  gap: 2cqw;
  pointer-events: none;
}
.b8__team { display: grid; gap: 0.35cqw; width: 34cqw; }
.b8__team--right { text-align: right; justify-items: end; }
.b8__who { font-size: 2.3cqw; text-shadow: 0.2cqw 0.2cqw 0 var(--b8-shadow); }
.b8__f { display: grid; grid-template-columns: 1fr 12cqw; align-items: center; gap: 0.8cqw; width: 100%; font-size: 1.55cqw; }
.b8__team--right .b8__f { grid-template-columns: 12cqw 1fr; }
.b8__team--right .b8__n { order: 2; }
.b8__n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0.15cqw 0.15cqw 0 var(--b8-shadow); }
.b8__hp { height: 1cqw; background: rgba(23, 18, 14, 0.75); border: 0.18cqw solid var(--b8-shadow); }
.b8__hp i { display: block; height: 100%; width: 100%; background: var(--b8-hp); transition: width 0.35s steps(6); }
.b8__team--right .b8__hp i { margin-left: auto; }
.b8__f.is-low .b8__hp i { background: var(--b8-hp-low); }
.b8__f.is-down { opacity: 0.45; text-decoration: line-through; }
.b8__f.is-fled { opacity: 0.45; }

/* Speech and damage numbers, positioned over the sprites. */
.b8__bubbles { position: absolute; inset: 0; pointer-events: none; }
.b8__say {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 30cqw;
  padding: 0.6cqw 1cqw;
  background: #fbf7ef;
  color: #241f1a;
  font-size: 1.7cqw;
  line-height: 1.15;
  border: 0.25cqw solid var(--b8-shadow);
  box-shadow: 0.3cqw 0.3cqw 0 var(--b8-shadow);
  animation: b8-pop 0.18s steps(3);
}
.b8__dmg {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 2.2cqw;
  text-shadow: 0.2cqw 0.2cqw 0 var(--b8-shadow);
  animation: b8-rise 1.1s steps(10) forwards;
}
@keyframes b8-pop { from { transform: translate(-50%, -80%) scale(0.6); } }
@keyframes b8-rise { to { transform: translate(-50%, -4cqw); opacity: 0; } }

/* "Ready… Fight!" and the winner. */
.b8__banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.b8__banner[hidden] { display: none; }
.b8__banner span {
  padding: 1cqw 3cqw;
  font-size: 5.5cqw;
  background: rgba(23, 18, 14, 0.72);
  border: 0.4cqw solid #fbf7ef;
  text-shadow: 0.4cqw 0.4cqw 0 #c0392b;
  animation: b8-pop 0.25s steps(4);
}

/* What's happening, along the bottom. */
.b8__caption {
  margin: 0;
  padding: 1cqw 1.6cqw 0.6cqw;
  min-height: 2.4em;
  font-size: max(0.85rem, 2cqw);
  line-height: 1.25;
  border-top: 0.25cqw solid #fbf7ef;
}

.b8__ctl {
  padding: 0.4cqw 1.6cqw 1.2cqw;
  display: flex;
  align-items: center;
  gap: 1.4cqw;
}
.b8__btn {
  font: inherit;
  font-size: max(0.8rem, 1.7cqw);
  color: #fbf7ef;
  background: rgba(23, 18, 14, 0.78);
  border: 0.25cqw solid #fbf7ef;
  padding: 0.4cqw 1.4cqw;
  cursor: pointer;
}
.b8__btn:hover, .b8__btn:focus-visible { background: #c0392b; outline: none; }
.b8__bar { flex: 1; height: 0.9cqw; background: rgba(23, 18, 14, 0.7); border: 0.2cqw solid #fbf7ef; }
.b8__bar i { display: block; height: 100%; width: 0; background: #fbf7ef; }

@media (prefers-reduced-motion: reduce) {
  .b8__say, .b8__dmg, .b8__banner span { animation: none; }
}

/* A named move, called out like a fighting game. */
.b8__move {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, 0);
  padding: 0.5cqw 2cqw;
  font-size: 3.4cqw;
  color: #fff2c0;
  background: rgba(23, 18, 14, 0.7);
  border: 0.3cqw solid #fff2c0;
  text-shadow: 0.3cqw 0.3cqw 0 #c0392b;
  white-space: nowrap;
  pointer-events: none;
  animation: b8-move 1.5s steps(8) forwards;
}
.b8__move[hidden] { display: none; }
@keyframes b8-move {
  0% { transform: translate(-50%, 1cqw) scale(0.6); opacity: 0; }
  12% { transform: translate(-50%, 0) scale(1.08); opacity: 1; }
  80% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -1cqw) scale(1); opacity: 0; }
}
.b8__f.is-dead .b8__n::before { content: "☠ "; text-decoration: none; display: inline-block; color: #ef6a4a; }
.b8__f.is-dead { text-decoration: none; }
.b8__f.is-dead .b8__n { text-decoration: line-through; }
@media (prefers-reduced-motion: reduce) { .b8__move { animation: none; } }

/* The battlefield's own picture, before the fight. */
.b8__map {
  position: absolute; inset: 0; display: grid; place-items: end start;
  background: #17120e; overflow: hidden; animation: b8-map-in 0.6s ease-out;
  transition: opacity 0.6s ease;
}
.b8__map[hidden] { display: none; }
.b8__map.is-leaving { opacity: 0; }
.b8__map img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; animation: b8-map-zoom 4s ease-out forwards; }
.b8__map-text { position: relative; display: grid; gap: 0.6cqw; margin: 3cqw; padding: 1.4cqw 2cqw; max-width: 70cqw; background: rgba(23, 18, 14, 0.78); border: 0.3cqw solid #fbf7ef; }
.b8__map-name { font-size: 4.4cqw; text-shadow: 0.3cqw 0.3cqw 0 #c0392b; }
.b8__map-terrain { font-size: 1.7cqw; line-height: 1.3; opacity: 0.9; }
.b8__map-sides { font-size: 2cqw; color: #fff2c0; }
@keyframes b8-map-in { from { opacity: 0; } }
@keyframes b8-map-zoom { from { transform: scale(1.08); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .b8__map, .b8__map img { animation: none; } }

/* The announcer's call: plans, gear and terrain as they come into play. */
.b8__call {
  position: absolute; left: 50%; top: 15%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 0.8cqw; max-width: 80cqw;
  padding: 0.6cqw 1.6cqw; background: rgba(23, 18, 14, 0.85); color: #fff2c0;
  border: 0.3cqw solid #e8b84a; font-size: 2.1cqw; line-height: 1.2; white-space: nowrap;
  animation: b8-call 0.35s ease-out; pointer-events: none;
}
.b8__call[hidden] { display: none; }
.b8__call span { overflow: hidden; text-overflow: ellipsis; }
.b8__call canvas { width: 3cqw; height: 3cqw; image-rendering: pixelated; flex: none; }
@keyframes b8-call { from { opacity: 0; transform: translate(-50%, -40%); } }

/* The war councils, shown before the fight. */
.b8__council { position: absolute; inset: 0; z-index: 4; display: grid; grid-template-rows: auto 1fr auto; pointer-events: none; transition: opacity 0.4s ease; animation: b8-map-in 0.5s ease-out; }
.b8__council[hidden] { display: none; }
.b8__council.is-leaving { opacity: 0; }
.b8__council-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6cqw 1.4cqw; margin: 2cqw 2.4cqw 0; }
.b8__council-team { font-size: 3.6cqw; text-shadow: 0.3cqw 0.3cqw 0 #1d1a17; }
.b8__council-stance { font-size: 1.8cqw; padding: 0.2cqw 1cqw; background: #1f4fa8; }
.b8__council-stance--attack { background: #c0262f; }
.b8__council-lead { font-size: 1.9cqw; color: #ffe08a; }
.b8__council-text { grid-row: 3; display: grid; gap: 0.4cqw; margin: 0 2.4cqw 1.6cqw; padding: 0.9cqw 1.6cqw; min-height: 7cqw; background: rgba(23, 18, 14, 0.86); border: 0.3cqw solid #fbf7ef; font-size: 2.2cqw; line-height: 1.3; }
.b8__council-text:empty { visibility: hidden; }
.b8__council-label { font-size: 1.6cqw; color: #ffe08a; }
.b8__council-gear { font-size: 2.8cqw; color: #ffffff; }
.b8__council-who { font-size: 1.7cqw; color: #cfe8ff; }
.b8__council-effect { font-size: 1.9cqw; opacity: 0.92; }
.b8__council-skip { position: absolute; right: 2cqw; top: 2cqw; pointer-events: auto; font: inherit; font-size: 1.6cqw; padding: 0.4cqw 1.2cqw; color: #fbf7ef; background: rgba(23, 18, 14, 0.7); border: 0.25cqw solid #fbf7ef; cursor: pointer; }
.b8__council-skip:hover, .b8__council-skip:focus-visible { background: #2b7d58; outline: none; }
@media (prefers-reduced-motion: reduce) { .b8__call, .b8__council { animation: none; } }
.b8.is-council .b8__hud { visibility: hidden; }

/* A page turn between scenes: pixel curtains sweep across with a title card. */
.b8__wipe {
  position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; gap: 1cqw; text-align: center;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2cqw, transparent 2cqw 4cqw),
    linear-gradient(135deg, #2b2050, #141024 70%);
  color: #ffffff; pointer-events: none;
  box-shadow: inset 0 0 0 0.6cqw #9cc0ff;
}
.b8__wipe[hidden] { display: none; }
.b8__wipe-title { font-size: 5.5cqw; line-height: 1; text-shadow: 0.5cqw 0.5cqw 0 #0b0a14; }
.b8__wipe-sub { font-size: 2.4cqw; color: #c9dcff; }
.b8__wipe.is-in { animation: b8-wipe-in 0.48s steps(8) both; }
.b8__wipe.is-out { animation: b8-wipe-out 0.48s steps(8) both; }
.b8__wipe.is-in .b8__wipe-title { animation: b8-title-in 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) 0.3s both; }
@keyframes b8-wipe-in { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes b8-wipe-out { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 100% 0 0); } }
@keyframes b8-title-in { from { transform: scale(2.2); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .b8__wipe.is-in, .b8__wipe.is-out, .b8__wipe.is-in .b8__wipe-title { animation-duration: 0.01s; } }

/* A full-screen stage arriving like a new page. */
.tv-film--full { animation: b8-page-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes b8-page-in { from { transform: translateX(10%) scale(0.94); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tv-film--full { animation: none; } }

/* The K.O. stamp on a kill. */
.b8__ko {
  position: absolute; transform: translate(-50%, -50%) rotate(-8deg); z-index: 4; pointer-events: none;
  font-size: 5cqw; line-height: 1; color: #ffe14d; text-shadow: 0.35cqw 0.35cqw 0 #c0262f, 0.7cqw 0.7cqw 0 #0b0a14;
  animation: b8-ko 1.2s steps(10) forwards;
}
@keyframes b8-ko { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(2.6); opacity: 0; } 15% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -80%) rotate(-8deg) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .b8__ko { animation: none; opacity: 0.9; } }
