/* 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 (top middle on phones, below) */
.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; }

/* Phones, the app and small screens: up top in the middle, clear of the
   touch buttons, between the radar (left) and the score (right) */
.is-touch .hud__place {
  left: 50%;
  right: auto;
  bottom: auto;
  top: clamp(10px, 2.4vh, 22px);
  max-width: calc(100vw - 2 * clamp(100px, 26vw, 150px));
  font-size: clamp(22px, 6vw, 34px);
  text-align: center;
  transform: translate(-50%, -8px);
}
.is-touch .hud__place.is-on { transform: translate(-50%, 0); }
@media (max-width: 640px) {
  .hud__place {
    left: 50%;
    right: auto;
    bottom: auto;
    top: clamp(10px, 2.4vh, 22px);
    max-width: calc(100vw - 2 * clamp(100px, 26vw, 150px));
    font-size: clamp(22px, 6vw, 34px);
    text-align: center;
    transform: translate(-50%, -8px);
  }
  .hud__place.is-on { transform: translate(-50%, 0); }
}

.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%; }

/* Helicopter markers: a diamond on each one in view, an arrow at the edge for the rest */
.hud__markers { position: absolute; inset: 0; overflow: hidden; }
.marker { position: absolute; left: 0; top: 0; width: 0; height: 0; --mk: #ff3550; }
.marker i {
  position: absolute;
  left: -10px;
  top: -10px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--mk);
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--mk);
}
.marker span {
  position: absolute;
  top: 16px;
  left: 0;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  color: #ffe1e7;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .8), 0 0 6px rgba(0, 0, 0, .7);
  white-space: nowrap;
}
.marker--edge i {
  left: -13px;
  top: -11px;
  width: 26px;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: var(--mk);
  clip-path: polygon(0 0, 100% 50%, 0 100%, 28% 50%);
  box-shadow: none;
  filter: drop-shadow(0 0 6px var(--mk));
}
.marker--edge span { top: 18px; }
.marker--locked { --mk: #35e0d0; }
.marker--locked i { animation: lockPulse .8s ease-in-out infinite; }
@keyframes lockPulse { 50% { box-shadow: 0 0 18px var(--mk); opacity: .7; } }

/* 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); }
.touch__buttons .touch__lock { grid-column: span 2; border-color: var(--teal); background: rgba(53, 224, 208, .22); }

/* ---- 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; }

/* ---- radio ----------------------------------------------------------- */

.radio {
  position: fixed;
  z-index: 5;
  top: calc(clamp(10px, 2.4vh, 22px) + 40px);
  left: clamp(12px, 2.4vw, 28px);
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(14, 6, 26, .62);
  border: 2px solid #f7c2ea14;
  border-radius: 12px;
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-12px);
  transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
}
.radio--on { opacity: 1; visibility: visible; transform: none; transition: opacity .35s ease, transform .35s ease, visibility 0s; }
.radio__screen { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: .01; pointer-events: none; }
.radio__screen iframe { display: block; width: 100%; height: 100%; border: 0; }
.radio__info { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; max-width: 220px; }
.radio__label { font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); }
.radio__title { font-family: var(--display); font-size: 22px; line-height: 1; letter-spacing: .04em; color: #f7c2ea; }
.radio__artist { font-size: 12px; color: rgba(255, 247, 251, .75); }
.radio__keys { margin-top: 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 247, 251, .55); }
.radio__keys .key { min-width: 20px; height: 20px; padding: 0 5px; font-size: 12px; line-height: 20px; box-shadow: 0 2px 0 #2f6f9b; }
.is-touch .radio__keys { display: none; }

@media (max-width: 640px) {
  .radio { top: calc(clamp(10px, 2.4vh, 22px) + 36px); left: 8px; padding: 4px 10px; border-radius: 999px; gap: 0; }
  .radio__label, .radio__keys { display: none; }
  .radio__info { flex-direction: row; align-items: baseline; gap: 5px; max-width: 170px; }
  .radio__title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .radio__title::before { content: "♪ "; color: var(--teal); }
  .radio__artist { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.is-touch .radio { top: 8px; left: 8px; padding: 4px 10px; border-radius: 999px; gap: 0; }
.is-touch .radio__label { display: none; }
.is-touch .radio__info { flex-direction: row; align-items: baseline; gap: 5px; max-width: 170px; }
.is-touch .radio__title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-touch .radio__title::before { content: "♪ "; color: var(--teal); }
.is-touch .radio__artist { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

.dialogue {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: safe center;
  padding: 16px;
  padding-bottom: 55px !important;
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 10, 60, .35), rgba(10, 4, 22, .82));
  overflow: auto;
  overflow-x: hidden;
  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 { width: 100%; min-width: 0; 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: a quiet two-column legend, so the title stays the star. */
.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 4px auto 22px;
  padding: 6px 22px;
  width: max-content;
  min-width: min(100%, 380px);
  max-width: 100%;
  background: rgba(14, 6, 26, .45);
  border: 1px solid rgba(255, 247, 251, .08);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
.is-touch .dialogue__rules { display: none; }

.controls > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 247, 251, .07);
}
.controls > div:last-child { border-bottom: 0; }

.controls dt {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 247, 251, .62);
  white-space: nowrap;
}
.controls dd { display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: 4px; margin: 0 0 0 auto; }
.controls dd span { margin: 0 3px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 247, 251, .35); }

