/* ===== VARIABLES DE TEMA ===== */
:root {
  --bg: #f4f4f4;
  --fg: #ffffff;
  --accent: #4a5d6b69;
  --card: #0000007a;

  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  --font-base: clamp(14px, 1.2vw, 18px);
}

body.dark {
  --bg: #111;
  --fg: #eee;
  --accent: #5d3903ff;
  --card: #1e1e1e;
}

/* ===== ESTRUCTURA GLOBAL ===== */
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg) url("images/bg.png") center center / cover fixed no-repeat;
  color: var(--fg);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5px;
  font-size: var(--font-base);
  font-family: "Segoe UI", Roboto, sans-serif;
}

/* ===== APP ===== */
#app {
  width: 50vw;
  height: 90vh;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* ===== GRID PRINCIPAL ===== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
/*  grid-template-rows: repeat(3, 1fr);*/
  gap: 5px 8px;
  flex: 1;
}

/* ===== GRID ITEMS ===== */
.grid-item-1 { grid-area: 1 / 1 / 2 / 5; background-color: white; font-size: 1rem;}
.grid-item-2 { grid-area: 1 / 4 / 2 / 5; background-color: #9a16a1; font-size: 1rem; }
.grid-item-3 { grid-area: 2 / 1 / 3 / 4; font-size: 1rem; }
.grid-item-4 { grid-area: 2 / 4 / 4 / 5; font-size: 1rem;}
.grid-item-5 { grid-area: 3 / 1 / 4 / 4;   display: flex;  flex-direction: column;  justify-content: flex-end;}

/* ===== TEXTO ===== */
.text-shadow {
  text-shadow:
    1px 1px rgba(0, 0, 0, 0.04),
    2px 2px rgba(0, 0, 0, 0.04),
    3px 3px rgba(0, 0, 0, 0.04),
    4px 4px rgba(0, 0, 0, 0.04),
    6px 6px rgba(0, 0, 0, 0.04);
  color: white;
  padding-left: 20px;
}

#text {
    margin-top: 20px;
  margin-left: 20px;
  margin-right: 20px;

}

h2 { margin-top: 0; }

/* ===== ILUSTRACIÓN ===== */
#fondo {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* ===== CHOICES ===== */
.choices {
  display: flex;
  flex-direction: column;
  justify-content: flex-end; 
  width: 100%;
  height: 100%;
  gap: 8px;
  max-height: 100px;
}


.choices button {
  flex: 1;
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 8px;
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.choices button:hover {
  transform: translateY(-2px);
  opacity: 0.85;
  background-color: orange;
  color: black;
}

/* ===== STATUS Y SECCIONES ===== */
#status { margin-top: 20px; font-size: 0.9rem; }
.section { margin-top: 20px; padding-top: 10px; border-top: 1px solid #5552; }
.inv-item, .skill { margin: 4px 0; font-size: 0.9rem; }

/* ===== RELOJ ===== */
#reloj { 
  position: relative;
  top: -64px;
  float: right;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  opacity: 1;
  padding-right: 18px;
}


/* ===== JUGADOR ===== */
#nombreJugador {
  font-size: x-large;
}

/* ===== HABILIDADES ===== */
#habilidades {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 250px;
}

.skill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: background 0.2s;
}

.skill:hover { 
  background: rgba(0,0,0,0.18); }

.skill-name { font-weight: 600; text-transform: capitalize; }

.skill-stars {
  color: gold;
  letter-spacing: 2px;
  font-size: 1.6em;
  text-shadow: 0 0 2px rgba(0,0,0,0.2);
}


/* Footer fijo al final pero sin superposición */
footer {
 
  color: white;
  text-align: center;
  padding: 10px 20px;
  border-radius: 8px 8px 0 0;
  position: relative; /* ya no fixed */
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1; /* vuelve a ser visible */
  box-sizing: border-box;
  font-size: 8px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  #app {
    width: 80vw;
    height: auto;
  }
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  #app {
    width: 95vw;
    height: auto;
    padding: 0.8rem;
  }
  
  #habilidades {
    max-width: 100%;
  }
    
  .grid-container {
    display: flex; 
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  /* Cada bloque ocupa todo el ancho y vuelve al flujo normal */
  .grid-container > div {
    width: 100%;
    position: static; /* anula cualquier absolute/fixed */
    grid-area: unset; /* <-- anula coordenadas previas */
    grid-column: unset;
    grid-row: unset;
  }

  /* Orden específico que quieres */
  .grid-item-1 { order: 1; }
  .grid-item-3 { order: 2; }
  .grid-item-2 { order: 3; }
  .grid-item-4 { order: 4; }
  .grid-item-5 { order: 5; }

  /* Aseguramos que las opciones no se encojan ni queden pegadas al inventario */
  .grid-item-4 {
    margin-bottom: 1rem;
  }

  .choices {
    height: auto;
    max-height: none;
  }

  .choices button {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    padding: 0.6rem;
  }
  #reloj {
    top: -30px;
    font-size: clamp(1.2rem, 3vw, 1.6rem);
  }

}

/* Tipos de mensajes */
#texto span {
  display: block;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#texto span.mostrar {
  opacity: 1;
  transform: translateY(0);
}

#texto span.rojo { color: red; }
#texto span.verde { color: green; }
#texto span.amarillo { color: orange; }
#texto span.azul { color: #4fc3f7; }
#texto span.blanco { color: #ffffff; }
