/* -------------------------------------------------
   RESET + GLOBAL
------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at top, #1b1b24, #050509);
  font-family: system-ui, sans-serif;
}

/* Prevent selection / long-press menus in game area */
body,
#app,
#arena,
#arenaInner,
#chatMessages,
#chatInputBar {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

/* Default skin colours */
:root {
  --skin-light: #ffb3b3;
  --skin-dark: #b33c3c;
}

/* -------------------------------------------------
   MAIN GAME BOX (800 x 600 base)
------------------------------------------------- */
#app {
  width: 800px;
  height: 600px;

  max-width: 100%;
  max-height: 100%;

  margin: 0 auto;
  padding: 10px;

  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

/* When itch fullscreen is active, allow the game to grow */
.fullscreen-mode #app {
  width: min(1200px, 100vw);
  height: min(800px, 100vh);
}

/* -------------------------------------------------
   ARENA
------------------------------------------------- */
#arena {
  flex: 1;
  min-width: 320px;
  height: 100%;

  display: flex;
  justify-content: center;
  align-items: center;
}

#arenaInner {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  background: radial-gradient(circle at top, #2d2d3a, #101018);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

/* Hidden before spawn */
.hidden {
  opacity: 0;
  transform: scale(0.75);
  pointer-events: none;
}

/* Arena fade-in */
@keyframes arenaFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.arena-fade-in {
  animation: arenaFadeIn 0.4s ease-out forwards;
}

/* -------------------------------------------------
   DUMMY CHARACTER
------------------------------------------------- */
#dummyBody {
  position: absolute;
  width: 160px;
  height: 320px;
  cursor: grab;
  transform-origin: center;
}

/* Spawn pop-in */
@keyframes dummySpawn {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  60% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.spawn-effect {
  animation: dummySpawn 0.45s ease-out forwards;
}

/* Body parts — this is where the PINK COLOUR comes from */
.part {
  position: absolute;
  background: radial-gradient(circle at top, var(--skin-light), var(--skin-dark));
  border-radius: 20px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

/* Head */
.head {
  width: 90px;
  height: 90px;
  top: 0;
  left: 35px;
  border-radius: 50%;
  font-size: 2.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Torso */
.torso {
  width: 70px;
  height: 110px;
  top: 95px;
  left: 45px;
  border-radius: 18px;
}

/* Arms */
.arm {
  width: 35px;
  height: 100px;
  top: 95px;
}

.arm.left {
  left: 5px;
}
.arm.right {
  left: 120px;
}

/* Legs */
.leg {
  width: 30px;
  height: 90px;
  top: 200px;
}

.leg.left {
  left: 50px;
}
.leg.right {
  left: 90px;
}

/* Feet */
.foot {
  width: 40px;
  height: 25px;
  top: 290px;
  background: radial-gradient(circle at top, #ffbdbd, #993232);
}

.foot.left {
  left: 50px;
}
.foot.right {
  left: 90px;
}

/* Hit flash */
@keyframes hitFlash {
  0% {
    transform: scale(1.08) rotate(3deg);
    filter: brightness(1.3);
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
}
.hit-flash {
  animation: hitFlash 0.15s ease-out;
}

/* -------------------------------------------------
   CHAT PANEL
------------------------------------------------- */
#chatPanel {
  flex: 0.9;
  min-width: 260px;
  max-width: 420px;
  height: 100%;
  max-height: 580px;

  background: #111118;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Header */
#chatHeader {
  background: linear-gradient(to right, #181824, #171723);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
}

.chat-status {
  font-size: 0.8rem;
  color: #5df387;
}

/* Messages area */
#chatMessages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

/* Message rows */
.chat-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-row.buddy {
  justify-content: flex-start;
}

.chat-row.player {
  justify-content: flex-end;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #26263c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Bubbles */
.chat-bubble {
  max-width: 70%;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.3;

  background: #202034;
  color: #ffffff; /* force white text */

  opacity: 0;
  transform: translateY(6px) scale(0.95);
  animation: msgIn 0.2s ease-out forwards;
}

.chat-row.player .chat-bubble {
  background: #3c7df2;
}

/* Message appear */
@keyframes msgIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Fade away */
.fade-out {
  animation: msgOut 0.25s ease-in forwards;
}
@keyframes msgOut {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.85);
  }
}

/* -------------------------------------------------
   CHAT INPUT
------------------------------------------------- */
#chatInputBar {
  background: #15151f;
  padding: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#chatInput {
  flex: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  outline: none;
  font-size: 0.9rem;
  background: #1e1e2a;
  color: #ffffff;
}

#chatInput::placeholder {
  color: #707070;
}

#sendBtn {
  padding: 8px 16px;
  background: #5df387;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#sendBtn:active {
  transform: scale(0.93);
  box-shadow: 0 0 10px rgba(93, 243, 135, 0.4);
}

/* -------------------------------------------------
   RESPONSIVE – ONLY STACK ON REALLY SMALL WIDTHS
------------------------------------------------- */
@media (max-width: 700px) {
  #app {
    flex-direction: column;
    width: 100%;
    height: 100%;
  }

  #arena {
    height: 55%;
  }

  #chatPanel {
    height: 45%;
    max-width: none;
    width: 100%;
  }
}
