/* ============================================================
   Juego · Gusano químico.
   Clases con prefijo gus- (convención del proyecto: nada de nombres
   genéricos). Sin var()/custom properties — colores literales, que es
   lo único que el validador CSS de NetBeans 8.2 entiende.

   Paleta heredada de main.css:
     bg #eef2f7 · superficie #ffffff · texto #1b2433 · apagado #5b6472
     acento #e8a020 · acento-texto #a8710f · azul #2b6cb0
     rojo #c23636 · verde #2f9160 · borde rgba(15,23,42,0.10)
   ============================================================ */

.gus-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 56px;
  width: 100%;
}

/* ── Cabecera de la sección ─────────────────────────────── */
.gus-hero {
  position: relative;
  overflow: hidden;
}

.gus-hero h1 {
  font-family: 'Fredoka', 'Playfair Display', serif;
  margin: 0 0 10px;
}

.gus-hero p {
  margin: 0;
  /* Deja sitio al gusano decorativo de la derecha: con 640px el texto se
     metia debajo del bicho y se leia a traves de el. */
  max-width: 520px;
}

.gus-hero-deco {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 210px;
  height: 120px;
  opacity: 0.5;
  pointer-events: none;
}

.gus-hero-deco svg {
  width: 100%;
  height: 100%;
}

/* El gusano de la cabecera respira despacio. La cabeza va medio segundo
   por detrás del cuerpo, que es lo que le da el aire de bicho vivo. */
@media (prefers-reduced-motion: no-preference) {
  .gus-hero-deco svg { animation: gus-flotar 3.6s ease-in-out infinite; }
  .gus-hero-cabeza   { animation: gus-asomar 3.6s ease-in-out infinite 0.5s; }
}

@keyframes gus-flotar {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

@keyframes gus-asomar {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(3px, -4px); }
}

/* ── MENÚ ───────────────────────────────────────────────── */
.gus-menu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 26px;
  align-items: start;
  margin-top: 26px;
}

.gus-menu-form {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 24px 26px 28px;
}

.gus-section-title {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: #1b2433;
}

.gus-section-title:not(:first-child) {
  margin-top: 26px;
}

.gus-opcion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.gus-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gus-opcion-card {
  display: block;
  border: 2px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  background: #f5f7fb;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.gus-opcion-card:hover {
  transform: translateY(-2px);
  border-color: rgba(232, 160, 32, 0.55);
}

.gus-radio:checked + .gus-opcion-card {
  border-color: #e8a020;
  background: #fff8ec;
}

.gus-radio:focus-visible + .gus-opcion-card {
  outline: 3px solid #2b6cb0;
  outline-offset: 2px;
}

.gus-opcion-icono {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 6px;
}

