:root {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", sans-serif;
  color: #1c1c1c;
  background-color: #fdf5e6;
  --ayan-main: linear-gradient(145deg, #ffe082, #ffca28);
  --axiang-main: linear-gradient(145deg, #c8c0ff, #8c7ae6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #fff2cc, transparent 50%),
    radial-gradient(circle at 80% 0%, #ffe0f0, transparent 45%),
    linear-gradient(145deg, #fef6ec, #f7ecff);
}

.app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

header h1 {
  margin: 0;
  font-size: 3rem;
  color: #e95f2a;
  letter-spacing: 0.2em;
}

header p {
  margin: 10px 0 0;
  color: #5c4b51;
  font-size: 1.1rem;
}

.name-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  padding: 18px 24px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.05);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.9rem;
  color: #5c4b51;
}

.input-group input {
  border: 2px solid rgba(233, 95, 42, 0.4);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 1rem;
  min-width: 150px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-group input:focus {
  border-color: #e95f2a;
}

.arena {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 32px;
  padding: 32px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
}

.fighter {
  text-align: center;
  position: relative;
  padding-bottom: 16px;
}

.fighter::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 70%;
  height: 10px;
  background: rgba(0, 0, 0, 0.15);
  filter: blur(12px);
  transform: translateX(-50%);
  border-radius: 50%;
}

.character {
  width: 180px;
  height: 240px;
  margin: 0 auto 12px;
  position: relative;
  animation: bob 3s ease-in-out infinite;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.character .head {
  width: 130px;
  height: 130px;
  margin: 0 auto;
  border-radius: 38% 42% 50% 52%;
  border: 6px solid #161616;
  background: var(--ayan-main);
  position: relative;
}

.character.axiang .head {
  background: var(--axiang-main);
}

.hair {
  position: absolute;
  top: -12px;
  left: 15px;
  width: 100px;
  height: 40px;
  border-radius: 40px;
  background: rgba(0, 0, 0, 0.75);
  transform: rotate(-6deg);
}

.character.axiang .hair {
  background: rgba(65, 44, 130, 0.85);
  transform: rotate(6deg);
}

.eyes {
  position: absolute;
  top: 52px;
  left: 28px;
  width: 74px;
  display: flex;
  justify-content: space-between;
}

.eye {
  width: 16px;
  height: 26px;
  background: #212121;
  border-radius: 10px;
}

.mouth {
  position: absolute;
  bottom: 32px;
  left: 50%;
  width: 46px;
  height: 16px;
  border-radius: 20px;
  background: #212121;
  transform: translateX(-50%);
}

.body {
  position: relative;
  width: 120px;
  margin: 0 auto;
  margin-top: 6px;
}

.torso {
  width: 120px;
  height: 70px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.85);
  border: 4px solid #111;
}

.arm,
.leg {
  position: absolute;
  width: 26px;
  background: var(--ayan-main);
  border: 4px solid #111;
  border-radius: 30px;
}

.character.axiang .arm,
.character.axiang .leg {
  background: var(--axiang-main);
}

.arm {
  height: 70px;
  top: 10px;
}

.arm.left {
  left: -20px;
  transform: rotate(8deg);
}

.arm.right {
  right: -20px;
  transform: rotate(-8deg);
}

.leg {
  height: 80px;
  bottom: -70px;
}

.leg.left {
  left: 10px;
}

.leg.right {
  right: 10px;
}

.fighter h2 {
  margin: 8px 0 4px;
}

.hotkey {
  margin: 0;
  font-size: 0.9rem;
  color: #757575;
}

.status-panel {
  text-align: center;
}

#statusText {
  min-height: 48px;
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: #4a3228;
}

#startBtn {
  padding: 14px 32px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(120deg, #ff8a4c, #ff5e62);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 30px rgba(255, 138, 76, 0.5);
}

#startBtn:disabled {
  background: #bdbdbd;
  box-shadow: none;
  cursor: not-allowed;
}

#startBtn:not(:disabled):hover {
  transform: translateY(-2px);
}

.scoreboard {
  display: flex;
  justify-content: space-around;
  margin-top: 18px;
  gap: 12px;
}

.scoreboard div {
  background: #fffdf7;
  padding: 14px 20px;
  border-radius: 20px;
  min-width: 140px;
  border: 2px solid #ffe0b2;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.scoreboard span {
  display: block;
  font-size: 0.9rem;
  color: #6d4c41;
}

.scoreboard strong {
  font-size: 1.9rem;
  color: #bf360c;
}

.log {
  margin-top: 32px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
}

.log h3 {
  margin: 0 0 12px;
}

#battleLog {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
}

#battleLog li {
  padding: 12px 14px;
  background: #fff8e6;
  border-radius: 14px;
  margin-bottom: 10px;
  border-left: 4px solid #ff7043;
  font-size: 0.95rem;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.dialog-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  background: #fff;
  border-radius: 28px;
  padding: 32px 28px;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

.dialog-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 5px solid #111;
  background: var(--ayan-main);
}

.dialog-avatar.axiang {
  background: var(--axiang-main);
}

.dialog p {
  font-size: 1.2rem;
  margin: 0 0 20px;
}

.dialog-btn {
  padding: 10px 30px;
  border: none;
  border-radius: 999px;
  background: #ff7043;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.dialog-btn.ghost {
  background: transparent;
  border: 2px dashed rgba(233, 95, 42, 0.7);
  color: #e95f2a;
  padding: 10px 26px;
}

.dialog-btn.ghost:hover {
  background: rgba(233, 95, 42, 0.1);
}

.video-dialog {
  width: min(640px, 90vw);
}

.video-wrapper {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 3px solid rgba(233, 95, 42, 0.2);
  background: #000;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.character.celebrate {
  animation: celebrate 0.45s ease-in-out infinite alternate;
  filter: drop-shadow(0 10px 20px rgba(255, 138, 76, 0.4));
}

.character.losing {
  animation: none;
}

.fighter-left .character.losing {
  animation: slideKneelLeft 1.1s ease forwards;
}

.fighter-right .character.losing {
  animation: slideKneelRight 1.1s ease forwards;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes celebrate {
  0% {
    transform: translateY(-4px) rotate(-2deg);
  }
  100% {
    transform: translateY(-12px) rotate(3deg);
  }
}

@keyframes slideKneelLeft {
  0% {
    transform: translateX(0) translateY(0) rotate(0);
  }
  60% {
    transform: translateX(-40px) translateY(40px) rotate(-35deg);
  }
  100% {
    transform: translateX(-60px) translateY(50px) rotate(-45deg);
    filter: grayscale(0.4);
  }
}

@keyframes slideKneelRight {
  0% {
    transform: translateX(0) translateY(0) rotate(0);
  }
  60% {
    transform: translateX(40px) translateY(40px) rotate(35deg);
  }
  100% {
    transform: translateX(60px) translateY(50px) rotate(45deg);
    filter: grayscale(0.4);
  }
}

@media (max-width: 640px) {
  .character {
    transform-origin: bottom center;
  }

  .scoreboard {
    flex-direction: column;
  }

  .name-panel {
    flex-direction: column;
    align-items: stretch;
  }
}

