@font-face {
  font-family: "Archivo Black";
  src: url("./fonts/archivo-black.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("./fonts/ibm-plex-mono-regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --black: #080808;
  --line: #343434;
  --cream: #f0eee8;
  --blue: #334df4;
  --red: #d94a4a;
  --screen: #d6d8ce;
  --screen-dark: #17201d;
  --screen-mid: #65716b;
  --pixel: "Press Start 2P", "Courier New", monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--black);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    linear-gradient(90deg, transparent 49.9%, rgba(255, 255, 255, 0.035) 50%, transparent 50.1%),
    var(--black);
  font-family: "Plex Mono", monospace;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.game-topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 215px 1fr 238px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.96);
}

.game-wordmark,
.back-link {
  display: flex;
  align-items: center;
  padding: 0 26px;
  color: var(--cream);
  text-decoration: none;
}

.game-wordmark {
  border-right: 1px solid var(--line);
  font-family: "Archivo Black", sans-serif;
  font-size: 25px;
  letter-spacing: -1.6px;
}

.game-wordmark span:last-child,
.stage-copy h1 span,
.console-brand span {
  color: var(--blue);
}

.game-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.game-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.back-link {
  justify-content: space-between;
  border-left: 1px solid var(--line);
  background: var(--cream);
  color: var(--black);
  font-size: 10px;
  font-weight: 700;
}

.game-stage {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: calc(100vh - 72px);
  padding: 72px 36px 64px;
  overflow: hidden;
}

.game-stage::before,
.game-stage::after {
  position: absolute;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.game-stage::before {
  inset: 34px 4.5vw;
}

.game-stage::after {
  top: 0;
  bottom: 0;
  left: 20%;
  width: 60%;
  border-width: 0 1px;
}

.stage-copy {
  position: absolute;
  z-index: 1;
  top: 86px;
  left: 5.5vw;
}

.stage-copy p {
  margin: 0 0 16px;
  color: #777;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.1px;
}

.stage-copy p::before {
  display: inline-block;
  width: 18px;
  height: 2px;
  margin: 0 10px 3px 0;
  background: var(--red);
  content: "";
}

.stage-copy h1 {
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(44px, 5vw, 82px);
  line-height: 0.82;
  letter-spacing: -4px;
}

.handheld {
  position: relative;
  z-index: 2;
  width: min(920px, 76vw);
  margin-top: 120px;
  padding: 42px 52px 34px;
  border: 1px solid #565656;
  border-radius: 36px 36px 104px 36px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 26%),
    #111;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.65);
}

.handheld-outline {
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: inherit;
}

.outline-one {
  inset: 9px;
}

.outline-two {
  inset: 18px;
  border-color: rgba(255, 255, 255, 0.055);
}

.console-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
}

.console-brand {
  font-family: "Archivo Black", sans-serif;
  font-size: 16px;
  letter-spacing: -0.5px;
}

.power-light {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #777;
}

.power-light i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 9px rgba(217, 74, 74, 0.8);
}

.screen-bezel {
  position: relative;
  z-index: 1;
  padding: 22px 34px 34px;
  border: 1px solid #464646;
  border-radius: 16px 16px 55px 16px;
  background: #090909;
}

.screen-label {
  display: flex;
  justify-content: space-between;
  padding-bottom: 12px;
  color: #6d6d6d;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.screen-label span:last-child {
  color: var(--blue);
}

.game-screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 3px solid #2c302e;
  background: var(--screen);
  color: var(--screen-dark);
  font-family: var(--pixel);
  image-rendering: pixelated;
}

.pixel-grid {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image:
    linear-gradient(rgba(20, 28, 25, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 28, 25, 0.45) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: multiply;
}

.battlefield {
  --enemy-field: #5ed66d;
  --player-field: #f17b22;
  position: absolute;
  inset: 0 0 30%;
  background: linear-gradient(
    to bottom,
    var(--enemy-field) 0 50%,
    var(--player-field) 50% 100%
  );
  transition: background 280ms steps(3);
}

.battlefield::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0;
}

