@font-face {
  font-family: "Oswald";
  src: url("fonts/oswald.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("fonts/spacemono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --abyss: #060A0C;
  --deep: #0B1416;
  --text: #E9F3EF;
  --secondary: rgba(233, 243, 239, .45);
  --phosphor: #4DFFB0;
  --sulphur: #FFD23A;
  --coral: #FF5E45;
  --ice: #CFF6FF;
  --col: 390px;
  --prompt-bottom: 21%;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

html {
  background: #060A0C;
}

body {
  background: var(--abyss);
  color: var(--text);
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  font-weight: 400;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button {
  font: inherit;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--abyss);
}

#bg {
  position: absolute;
  inset: -4%;
  z-index: 0;
  background-image: url("assets/bg_wide.webp");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  filter: brightness(1.22) saturate(1.08);
  animation: bgDrift 46s ease-in-out infinite alternate;
  will-change: transform, filter;
  transition: filter .42s ease;
}

#depth {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 118%, rgba(18, 58, 60, .55), rgba(11, 20, 22, 0) 62%),
    linear-gradient(to top, rgba(11, 20, 22, .55), rgba(11, 20, 22, 0) 42%);
  transition: filter .42s ease;
}

#warm {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 108%, rgba(150, 78, 12, .52), rgba(90, 44, 8, .14) 44%, rgba(0, 0, 0, 0) 72%);
  mix-blend-mode: screen;
  will-change: opacity, filter;
  transition: opacity .5s ease, filter .42s ease;
}

#watermark {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease, filter .42s ease;
}

#combo {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-size: calc(var(--col) * .8 / var(--d, 1));
  line-height: .82;
  letter-spacing: -.04em;
  color: rgba(233, 243, 239, .085);
  white-space: nowrap;
  transform: translateY(-4%) scale(1);
  transform-origin: center center;
  transition: transform .12s cubic-bezier(.2, 1.6, .4, 1);
  text-shadow: 0 0 60px rgba(150, 255, 225, .05);
}

#combo.pop {
  transform: translateY(-4%) scale(1.12);
}

#game {
  position: absolute;
  inset: 0;
  z-index: 3;
  transition: filter .42s ease;
  will-change: filter;
}

#game canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

#vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(6, 10, 12, 0) 32%, rgba(4, 8, 10, .26) 66%, rgba(2, 4, 6, .62) 100%);
}

#hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

#hudInner {
  position: relative;
  width: var(--col);
  height: 100%;
}

#scoreWrap {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}

#score {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: calc(var(--col) * .145);
  line-height: .82;
  letter-spacing: .005em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-shadow: 0 0 1px rgba(0, 0, 0, .5), 0 4px 22px rgba(0, 0, 0, .7), 0 0 44px rgba(160, 255, 225, .12);
}

#newBest {
  margin-top: calc(var(--col) * .012);
  height: calc(var(--col) * .032);
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: calc(var(--col) * .026);
  line-height: 1.2;
  letter-spacing: .2em;
  padding-left: .2em;
  color: var(--sulphur);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
  text-shadow: 0 0 18px rgba(255, 210, 58, .4), 0 2px 14px rgba(0, 0, 0, .8);
}

#newBest.show {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease, visibility 0s linear 0s;
}

#bestRow {
  margin-top: calc(var(--col) * .002);
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 500;
  font-size: calc(var(--col) * .031);
  line-height: 1.15;
  letter-spacing: .12em;
  padding-left: .12em;
  color: var(--secondary);
  transition: color .3s ease;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .8);
}

#bestRow.is-new {
  color: var(--sulphur);
}

#best {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

#title {
  position: absolute;
  top: 35%;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-size: calc(var(--col) * .18);
  line-height: 1;
  letter-spacing: -.015em;
  color: var(--text);
  text-shadow:
    0 0 1px rgba(255, 255, 255, .6),
    0 0 18px rgba(160, 255, 230, .3),
    0 0 48px rgba(80, 255, 215, .16),
    0 10px 36px rgba(0, 0, 0, .65);
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .45s ease, transform .45s ease;
  animation: titleIn .9s cubic-bezier(.16, 1, .3, 1) 1;
}

#prompt {
  position: absolute;
  left: 50%;
  bottom: var(--prompt-bottom, 21%);
  transform: translateX(-50%);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: calc(var(--col) * .034);
  letter-spacing: .48em;
  padding-left: .48em;
  line-height: 1.5;
  color: rgba(233, 243, 239, .82);
  white-space: nowrap;
  text-transform: lowercase;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .85);
  pointer-events: none;
  opacity: 1;
  animation: promptPulse 2.8s ease-in-out infinite;
  transition: opacity .35s ease;
}

#sound {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: calc(var(--col) * .035);
  z-index: 6;
  width: clamp(30px, calc(var(--col) * .075), 44px);
  height: clamp(30px, calc(var(--col) * .075), 44px);
  padding: 0;
  border: 0;
  background: none;
  color: rgba(233, 243, 239, .5);
  cursor: pointer;
  pointer-events: auto;
  opacity: .55;
  transition: opacity .3s ease, color .3s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#sound svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#sound .spk {
  fill: currentColor;
  stroke: none;
}

#sound .slash {
  opacity: 0;
}

#sound.off .w1,
#sound.off .w2 {
  opacity: 0;
}

#sound.off .slash {
  opacity: 1;
}

#sound:hover {
  opacity: .85;
}

#sound:focus-visible {
  outline: 1px solid rgba(233, 243, 239, .5);
  outline-offset: 5px;
  border-radius: 50%;
}

#sound:active {
  transform: scale(.93);
}

#pause {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 10, .62);
  pointer-events: auto;
  cursor: pointer;
}

.pauseInner {
  text-align: center;
}

.pauseTitle {
  font-family: "Poppins", "Arial Black", sans-serif;
  font-weight: 800;
  font-size: calc(var(--col) * .11);
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 30px rgba(120, 255, 220, .25);
}

.pausePrompt {
  margin-top: calc(var(--col) * .022);
  font-family: "Space Mono", "Courier New", monospace;
  font-size: calc(var(--col) * .03);
  letter-spacing: .4em;
  padding-left: .4em;
  color: rgba(233, 243, 239, .55);
}

#sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body[data-mode="playing"] #scoreWrap,
body[data-mode="dead"] #scoreWrap {
  opacity: 1;
}

body[data-mode="playing"] #title,
body[data-mode="dead"] #title {
  opacity: 0;
  transform: translateY(-8px);
  animation: none;
}

body[data-mode="playing"] #watermark,
body[data-mode="dead"] #watermark {
  opacity: 1;
}

body[data-mode="playing"] #prompt {
  opacity: 0;
  animation: none;
}

body[data-mode="menu"] {
  --prompt-bottom: 21%;
}

body[data-mode="dead"] {
  --prompt-bottom: 7%;
}

body[data-mode="playing"] #sound {
  opacity: .3;
}

body.paused #pause {
  display: flex;
}

body.is-dead #bg,
body.is-dead #depth,
body.is-dead #warm,
body.is-dead #game,
body.is-dead #watermark {
  filter: saturate(.14) brightness(1.02) contrast(1.02);
}

@keyframes bgDrift {
  from {
    transform: scale(1.06) translate3d(-.6%, -.3%, 0);
  }
  to {
    transform: scale(1.1) translate3d(.6%, .3%, 0);
  }
}

@keyframes titleIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes promptPulse {
  0%,
  100% {
    opacity: .72;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #bg {
    animation: none;
  }
  #title {
    animation: none;
  }
  #prompt {
    animation: none;
    opacity: .8;
  }
  #combo {
    transition: none;
  }
}
