/* Escenario original de Flash: 640 x 480 px. Todo se posiciona en esas coordenadas
   y el conjunto se escala para ajustarse a la ventana (ver app.js → fit()). */
:root {
  --sans: Arial, "Liberation Sans", Helvetica, sans-serif;
  --serif: "Times New Roman", "Liberation Serif", Times, serif;
  --verdana: Verdana, "DejaVu Sans", Geneva, sans-serif;
  --gothic: "Century Gothic", "Avenir Next", Avenir, "URW Gothic", "Segoe UI", var(--sans);
  --page: #fff;
}
@media (prefers-color-scheme: dark) { :root { --page: #1b1b1b; } }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--page);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#viewport { position: fixed; inset: 0; overflow: hidden; }

#stage {
  position: absolute; left: 0; top: 0;
  width: 640px; height: 480px;
  transform-origin: 0 0;
  overflow: hidden;
  background: #fff;
  font-family: var(--sans);
  touch-action: none;
}
#stage > *, #screen > * { position: absolute; }
#screen { inset: 0; }
#stage img { display: block; pointer-events: none; }
.layer { position: absolute; left: 0; top: 0; width: 640px; height: 480px; }
#stage img { position: absolute; }

#bg { left: 0; top: 0; width: 640px; height: 480px; }

/* pie de página: «Sitio Web diseñado por…» + enlace (texto de 14 px) */
#www {
  left: 4px; top: 442.7px; width: 250px; height: 34px;
  padding-left: 2.4px;
  font: 14.2px/16.3px var(--sans); color: #000; text-decoration: none;
  white-space: nowrap;
}
#www:hover, #www:focus-visible { text-decoration: underline; }

#logo { left: 471.1px; top: 3px; width: 164.6px; height: 43px; }
#logolink { left: 467.6px; top: 0.3px; width: 170.7px; height: 51px; }

/* destello crema del ángulo superior derecho al acertar (clip "sonidos" original) */
#flash { left: 598.6px; top: 0.3px; width: 40.65px; height: 22.15px; background: #fefee5; pointer-events: none; }

/* ---------- texto SVG ---------- */
svg text { white-space: pre; }
.sans   { font-family: var(--sans); }
.serif  { font-family: var(--serif); }
.verd   { font-family: var(--verdana); }
.gothic { font-family: var(--gothic); }

/* ---------- botón "Siguiente" / "Reiniciar" ---------- */
.nbtn {
  appearance: none; border: 0; padding: 0; margin: 0; background: none;
  cursor: pointer; color: inherit; font: inherit;
}
.nbtn img { position: absolute; left: 0; top: 0; }
.nbtn span {
  position: absolute; left: 0; right: 0; text-align: center;
  font: 19px/1 var(--gothic); color: #ff9; pointer-events: none;
}
.nbtn:hover img { filter: brightness(1.18); }
.nbtn:active img { filter: brightness(.9); }
.nbtn:focus-visible { outline: 2px solid #ff9; outline-offset: 2px; }

/* ---------- pantalla inicial ---------- */
#pname {
  position: absolute; left: 227.05px; top: 265.6px; width: 299.75px; height: 42.35px;
  border: 0; background: transparent; outline: none;
  padding: 0 2px 0 2px; margin: 0;
  font: 25px/42px var(--sans); color: #000;
  -webkit-user-select: text; user-select: text;
}
#pname:focus { background: rgba(255,255,255,.35); }

/* ---------- carga ---------- */
.bar { position: absolute; left: 137.4px; top: 196.3px; width: 121px; height: 17px; }

/* ---------- tarjeta madre ---------- */
.marker { position: absolute; pointer-events: none; width: 25.1px; height: 25.15px; overflow: visible; }
.marker .dots { transform-origin: 12.55px 12.6px; animation: orbit 2.5s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .marker .dots { animation: none; } }

.ball {
  position: absolute; width: 22.5px; height: 22.5px; cursor: grab; touch-action: none;
}
.ball svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ball.drag { cursor: grabbing; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.ball b, .row .n {
  position: absolute; font: 10px/12px var(--verdana); font-weight: normal; color: #ffc;
  text-align: center; pointer-events: none;
}
.ball b { left: 2.73px; top: 4.75px; width: 26.05px; padding: 0 2px; transform-origin: 0 0; transform: scaleX(.6349); }

.row { position: absolute; width: 189px; height: 22.5px; pointer-events: none; }
.row svg { position: absolute; left: 0; top: 0; }
.row .n { left: 2.1px; top: 4.95px; width: 17.9px; padding: 0 2px; }
.row .t {
  position: absolute; left: 22.73px; top: 0.25px; width: 261.95px;
  padding: 2px; font: 10px/12px var(--verdana); color: #006;
  transform-origin: 0 0; transform: scaleX(.6349); white-space: normal;
}

/* ---------- botón pantalla completa (fuera del escenario) ---------- */
#fs {
  position: fixed; right: 8px; bottom: 8px; z-index: 5;
  width: 32px; height: 32px; padding: 0; display: grid; place-items: center;
  border: 1px solid rgba(0,0,0,.35); border-radius: 6px;
  background: rgba(255,255,255,.75); color: #000; cursor: pointer; opacity: .55;
}
#fs:hover, #fs:focus-visible { opacity: 1; }
@media (prefers-color-scheme: dark) { #fs { background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.4); } }
html:fullscreen #fs, body.is-fs #fs { display: none; }