.controls kbd {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  line-height: 21px;
  text-align: center;
  color: #f7c2ea;
  background: rgba(255, 247, 251, .08);
  border: 1px solid rgb(0 115 211 / 15%);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* A keycap, in light blue (the in-flight HUD uses this one) */
.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);
}

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

/* Hangar: pick a ship and a laser colour */
.hangar { margin: 0 auto 14px; max-width: 460px; }
.hangar__row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.hangar__label { width: 44px; text-align: right; font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 247, 251, .6); }
.hangar__options { display: flex; flex-wrap: wrap; gap: 6px; }
.hangar__option {
  appearance: none;
  padding: 6px 10px;
  font: 500 12px/1 var(--body);
  color: #f7c2ea;
  background: rgba(255, 247, 251, .08);
  border: 1px solid rgba(255, 247, 251, .14);
  border-radius: 7px;
  cursor: pointer;
}
.hangar__option.is-picked { color: #1a0b24; background: #f7c2ea; border-color: #f7c2ea; }
.hangar__option.is-locked { opacity: .55; }
.hangar__swatch { width: 30px; height: 26px; padding: 0; background: var(--swatch); border: 2px solid rgba(0, 0, 0, .35); box-shadow: 0 0 10px var(--swatch); font-size: 11px; }
.hangar__swatch.is-picked { background: var(--swatch); border-color: #fff; outline: 2px solid var(--swatch); outline-offset: 2px; }
.hangar__note { margin: 2px 0 0; min-height: 15px; font-size: 11px; color: rgba(255, 247, 251, .6); }
.dialogue__start--unlock { font-size: 22px; }

.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; overflow-wrap: anywhere; font-size: 11px; letter-spacing: .04em; color: rgba(255, 247, 251, .6); }

@media (min-width: 600px) {
  .dialogue { padding-bottom: 104px; }
  .dialogue__rules.controls {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 30px;
    margin: 0;
    padding: 10px 22px;
    width: auto;
    min-width: 0;
    border: #f7c2ea14 2px solid;
    animation: controls-warp-in .75s cubic-bezier(.16, 1, .3, 1) 1s both;
  }
  .dialogue__rules.controls > div { padding: 2px 0; border-bottom: 0; }
}

/* Touch devices don't have keys: no controls legend at all */
.is-touch .dialogue__rules.controls { display: none; }

@keyframes controls-warp-in {
  0% { opacity: 0; transform: translateX(110%) skewX(-18deg) scaleX(1.4); filter: blur(10px); }
  60% { opacity: 1; transform: translateX(-2%) skewX(4deg) scaleX(.98); filter: blur(1px); }
  100% { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dialogue__rules.controls { animation: none; }
}

@media (max-height: 520px) {
  .dialogue__by, .dialogue__goal, .dialogue__credit { display: none; }
  .controls { margin-bottom: 12px; padding: 2px 18px; }
  .controls > div { padding: 6px 0; }
  .dialogue__city { margin-bottom: 10px; }
}

@media (max-width: 640px) {
  .controls { width: auto; padding: 4px 16px; }
  .controls dd { flex-wrap: wrap; }
}

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