* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: Arial, sans-serif;
  touch-action: manipulation;
}

body {
  position: fixed;
  inset: 0;
}

button,
input {
  font: inherit;
  border: none;
  outline: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #111;
}

.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hidden {
  display: none;
}

.active {
  display: block;
}

.screenBg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.splashBg {
  background: #000;
}

.menuBg {
  background: #000;
  background-size: 140px 140px, 220px 220px, cover;
}

.countdownBg {
  background: rgba(0, 0, 0, 0.82);
}

.splashContent {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
}

.logoImage {
  width: min(82vw, 420px);
  height: auto;
  display: block;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 0 8px rgba(255, 120, 0, 0.35))
    drop-shadow(0 0 18px rgba(255, 80, 0, 0.28))
    drop-shadow(0 0 28px rgba(255, 180, 0, 0.18));
  animation: logoBreath 2.2s ease-in-out infinite, flameFlicker 1.8s ease-in-out infinite;
}

.menuLogoImage {
  width: min(60vw, 280px);
  margin: 0 auto 18px;
}

@keyframes logoBreath {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes flameFlicker {
  0% {
    filter:
      drop-shadow(0 0 8px rgba(255, 120, 0, 0.35))
      drop-shadow(0 0 18px rgba(255, 80, 0, 0.28))
      drop-shadow(0 0 28px rgba(255, 180, 0, 0.18));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(255, 140, 0, 0.45))
      drop-shadow(0 0 24px rgba(255, 90, 0, 0.34))
      drop-shadow(0 0 36px rgba(255, 200, 0, 0.24));
  }
  100% {
    filter:
      drop-shadow(0 0 8px rgba(255, 120, 0, 0.35))
      drop-shadow(0 0 18px rgba(255, 80, 0, 0.28))
      drop-shadow(0 0 28px rgba(255, 180, 0, 0.18));
  }
}

#tapToPlay {
  position: absolute;
  bottom: calc(34px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.95);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow:
    0 0 8px rgba(255,255,255,0.65),
    0 0 16px rgba(255,255,255,0.45),
    2px 2px 0 rgba(0,0,0,0.8);
  animation: tapGlow 1.4s ease-in-out infinite;
}

@keyframes tapGlow {
  0% { opacity: 0.35; }
  50% { opacity: 1; }
  100% { opacity: 0.35; }
}

