html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #000;
  color: #f2f2f2;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Consolas,
    Menlo,
    monospace;
  cursor: url("cursor.cur"), auto;
}

.screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ansi-wrap {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.artboard {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  transform: none;
}

#ascii-image {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

#glitch-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: #000;
  background: transparent;
  white-space: pre;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.glitch-char {
  position: absolute;
  color: #000;
  font:
    8.5px/8.5px
    "Courier New",
    Courier,
    monospace;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.social-links {
  position: absolute;
  top: 32vh;
  left: 28.125%;
  z-index: 10;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;

  pointer-events: auto;
}

.social-links a {
  color: #000;
  font-family: Georgia, serif;
  font-size: 15.5px;
  line-height: 1.15;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.social-links a:hover,
.social-links a:focus-visible {
  text-decoration-thickness: 2px;
}

/*
  Audio UI must remain directly inside body,
  outside .screen, .ansi-wrap, and .artboard.
*/
#audio-ui {
  position: fixed;
  top: 10px;
  right: 26px;
  left: auto;
  z-index: 10000;

  display: flex;
  align-items: center;
  gap: 10px;

  box-sizing: border-box;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 8px 10px;

  background: #d4d4d4;
  border: 2px solid #222;
  box-shadow:
    3px 3px 0
    rgba(0, 0, 0, 0.6);

  color: #000;
  font-family: Georgia, serif;
  transform: none;
}

#audio-ui button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;

  width: 28px;
  height: 24px;
  padding: 0;

  background:
    linear-gradient(
      #fff,
      #aaa
    );

  border: 1px solid #222;
  color: #000;
  cursor: pointer;
  filter: grayscale(1);
}

#audio-ui input[type="range"] {
  flex: 1 1 140px;
  width: 140px;
  min-width: 70px;
  max-width: 140px;
  height: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* Keep :: directly beside the closing bracket. */
#audio-ui input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  background: #777;
  border: 1px solid #222;
  border-radius: 0;
}

#audio-ui input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 18px;
  margin-top: -7px;
  background: #d4d4d4;
  border: 1px solid #111;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
}

#audio-ui input[type="range"]::-moz-range-track {
  width: 100%;
  height: 5px;
  background: #777;
  border: 1px solid #222;
  border-radius: 0;
}

#audio-ui input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 18px;
  background: #d4d4d4;
  border: 1px solid #111;
  border-radius: 0;
}

.girl-textbox {
  position: absolute;
  top: 700px;
  left: 65%;
  z-index: 10;
  pointer-events: auto;
}

.girl-textbox textarea {
  display: block;
  width: 260px;
  height: 120px;
  padding-right: 0;

  resize: none;
  overflow: hidden;
  text-align: right;
  direction: ltr;

  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;

  appearance: none;
  -webkit-appearance: none;

  color: #000;
  font-family: Georgia, serif;
  font-size: 18px;
  pointer-events: auto;
}

#viewCounterUI {
  position: fixed;
  top: 70px;
  right: 20px;
  left: auto;
  z-index: 10000;
}

#viewCounterImg {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
}

.loved-message {
  position: absolute;
  left: 50px;
  bottom: 50px;
  z-index: 10;

  color: #000;
  background: none;
  border: none;

  font-family: Georgia, serif;
  font-size:
    clamp(
      42px,
      5vw,
      82px
    );

  font-weight: 400;
  line-height: 1;
  white-space: nowrap;

  pointer-events: auto;
  user-select: none;
}

.text-glitching {
  animation:
    text-jitter
    100ms
    steps(2, end)
    infinite;
}

@keyframes text-jitter {
  0% {
    transform:
      translate(0, 0);
  }

  25% {
    transform:
      translate(2px, 0);
  }

  50% {
    transform:
      translate(-2px, 1px);
  }

  75% {
    transform:
      translate(1px, -1px);
  }

  100% {
    transform:
      translate(0, 0);
  }
}

@media (max-width: 768px) {
  .ansi-wrap,
  .artboard {
    width: 100%;
    min-height: 100dvh;
    transform: none;
  }

  #ascii-image {
    width: 100%;
    min-height: 100dvh;
  }

  #glitch-layer,
  .girl-textbox {
    display: none;
  }

  /*
    This is the important mobile fix.
    Do not change this back to left: 10px.
  */
  #audio-ui {
    top: 10px;
    right:
      max(
        10px,
        env(safe-area-inset-right)
      );

    left: auto;
    max-width:
      calc(100vw - 20px);
  }

  #audio-ui input[type="range"] {
    width:
      min(
        140px,
        calc(100vw - 100px)
      );
  }
}
.top-message {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;

  color: #000;
  font-family: Georgia, serif;
  font-size: clamp(16px, 2vw, 24px);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
