@font-face {
  font-family: "Alfa Slab One";
  font-display: swap;
  src: url("fonts/alfa-slab-one.woff2") format("woff2");
}

@font-face {
  font-family: Anton;
  font-display: swap;
  src: url("fonts/anton.woff2") format("woff2");
}

:root {
  --ink: #14090a;
  --cream: #fff1cf;
  --amber: #ffc24d;
  --ember: #ff4a24;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  /* the golden-hour field, so the first paint already looks like the scene while the orcs load */
  background: linear-gradient(#3a62b8 0%, #f3a455 34%, #ffd596 43%, #6f8a2a 44%, #3f5f17 100%);
  color: #fff;
  font-family: Anton, Impact, sans-serif;
}

/* No WebGL2, or a device too slow to draw the horde: a still of the final scene and working buttons. */
.no-gl body,
.is-lite body {
  background: #0b0d1c url("media/standoff-poster.jpg") center / cover no-repeat;
}

.is-lite #scene,
.is-lite #tags,
.is-lite .corner,
.is-lite .hint,
.is-lite .kills,
.is-lite .replay,
.no-gl .corner,
.no-gl .hint,
.no-gl .replay {
  display: none;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: crosshair;
  touch-action: none;
  transition: opacity 0.5s;
}

.is-ready #scene {
  opacity: 1;
}

.vignette {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 62%, transparent 52%, rgb(4 4 14 / 60%) 100%),
    linear-gradient(180deg, rgb(6 6 20 / 38%), transparent 34%);
  pointer-events: none;
}

.flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, rgb(255 214 150 / 85%), rgb(255 120 40 / 35%) 70%);
  opacity: 0;
  pointer-events: none;
}

.flash.show {
  animation: flash 0.35s ease-out;
}

@keyframes flash {
  from {
    opacity: 0.55;
  }
}

/* ---------------------------------------------------------------- brand, counter, versus line */
.hud {
  position: fixed;
  inset: 0 0 auto;
  display: grid;
  justify-items: center;
  padding-top: clamp(8px, 2.2vh, 24px);
  pointer-events: none;
  text-transform: uppercase;
}

.brand {
  position: relative;
  display: grid;
  place-items: center;
  width: min(96vw, 900px);
  height: clamp(132px, 25vh, 232px);
  margin: 0;
}

.logo {
  position: absolute;
  height: 100%;
  filter: drop-shadow(0 12px 16px rgb(0 0 0 / 60%));
  opacity: 0;
  transform: scale(2.6) rotate(-7deg);
}

.is-final .logo {
  opacity: 1;
  transform: none;
  transition:
    transform 0.42s cubic-bezier(0.2, 1.7, 0.4, 1),
    opacity 0.1s;
}

.is-dance .logo {
  animation: bop 0.5s ease-in-out infinite;
}

@keyframes bop {
  50% {
    transform: translateY(-7%) rotate(3deg) scale(1.04);
  }
}

.counter {
  display: grid;
  justify-items: center;
  line-height: 0.95;
  transition:
    opacity 0.18s,
    transform 0.18s;
}

.is-final .counter {
  opacity: 0;
  transform: scale(0.5);
}

.night {
  color: var(--amber);
  font-size: clamp(15px, 2.6vh, 26px);
  letter-spacing: 0.3em;
  text-shadow: 0 2px 0 var(--ink);
}

.count {
  font-size: min(13vh, 13.5vw);
  font-variant-numeric: tabular-nums;
  paint-order: stroke fill;
  text-shadow: 0 0.07em 0 rgb(0 0 0 / 45%);
  white-space: nowrap;
  -webkit-text-stroke: 0.09em var(--ink);
}

