/* UFO Hunters — Medellín
   A sunset-soaked HUD: hot pink, orange and teal over the 3D scene. */

:root {
  --pink: #ff4fa3;
  --orange: #ffb347;
  --teal: #35e0d0;
  --ink: #fff7fb;
  --shade: rgba(14, 6, 26, .62);
  --display: "Bebas Neue", "Arial Narrow", sans-serif;
  --body: "Rubik", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* The game sizes itself to the viewport; inside the portfolio that
   viewport is the iframe, so the page itself must not scroll. */
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #120a1e;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
          user-select: none;
  touch-action: none;
}

.stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; transition: filter 1.2s ease; }
.is-playing, .is-playing .stage { cursor: none; }
.is-over .stage { filter: grayscale(1) contrast(1.15) brightness(.8); }
.is-won .stage { filter: saturate(1.25) brightness(1.05); }

/* ---- HUD ----------------------------------------------------------- */

.hud { position: fixed; inset: 0; pointer-events: none; transition: opacity .4s ease; }
.hud--hidden { opacity: 0; }

.hud__top {
  position: absolute;
  top: clamp(10px, 2.4vh, 22px);
  right: clamp(12px, 2.4vw, 28px);
  text-align: right;
  font-family: var(--display);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 14px rgba(0, 0, 0, .5);
}