.battlefield.is-hit-enemy::after {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.72) 0 50%,
    transparent 50% 100%
  );
  animation: field-impact 340ms steps(3);
}

.battlefield.is-hit-player::after {
  background: linear-gradient(
    to bottom,
    transparent 0 50%,
    rgba(255, 255, 255, 0.72) 50% 100%
  );
  animation: field-impact 340ms steps(3);
}

.fighter-status {
  position: absolute;
  z-index: 4;
  width: 42%;
  padding: 12px 14px 11px;
  border: 3px solid var(--screen-dark);
  border-radius: 3px 3px 14px 3px;
  background: #eef0e7;
  box-shadow: 5px 5px 0 rgba(23, 32, 29, 0.32);
}

.enemy-status {
  top: 7%;
  left: 5%;
}

.player-status {
  right: 4%;
  bottom: 4%;
}

.fighter-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: clamp(7px, 0.8vw, 10px);
  line-height: 1.4;
}

.fighter-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-name span {
  flex: none;
  font-size: 7px;
}

.hp-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 3px 5px;
  border-radius: 9px;
  background: var(--screen-dark);
  color: #f3d65b;
  font-size: 6px;
}

.hp-track {
  height: 6px;
  overflow: hidden;
  border: 1px solid #f1eee2;
  background: #515b56;
}

.hp-track i {
  display: block;
  width: 100%;
  height: 100%;
  background: #3dba68;
  transition: width 500ms steps(8), background-color 200ms;
}

.hp-track i.is-mid {
  background: #d4b444;
}

.hp-track i.is-low {
  background: #d54b47;
}

.hp-numbers {
  padding-top: 6px;
  text-align: right;
  font-size: 7px;
}

.fighter-sprite {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: auto;
  height: 50%;
  aspect-ratio: 1;
  transition: transform 120ms steps(2), opacity 180ms;
}

.fighter-sprite img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: saturate(0.96) contrast(1.08);
}

.loading-pixel {
  position: absolute;
  font-size: 7px;
}

.fighter-sprite.is-loaded .loading-pixel {
  display: none;
}

.enemy-sprite {
  top: 0;
  right: 7%;
}

.player-sprite {
  bottom: 0;
  left: 7%;
}

.player-sprite img {
  transform: scaleX(-1);
}

.fighter-sprite.is-hit {
  animation: sprite-hit 360ms steps(2);
}

.fighter-sprite.is-attack {
  animation: sprite-attack 400ms steps(3);
}

.fighter-sprite.is-fainted {
  transform: translateY(60%) !important;
  opacity: 0;
}

.fighter-sprite.is-hashing {
  animation: hash-scan 180ms steps(2) infinite;
}

.fighter-sprite.is-encoded {
  animation: encode-into-block 500ms steps(6) forwards;
}

.fighter-sprite.is-released {
  animation: decode-from-block 480ms steps(5) both;
}

.move-effect {
  position: absolute;
  z-index: 3;
  width: 25%;
  height: 34%;
  pointer-events: none;
}

.move-effect.targets-enemy {
  top: 5%;
  right: 5%;
}

.move-effect.targets-player {
  bottom: 4%;
  left: 5%;
}

.move-effect i {
  --effect-color: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 11px;
  height: 11px;
  background: var(--effect-color);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
  opacity: 0;
}

