:root {
  color-scheme: dark;
  --ink: #070719;
  --ink-2: #101040;
  --blue: #3337db;
  --cyan: #47d7ff;
  --red: #ff3d50;
  --yellow: #ffe34e;
  --orange: #ff8a1f;
  --white: #f4f5ff;
  --muted: #a7aed1;
  --panel: rgba(10, 11, 45, 0.92);
  --line: rgba(89, 118, 255, 0.45);
  --shadow: 0 0 24px rgba(48, 56, 255, 0.3);
  font-family: "Courier New", "MS Gothic", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #050512;
}

body {
  color: var(--white);
  overflow-x: hidden;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.game-shell {
  position: relative;
  width: min(100%, 920px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 14%, rgba(61, 66, 255, 0.46), transparent 36%),
    radial-gradient(circle at 15% 75%, rgba(0, 185, 255, 0.12), transparent 35%),
    linear-gradient(135deg, #03030e 0%, #0a0a2b 52%, #17158b 100%);
  border-inline: 1px solid rgba(85, 101, 255, 0.3);
}

.game-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: screen;
}

.audio-toggle {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, calc((100vw - 920px) / 2 + 10px));
  z-index: 95;
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(71, 215, 255, 0.65);
  border-radius: 0;
  color: #adb6df;
  background: rgba(5, 6, 27, 0.9);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.65);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  touch-action: manipulation;
}

.audio-toggle-dot {
  width: 8px;
  height: 8px;
  border: 1px solid #68709d;
  background: #303550;
}

.audio-toggle.is-on {
  border-color: var(--yellow);
  color: var(--yellow);
}

.audio-toggle.is-on .audio-toggle-dot {
  border-color: var(--yellow);
  background: #34df7b;
  box-shadow: 0 0 8px #34df7b;
}

.audio-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.screen {
  position: relative;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

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

.screen--active {
  animation: screen-in 240ms ease-out both;
}

.eyebrow {
  margin: 0;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-shadow: 0 0 10px rgba(255, 61, 80, 0.75);
}

.title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  isolation: isolate;
}

.title-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(110deg, transparent 42%, rgba(63, 68, 255, 0.22) 42% 58%, transparent 58%),
    repeating-linear-gradient(90deg, transparent 0 52px, rgba(67, 86, 255, 0.08) 52px 54px);
}

.game-logo {
  display: grid;
  margin: 0;
  text-align: center;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(3rem, 13vw, 6.8rem);
  font-style: italic;
  line-height: 0.78;
  letter-spacing: -0.045em;
  transform: skew(-5deg) rotate(-2deg);
  filter: drop-shadow(8px 8px 0 #06061a) drop-shadow(0 0 20px rgba(255, 38, 48, 0.35));
}

.game-logo span:first-child {
  color: var(--red);
  -webkit-text-stroke: 1px #ff9b26;
}

.game-logo span:last-child {
  color: var(--yellow);
  -webkit-text-stroke: 1px #ff531e;
}

.title-cards {
  position: relative;
  width: min(84vw, 420px);
  height: clamp(230px, 43vh, 370px);
  margin-block: -4px 4px;
}

.title-cards img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(39vw, 175px);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 28%;
  border: 3px solid rgba(103, 130, 255, 0.7);
  box-shadow: 0 12px 30px #000, 0 0 18px rgba(68, 87, 255, 0.5);
}

.title-cards img:nth-child(1) {
  transform: translate(-120%, -48%) rotate(-10deg);
}

.title-cards img:nth-child(2) {
  z-index: 2;
  transform: translate(-50%, -52%) scale(1.07);
}

.title-cards img:nth-child(3) {
  transform: translate(20%, -48%) rotate(10deg);
}

.pixel-button {
  position: relative;
  min-height: 54px;
  padding: 13px 24px;
  border: 2px solid var(--yellow);
  border-radius: 0;
  color: #141414;
  background: linear-gradient(#fff25d, #ffad21);
  box-shadow: 5px 5px 0 #aa1d20, 0 0 18px rgba(255, 217, 52, 0.45);
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
  touch-action: manipulation;
}

.pixel-button:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #aa1d20;
}