.hud__stars { font-size: clamp(20px, 3.4vw, 34px); letter-spacing: .08em; }
.hud__stars i { font-style: normal; color: rgba(255, 255, 255, .22); }
.hud__stars i.is-on { color: #fff; text-shadow: 0 0 10px rgba(255, 255, 255, .8), 0 2px 0 rgba(0, 0, 0, .5); }
.hud__stars.is-hot i.is-on { animation: starBlink .5s steps(2) infinite; }

@keyframes starBlink { 50% { color: var(--pink); text-shadow: 0 0 14px var(--pink); } }

.hud__score {
  margin-top: 4px;
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: .04em;
  background: linear-gradient(180deg, #fff3a8, var(--orange) 45%, var(--pink));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55));
}

.hud__time { margin-top: 2px; font-size: clamp(20px, 3vw, 30px); letter-spacing: .08em; color: var(--ink); }
.hud__time.is-low { color: var(--pink); animation: starBlink .8s steps(2) infinite; }

/* How to get out, top left */
.hud__esc {
  position: absolute;
  top: clamp(10px, 2.4vh, 22px);
  left: clamp(12px, 2.4vw, 28px);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .7), 0 0 10px rgba(0, 0, 0, .6);
}
.is-touch .hud__esc { display: none; }

/* Radar with the two bars underneath, bottom left */
.hud__radar {
  position: absolute;
  left: clamp(12px, 2.4vw, 28px);
  bottom: clamp(12px, 2.6vh, 26px);
  width: clamp(110px, 17vw, 170px);
}

.hud__map {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 0 24px rgba(255, 79, 163, .45);
  background: rgba(14, 6, 26, .5);
}

.hud__bars { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 7px; }
.bar { display: block; height: 8px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(0, 0, 0, .8); }
.bar b { display: block; height: 100%; width: 100%; transform-origin: left; }
.bar--hull b { background: linear-gradient(90deg, #58e06f, #b6ff8a); }
.bar--cloak b { background: linear-gradient(90deg, #2bb8ff, var(--teal)); }

/* District name, bottom right, in script */
.hud__place {
  position: absolute;
  right: clamp(14px, 2.6vw, 32px);
  bottom: clamp(14px, 3vh, 30px);
  font-family: "Yellowtail", cursive;
  font-size: clamp(24px, 4.2vw, 44px);
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 0 18px var(--pink), 0 2px 0 rgba(0, 0, 0, .6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s ease, transform .6s ease;
}
.hud__place.is-on { opacity: 1; transform: none; }

.hud__toast {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: clamp(22px, 3.6vw, 38px);
  letter-spacing: .08em;
  color: var(--teal);
  text-shadow: 0 0 16px rgba(53, 224, 208, .8), 0 2px 0 rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity .25s ease;
  white-space: nowrap;
}
.hud__toast.is-on { opacity: 1; }

.hud__cloaked {
  position: absolute;
  left: 50%;
  bottom: 16%;
  transform: translateX(-50%);
  padding: 4px 14px 2px;
  font-family: var(--display);
  font-size: clamp(16px, 2.2vw, 22px);
  letter-spacing: .3em;
  color: var(--teal);
  border: 1px solid rgba(53, 224, 208, .7);
  background: rgba(8, 30, 40, .45);
  opacity: 0;
  transition: opacity .2s ease;
}
.hud__cloaked.is-on { opacity: 1; animation: cloakPulse 1.2s ease-in-out infinite; }
@keyframes cloakPulse { 50% { box-shadow: 0 0 18px rgba(53, 224, 208, .7); } }

.hud__aim {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 18px;
  height: 18px;
  margin: -9px;
  border: 2px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(53, 224, 208, .8);
}
.hud__aim::after { content: ""; position: absolute; inset: 6px; background: #fff; border-radius: 50%; }

/* Red flash round the edges when a shot lands */
.hud__hit {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 140px 30px rgba(255, 30, 70, .85);
  opacity: 0;
  transition: opacity .5s ease;
}
.hud__hit.is-on { opacity: 1; transition: none; }

/* ---- touch controls (shown on touch screens only) ------------------ */

.touch { display: none; }
.is-touch .touch { display: block; }
.is-touch .hud__radar { bottom: auto; top: clamp(10px, 2.4vh, 22px); width: clamp(84px, 22vw, 120px); }

.touch__stick {
  position: absolute;
  left: 22px;
  bottom: 22px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45);
  background: rgba(14, 6, 26, .35);
  pointer-events: auto;
}
.touch__stick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  box-shadow: 0 0 16px var(--pink);
}

.touch__buttons {
  position: absolute;
  right: 14px;
  bottom: 70px;
  display: grid;
  grid-template-columns: repeat(2, 62px);
  gap: 8px;
  pointer-events: auto;
}
.touch__buttons button {
  height: 46px;
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 10px;
  background: rgba(14, 6, 26, .5);
  color: #fff;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: .08em;
}
.touch__buttons .touch__fire { grid-column: span 2; border-color: var(--pink); background: rgba(255, 79, 163, .4); }

/* ---- result banner ------------------------------------------------- */

.banner {
  position: fixed;
  left: 0;
  right: 0;
  top: 34%;
  padding: 14px 0 10px;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .7) 20%, rgba(0, 0, 0, .7) 80%, transparent);
  pointer-events: none;
  transition: opacity .5s ease;
}
.banner--hidden { opacity: 0; }
.banner__text {
  display: block;
  font-family: var(--display);
  font-size: clamp(44px, 10vw, 110px);
  line-height: 1;
  letter-spacing: .06em;
  color: #ffd84a;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .6);
}
.is-over .banner__text { color: #e8324a; }
.banner__sub { display: block; margin-top: 4px; font-size: clamp(13px, 1.8vw, 17px); letter-spacing: .2em; text-transform: uppercase; }

/* ---- start / game-over dialogue ------------------------------------ */

.dialogue {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 10, 60, .35), rgba(10, 4, 22, .82));
  overflow: auto;
  touch-action: auto;
  transition: opacity .35s ease, visibility 0s linear 0s;
}
.dialogue--hidden { opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }

.dialogue__content { max-width: 560px; margin: auto; }

.dialogue__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(54px, 12vw, 118px);
  line-height: .9;
  letter-spacing: .03em;
  background: linear-gradient(180deg, #fff3a8 8%, var(--orange) 38%, var(--pink) 70%, #8a3cff);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .5)) drop-shadow(0 0 26px rgba(255, 79, 163, .5));
}

.dialogue__city {
  margin: -.32em 0 0;
  font-family: "Yellowtail", cursive;
  font-size: clamp(34px, 7vw, 66px);
  line-height: 1;
  color: var(--ink);
  transform: rotate(-5deg);
  text-shadow: 0 0 20px var(--teal), 0 3px 0 rgba(0, 0, 0, .5);
}

.dialogue__by { margin: 18px 0 14px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 247, 251, .8); }

/* Controls: two key clusters shaped like the keyboard (W over A S D, and the
   arrows), then the single keys in a tidy grid underneath. */
.controls {
  margin: 0 auto 14px;
  padding: 16px 18px 14px;
  max-width: 500px;
  font-size: 13px;
  background: var(--shade);
  border: 1px solid rgba(112, 182, 227, .4);
}
.is-touch .dialogue__rules { display: none; }

.controls__pads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(112, 182, 227, .25);
}