.is-slam .count {
  color: var(--ember);
  animation: punch 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes punch {
  from {
    transform: scale(1.9);
  }
}

.versus {
  min-height: 1.1em;
  margin: clamp(2px, 0.8vh, 8px) 0 clamp(4px, 0.8vh, 8px);
  font-size: clamp(19px, 3.6vh, 36px);
  font-weight: 400;
  line-height: 1.1;
  paint-order: stroke fill;
  text-align: center;
  -webkit-text-stroke: 0.14em var(--ink);
}

.versus b {
  display: none;
  color: var(--ember);
  font-size: 1.25em;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.is-final .versus b {
  display: inline;
}

.versus i {
  color: var(--amber);
  font-style: normal;
}

/* the easter egg: "100,000 orcs" gets struck through and becomes cowboys */
.cowword {
  display: none;
  color: var(--amber);
}

.is-dance .cowword {
  display: inline;
}

.is-dance .orcword {
  text-decoration: line-through;
  text-decoration-thickness: 0.14em;
}

.pitch {
  margin: 0 0 clamp(8px, 1.6vh, 16px);
  color: var(--cream);
  font-size: clamp(13px, 2.2vh, 19px);
  letter-spacing: 0.12em;
  paint-order: stroke fill;
  text-align: center;
  -webkit-text-stroke: 0.22em var(--ink);
}

.posse,
.versus small {
  display: inline-block;
  opacity: 0;
  transform: scale(0.3);
}

.versus small {
  font-size: 0.5em;
  letter-spacing: 0.08em;
}

.is-vs .posse,
.is-vs .versus small {
  opacity: 1;
  transform: none;
  transition:
    transform 0.3s cubic-bezier(0.2, 1.8, 0.4, 1),
    opacity 0.1s;
}

.is-vs .versus small {
  transition-delay: 0.55s;
}

.is-posse .posse {
  animation: punch 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* ---------------------------------------------------------------- buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 13px 22px 15px;
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow:
    0 6px 0 var(--ink),
    0 14px 22px rgb(0 0 0 / 45%);
  color: var(--ink);
  font: 400 clamp(15px, 2.2vh, 19px) / 1 "Alfa Slab One", serif;
  letter-spacing: 0.03em;
  pointer-events: auto;
  text-decoration: none;
  cursor: pointer;
}

.btn img {
  width: 1.3em;
  height: 1.3em;
}

.steam {
  background: linear-gradient(#c4f04a, #7fc21d);
  font-size: clamp(17px, 2.6vh, 22px);
}

.discord {
  background: linear-gradient(#fff6de, #f0d596);
}

.signup {
  flex-basis: 100%;
  margin: 2px 0 0;
  color: var(--cream);
  font-size: clamp(13px, 2.4vh, 21px);
  letter-spacing: 0.1em;
  paint-order: stroke fill;
  text-align: center;
  -webkit-text-stroke: 0.22em var(--ink);
}

.signup b {
  color: var(--amber);
  font-weight: 400;
}

.corner {
  position: fixed;
  bottom: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s 0.5s;
}

.is-final .corner {
  opacity: 1;
  pointer-events: auto;
}

.more {
  right: 16px;
  background: linear-gradient(#ff7a4d, #e23c17);
  color: #fff;
  text-transform: uppercase;
}

.more:disabled {
  background: #4a4350;
  cursor: default;
}

.live {
  right: 16px;
  bottom: 74px;
  margin: 0;
  color: rgb(255 255 255 / 80%);
  font-size: 12px;
  letter-spacing: 0.16em;
  pointer-events: none !important;
  text-align: right;
  text-transform: uppercase;
}

.chip {
  position: fixed;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: rgb(20 9 10 / 55%);
  color: rgb(255 255 255 / 85%);
  font: 400 13px/1 Anton, sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.replay {
  bottom: 16px;
  left: 16px;
  cursor: pointer;
}

.sound {
  top: 14px;
  right: 14px;
  cursor: pointer;
}

.sound::before {
  content: "♪ ";
  color: var(--amber);
}

.sound.is-muted {
  color: rgb(255 255 255 / 55%);
}

.sound.is-muted::before {
  content: "✕ ";
  color: inherit;
}

/* ---------------------------------------------------------------- radio: the game's own, top left, labels under it */
.radio {
  position: fixed;
  top: 8px;
  left: 14px;
  display: grid;
  justify-items: start;
  gap: 2px;
}

.radio-row {
  display: flex;
  gap: 6px;
}

.radio .chip {
  position: static;
}

.radio-title {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radio-next,
.radio-toggle {
  cursor: pointer;
}

.radio-toggle {
  padding: 0;
  border: 0;
  background: none;
}

.radio-toggle img {
  display: block;
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 4px 5px rgb(0 0 0 / 55%));
}

.radio.is-playing .radio-toggle img {
  animation: radio-bop 0.52s ease-in-out infinite;
}

.radio.is-off .radio-toggle img {
  filter: grayscale(1) brightness(0.6);
}

.radio.is-off .radio-next {
  display: none;
}

@keyframes radio-bop {
  50% {
    transform: translateY(-3px) rotate(-5deg) scale(1.06);
  }
}

.kills {
  top: 50px;
  right: 14px;
  margin: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.has-kills .kills {
  opacity: 1;
}

/* ---------------------------------------------------------------- shooting hint and unlock toasts */
.hint,
.toast {
  margin: 0;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.2em var(--ink);
}

.hint {
  position: fixed;
  right: 0;
  bottom: 52px;
  left: 0;
  font-size: clamp(15px, 2.4vh, 20px);
  letter-spacing: 0.2em;
  opacity: 0;
}

.is-final:not(.has-shot) .hint {
  animation: pulse 1.4s ease-in-out 1s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }

  50% {
    opacity: 1;
  }
}

/* sits in the page flow right under the buttons (under the pitch line on phones), so it never covers them */
.toast {
  margin-top: clamp(4px, 1vh, 10px);
  padding: 0 12px;
  color: var(--amber);
  font-size: clamp(17px, min(3.4vh, 5.2vw), 32px);
  opacity: 0;
}

.toast.show {
  animation: toast 2.6s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}

@keyframes toast {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }

  12%,
  80% {
    opacity: 1;
    transform: none;
  }

  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ---------------------------------------------------------------- player tags: chunky extruded P1 to P4 */
.tag {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  pointer-events: none;
  will-change: transform;
}

.tag.on {
  display: block;
}

.tag span {
  position: absolute;
  bottom: 0;
  left: 0;
  display: block;
  color: var(--face);
  font: 400 clamp(22px, min(5.6vh, 8.5vw), 56px) / 1 "Alfa Slab One", serif;
  paint-order: stroke fill;
  text-shadow:
    0 0.04em 0 var(--side),
    0 0.08em 0 var(--side),
    0 0.12em 0 var(--side),
    0 0.16em 0 var(--side),
    0 0.2em 0 var(--ink),
    0 0.34em 0.3em rgb(0 0 0 / 55%);
  transform: translateX(-50%) rotate(-6deg);
  transform-origin: 50% 100%;
  animation:
    tag-in 0.4s cubic-bezier(0.2, 1.9, 0.4, 1),
    tag-bob 1.1s ease-in-out 0.4s infinite;
  -webkit-text-stroke: 0.1em var(--ink);
}

.tag span::after {
  display: block;
  margin-top: -0.12em;
  content: "▼";
  font-size: 0.42em;
  text-align: center;
}

.p1 {
  --face: #ff6152;
  --side: #a3261c;
}

.p2 {
  --face: #58abff;
  --side: #1d5aa6;
}

.p3 {
  --face: #ffdc52;
  --side: #a8811a;
}

.p4 {
  --face: #6ee686;
  --side: #23853a;
}

.p2 span,
.p4 span {
  transform: translateX(-50%) rotate(6deg);
}

@keyframes tag-in {
  from {
    scale: 0;
  }
}

@keyframes tag-bob {
  50% {
    translate: 0 -14%;
  }
}

/* ---------------------------------------------------------------- shared kill count and the owner's readout */
.world {
  position: fixed;
  right: 0;
  bottom: 18px;
  left: 0;
  margin: 0;
  color: var(--cream);
  font-size: clamp(13px, 2vh, 17px);
  letter-spacing: 0.14em;
  opacity: 0;
  paint-order: stroke fill;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 0.4s;
  -webkit-text-stroke: 0.22em var(--ink);
}

.is-final .world.on {
  opacity: 1;
}

.world b {
  color: var(--ember);
  font-size: 1.4em;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.logo {
  pointer-events: auto;
}

.peek {
  top: 8px;
  left: 50%;
  z-index: 2;
  width: max-content;
  max-width: 94vw;
  margin: 0;
  background: rgb(20 9 10 / 85%);
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 0.3s;
}

.peek.show {
  opacity: 1;
}

.narrow,
.steam .label small {
  display: none;
}

@keyframes tag-out {
  to {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  /* Phones: logo and one headline on top, the scene free in the middle, one button row at the bottom. */
  .brand {
    height: clamp(104px, 19vh, 180px);
  }

  .versus {
    margin-bottom: 2px;
    font-size: min(3.4vh, 6.1vw);
    white-space: nowrap;
  }

  .versus small,
  .wide,
  .signup,
  .live,
  .radio-title,
  .discord .label {
    display: none;
  }

  .narrow {
    display: inline;
  }

  .pitch {
    margin: 0;
    font-size: min(1.9vh, 3.2vw);
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .actions {
    position: fixed;
    inset: auto 10px 12px;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    padding: 0;
  }

  .btn {
    padding: 10px 12px 12px;
    white-space: nowrap;
  }

  .steam {
    flex: 1;
    font-size: 17px;
  }

  .steam .label {
    display: grid;
    gap: 4px;
    justify-items: start;
  }

  .steam .label small {
    display: block;
    font: 400 11px/1 Anton, sans-serif;
    letter-spacing: 0.1em;
    opacity: 0.8;
    text-transform: uppercase;
  }

  .discord {
    flex: none;
    width: 60px;
    padding: 0;
  }

  .discord img {
    width: 26px;
    height: 26px;
  }

  .world {
    bottom: 86px;
    font-size: 12px;
  }

  .more {
    right: 10px;
    bottom: 114px;
    padding: 8px 12px 10px;
    font-size: 13px;
  }

  .replay {
    bottom: 116px;
    left: 8px;
  }

  .hint {
    bottom: 164px;
    font-size: 14px;
  }

  .chip {
    padding: 6px 8px;
    font-size: 11px;
  }

  /* the sound switch shrinks to its icon */
  .sound {
    top: 8px;
    right: 8px;
    font-size: 0;
  }

  .sound::before {
    content: "♪";
    font-size: 15px;
  }

  .sound.is-muted::before {
    content: "✕";
  }

  .radio {
    top: 4px;
    left: 6px;
  }

  .radio-toggle img {
    width: 42px;
    height: 42px;
  }

  .kills {
    top: 8px;
    right: auto;
    left: 56px;
  }

  /* player tags are smaller here and bow out once everyone has seen who is who */
  .tag span {
    font-size: clamp(18px, 5.6vw, 26px);
  }

  .tag.on {
    animation: tag-out 0.5s 4.5s forwards;
  }
}