.move-effect.fx-signal i { --effect-color: #3861ff; }
.move-effect.fx-beast i { --effect-color: #f2eee0; }
.move-effect.fx-void i { --effect-color: #6c42d8; }
.move-effect.fx-btc i { --effect-color: #f1bd31; }
.move-effect.fx-data i { --effect-color: #42d7cd; }
.move-effect.fx-rune i { --effect-color: #ef4c58; }
.move-effect.fx-ink i { --effect-color: #101010; }
.move-effect.fx-flora i { --effect-color: #77d657; }

.move-effect.is-active.fx-signal i {
  animation: fx-flame 640ms steps(5) var(--delay) both;
}

.move-effect.is-active.fx-beast i {
  height: 7px;
  animation: fx-bite 560ms steps(4) var(--delay) both;
}

.move-effect.is-active.fx-void i {
  animation: fx-orbit 680ms steps(7) var(--delay) both;
}

.move-effect.is-active.fx-btc i {
  animation: fx-block-drop 620ms steps(6) var(--delay) both;
}

.move-effect.is-active.fx-data i {
  width: 15px;
  height: 5px;
  animation: fx-glitch 600ms steps(2) var(--delay) both;
}

.move-effect.is-active.fx-rune i {
  width: 22px;
  height: 5px;
  animation: fx-rune-cut 580ms steps(4) var(--delay) both;
}

.move-effect.is-active.fx-ink i {
  animation: fx-splatter 620ms steps(5) var(--delay) both;
}

.move-effect.is-active.fx-flora i {
  animation: fx-bloom 650ms steps(6) var(--delay) both;
}

.battle-panel {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 42% 58%;
  min-height: 30%;
  border-top: 4px solid var(--screen-dark);
  background: #eef0e7;
}

.battle-readout {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  border-right: 4px solid var(--screen-dark);
}

.battle-message {
  padding: 18px 16px;
  font-size: clamp(7px, 0.77vw, 10px);
  line-height: 1.75;
}

.battle-message::after {
  display: inline-block;
  margin-left: 7px;
  color: var(--blue);
  content: ">";
  animation: prompt-blink 900ms steps(2) infinite;
}

.capture-odds {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 13px;
  border-top: 2px solid var(--screen-dark);
  background: #d9ddd2;
  font-size: clamp(5px, 0.5vw, 7px);
}

.capture-odds strong {
  color: var(--blue);
  font-size: 1.15em;
}

.move-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.move-button {
  position: relative;
  min-width: 0;
  padding: 12px 9px 10px 22px;
  border: 0;
  border-right: 2px solid var(--screen-dark);
  border-bottom: 2px solid var(--screen-dark);
  background: transparent;
  color: var(--screen-dark);
  cursor: pointer;
  text-align: left;
  font-family: var(--pixel);
  font-size: clamp(6px, 0.64vw, 8px);
  line-height: 1.5;
}

.move-button:nth-child(2n) {
  border-right: 0;
}

.move-button:nth-child(n + 3) {
  border-bottom: 0;
}

.move-button::before {
  position: absolute;
  top: 14px;
  left: 7px;
  color: var(--blue);
  content: ">";
  opacity: 0;
}

.move-button.is-selected::before {
  opacity: 1;
  animation: cursor-nudge 600ms steps(2) infinite;
}

.move-button span {
  display: block;
  margin-top: 4px;
  color: var(--screen-mid);
  font-size: 5px;
}

.move-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.console-controls {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 205px;
  padding: 22px 22px 0;
}

.control-caption,
.action-buttons span,
.system-buttons span {
  color: #686868;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
}

.dpad-wrap {
  justify-self: start;
  text-align: center;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  margin-top: 10px;
  transform: rotate(-3deg);
}

.dpad button,
.dpad i {
  border: 1px solid #454545;
  background: #080808;
  box-shadow: inset 0 0 0 1px #181818;
}

.dpad button {
  cursor: pointer;
}

.dpad button:active {
  background: #1c1c1c;
}

.dpad [data-direction="up"] {
  grid-column: 2;
  border-radius: 5px 5px 0 0;
}

.dpad [data-direction="left"] {
  grid-row: 2;
  grid-column: 1;
  border-radius: 5px 0 0 5px;
}

.dpad i {
  grid-row: 2;
  grid-column: 2;
}

.dpad [data-direction="right"] {
  grid-row: 2;
  grid-column: 3;
  border-radius: 0 5px 5px 0;
}

.dpad [data-direction="down"] {
  grid-row: 3;
  grid-column: 2;
  border-radius: 0 0 5px 5px;
}

.system-buttons {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, 58px);
  gap: 7px 12px;
  padding-bottom: 7px;
  text-align: center;
}

.system-buttons button {
  height: 15px;
  border: 1px solid #414141;
  border-radius: 10px;
  background: #080808;
  color: transparent;
  cursor: pointer;
  transform: rotate(-8deg);
}

.system-buttons span {
  grid-column: 1 / -1;
}

.action-buttons {
  justify-self: end;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  transform: rotate(-10deg);
}

.action-buttons > div {
  display: grid;
  justify-items: center;
  gap: 7px;
}

.action-button {
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: var(--cream);
  cursor: pointer;
  font-family: "Archivo Black", sans-serif;
  font-size: 24px;
  box-shadow:
    inset 0 -7px 0 rgba(0, 0, 0, 0.25),
    0 5px 0 #050505;
}

.action-button:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.25),
    0 1px 0 #050505;
}

.a-button {
  background: var(--blue);
}

.b-button {
  margin-top: 24px;
  background: var(--red);
}

.capture-control {
  margin-top: 54px;
}

.capture-button {
  width: 46px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: #d5b83e;
  color: #111;
  cursor: pointer;
  font-family: "Archivo Black", sans-serif;
  font-size: 11px;
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 #050505;
}

.capture-button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 1px 0 #050505;
}

.capture-button:disabled {
  cursor: default;
  filter: grayscale(1);
  opacity: 0.35;
}

.console-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  min-height: 30px;
  color: #555;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
}

.collection-progress {
  display: grid;
  gap: 6px;
  width: 210px;
  margin-left: 20px;
  color: #6f6f6f;
}

.collection-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.collection-progress strong {
  color: var(--cream);
  font-family: "Archivo Black", sans-serif;
  font-size: 13px;
}

.collection-track {
  height: 5px;
  border: 1px solid #3a3a3a;
  background: #050505;
}

.collection-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 400ms steps(10);
}

.collection-progress small {
  font-size: 6px;
  letter-spacing: 0.8px;
}

.speaker {
  display: flex;
  gap: 8px;
  margin-left: 20px;
  transform: rotate(-18deg);
}

.speaker i {
  width: 4px;
  height: 28px;
  border-radius: 4px;
  background: #050505;
  box-shadow: inset 1px 0 #262626;
}

.game-ledger {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(920px, 76vw);
  margin-top: 34px;
  border: 1px solid var(--line);
}

.game-ledger > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
}

.game-ledger > div:last-of-type {
  border-right: 0;
}

.game-ledger span,
.game-ledger p {
  color: #777;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
}

.game-ledger strong {
  font-family: "Archivo Black", sans-serif;
  font-size: 18px;
}

.game-ledger p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.game-ledger .ledger-action {
  grid-column: span 2;
  min-height: 42px;
  border: 0;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #0b0b0b;
  color: var(--cream);
  cursor: pointer;
  font-size: 8px;
  font-weight: 700;
}

.game-ledger .ledger-action.blue {
  border-right: 0;
  background: var(--blue);
}

.screen-overlay {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #e9ebe2;
  color: var(--screen-dark);
}

.screen-overlay[hidden] {
  display: none;
}

.overlay-heading {
  display: grid;
  gap: 8px;
  padding: 18px 20px 14px;
  border-bottom: 4px solid var(--screen-dark);
}

.overlay-heading span,
.overlay-help {
  font-size: 6px;
  letter-spacing: 0.5px;
}

.overlay-heading strong {
  font-size: 11px;
  line-height: 1.5;
}

.band-list {
  display: grid;
  min-height: 0;
}

.draft-band {
  --band-color: #5ed66d;
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 15px;
  min-height: 0;
  padding: 8px 20px;
  overflow: hidden;
  border: 0;
  border-bottom: 3px solid var(--screen-dark);
  background: var(--band-color);
  color: var(--screen-dark);
  cursor: pointer;
  text-align: left;
  font-family: var(--pixel);
}

.draft-band.is-dark-band {
  color: #f4f1e7;
}

.draft-band.is-dark-band .draft-band-meta,
.draft-band.is-dark-band .draft-band-stats {
  color: #f4f1e7;
}

.draft-band.is-dark-band .draft-hp-track {
  border-color: #f4f1e7;
  background: #292929;
}

.draft-band:last-child {
  border-bottom: 0;
}

.draft-band::before {
  position: absolute;
  z-index: 2;
  left: 7px;
  color: var(--blue);
  content: ">";
  opacity: 0;
}

.draft-band.is-selected::before {
  opacity: 1;
  animation: cursor-nudge 600ms steps(2) infinite;
}

.draft-band img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  image-rendering: pixelated;
}