.pixel-button--start {
  width: min(82vw, 360px);
  animation: button-pulse 1.15s steps(2, end) infinite;
}

.pixel-button--secondary {
  border-color: #6570d7;
  color: var(--white);
  background: #15174e;
  box-shadow: 5px 5px 0 #050515;
}

.title-note,
.game-stat-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.die-games-link {
  color: #c8ceef;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-shadow: 2px 2px 0 #050515;
}

.die-games-link:hover {
  color: var(--yellow);
}

.die-games-link:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

.screen-header,
.battle-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.select-screen .screen-header,
.battle-screen .battle-header {
  margin-top: 34px;
}

.screen-header h2,
.battle-header h2 {
  margin: 2px 0 0;
  font-size: clamp(1.15rem, 5vw, 1.7rem);
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--cyan);
  background: rgba(7, 8, 31, 0.75);
  font-size: 1.35rem;
  cursor: pointer;
  touch-action: manipulation;
}

.header-number {
  color: var(--yellow);
  font-size: 1.25rem;
  font-weight: 900;
  text-align: right;
}

.fighter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 720px;
  margin: 0 auto 14px;
}

.fighter-tile {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(79, 102, 241, 0.62);
  border-radius: 0;
  color: var(--white);
  background: #080923;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55);
  cursor: pointer;
  touch-action: manipulation;
}

.fighter-tile::after {
  content: "SELECT";
  position: absolute;
  inset: auto 0 0;
  padding: 6px 4px;
  color: #0b0b1a;
  background: var(--yellow);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(100%);
  transition: 120ms ease-out;
}

.fighter-tile:hover,
.fighter-tile:focus-visible {
  border-color: var(--yellow);
  transform: translateY(-2px);
}

.fighter-tile:hover::after,
.fighter-tile:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.fighter-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 0.78;
  object-fit: cover;
  object-position: 50% 31%;
  filter: saturate(1.07) contrast(1.04);
}