.menuWrap,
.subScreenWrap {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.menuWrap {
  justify-content: space-between;
}

.menuTop {
  margin-top: 24px;
  text-align: center;
}

.menuSubtitle {
  margin-top: 10px;
  color: rgba(255,255,255,0.78);
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
}

.currencyPill {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.currencyPill.small {
  margin-top: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.machineCurrencyWrap {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.menuButtons,
.bigOptionList {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menuButtons {
  margin-bottom: 30px;
}

.bigOptionList {
  margin-top: 24px;
}

.menuBtn {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  background: rgba(255,255,255,0.11);
  color: white;
  border: 2px solid rgba(255,255,255,0.16);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.menuBtn.primary {
  background: rgba(255,255,255,0.20);
}

.machineBtn {
  background: rgba(255, 177, 38, 0.18);
  border-color: rgba(255, 190, 60, 0.38);
}

.menuBtn:active {
  transform: scale(0.98);
}

.menuBtn:disabled {
  opacity: 0.45;
}

.subHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  color: white;
}

.subHeader h2 {
  margin: 0;
  font-size: 24px;
  text-shadow: 2px 2px 0 #000;
}

.backBtn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  color: white;
  border: 2px solid rgba(255,255,255,0.14);
  font-size: 22px;
}

.backSpacer {
  width: 42px;
  height: 42px;
}

.panel {
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 16px;
  color: white;
}

.panelTitle {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
}

.panelText {
  font-size: 14px;
  color: rgba(255,255,255,0.82);
  margin: 10px 0 14px;
}

.roomCodeBox {
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 4px;
}

.roomInput {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  border: 2px solid rgba(255,255,255,0.14);
  color: white;
  font-size: 22px;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.roomInput::placeholder {
  color: rgba(255,255,255,0.45);
}

.machineWrap {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.machineSubtitle {
  text-align: center;
  color: rgba(255,255,255,0.76);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
}

.machineArt {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.blackMarketMachine {
  position: relative;
  width: min(88vw, 360px);
  margin: 0 auto;
  filter: drop-shadow(0 0 18px rgba(255, 80, 0, 0.12));
}

.machineWarningTop {
  width: 80%;
  text-align: center;
  margin: 0 auto 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(to bottom, #751111, #420808);
  border: 2px solid rgba(255,255,255,0.12);
  color: #ffd86a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
}

.machineChamberFrame {
  position: relative;
  width: 100%;
  height: 250px;
  border-radius: 26px 26px 18px 18px;
  background:
    linear-gradient(to bottom, #272727, #111111);
  border: 4px solid rgba(255,255,255,0.14);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,0.35),
    0 0 0 2px rgba(255,90,0,0.08);
  padding: 16px;
}

.machineChamberGlass {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.20), transparent 30%),
    linear-gradient(to bottom, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    linear-gradient(to bottom, rgba(90,0,0,0.35), rgba(20,20,20,0.6));
  border: 3px solid rgba(255,255,255,0.08);
}

.machineWarningLight {
  position: absolute;
  top: 10px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff4b1f;
  box-shadow: 0 0 8px rgba(255,75,31,0.9), 0 0 18px rgba(255,75,31,0.45);
  animation: warningBlink 1.1s infinite alternate;
  z-index: 3;
}

.machineWarningLight.left { left: 10px; }
.machineWarningLight.right { right: 10px; }

@keyframes warningBlink {
  0% { opacity: 0.45; }
  100% { opacity: 1; }
}

.machineCapsules {
  position: absolute;
  inset: 0;
}

.capsule {
  position: absolute;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.16);
  box-shadow: 0 0 10px rgba(255,255,255,0.08);
}

.capsule::before,
.capsule::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.capsule::before {
  left: 1px;
  background: rgba(20,20,20,0.85);
  border: 1px solid rgba(255,255,255,0.08);
}

.capsule::after {
  right: 1px;
}

.capsule-red { left: 24px; top: 138px; transform: rotate(-18deg); }
.capsule-blue { left: 90px; top: 74px; transform: rotate(16deg); }
.capsule-green { left: 188px; top: 130px; transform: rotate(12deg); }
.capsule-yellow { left: 156px; top: 48px; transform: rotate(-20deg); }
.capsule-purple { left: 52px; top: 34px; transform: rotate(8deg); }

.capsule-red::after { background: #ff4a3d; box-shadow: 0 0 12px rgba(255,74,61,0.5); }
.capsule-blue::after { background: #3a7cff; box-shadow: 0 0 12px rgba(58,124,255,0.5); }
.capsule-green::after { background: #39d267; box-shadow: 0 0 12px rgba(57,210,103,0.5); }
.capsule-yellow::after { background: #e6c038; box-shadow: 0 0 12px rgba(230,192,56,0.5); }
.capsule-purple::after { background: #9d4fff; box-shadow: 0 0 12px rgba(157,79,255,0.5); }

.machineControlBody {
  position: relative;
  width: 88%;
  min-height: 170px;
  margin: -8px auto 0;
  border-radius: 18px;
  background: linear-gradient(to bottom, #701010, #360707);
  border: 4px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25);
  padding: 16px 14px 18px;
}

.hazardStripe {
  position: absolute;
  top: 14px;
  width: 14px;
  height: calc(100% - 28px);
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      180deg,
      #111 0px,
      #111 8px,
      #d8a51e 8px,
      #d8a51e 16px
    );
  opacity: 0.9;
}

.leftStripe { left: 8px; }
.rightStripe { right: 8px; }

.machinePanelRow {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
}

.machinePanelRow.bottom {
  margin-top: 12px;
  margin-bottom: 0;
}

.machineSmallLabel {
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.82);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.machineCenterPanel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 78px;
  justify-content: center;
}

.machineSlot {
  width: 92px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.machineLeverWrap {
  position: relative;
  width: 64px;
  height: 56px;
}

.machineLeverStem {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) rotate(-18deg);
  bottom: 6px;
  width: 10px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #d7d7d7, #8f8f8f);
  border: 2px solid rgba(0,0,0,0.25);
}

.machineLeverKnob {
  position: absolute;
  right: 8px;
  top: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff9a2f, #c33210);
  box-shadow: 0 0 10px rgba(255,90,25,0.35);
  border: 2px solid rgba(0,0,0,0.2);
}

.machinePullBtn {
  background: linear-gradient(to bottom, rgba(255,110,40,0.26), rgba(140,25,10,0.32));
  border-color: rgba(255,140,70,0.28);
}

.machineResultCard {
  display: flex;
  align-items: center;
  gap: 14px;
}

.machineResultThumb {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(0,0,0,0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 4px,
      rgba(0,0,0,0.04) 4px,
      rgba(0,0,0,0.04) 8px
    ),
    #1f1f1f;
  border: 2px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
}

.machineResultInfoName {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
}

.machineResultInfoMeta {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
}

.fightersGrid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 14px;
}

.fighterCardMini {
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 12px;
  color: white;
  text-align: center;
}

.fighterCardMini.selected {
  border-color: rgba(255,255,255,0.7);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.12);
}

.fighterThumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(0,0,0,0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 4px,
      rgba(0,0,0,0.04) 4px,
      rgba(0,0,0,0.04) 8px
    ),
    #2d2d2d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 24px;
  image-rendering: pixelated;
  margin-bottom: 10px;
}

.fighterMiniName {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.fighterMiniRarity {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
}

.fighterStatusText {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.82);
}

.selectedPreview {
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 14px;
  color: white;
}

.selectedPreviewTitle {
  font-size: 14px;
  color: rgba(255,255,255,0.76);
  margin-bottom: 10px;
}

.previewCard {
  display: flex;
  align-items: center;
  gap: 12px;
}

.previewThumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(0,0,0,0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 4px,
      rgba(0,0,0,0.04) 4px,
      rgba(0,0,0,0.04) 8px
    ),
    #2d2d2d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: white;
}

.previewInfoName {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 6px;
}

.previewInfoMeta {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
}

.readyBtn {
  margin-top: auto;
}

#countdownScreen {
  z-index: 60;
}

#countdownText {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 72px;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(255,255,255,0.35);
}

.rarity.common,
.fighterMiniRarity.common { background: #535353; }

.rarity.rare,
.fighterMiniRarity.rare { background: #2a63ff; }

.rarity.epic,
.fighterMiniRarity.epic { background: #7d34ff; }

.rarity.legendary,
.fighterMiniRarity.legendary { background: #d99200; }

.rarity.mythic,
.fighterMiniRarity.mythic { background: #d62f7d; }

#game {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #111;
}

#mapLayer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#hitFlash {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: rgba(255, 0, 0, 0);
  transition: background 0.12s ease;
}

#topHud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  padding: 10px 12px 0;
  align-items: start;
}

.hudCenter {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hudCard {
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  padding: 8px;
  color: #fff;
  min-width: 0;
}

.hudCard.right {
  text-align: right;
}

.fighterInfo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}

.hudCard.right .fighterInfo {
  flex-direction: row-reverse;
}

.rarity {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
}

.healthBarFrame {
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 2px solid rgba(255,255,255,0.16);
}

.healthBarFill {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #24f26c, #e3ff4d);
  transition: width 0.18s ease;
}

.hpText {
  margin-top: 4px;
  font-size: 11px;
}

#arena {
  position: absolute;
  top: 92px;
  left: 0;
  right: 0;
  bottom: 220px;
  z-index: 5;
}

.fighter {
  position: absolute;
  bottom: 30px;
  width: 128px;
  text-align: center;
  transition: transform 0.08s ease;
}

.fighter-left {
  left: 18px;
}

.fighter-right {
  right: 18px;
}

.sprite {
  width: 128px;
  height: 128px;
  border-radius: 18px;
  border: 4px solid rgba(255,255,255,0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(0,0,0,0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 4px,
      rgba(0,0,0,0.04) 4px,
      rgba(0,0,0,0.04) 8px
    ),
    #2d2d2d;
  image-rendering: pixelated;
  object-fit: contain;
  overflow: hidden;
}

.fighterLabel {
  margin-top: 8px;
  color: white;
  font-size: 13px;
  text-shadow: 1px 1px 0 #000;
}

.rarityGlow-common { box-shadow: 0 0 12px rgba(255,255,255,0.12); }
.rarityGlow-rare { box-shadow: 0 0 14px rgba(42,99,255,0.45); }
.rarityGlow-epic { box-shadow: 0 0 14px rgba(125,52,255,0.45); }
.rarityGlow-legendary { box-shadow: 0 0 16px rgba(217,146,0,0.45); }
.rarityGlow-mythic { box-shadow: 0 0 18px rgba(214,47,125,0.5); }

.hitShake {
  animation: hitShake 0.14s linear;
}

@keyframes hitShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

#damageLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.damageText {
  position: absolute;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  text-shadow:
    2px 2px 0 #000,
    0 0 8px rgba(255,255,255,0.3);
  animation: floatUp 0.6s ease forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-35px); }
}

#bottomHud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  padding: 0 14px 16px;
}

#controls {
  display: flex;
  justify-content: center;
}