.draft-band-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.draft-band-copy strong {
  font-size: 11px;
}

.draft-band-copy span,
.draft-band-meta {
  font-size: 6px;
  line-height: 1.5;
}

.draft-band-stats {
  color: var(--screen-dark);
}

.draft-hp-track {
  display: block;
  width: min(190px, 100%);
  height: 8px;
  overflow: hidden;
  border: 2px solid var(--screen-dark);
  background: rgba(238, 240, 231, 0.65);
}

.draft-hp-track i {
  display: block;
  height: 100%;
  background: #3dba68;
}

.draft-band-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.overlay-help {
  margin: 0;
  padding: 11px 20px;
  border-top: 4px solid var(--screen-dark);
  background: #eef0e7;
}

.hash-capture {
  position: absolute;
  z-index: 11;
  left: 24%;
  top: 43%;
  width: 28px;
  height: 28px;
  pointer-events: none;
  border: 3px solid #111;
  background: #efc43f;
  box-shadow:
    inset 0 0 0 3px #f8e98e,
    5px 5px 0 rgba(0, 0, 0, 0.35);
  opacity: 0;
}

.hash-capture::before {
  position: absolute;
  inset: 6px;
  content: "";
  background:
    linear-gradient(90deg, #111 0 25%, transparent 25% 50%, #111 50% 75%, transparent 75%),
    linear-gradient(#111 0 25%, transparent 25% 50%, #111 50% 75%, transparent 75%);
  background-size: 8px 8px;
}

.hash-capture::after {
  position: absolute;
  top: 8px;
  right: -10px;
  width: 7px;
  height: 7px;
  border: 2px solid #111;
  background: var(--blue);
  content: "";
}

.hash-capture i {
  position: absolute;
  z-index: 2;
  width: 4px;
  height: 4px;
  background: var(--blue);
}

.hash-capture i:nth-child(1) { top: 3px; left: 3px; }
.hash-capture i:nth-child(2) { top: 3px; right: 3px; }
.hash-capture i:nth-child(3) { right: 3px; bottom: 3px; }
.hash-capture i:nth-child(4) { bottom: 3px; left: 3px; }

.hash-capture span {
  position: absolute;
  right: -17px;
  bottom: 2px;
  width: 6px;
  height: 6px;
  border: 2px solid #111;
  background: #efc43f;
}

.hash-capture.is-thrown {
  animation: proof-packet-send 900ms steps(12) forwards;
}

.hash-capture.is-mining,
.hash-capture.is-confirmed,
.hash-capture.is-rejected {
  left: 79%;
  top: 17%;
}

.hash-capture.is-mining {
  animation: block-mining 360ms steps(3) infinite;
}

.hash-capture.is-mining i {
  animation: hash-bit 240ms steps(2) infinite alternate;
}

.hash-capture.is-confirmed {
  animation: block-confirmed 720ms steps(7) forwards;
}

.hash-capture.is-rejected {
  animation: block-rejected 520ms steps(5) forwards;
}

.save-dialog {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid #5b5b5b;
  background: #0b0b0b;
  color: var(--cream);
  box-shadow: 0 30px 100px #000;
  font-family: "Plex Mono", monospace;
}

.save-dialog::backdrop {
  background: rgba(0, 0, 0, 0.84);
}

.save-dialog form {
  padding: 24px;
}

.save-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.save-dialog-head > div {
  display: grid;
  gap: 5px;
}

.save-dialog-head span,
.save-dialog label,
.save-dialog p,
.import-panel span {
  color: #888;
  font-size: 9px;
  line-height: 1.6;
  letter-spacing: 0.5px;
}

.save-dialog-head strong {
  font-family: "Archivo Black", sans-serif;
  font-size: 25px;
}

.save-dialog button {
  min-height: 42px;
  border: 1px solid #484848;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.save-dialog textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid #414141;
  background: #050505;
  color: var(--cream);
  font: 10px/1.6 "Plex Mono", monospace;
  padding: 13px;
}

.save-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.save-actions button:first-child,
.import-panel button {
  background: var(--blue);
  border-color: var(--blue);
}

.import-panel {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.import-panel[hidden] {
  display: none;
}

@keyframes sprite-hit {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-12px); }
  50% { transform: translateX(12px); }
  75% { transform: translateX(-7px); }
}

@keyframes sprite-attack {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(20px); }
}