.pad { margin: 0; }
.pad__keys {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  gap: 5px;
  justify-content: center;
}
.pad__up { grid-column: 2; }
.pad__up + .key { grid-column: 1; }   /* the row of three starts back at the left */
.pad .key { width: 36px; height: 36px; margin: 0; padding: 0; font-size: 20px; line-height: 36px; }
.pad figcaption { margin-top: 10px; letter-spacing: .1em; text-transform: uppercase; font-size: 11.5px; color: rgba(255, 247, 251, .85); }
.pad figcaption b { color: var(--key); font-weight: 500; }

.controls__keys {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px 18px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}
.controls__keys li { display: flex; align-items: center; gap: 5px; letter-spacing: .1em; text-transform: uppercase; font-size: 11.5px; color: rgba(255, 247, 251, .85); }
.controls__keys li .key:last-of-type { margin-right: 6px; }

/* A keycap, in light blue */
.key {
  --key: #70b6e3;
  display: inline-block;
  min-width: 28px;
  height: 28px;
  margin: 0;
  padding: 0 7px;
  text-align: center;
  font-family: var(--display);
  font-size: 16px;
  line-height: 28px;
  letter-spacing: .06em;
  text-transform: none;
  color: #0c1c2a;
  background: linear-gradient(180deg, #a5d4f3, #70b6e3);
  border: 1px solid #c9e6f9;
  border-radius: 5px;
  box-shadow: 0 3px 0 #2f6f9b, 0 4px 8px rgba(0, 0, 0, .5);
}
.key--wide { min-width: 58px; }
.controls { --key: #70b6e3; }

.dialogue__goal { margin: 0 auto 14px; max-width: 460px; font-size: 14.5px; line-height: 1.5; color: rgba(255, 247, 251, .88); }

.dialogue__scores { margin: 0 0 14px; font-family: var(--display); font-size: 24px; letter-spacing: .08em; color: var(--teal); }
.dialogue__scores:empty { display: none; }

.dialogue__start {
  appearance: none;
  padding: 12px 34px 9px;
  border: 0;
  border-radius: 6px;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: .12em;
  color: #1a0b24;
  background: linear-gradient(180deg, #fff3a8, var(--orange) 55%, var(--pink));
  box-shadow: 0 4px 0 rgba(0, 0, 0, .5), 0 0 26px rgba(255, 79, 163, .55);
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.dialogue__start:hover, .dialogue__start:focus-visible { transform: translateY(-2px); filter: brightness(1.1); outline: none; }
.dialogue__start:disabled { filter: grayscale(.7) brightness(.8); cursor: wait; transform: none; font-size: 20px; }

.dialogue__credit { margin: 14px 0 0; font-size: 11px; letter-spacing: .04em; color: rgba(255, 247, 251, .6); }

@media (max-height: 520px) {
  .dialogue__by, .dialogue__goal, .dialogue__credit { display: none; }
  .controls { padding: 10px 12px; margin-bottom: 10px; }
  .controls__pads { padding-bottom: 8px; }
  .controls__keys { margin-top: 8px; gap: 6px 14px; }
  .pad__keys { grid-template-columns: repeat(3, 28px); gap: 4px; }
  .pad .key { width: 28px; height: 28px; line-height: 28px; font-size: 16px; }
  .pad figcaption { margin-top: 6px; }
  .dialogue__city { margin-bottom: 10px; }
}

@media (max-width: 460px) {
  .controls__pads { gap: 10px; }
  .pad__keys { grid-template-columns: repeat(3, 30px); }
  .pad .key { width: 30px; height: 30px; line-height: 30px; }
  .controls__keys { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .hud__stars.is-hot i.is-on, .hud__time.is-low, .hud__cloaked.is-on { animation: none; }
}