#pad {
  position: relative;
  width: 220px;
  height: 220px;
}

.controlBtn {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 28px;
  border: 2px solid rgba(255,255,255,0.18);
}

.controlBtn:active,
.controlBtn.pressed {
  transform: scale(0.96);
  background: rgba(255,255,255,0.22);
}

.up { top: 0; left: 76px; }
.left { top: 76px; left: 0; }
.attack { top: 76px; left: 76px; }
.right { top: 76px; left: 152px; }
.down { top: 152px; left: 76px; }

#newMatchBtn,
#backToMenuBtn {
  position: absolute;
  z-index: 12;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.58);
  color: white;
  border: 2px solid rgba(255,255,255,0.16);
}

#newMatchBtn {
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
}

#backToMenuBtn {
  top: max(95px, calc(env(safe-area-inset-top) + 88px));
  right: 12px;
  font-size: 13px;
}

.resultScreenContent {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
  color: white;
}

.resultTitle {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 3px 3px 0 #000;
  margin-bottom: 16px;
}

.resultReward {
  font-size: 28px;
  font-weight: 800;
  color: #ffe16c;
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 36px;
}

.resultButtons {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-height: 740px) {
  .resultTitle {
    font-size: 40px;
  }

  .resultReward {
    font-size: 24px;
  }
}