@keyframes hash-scan {
  0%, 100% { filter: brightness(1) contrast(1.08); }
  50% { filter: brightness(1.9) contrast(1.4) saturate(0); }
}

@keyframes encode-into-block {
  0% { transform: scale(1); opacity: 1; filter: brightness(1); }
  40% { transform: scale(0.72); opacity: 1; filter: brightness(2) saturate(0); }
  75% { transform: scale(0.18); opacity: 0.75; filter: brightness(3) saturate(0); }
  100% { transform: scale(0); opacity: 0; filter: brightness(4) saturate(0); }
}

@keyframes decode-from-block {
  0% { transform: scale(0); opacity: 0; filter: brightness(4) saturate(0); }
  45% { transform: scale(0.45); opacity: 1; filter: brightness(2) saturate(0); }
  100% { transform: scale(1); opacity: 1; filter: brightness(1) saturate(1); }
}

@keyframes field-impact {
  0%, 100% { opacity: 0; }
  35%, 65% { opacity: 0.7; }
}

@keyframes proof-packet-send {
  0% { left: 24%; top: 43%; opacity: 1; transform: rotate(0) scale(0.75); }
  38% { left: 48%; top: 7%; opacity: 1; transform: rotate(90deg) scale(1.15); }
  78% { left: 72%; top: 13%; opacity: 1; transform: rotate(180deg) scale(0.9); }
  100% { left: 79%; top: 17%; opacity: 1; transform: rotate(180deg) scale(1); }
}

