:root {
  --primary: #22d3ee; /* Neon Cyan */
  --primary-glow: rgba(34, 211, 238, 0.4);
  --error: #f43f5e; /* Rose / Error red */
  --bg-dark: #020617;
  --bg-gradient: radial-gradient(circle at center, #0a192f 0%, #020617 100%);
  --card-bg: rgba(15, 23, 42, 0.6);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-md: 16px;
}

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

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: var(--bg-dark);
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
  overflow: hidden;
}

.main-container {
  width: 95%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 1rem;
}

header h1 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  color: var(--primary);
  font-weight: 700;
}

#contadorFallos {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

#instrucciones {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  opacity: 0.8;
  letter-spacing: 0.05rem;
  margin-top: -0.5rem;
}

/* Game Arena */
#game-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  position: relative;
}

/* Visual Hangman (CSS ONLY) */
#hangman-visual {
  width: 150px;
  height: 200px;
  position: relative;
  margin-bottom: 1rem;
}

.part {
  position: absolute;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  opacity: 0.05; /* Hidden by default (faint outline) */
  transition:
    opacity 0.4s ease,
    box-shadow 0.4s ease;
}

.part.visible {
  opacity: 1;
  box-shadow: 0 0 15px var(--primary);
}

/* Gallows Drawing */
.base {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 4px;
}
.mast {
  bottom: 0;
  left: 20%;
  width: 4px;
  height: 100%;
  border-radius: 4px;
}
.crossbar {
  top: 0;
  left: 20%;
  width: 60%;
  height: 4px;
  border-radius: 4px;
}
.rope {
  top: 0;
  left: 80%;
  width: 2px;
  height: 30px;
}

/* Body Parts */
.head {
  top: 30px;
  left: calc(80% - 14px);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: none;
}
.body {
  top: 60px;
  left: 80%;
  width: 3px;
  height: 60px;
}
.l-arm {
  top: 75px;
  left: 80%;
  width: 30px;
  height: 3px;
  transform: rotate(-20deg);
  transform-origin: left;
}
.r-arm {
  top: 75px;
  left: 80%;
  width: 30px;
  height: 3px;
  transform: rotate(200deg);
  transform-origin: left;
}
.l-leg {
  top: 118px;
  left: 80%;
  width: 35px;
  height: 3px;
  transform: rotate(-240deg);
  transform-origin: left;
}
.r-leg {
  top: 118px;
  left: 81%;
  width: 35px;
  height: 3px;
  transform: rotate(60deg);
  transform-origin: left;
}

/* Guessing Container */
#contenedor {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.letra {
  width: 36px;
  height: 48px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.letra[data-lock="1"] {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.espacio {
  width: 20px;
}

/* Info Section */
#info-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-height: 80px;
}

#fallos-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#fallos {
  letter-spacing: 0.2rem;
  color: var(--error);
  font-weight: 600;
  text-transform: uppercase;
}

#mensaje {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

#mensaje a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--primary);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  transition: all 0.3s ease;
}

#mensaje a:hover {
  background: var(--primary);
  color: var(--bg-dark);
  box-shadow: 0 0 15px var(--primary-glow);
}

.success-text {
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary-glow);
}
.error-text {
  color: var(--error);
}

/* Button */
.btn-new-game {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-new-game:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* Responsive */
@media (max-width: 480px) {
  .letra {
    width: 30px;
    height: 40px;
    font-size: 1.2rem;
  }
  #hangman-visual {
    transform: scale(0.8);
  }
}
