:root {
  --arena-black: #100d0b;
  --panel-bg: rgba(16, 13, 11, 0.86);
  --panel-border: #7d6753;
  --text: #fff8ea;
  --muted: #d6c8b7;
  --accent: #f1b84b;
  --danger: #ff6b5f;
  --health: #58c969;
  --focus: #fff2a8;
  --enemy-x: calc(100% - clamp(100px, 17vw, 140px));
}

* {
  box-sizing: border-box;
}

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

  50% {
    transform: translateY(1px);
  }
}

@keyframes flash {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(18px, 4vw, 42px);
  background-color: var(--arena-black);
  background-image: linear-gradient(rgba(16, 13, 11, 0.72), rgba(16, 13, 11, 0.9)), url("arena.webp");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 860px);
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-weight: 700;
  text-underline-offset: 4px;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel-bg);
}

.language-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 54px;
  min-height: 44px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.language-switcher button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--arena-black);
}

.language-switcher button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.back-link:hover {
  color: var(--accent);
}

.game-shell {
  width: min(100%, 860px);
  margin: 16px auto 0;
  text-align: center;
}

.game-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

#gameTitle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4.5rem;
  line-height: 1;
}

#titleIcon {
  width: clamp(46px, 9vw, 72px);
  height: clamp(46px, 9vw, 72px);
  object-fit: contain;
}

.game-intro {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  width: min(100%, 760px);
  margin: 0 auto 14px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel-border);
}

.status-panel > p {
  min-width: 0;
  margin: 0;
  padding: 14px 10px;
  overflow-wrap: anywhere;
  background: var(--panel-bg);
  color: var(--muted);
  font-size: 0.95rem;
}

.status-panel span {
  display: block;
  margin-bottom: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-panel strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

#hpContainer {
  grid-column: 1 / -1;
  width: 100%;
  height: 14px;
  background: #3b3029;
}

#hpBar {
  width: 100%;
  height: 100%;
  background: var(--health);
  transition: width 0.2s ease;
}

#gameArea {
  position: relative;
  width: min(100%, 760px);
  min-height: 220px;
  margin: 0 auto;
  aspect-ratio: 14 / 5;
  overflow: hidden;
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.36);
  box-shadow: inset 0 -45px 50px rgba(0, 0, 0, 0.42), 0 20px 55px rgba(0, 0, 0, 0.36);
}

#player,
#enemy {
  position: absolute;
  z-index: 2;
  bottom: 0;
  width: clamp(96px, 18vw, 140px);
  height: clamp(96px, 18vw, 140px);
  object-fit: contain;
  filter: drop-shadow(0 10px 5px rgba(0, 0, 0, 0.6));
  animation: idle 1.2s ease-in-out infinite;
}

#player {
  left: clamp(10px, 5vw, 48px);
}

#enemy {
  left: var(--enemy-x);
  transition: left 0.05s linear;
}

#hitZone {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 17%;
  width: 12%;
  height: 100%;
  border-right: 2px solid rgba(123, 255, 138, 0.9);
  border-left: 2px solid rgba(123, 255, 138, 0.9);
  background: rgba(88, 201, 105, 0.14);
  box-shadow: inset 0 0 24px rgba(88, 201, 105, 0.2);
}

#notification {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 50%;
  min-height: 24px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 5px 10px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.74);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#restartHint {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: none;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 12px 16px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--danger);
  border-radius: 4px;
  background: rgba(20, 8, 7, 0.92);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
}

.flash {
  animation: flash 1s infinite;
}

#actionFeedback {
  min-height: 30px;
  margin: 14px 0 8px;
  color: var(--accent);
  font-weight: 700;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.game-controls button {
  min-width: 120px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: #302720;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.game-controls button:hover {
  border-color: var(--accent);
  background: #4a3827;
  transform: translateY(-2px);
}

.back-link:focus-visible,
.game-controls button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

kbd {
  margin-left: 6px;
  padding: 2px 5px;
  border: 1px solid #96816d;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #17120f;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
}

@media (max-width: 700px) {
  .game-toolbar {
    align-items: flex-start;
  }

  .language-switcher button {
    min-width: 48px;
    padding-inline: 6px;
  }

  #gameTitle {
    font-size: 2.25rem;
  }

  .status-panel {
    grid-template-columns: 1fr;
  }

  #hpContainer {
    grid-column: 1;
  }

  #gameArea {
    min-height: 190px;
  }

  #restartHint {
    font-size: 1rem;
  }

  .game-controls button {
    flex: 1 1 88px;
    min-width: 88px;
  }
}

@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;
  }
}