@keyframes block-mining {
  0%, 100% {
    opacity: 1;
    transform: translate(0, 0);
    box-shadow: inset 0 0 0 3px #f8e98e, 5px 5px 0 rgba(0, 0, 0, 0.35);
  }
  33% {
    opacity: 1;
    transform: translate(-5px, 2px);
    box-shadow: inset 0 0 0 3px #fff, 10px 0 0 var(--blue);
  }
  66% {
    opacity: 1;
    transform: translate(5px, -2px);
    box-shadow: inset 0 0 0 3px #fff, -10px 0 0 var(--red);
  }
}

@keyframes hash-bit {
  100% { background: #fff; transform: scale(1.8); }
}

@keyframes block-confirmed {
  0% { opacity: 1; transform: scale(1); background: #efc43f; }
  35% { opacity: 1; transform: scale(1.8); background: #fff; }
  65% { opacity: 1; transform: translate(20px, -12px) scale(1); background: var(--blue); }
  100% { opacity: 0; transform: translate(80px, -28px) scale(0.4); background: var(--blue); }
}

@keyframes block-rejected {
  0% { opacity: 1; transform: scale(1); }
  35% { opacity: 1; transform: scale(1.8) rotate(12deg); background: var(--red); }
  65% { opacity: 1; transform: scale(0.9) rotate(-12deg); }
  100% { opacity: 0; transform: scale(2.8) rotate(30deg); background: var(--red); }
}

@keyframes fx-flame {
  0% { opacity: 0; transform: translate(var(--x), 45px) scale(0.5); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x-tight), -55px) scale(1.5); }
}

@keyframes fx-bite {
  0% { opacity: 0; transform: translate(var(--x), var(--row)); }
  45%, 70% { opacity: 1; transform: translate(var(--x-tight), var(--row-tight)); }
  100% { opacity: 0; transform: translate(var(--x-tight), 0); }
}

@keyframes fx-orbit {
  0% { opacity: 0; transform: rotate(var(--angle)) translateX(72px) scale(0.5); }
  35%, 70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(calc(var(--angle) + 210deg)) translateX(5px) scale(1.5); }
}