.gus-opcion-nombre {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.gus-opcion-desc {
  font-size: 0.86rem;
  color: #5b6472;
  line-height: 1.35;
}

.gus-menu-footer {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.gus-btn {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  background: #e8a020;
  color: #1b2433;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.gus-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.gus-btn-sec {
  background: #f5f7fb;
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: #1b2433;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 0.94rem;
}

.gus-btn-sec:hover {
  background: #eef2f7;
}

.gus-aviso {
  font-size: 0.88rem;
  color: #5b6472;
  margin: 0;
}

/* ── Cómo se juega ──────────────────────────────────────── */
.gus-comojuega {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 22px 26px;
  margin-top: 22px;
}

.gus-comojuega ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}

.gus-comojuega li + li {
  margin-top: 6px;
}

.gus-tecla {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  padding: 1px 7px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #f5f7fb;
  font-family: monospace;
  font-size: 0.85rem;
}

/* ── Ranking (menú y partida) ───────────────────────────── */
.gus-ranking {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 18px 20px 22px;
}

.gus-ranking h2 {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 1.02rem;
  margin: 0 0 2px;
}

.gus-ranking-sub {
  font-size: 0.82rem;
  color: #5b6472;
  margin: 0 0 12px;
}

.gus-ranking-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.gus-ranking-tabla th {
  text-align: left;
  font-weight: 600;
  color: #5b6472;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

.gus-ranking-tabla td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.gus-ranking-tabla td:first-child {
  color: #a8710f;
  font-weight: 700;
  width: 26px;
}

.gus-ranking-tabla td:nth-child(3) {
  font-weight: 700;
  text-align: right;
}

.gus-ranking-tabla td:nth-child(4) {
  text-align: right;
  color: #5b6472;
  width: 34px;
}

.gus-menu-ranking-vacio,
.gus-ranking-vacio {
  font-size: 0.88rem;
  color: #5b6472;
  margin: 0;
}

/* ── PARTIDA ────────────────────────────────────────────── */
.gus-jugar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
  margin-top: 20px;
}

.gus-tablero-caja {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 16px 18px 20px;
}

/* HUD */
.gus-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.gus-hud-dato {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.gus-hud-etiqueta {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5b6472;
  font-weight: 600;
}

.gus-hud-valor {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1b2433;
}

.gus-combo-vivo {
  color: #a8710f;
}

.gus-hud-acciones {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.gus-btn-mini {
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #f5f7fb;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #1b2433;
  cursor: pointer;
  font-family: inherit;
}

.gus-btn-mini:hover {
  background: #eef2f7;
}

/* Misión */
.gus-mision-caja {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f7fb;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.gus-mision-etiqueta {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5b6472;
  font-weight: 700;
  white-space: nowrap;
}

.gus-mision-valor {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 1.16rem;
  font-weight: 700;
  color: #1b2433;
}

.gus-mision-color {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  flex: none;
}

/* Barra de tiempo del nivel */
.gus-barra {
  height: 8px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.gus-barra-relleno {
  height: 100%;
  width: 100%;
  background: #2f9160;
  border-radius: 999px;
  transition: width 0.12s linear;
}

.gus-barra-poco {
  background: #c23636;
}

/* El atributo hidden y los display: flex/inline-block.
   La regla del navegador es [hidden]{display:none}, pero una clase propia
   con display: flex GANA por especificidad y el panel se ve igual. Sin
   esto salen a la vez la portada, el anuncio de nivel, la pausa, la ayuda
   y el fin de partida, unos encima de otros. Pasó de verdad al probarlo. */
.gus-overlay[hidden],
.gus-fin-record[hidden],
.gus-form-guardar[hidden],
.gus-mision-color[hidden],
.gus-fin-fallos[hidden] {
  display: none;
}

/* Canvas y superposiciones */
.gus-canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

#gus-canvas {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f7fafc;
  touch-action: none;
  max-width: 100%;
}

.gus-overlay {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(238, 242, 247, 0.92);
  border-radius: 12px;
  text-align: center;
  padding: 20px;
}

.gus-overlay-caja {
  max-width: 460px;
}

.gus-overlay h2 {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.gus-overlay p {
  margin: 0 0 14px;
  color: #5b6472;
}

/* Anuncio de nivel: no tapa del todo, se ve el tablero detrás */
.gus-anuncio {
  background: rgba(255, 255, 255, 0.86);
}

.gus-anuncio-nivel {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a8710f;
  font-weight: 700;
}

.gus-anuncio-mision {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  margin: 4px 0 8px;
  line-height: 1.15;
}

.gus-anuncio-pista {
  color: #5b6472;
  font-size: 0.95rem;
  margin: 0 auto 14px;
  max-width: 420px;
}

.gus-anuncio-barra {
  height: 4px;
  background: #e8a020;
  border-radius: 999px;
  margin: 0 auto;
  width: 100%;
  max-width: 260px;
}

/* Fin de partida */
.gus-fin-puntos {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: #a8710f;
  margin: 6px 0 2px;
}

.gus-fin-record {
  display: inline-block;
  background: #2f9160;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 8px;
}

.gus-fin-fallos {
  text-align: left;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 14px;
}

.gus-fin-fallos h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5b6472;
  margin: 0 0 8px;
}

.gus-fin-fallos ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.gus-fin-fallos li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.gus-fallo-chip {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  font-weight: 700;
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 7px;
  padding: 1px 5px;
  font-size: 0.85rem;
}

.gus-form-guardar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.gus-form-guardar input[type="text"] {
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  min-width: 180px;
}

.gus-fin-acciones {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Mando táctil */
.gus-dpad {
  display: none;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 8px;
  justify-content: center;
  margin: 16px auto 0;
}

.gus-dpad button {
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #f5f7fb;
  border-radius: 12px;
  font-size: 1.3rem;
  color: #1b2433;
  cursor: pointer;
  touch-action: manipulation;
}

.gus-dpad button:active {
  background: #e8a020;
}

.gus-dpad-arriba { grid-column: 2; grid-row: 1; }
.gus-dpad-izq    { grid-column: 1; grid-row: 2; }
.gus-dpad-abajo  { grid-column: 2; grid-row: 2; }
.gus-dpad-der    { grid-column: 3; grid-row: 2; }

@media (pointer: coarse) {
  .gus-dpad { display: grid; }
}

/* Panel lateral de la partida */
.gus-lateral {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gus-guardado-panel {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 34px 30px;
  text-align: center;
}

.gus-guardado-panel h1 {
  font-family: 'Fredoka', 'Source Sans 3', sans-serif;
  margin: 0 0 8px;
}

.gus-guardado-acciones {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.gus-volver {
  margin-top: 16px;
  font-size: 0.9rem;
}

.gus-volver a {
  color: #2b6cb0;
}

/* ── Móvil ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .gus-menu-layout,
  .gus-jugar-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Por debajo de este ancho ya no cabe el gusano decorativo sin pisar el
   texto de la cabecera, asi que se quita. */
@media (max-width: 860px) {
  .gus-hero-deco { display: none; }
  .gus-hero p { max-width: none; }
}

@media (max-width: 620px) {
  .gus-main { padding: 0 12px 40px; }
  .gus-tablero-caja { padding: 12px 12px 16px; }
  .gus-menu-form { padding: 18px 16px 22px; }
  .gus-hud { gap: 8px 12px; }
  .gus-hud-valor { font-size: 1.1rem; }
  .gus-anuncio-mision { font-size: 1.5rem; }
  .gus-fin-puntos { font-size: 2.4rem; }
}