.fighter-tile-name {
  display: block;
  min-height: 37px;
  padding: 7px 4px 6px;
  overflow: hidden;
  color: var(--yellow);
  font-size: clamp(0.75rem, 2.8vw, 0.9rem);
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-screen {
  display: flex;
  height: 100dvh;
  min-height: 620px;
  flex-direction: column;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

.battle-header {
  grid-template-columns: 36px 1fr 94px;
  min-height: 36px;
  flex: 0 0 auto;
  margin: 0 0 4px;
  gap: 5px;
}

.battle-screen .battle-header {
  margin: 0 0 4px;
}

.battle-heading {
  text-align: center;
}

.battle-heading h2 {
  margin: 0;
  color: var(--red);
  font-size: clamp(0.75rem, 3vw, 1rem);
  letter-spacing: 0.12em;
  text-shadow: 0 0 9px rgba(255, 45, 63, 0.65);
}

.battle-header .icon-button {
  width: 34px;
  height: 34px;
  font-size: 1rem;
}

.hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px minmax(0, 1fr);
  align-items: stretch;
  gap: 4px;
  flex: 0 0 auto;
  margin-bottom: 5px;
  padding: 5px;
  border: 2px solid rgba(36, 115, 255, 0.72);
  background: linear-gradient(180deg, rgba(4, 8, 32, 0.97), rgba(8, 12, 48, 0.94));
  box-shadow: inset 0 0 16px rgba(22, 69, 194, 0.26);
}

.hud-side {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: stretch;
  gap: 5px;
  min-width: 0;
}

.hud-side--cpu {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.hud-bars {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
}

.hud-portrait {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 2px solid #246fff;
  background: linear-gradient(145deg, #07102c, #0b2159);
  box-shadow: inset 0 0 10px rgba(47, 164, 255, 0.42);
}

.hud-portrait img {
  position: absolute;
  top: -3%;
  left: 50%;
  display: block;
  width: 215%;
  max-width: none;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 2px #000);
  transform: translateX(-50%);
}

.hud-name-row {
  display: flex;
  justify-content: space-between;
  gap: 3px;
  min-width: 0;
  color: #fff;
  font-size: clamp(0.62rem, 2.65vw, 0.9rem);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 2px 2px 0 #000;
}

.hud-name-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-side--cpu .hud-name-row {
  flex-direction: row-reverse;
}

.meter-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.hud-side--cpu .meter-line {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.hud-side--cpu .meter-label {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.hud-side--cpu .meter {
  grid-column: 1;
  grid-row: 1;
}

.meter-label {
  color: var(--red);
  font-size: clamp(0.54rem, 2vw, 0.7rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 0 #000;
}

.meter-line:last-child .meter-label {
  color: var(--cyan);
  letter-spacing: -0.06em;
}

.meter-label strong {
  color: #fff;
  font-size: 0.58rem;
}

.meter {
  height: 13px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid rgba(201, 221, 255, 0.88);
  background: rgba(0, 0, 0, 0.65);
  box-shadow: 1px 1px 0 #000;
}

.meter span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  transition: width 420ms steps(8, end), background-color 180ms linear;
}

.hud-side--cpu .meter span {
  margin-left: auto;
  transform-origin: right;
}

.meter--hp span {
  background: linear-gradient(90deg, #ff334c 0%, #ff8c1f 56%, #fff04e 100%);
  box-shadow: 0 0 8px rgba(255, 102, 42, 0.62);
}

.meter--spirit {
  height: 9px;
  border-color: rgba(71, 215, 255, 0.55);
}

.meter--spirit span {
  width: 0;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.meter--spirit.is-full span {
  background: var(--yellow);
  box-shadow: 0 0 10px var(--yellow);
  animation: spirit-pulse 600ms steps(2, end) infinite;
}

.hud-clock {
  display: grid;
  align-content: center;
  color: var(--yellow);
  text-align: center;
  text-shadow: 2px 2px 0 #4b1d00, 0 0 8px rgba(255, 226, 66, 0.56);
}

.hud-clock span {
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.hud-clock strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.8rem, 8vw, 2.75rem);
  line-height: 0.82;
}

.arena {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-height: 330px;
  max-height: 600px;
  overflow: hidden;
  border: 2px solid var(--line);
  background:
    linear-gradient(to bottom, rgba(1, 3, 16, 0.08), rgba(2, 3, 16, 0.08) 58%, rgba(1, 2, 12, 0.2)),
    url("assets/arena-deathmatch.png") center / cover no-repeat,
    #050615;
  box-shadow: inset 0 0 40px rgba(28, 35, 152, 0.5), var(--shadow);
  perspective: 900px;
}

.arena::before,
.arena::after {
  position: absolute;
  top: 24%;
  z-index: 2;
  padding: 7px 4px;
  border: 1px solid rgba(255, 56, 70, 0.34);
  color: rgba(255, 57, 70, 0.58);
  background: rgba(4, 5, 21, 0.44);
  font-size: clamp(0.55rem, 2.2vw, 0.85rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  text-shadow: 0 0 7px rgba(255, 35, 50, 0.55);
}

.arena::before {
  left: 1.2%;
  content: "デスマッチ";
}

.arena::after {
  right: 1.2%;
  content: "生き残れ";
}

.arena-lighting {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(108deg, rgba(255, 20, 42, 0.14), transparent 26%),
    linear-gradient(252deg, rgba(24, 67, 255, 0.2), transparent 27%),
    radial-gradient(ellipse at 50% 72%, transparent 48%, rgba(0, 0, 0, 0.38) 100%);
  mix-blend-mode: screen;
}

.arena-brand {
  position: absolute;
  top: 5%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: max-content;
  color: #ff4857;
  text-align: center;
  text-shadow: 0 0 8px rgba(255, 39, 54, 0.85), 3px 3px 0 #24040d;
  transform: translateX(-50%);
  pointer-events: none;
}

.arena-brand strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.6rem, 7.5vw, 3.4rem);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
}

.arena-brand span {
  font-size: clamp(0.65rem, 2.8vw, 1.15rem);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.combatant {
  --sprite-scale: 100%;
  --sprite-offset: 0%;
  position: absolute;
  bottom: 13%;
  z-index: 4;
  display: flex;
  width: 44%;
  height: 66%;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-end;
  transition: filter 120ms linear;
}

.combatant--player {
  left: 2%;
  transform: rotateY(7deg);
}

.combatant--cpu {
  right: 2%;
  transform: rotateY(-7deg);
}

/* Normalize visible body height across different sprite canvases; Kaseda is intentionally larger. */
.combatant[data-fighter-id="mogami"] { --sprite-scale: 93%; --sprite-offset: 2.4%; }
.combatant[data-fighter-id="wakamatsu"] { --sprite-scale: 96.5%; --sprite-offset: 0.3%; }
.combatant[data-fighter-id="kaseda"] { --sprite-scale: 111%; --sprite-offset: -1.9%; }
.combatant[data-fighter-id="tababa"] { --sprite-scale: 103%; --sprite-offset: -2.2%; }
.combatant[data-fighter-id="murota"] { --sprite-scale: 100%; --sprite-offset: -0.2%; }
.combatant[data-fighter-id="sakuda"] { --sprite-scale: 97.5%; --sprite-offset: 0.9%; }
.combatant[data-fighter-id="ueki"] { --sprite-scale: 103%; --sprite-offset: -1.4%; }
.combatant[data-fighter-id="ancham"] { --sprite-scale: 99%; --sprite-offset: -1%; }
.combatant[data-fighter-id="shm"] { --sprite-scale: 99%; --sprite-offset: 0.2%; }

.fighter-sprite {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: visible;
}

.fighter-sprite::after {
  content: "";
  position: absolute;
  right: 2%;
  bottom: 2%;
  left: 2%;
  height: 32%;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 224, 68, 0.55), rgba(255, 44, 50, 0.08) 52%, transparent 72%);
  opacity: 0;
}

.combatant.is-ready .fighter-sprite::after {
  opacity: 0.9;
  animation: spirit-pulse 600ms steps(2, end) infinite;
}

.fighter-sprite img {
  position: absolute;
  bottom: var(--sprite-offset);
  left: 50%;
  display: block;
  width: auto;
  max-width: none;
  height: var(--sprite-scale);
  filter: drop-shadow(5px 7px 2px rgba(0, 0, 0, 0.68));
  image-rendering: pixelated;
  transform: translateX(-50%);
  user-select: none;
  -webkit-user-drag: none;
}

.combatant-name {
  display: block;
  width: 100%;
  margin: 1px auto 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(0.7rem, 3.2vw, 1.1rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 2px 2px 0 #050510, -1px -1px 0 #050510, 0 0 7px #050510;
  white-space: nowrap;
}

.combatant-side {
  display: none;
}

.impact-zone {
  position: absolute;
  top: 53%;
  left: 50%;
  z-index: 7;
  display: grid;
  width: 22%;
  min-height: 90px;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.arena-apron-logo {
  position: absolute;
  bottom: 1.6%;
  left: 50%;
  z-index: 3;
  display: grid;
  width: max-content;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-style: italic;
  line-height: 0.72;
  text-align: center;
  transform: translateX(-50%) skew(-7deg) rotate(-2deg);
  filter: drop-shadow(3px 3px 0 #10030a);
  pointer-events: none;
}

.arena-apron-logo span {
  color: var(--red);
  font-size: clamp(0.9rem, 4.7vw, 2rem);
  letter-spacing: -0.02em;
  -webkit-text-stroke: 0.4px var(--orange);
}

.arena-apron-logo strong {
  color: var(--yellow);
  font-size: clamp(1.25rem, 6.5vw, 2.8rem);
  letter-spacing: -0.03em;
  -webkit-text-stroke: 0.5px var(--red);
}

#impact-text {
  display: block;
  color: var(--yellow);
  font-family: Impact, sans-serif;
  font-size: clamp(1.2rem, 7vw, 2.7rem);
  font-style: italic;
  text-align: center;
  text-shadow: 3px 3px 0 #a21520, -2px -2px 0 #111;
  opacity: 0;
}

#impact-text.is-visible {
  animation: impact-pop 580ms steps(4, end) both;
}

.combatant.is-attacking-player {
  animation: attack-right 420ms ease-in-out;
}

.combatant.is-attacking-cpu {
  animation: attack-left 420ms ease-in-out;
}

.combatant.is-hit {
  animation: hit-shake 460ms steps(3, end);
  filter: brightness(2) saturate(0.4);
}

.combatant.is-guarding .fighter-sprite img {
  filter: drop-shadow(0 0 13px rgba(71, 215, 255, 0.95)) brightness(1.08);
}

.combatant.is-ko {
  animation: ko-fall 650ms ease-in forwards;
  filter: grayscale(0.8) brightness(0.55);
}

.match-call {
  position: relative;
  display: flex;
  min-height: 58px;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  margin-block: 5px;
  padding: 7px 38px 7px 12px;
  border: 2px solid #35a0ff;
  background: rgba(2, 5, 22, 0.96);
  box-shadow: inset 0 0 0 2px rgba(29, 61, 139, 0.6), 3px 3px 0 rgba(0, 0, 0, 0.55);
}

.match-call::after {
  content: "▼";
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: #fff;
  font-size: 0.75rem;
}

.match-call strong {
  overflow: hidden;
  color: var(--yellow);
  font-size: 0.78rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-call span {
  overflow: hidden;
  color: #f4f6ff;
  font-size: clamp(0.72rem, 3vw, 0.9rem);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  flex: 0 0 auto;
}

.command {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 82px;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 8px 3px 6px;
  border: 2px solid #ff5a62;
  border-bottom-width: 5px;
  border-radius: 0;
  color: var(--white);
  background: linear-gradient(145deg, #a31622, #470911);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.11), 3px 3px 0 rgba(0, 0, 0, 0.62);
  cursor: pointer;
  touch-action: manipulation;
}

.command:hover:not(:disabled),
.command:focus-visible:not(:disabled) {
  border-color: var(--yellow);
  filter: brightness(1.25);
}

.command:active:not(:disabled) {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.command:disabled {
  cursor: not-allowed;
  filter: grayscale(0.75) brightness(0.55);
}

.command strong,
.command small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command strong {
  width: 100%;
  color: #fff;
  font-size: clamp(0.68rem, 3.05vw, 1rem);
  line-height: 1.05;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
}

.command small {
  display: none;
}

.command-key {
  position: absolute;
  top: 3px;
  left: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.58rem;
  font-weight: 900;
}

.command-icon {
  display: grid;
  width: clamp(24px, 8vw, 37px);
  height: clamp(24px, 8vw, 37px);
  place-items: center;
  color: #fff;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.75));
}

.command-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.command--grapple {
  border-color: #39a2ff;
  background: linear-gradient(145deg, #165db4, #09265d);
}

.command--weapon {
  border-color: #ffd54e;
  background: linear-gradient(145deg, #bc8114, #644107);
}

.command--guard {
  border-color: #45ef9c;
  background: linear-gradient(145deg, #128b4e, #064327);
}

.command--signature {
  grid-column: auto;
  min-height: 82px;
  border-color: #c875ff;
  background: linear-gradient(145deg, #7c2dc1, #35105f);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.11), 0 0 15px rgba(162, 69, 255, 0.28), 3px 3px 0 rgba(0, 0, 0, 0.62);
}

#signature-name {
  display: -webkit-box;
  min-height: 2.1em;
  overflow: hidden;
  font-size: clamp(0.5rem, 2.2vw, 0.78rem);
  line-height: 1.05;
  white-space: normal;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.command--signature:not(:disabled) {
  animation: signature-ready 620ms steps(2, end) infinite;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 2, 13, 0.83);
  backdrop-filter: blur(5px);
}

.result-panel {
  width: min(100%, 440px);
  padding: 28px 22px;
  border: 3px solid var(--yellow);
  background:
    linear-gradient(135deg, rgba(51, 55, 219, 0.3), transparent 42%),
    #0a0b2e;
  box-shadow: 10px 10px 0 #9c1822, 0 0 45px rgba(255, 70, 66, 0.28);
  text-align: center;
  animation: result-in 340ms steps(5, end) both;
}

.result-panel h2 {
  margin: 10px 0 6px;
  color: var(--yellow);
  font-family: Impact, sans-serif;
  font-size: clamp(3rem, 14vw, 5.7rem);
  font-style: italic;
  line-height: 0.9;
  text-shadow: 5px 5px 0 #a31924;
}

.result-panel p:not(.eyebrow) {
  min-height: 24px;
  margin: 14px 0 22px;
  color: #d5dafb;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.die-games-link--result {
  display: inline-block;
  margin-top: 22px;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes button-pulse {
  50% { filter: brightness(1.25); }
}

@keyframes spirit-pulse {
  50% { filter: brightness(1.6); }
}

@keyframes card-shine {
  0%, 40% { transform: translateX(-130%); }
  75%, 100% { transform: translateX(130%); }
}

@keyframes impact-pop {
  0% { opacity: 0; transform: scale(3) rotate(-8deg); }
  20%, 70% { opacity: 1; transform: scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: scale(0.8) rotate(3deg); }
}

@keyframes attack-right {
  0%, 100% { transform: rotateY(7deg) translateX(0); }
  48% { transform: rotateY(2deg) translateX(36px) scale(1.04); }
}

@keyframes attack-left {
  0%, 100% { transform: rotateY(-7deg) translateX(0); }
  48% { transform: rotateY(-2deg) translateX(-36px) scale(1.04); }
}

@keyframes hit-shake {
  0%, 100% { translate: 0; }
  25% { translate: -10px 2px; }
  50% { translate: 9px -3px; }
  75% { translate: -5px 2px; }
}

@keyframes ko-fall {
  to { transform: translateY(34px) rotate(10deg); opacity: 0.45; }
}

@keyframes signature-ready {
  50% { filter: brightness(1.45); box-shadow: 0 0 28px rgba(255, 220, 55, 0.55); }
}

@keyframes result-in {
  from { opacity: 0; transform: scale(0.72); }
  to { opacity: 1; transform: scale(1); }
}

@media (min-width: 680px) {
  .fighter-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .fighter-grid .fighter-tile:nth-child(n + 6) {
    transform: translateX(50%);
  }

  .fighter-grid .fighter-tile:nth-child(n + 6):hover,
  .fighter-grid .fighter-tile:nth-child(n + 6):focus-visible {
    transform: translate(50%, -2px);
  }

  .battle-screen {
    padding-inline: 28px;
  }

  .command-panel {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .command--signature {
    grid-column: auto;
  }
}

@media (max-height: 660px) and (orientation: landscape) {
  .battle-screen {
    display: grid;
    grid-template-columns: minmax(330px, 1fr) minmax(280px, 0.72fr);
    grid-template-rows: auto auto 1fr;
    gap: 8px 14px;
  }

  .battle-header,
  .hud {
    grid-column: 1 / -1;
    margin: 0;
  }

  .arena {
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
    height: 100%;
  }

  .match-call,
  .command-panel {
    grid-column: 2;
  }

  .match-call {
    grid-row: 3;
    align-self: start;
    margin: 0;
  }

  .command-panel {
    grid-row: 3;
    align-self: end;
    grid-template-columns: 1fr 1fr;
  }

  .command--signature {
    grid-column: 1 / -1;
  }
}

@media (max-width: 370px) {
  .screen {
    padding-inline: 10px;
  }

  .fighter-grid {
    gap: 7px;
  }

  .arena {
    min-height: 310px;
  }

  .command-panel {
    gap: 5px;
  }

  .command {
    min-height: 64px;
  }

  .command small {
    display: none;
  }
}

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