@keyframes fx-block-drop {
  0% { opacity: 0; transform: translate(var(--x), -75px); }
  40%, 80% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x-tight), var(--stack)); }
}

@keyframes fx-glitch {
  0%, 100% { opacity: 0; }
  20% { opacity: 1; transform: translate(var(--glitch-x), var(--glitch-y)); }
  40% { opacity: 0; transform: translate(var(--glitch-x-alt), var(--glitch-y-alt)); }
  60%, 80% { opacity: 1; transform: translate(var(--x-tight), var(--glitch-y)); }
}

@keyframes fx-rune-cut {
  0% { opacity: 0; transform: rotate(var(--cut-angle)) translateX(-75px); }
  35%, 75% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--cut-angle)) translateX(55px); }
}

@keyframes fx-splatter {
  0% { opacity: 0; transform: translate(0, 0) scale(0.2); }
  30%, 75% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--angle)) translateX(var(--radius)) scale(var(--particle-scale)); }
}

@keyframes fx-bloom {
  0% { opacity: 0; transform: rotate(var(--angle)) translateX(5px) scale(0.1); }
  45%, 80% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--angle)) translateX(62px) rotate(180deg) scale(1.25); }
}

@keyframes prompt-blink {
  50% { opacity: 0; }
}

@keyframes cursor-nudge {
  50% { transform: translateX(3px); }
}

@media (max-width: 1050px) {
  .stage-copy {
    position: relative;
    top: auto;
    left: auto;
    justify-self: start;
    width: min(920px, 92vw);
  }

  .stage-copy h1 {
    font-size: 54px;
  }

  .handheld,
  .game-ledger {
    width: min(920px, 92vw);
  }

  .handheld {
    margin-top: 50px;
  }
}

