:root {
  --fg: #111;
  --line: #ececec;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: var(--fg);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* la criatura ocupa la primera pantalla, centrada; la galería va debajo */
.stage-area {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  padding: 2rem;
}

/* la criatura: una imagen cuadrada, centrada */
#stage {
  width: 440px;
  max-width: 86vw;
  aspect-ratio: 4 / 3;
  height: auto;
  border: 1px solid var(--line);
  cursor: pointer; /* click -> alterna dibujo / código */
}

/* progreso de generación, justo bajo el cuadrado */
.progress { width: 440px; max-width: 86vw; height: 2px; background: var(--line); overflow: hidden; }
#bar { height: 100%; width: 0%; background: var(--fg); transition: width .12s linear; }

.actions { display: flex; gap: 2.4rem; }

.actions button {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: .06em;
  text-transform: lowercase;
  color: var(--fg);
  cursor: pointer;
  opacity: .8;
  transition: opacity .15s, color .15s;
}
.actions button:hover:not(:disabled) { opacity: 1; }
.actions button:disabled { opacity: .2; cursor: progress; }
#kill:hover:not(:disabled) { color: #e23b3b; }

/* galería de criaturas salvadas, debajo */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .7rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}
.thumb { cursor: zoom-in; }
.thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  display: block;
}
.thumb .date { font-size: .58rem; color: #999; margin-top: .25rem; text-align: center; }

/* lightbox: la imagen en grande */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  z-index: 10;
}
.lightbox[hidden] { display: none; }
.lb-inner { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.lightbox img {
  max-width: 90vw;
  max-height: 78vh;
  border: 1px solid var(--line);
  box-shadow: 0 12px 48px rgba(0, 0, 0, .18);
}
.lb-actions { display: flex; gap: 1.8rem; }
.lb-actions button {
  appearance: none; border: none; background: none; padding: 0;
  font-family: var(--mono); font-size: .9rem; letter-spacing: .05em;
  text-transform: lowercase; color: var(--fg); cursor: pointer; opacity: .8;
}
.lb-actions button:hover:not(:disabled) { opacity: 1; }
.lb-actions button:disabled { opacity: .25; cursor: default; }