.fighterThumbImg {
  width: 88%;
  height: 88%;
  object-fit: contain;
  image-rendering: pixelated;
}

.previewThumbImg {
  width: 88%;
  height: 88%;
  object-fit: contain;
  image-rendering: pixelated;
}

.battleSpriteImg {
  width: 92%;
  height: 92%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.enemyFlip {
  transform: scaleX(-1);
}

.lockedImg {
  opacity: 0.25;
  filter: grayscale(100%);
}

.notFoundName {
  color: rgba(255,255,255,0.72);
}

@media (max-height: 740px) {
  #countdownText {
    font-size: 60px;
  }

  #arena {
    bottom: 205px;
  }

  .fighter,
  .sprite {
    width: 112px;
    height: 112px;
  }

  #pad {
    width: 205px;
    height: 205px;
  }

  .controlBtn {
    width: 62px;
    height: 62px;
  }

  .up { top: 0; left: 71px; }
  .left { top: 71px; left: 0; }
  .attack { top: 71px; left: 71px; }
  .right { top: 71px; left: 142px; }
  .down { top: 142px; left: 71px; }
}

.machineImageWrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.machineImage {
  width: min(85vw, 320px);
  height: auto;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 0 12px rgba(255,80,0,0.25))
    drop-shadow(0 0 24px rgba(255,120,0,0.15));
}

.machineImage {
  animation: machineGlow 2s ease-in-out infinite;
}