@media (max-width: 720px) {
  .game-topbar {
    grid-template-columns: 145px 1fr;
    min-height: 60px;
  }

  .game-wordmark {
    padding: 0 16px;
    font-size: 20px;
  }

  .game-status {
    display: none;
  }

  .back-link {
    padding: 0 14px;
    font-size: 8px;
  }

  .game-stage {
    min-height: calc(100vh - 60px);
    padding: 48px 10px 42px;
  }

  .game-stage::before {
    inset: 18px 10px;
  }

  .stage-copy {
    width: 100%;
    padding: 0 10px;
  }

  .stage-copy h1 {
    font-size: 42px;
    letter-spacing: -2.5px;
  }

  .stage-copy p {
    font-size: 7px;
  }

  .handheld {
    width: 100%;
    margin-top: 36px;
    padding: 27px 14px 23px;
    border-radius: 24px 24px 64px 24px;
  }

  .console-brand {
    font-size: 13px;
  }

  .screen-bezel {
    padding: 17px 11px 24px;
    border-radius: 12px 12px 38px 12px;
  }

  .fighter-status {
    width: 45%;
    padding: 7px;
    border-width: 2px;
    box-shadow: 3px 3px 0 rgba(23, 32, 29, 0.28);
  }

  .fighter-name {
    font-size: 5.5px;
  }

  .fighter-name span,
  .hp-numbers,
  .hp-row {
    font-size: 4.5px;
  }

  .hp-row {
    gap: 3px;
    margin-top: 4px;
  }

  .hp-track {
    height: 4px;
  }

  .battle-panel {
    grid-template-columns: 38% 62%;
    border-top-width: 2px;
  }

  .battle-message {
    padding: 9px 7px;
    font-size: 5.2px;
    line-height: 1.6;
  }

  .battle-readout {
    border-right-width: 2px;
  }

  .capture-odds {
    padding: 4px 6px;
    border-top-width: 1px;
    font-size: 3.8px;
  }

  .move-button {
    padding: 7px 3px 5px 12px;
    border-width: 1px;
    font-size: 4.5px;
  }

  .move-button::before {
    top: 8px;
    left: 3px;
  }

  .move-button span {
    font-size: 3.5px;
  }

  .console-controls {
    grid-template-columns: 1fr 1.35fr;
    min-height: 150px;
    padding: 14px 4px 0;
  }

  .dpad-wrap {
    grid-column: 1;
  }

  .dpad {
    grid-template-columns: repeat(3, 29px);
    grid-template-rows: repeat(3, 29px);
  }

  .system-buttons {
    display: none;
  }

  .action-buttons {
    grid-column: 2;
    gap: 5px;
    transform: translateX(7px) rotate(-10deg);
  }

  .action-button {
    width: 47px;
    height: 47px;
    font-size: 18px;
  }

  .b-button {
    margin-top: 18px;
  }

  .capture-control {
    margin-top: 39px;
  }

  .capture-button {
    width: 35px;
    height: 24px;
    font-size: 8px;
  }

  .console-footer {
    align-items: center;
    font-size: 5px;
  }

  .collection-progress {
    width: 145px;
    margin-left: 8px;
  }

  .collection-progress strong {
    font-size: 9px;
  }

  .collection-progress small {
    font-size: 4px;
  }

  .speaker {
    display: none;
  }

  .overlay-heading {
    gap: 4px;
    padding: 9px 10px 7px;
    border-bottom-width: 2px;
  }

  .overlay-heading span,
  .overlay-help {
    font-size: 4px;
  }

  .overlay-heading strong {
    font-size: 6.5px;
  }

  .draft-band {
    grid-template-columns: 48px 1fr auto;
    gap: 7px;
    padding: 3px 9px;
    border-bottom-width: 2px;
  }

  .draft-band::before {
    left: 2px;
    font-size: 5px;
  }

  .draft-band img {
    width: 43px;
    height: 43px;
  }

  .draft-band-copy {
    gap: 3px;
  }

  .draft-band-copy strong {
    font-size: 6px;
  }

  .draft-band-copy span,
  .draft-band-meta {
    font-size: 3.5px;
  }

  .draft-hp-track {
    height: 5px;
    border-width: 1px;
  }

  .overlay-help {
    padding: 6px 10px;
    border-top-width: 2px;
  }

  .save-dialog form {
    padding: 17px;
  }

  .save-dialog-head strong {
    font-size: 19px;
  }

  .save-actions {
    grid-template-columns: 1fr;
  }

  .game-ledger {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    margin-top: 20px;
  }

  .game-ledger > div:nth-child(2) {
    border-right: 0;
  }

  .game-ledger > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .game-ledger > div {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
