/* ===========================================================
   DONKEY.BAS - Web Port
   Estilo retro CGA con mejoras suaves (escalado nítido,
   centrado a pantalla completa y controles táctiles).
   =========================================================== */

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

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: "Courier New", Courier, monospace;
  color: #fff;
  /* Evita el resaltado azul al tocar en móvil. */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Contenedor que mantiene la proporción 320x200 (8:5) de la CGA. */
#frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, 160vh);
  height: min(62.5vw, 100vh);
  background: #000;
}

/* El canvas se escala nítido (sin suavizado) para conservar el look pixelado. */
#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
}

/* ---------- Overlay de título ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  background: #000;
  text-align: center;
  padding: 4%;
}

.overlay.hidden {
  display: none;
}

.ibm-logo .brand {
  font-size: clamp(28px, 7vw, 64px);
  font-weight: bold;
  letter-spacing: 0.15em;
  color: #fff;
}

.ibm-logo .subbrand {
  font-size: clamp(12px, 2.6vw, 24px);
  color: #fff;
  margin-bottom: 4%;
}

/* Caja con doble borde imitando los caracteres CHR$ del BASIC. */
.title-box {
  border: 3px double #55ff55;
  padding: 3% 8%;
  margin: 0 auto;
  display: inline-block;
}

.title-box .game-name {
  font-size: clamp(22px, 6vw, 48px);
  color: #55ff55;
  letter-spacing: 0.3em;
}

.title-box .version {
  font-size: clamp(10px, 2.2vw, 18px);
  color: #55ff55;
}

.copyright {
  font-size: clamp(9px, 2vw, 16px);
  color: #fff;
  margin-top: 4%;
}

.instructions {
  font-size: clamp(10px, 2.2vw, 18px);
  color: #ffff55;
  line-height: 1.8;
}

.instructions strong {
  color: #55ffff;
}

.press-start {
  background: #000;
  border: 2px solid #ffff55;
  color: #ffff55;
  font-family: inherit;
  font-size: clamp(12px, 2.6vw, 22px);
  padding: 2% 5%;
  cursor: pointer;
  animation: blink 1s steps(2, start) infinite;
}

.press-start:hover {
  background: #ffff55;
  color: #000;
}

@keyframes blink {
  50% { opacity: 0.35; }
}

/* ---------- Botón táctil (solo visible en pantallas táctiles) ---------- */
.touch-btn {
  position: absolute;
  bottom: 3%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(85, 255, 255, 0.15);
  border: 2px solid #55ffff;
  color: #55ffff;
  font-family: inherit;
  font-size: clamp(12px, 3vw, 20px);
  padding: 10px 22px;
  border-radius: 8px;
  display: none;
  z-index: 5;
}

.touch-btn:active {
  background: rgba(85, 255, 255, 0.4);
}

/* Mostrar el botón táctil únicamente en dispositivos sin puntero fino. */
@media (hover: none) and (pointer: coarse) {
  .touch-btn.playing {
    display: block;
  }
}