@keyframes machineGlow {
  0% {
    filter:
      drop-shadow(0 0 10px rgba(255,80,0,0.2));
  }
  50% {
    filter:
      drop-shadow(0 0 18px rgba(255,120,0,0.35));
  }
  100% {
    filter:
      drop-shadow(0 0 10px rgba(255,80,0,0.2));
  }
}

.machineShake {
  animation: machineShake 0.4s ease;
}

@keyframes machineShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

.machineRevealOverlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
}

.machineFlash {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  pointer-events: none;
}

.machineFlash.active {
  animation: machineWhiteFlash 0.35s ease;
}

@keyframes machineWhiteFlash {
  0% { background: rgba(255,255,255,0); }
  40% { background: rgba(255,255,255,1); }
  100% { background: rgba(255,255,255,0); }
}

.capsuleReveal {
  position: relative;
  z-index: 2;
}

.revealCapsule {
  position: relative;
  width: 110px;
  height: 110px;
  animation: capsuleBob 1.2s ease-in-out infinite;
}

@keyframes capsuleBob {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

.revealCapsuleTop,
.revealCapsuleBottom {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 55px;
  border: 4px solid rgba(255,255,255,0.18);
}

.revealCapsuleTop {
  top: 0;
  border-radius: 55px 55px 18px 18px;
  background: linear-gradient(to bottom, #232323, #0d0d0d);
}

.revealCapsuleBottom {
  bottom: 0;
  border-radius: 18px 18px 55px 55px;
  background: linear-gradient(to bottom, #ff5a1f, #b21f0e);
  box-shadow: 0 0 18px rgba(255,90,31,0.35);
}

.revealCapsule.shake {
  animation: capsuleShake 0.5s ease;
}

@keyframes capsuleShake {
  0% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.05) rotate(-6deg); }
  40% { transform: scale(1.05) rotate(6deg); }
  60% { transform: scale(1.05) rotate(-4deg); }
  80% { transform: scale(1.05) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes capsuleShake {
  0% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-8px) rotate(-8deg); }
  40% { transform: translateX(8px) rotate(8deg); }
  60% { transform: translateX(-6px) rotate(-6deg); }
  80% { transform: translateX(6px) rotate(6deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

.fighterRevealCard {
  position: relative;
  z-index: 3;
  width: min(82vw, 340px);
  padding: 20px 18px;
  border-radius: 20px;
  background: rgba(0,0,0,0.86);
  border: 2px solid rgba(255,255,255,0.16);
  color: white;
  text-align: center;
}

.fighterRevealThumb {
  width: 140px;
  height: 140px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(0,0,0,0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 4px,
      rgba(0,0,0,0.04) 4px,
      rgba(0,0,0,0.04) 8px
    ),
    #1f1f1f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fighterRevealThumb img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  image-rendering: pixelated;
}

.fighterRevealName {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 #000;
}

.fighterRevealRarity {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.fighterRevealStatus {
  font-size: 16px;
  font-weight: 800;
  color: #ffe16c;
  margin-bottom: 18px;
}

.capsuleImage {
  width: 140px;
  height: auto;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 0 12px rgba(255,80,0,0.4))
    drop-shadow(0 0 24px rgba(255,120,0,0.25));
}

.revealCapsule {
  transition: transform 0.2s ease;
}

.machineRevealOverlay.hidden {
  display: none;
}

.capsuleReveal.hidden {
  display: none;
}

.fighterRevealCard.hidden {
  display: none;
}

.fighterInspectModal.hidden {
  display: none;
}


.fighterInspectModal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fighterInspectModal.hidden {
  display: none;
}

.fighterInspectBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.fighterInspectCard {
  position: relative;
  z-index: 2;
  width: min(90vw, 420px);
  max-height: 82dvh;
  overflow-y: auto;
  border-radius: 22px;
  background: linear-gradient(to bottom, #151515, #080808);
  border: 2px solid rgba(255,255,255,0.14);
  box-shadow: 0 0 24px rgba(0,0,0,0.4);
  padding: 18px;
  color: white;
}

.inspectCloseBtn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.10);
  border: 2px solid rgba(255,255,255,0.14);
  color: white;
  font-size: 18px;
  font-weight: 900;
}

.fighterInspectTop {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 8px;
}

.fighterInspectImageWrap {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(0,0,0,0.18)),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 4px,
      rgba(0,0,0,0.04) 4px,
      rgba(0,0,0,0.04) 8px
    ),
    #202020;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fighterInspectImage {
  width: 88%;
  height: 88%;
  object-fit: contain;
  image-rendering: pixelated;
}

.fighterInspectInfo {
  flex: 1;
  min-width: 0;
}

.fighterInspectName {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 #000;
}

.fighterInspectRarity {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.inspectHpBlock {
  margin-top: 4px;
}

.inspectHpLabel {
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
}

.inspectHpBarFrame {
  position: relative;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.10);
  border: 2px solid rgba(255,255,255,0.16);
}

.inspectHpBarFill {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #24f26c, #e3ff4d);
}

.inspectHpText {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  color: #111;
}

.fighterInspectMoves {
  margin-top: 18px;
}

.fighterInspectMovesTitle {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 10px;
  text-shadow: 1px 1px 0 #000;
}

.inspectMovesList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inspectMoveRow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

.inspectMoveName {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.inspectMoveCombo {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.comboIcon {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: white;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: Arial, sans-serif;
  touch-action: manipulation;
}

img,
button,
div,
span {
  -webkit-user-drag: none;
  user-select: none;
}

/* KEY BUTTON */
.rarityKeyBtn {
  position: absolute;
  left: 10px;
  top: 120px;
  width: 50px;
  z-index: 10;
  image-rendering: pixelated;
}

/* MODAL */
.rarityKeyOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
}

.rarityKeyPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #111;
  padding: 20px;
  border-radius: 12px;
  z-index: 101;
  width: 90%;
  max-width: 350px;
  color: white;
  text-align: center;
}

.rarityRow {
  margin: 10px 0;
  font-weight: bold;
}

/* COLORS */
.rarityRow.common { color: #aaa; }
.rarityRow.rare { color: #2a63ff; }
.rarityRow.epic { color: #7d34ff; }
.rarityRow.legendary { color: #d99200; }
.rarityRow.mythic { color: #ff2f7d; }

.roundTracker {
  position: absolute;
  top: max(62px, calc(env(safe-area-inset-top) + 52px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 10px;
}

.roundDot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.22);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.35);
}

.roundDot.playerWin {
  background: #24f26c;
  box-shadow: 0 0 10px rgba(36,242,108,0.55);
}

.roundDot.enemyWin {
  background: #ff4545;
  box-shadow: 0 0 10px rgba(255,69,69,0.55);
}

.koOverlay {
  position: fixed; /* IMPORTANT */
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.koOverlay.hidden {
   display: none;
}

.koText {
  position: fixed;
  top: calc(50% - 80px);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;

  font-size: 90px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1;

  color: #ff3b00; /* main red */

  -webkit-text-stroke: 5px #000;

  text-shadow:
    /* inner glow */
    0 0 6px #ffea00,
    0 0 12px #ffae00,

    /* orange depth */
    0 4px 0 #ff6a00,
    0 8px 0 #d13b00,

    /* outer glow */
    0 0 18px rgba(255, 120, 0, 0.6),
    0 0 28px rgba(255, 60, 0, 0.4),

    /* drop shadow */
    0 10px 20px rgba(0,0,0,0.6);
}

@keyframes koArcadePop {
  0% {
    transform: translate(-50%, -50%) scale(0.45) rotate(-6deg);
    opacity: 0;
  }
  45% {
    transform: translate(-50%, -50%) scale(1.12) rotate(2deg);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -50%) scale(0.96) rotate(-1deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}

@media (max-width: 430px) {
  .koText {
    font-size: 76px;
  }
}

#game.koShake {
  animation: koScreenShake 0.28s linear;
}

@keyframes koScreenShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(6px, -2px); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(4px, -1px); }
  100% { transform: translate(0, 0); }
}

.koText {
  animation: koPop 0.25s ease-out;
}

@keyframes koPop {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.loginWrap {
  justify-content: center;
  align-items: center;
}

.loginCard {
  width: 100%;
  max-width: 380px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 20px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loginCard h2 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 28px;
}