* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #16241a 0%, #080c09 60%, #040604 100%);
  font-family: Georgia, "Times New Roman", serif;
  color: #cfe8d0;
}

.juego {
  position: relative;
  width: min(100vw, 160dvh);
  aspect-ratio: 8 / 5;
}

html:fullscreen, html:-webkit-full-screen { background: #080c09; }
html:fullscreen body, html:-webkit-full-screen body { width: 100vw; height: 100dvh; }

#canvas1 {
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  max-width: 100vw;
  max-height: 100dvh;
  display: block;
  background: #000;
  border: 1px solid #2c4a30;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #000, 0 18px 60px rgba(0, 0, 0, 0.75), 0 0 80px rgba(60, 160, 80, 0.12);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

[hidden] { display: none !important; }

#menu {
  position: absolute;
  top: 39%;
  left: 32%;
  width: 36%;
  display: grid;
  gap: 8px;
}

.juego button {
  padding: 12px;
  border: 2px solid #7ee787;
  border-radius: 10px;
  background: #102618;
  color: #efffe8;
  font: bold clamp(12px, 2.5vw, 21px) Georgia, serif;
  cursor: pointer;
  touch-action: manipulation;
}

.juego button:hover, .juego button:focus-visible {
  background: #285132;
  border-color: #ffd166;
  outline: 2px solid #ffd166;
  outline-offset: 3px;
}

#jugar { background: #335d29; color: #ffe39b; }
#volver { position: absolute; left: 38%; top: 78%; width: 24%; }
#menu button { padding: clamp(6px, 1.5vw, 10px); }
#ajustes {
  position: absolute;
  inset: 18% 16% 27%;
  padding: clamp(10px, 2.5vw, 24px);
  border: 2px solid #d5b55d;
  border-radius: 14px;
  background: #08180ff2;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 8px;
  overflow: auto;
}
#ajustes h2 { color: #ffe09a; text-align: center; font-size: clamp(17px, 3vw, 26px); }
#ajustes label { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; font: bold clamp(12px, 2vw, 18px) Verdana, sans-serif; }
#ajustes small { display: block; margin-top: 5px; color: #b9cbb7; font: normal clamp(10px, 1.5vw, 12px) Verdana, sans-serif; }
#ajustes input { width: 25px; height: 25px; flex-shrink: 0; accent-color: #80d884; cursor: pointer; }
#ajustes input:focus-visible { outline: 2px solid #ffd166; outline-offset: 4px; }
#ajustes p { color: #b9cbb7; text-align: center; font: clamp(10px, 1.5vw, 12px) Verdana, sans-serif; }

#equipo {
  position: absolute;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
#equipo button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font: bold clamp(10px, 1.5vw, 13px) Verdana, sans-serif;
  background: #0b1b14ed;
}
#equipo canvas { width: 32px; height: 38px; image-rendering: pixelated; }
.estado-hacha { display: grid; gap: 5px; }
#barra-hacha { width: 100%; height: 9px; accent-color: #82d873; }
#usar-hacha.agotada { border-color: #bd7364; color: #efac94; }
#vestuario {
  position: absolute;
  inset: 13% 9%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(10px, 2.5vw, 24px);
  border: 2px solid #d5b55d;
  border-radius: 14px;
  background: #08180ff5;
  box-shadow: 0 0 0 100vmax #0009;
  overflow: auto;
  text-align: center;
}
#vestuario h2 { color: #ffe09a; font-size: clamp(18px, 3vw, 26px); }
#vestuario p { font: clamp(11px, 1.7vw, 14px) Verdana, sans-serif; }
#lista-trajes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; flex: 1; }
#lista-trajes button { padding: 5px; font: 12px Verdana, sans-serif; }
#lista-trajes button[aria-pressed="true"] { border-color: #ffd166; background: #355226; }
#lista-trajes canvas { display: block; width: 40px; height: 60px; margin: 0 auto 5px; image-rendering: pixelated; }
#cerrar-trajes { align-self: center; min-width: 50%; font-size: 14px; padding: 8px; }

noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #080c09;
  text-align: center;
  font-size: 20px;
}
