@font-face {
  font-family: 'SDS';
  src: url('art/SDS_8x8.ttf') format('truetype');
  font-display: block;
}

:root {
  --bg: #0b0614;
  --fg: #efe6ff;
  --dim: #8f7fb0;
  --accent: #b04bff;
  --neon: #2be8ff;
  --pink: #ff2bd6;
  --scale: 2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'SDS', ui-monospace, monospace;
  overflow: hidden;
  -webkit-font-smoothing: none;
  font-smooth: never;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#screen {
  grid-area: 1 / 1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* ------------------------------------------------------------------ HUD */
#hud {
  grid-area: 1 / 1;
  position: relative;
  pointer-events: none;
  font-size: calc(8px * var(--scale));
  text-shadow: calc(1px * var(--scale)) calc(1px * var(--scale)) 0 #000;
}
#hud.hidden { display: none; }
#hud-room { position: absolute; left: 1.5%; top: 1.5%; }
#hud-world { position: absolute; right: 1.5%; top: 1.5%; color: var(--neon); }
#hud-seed { position: absolute; right: 1.5%; bottom: 1.5%; color: var(--dim); font-size: 0.75em; }
#hud-credits {
  position: absolute; left: 1.5%; bottom: 1.5%;
  color: var(--dim); font-size: 0.75em; pointer-events: auto; text-decoration: none;
}
#hud-credits:hover { color: var(--fg); }
#hud-banner, #hud-msg {
  position: absolute; left: 0; right: 0; text-align: center;
  opacity: 0; white-space: nowrap;
}
#hud-banner { top: 40%; font-size: 1.5em; color: #fff; letter-spacing: 0.1em; }
#hud-banner.show { animation: banner 2.2s ease-out forwards; }
#hud-msg { top: 70%; color: #9dff6a; transition: opacity 0.3s; }
#hud-msg.show { opacity: 1; }
@keyframes banner {
  0% { opacity: 0; transform: scale(1.4); filter: blur(2px); }
  12% { opacity: 1; transform: scale(1); filter: none; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* --------------------------------------------------------------- título */
#title {
  grid-area: 1 / 1;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
  text-align: center;
  max-width: 100vw;
}
#title.hidden { display: none; }
.logo {
  margin: 0;
  font-weight: normal;
  font-size: clamp(32px, 10vw, 88px);
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow:
    0 0 0 #fff,
    3px 3px 0 var(--accent),
    6px 6px 0 #3a1460,
    0 0 24px rgba(176, 75, 255, 0.8);
  animation: glitch 4s infinite steps(1);
}
@keyframes glitch {
  0%, 92%, 100% { transform: none; }
  93% { transform: translate(-3px, 1px); text-shadow: 3px 0 var(--pink), -3px 0 var(--neon); }
  95% { transform: translate(2px, -1px); }
  97% { transform: translate(-1px, 0); text-shadow: -2px 0 var(--pink), 2px 0 var(--neon); }
}
.tagline { margin: 0; color: var(--neon); font-size: clamp(12px, 2.6vw, 20px); }
.heroes { display: flex; gap: 20px; margin: 10px 0; }
.hero-card {
  font: inherit;
  color: var(--dim);
  background: #160c28;
  border: 3px solid #2e1d4d;
  padding: 12px 16px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.hero-card canvas { width: 64px; height: 128px; image-rendering: pixelated; }
.hero-card.selected { border-color: var(--accent); color: #fff; box-shadow: 0 0 18px rgba(176, 75, 255, 0.6); }
.hero-card:focus-visible { outline: 2px solid var(--neon); }
.hint { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.6; }
.hint.touch { display: none; }
@media (pointer: coarse) {
  .hint.desktop { display: none; }
  .hint.touch { display: block; }
}
.credits-link { color: var(--dim); font-size: 11px; margin-top: 8px; }
.credits-link:hover { color: #fff; }

/* -------------------------------------------------------- joystick táctil */
#stick {
  position: fixed;
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  display: none;
  z-index: 3;
}
#stick.on { display: block; }
#stick i {
  position: absolute; left: 50%; top: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: rgba(176, 75, 255, 0.55);
  transform: translate(var(--kx, 0), var(--ky, 0));
}

body:not(.ready) #title { visibility: hidden; }
