@font-face {
  font-family: "KenPixel";
  src: url("./assets/fonts/kenpixel.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --button: #c9c9c9;
  --button-light: #f2f2f2;
  --button-dark: #707070;
  --button-ink: #505050;
  --purple: #7443e5;
  --purple-light: #a486ff;
  --purple-dark: #40208e;
  --yellow: #fff200;
  --black: #111;
}

* { box-sizing: border-box; }

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

body {
  overflow: hidden;
  background: #102c5b;
  color: #fff;
  font-family: "KenPixel", ui-monospace, Menlo, monospace;
}

button,
a { -webkit-tap-highlight-color: transparent; }

.game-menu {
  isolation: isolate;
  position: relative;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
}

.game-menu__background,
.game-menu__vignette {
  position: absolute;
  pointer-events: none;
}

.game-menu__background {
  z-index: -2;
  inset: -5%;
  background: #102c5b url("./assets/voxel-hero.jpg") center / cover no-repeat;
  will-change: transform;
  animation: scene-drift 16s ease-in-out infinite alternate;
}

.game-menu__vignette {
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 8, 20, .04), transparent 34%, transparent 72%, rgba(2, 8, 20, .24)),
    radial-gradient(circle at 50% 45%, transparent 45%, rgba(1, 6, 18, .14) 100%);
}

@keyframes scene-drift {
  from {
    transform: translate3d(-22px, -8px, 0) scale(1.035);
  }
  to {
    transform: translate3d(22px, 8px, 0) scale(1.065);
  }
}

.masthead {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: min(67vw, 1360px);
  transform: translateX(-50%);
}

.masthead__logo {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(8px 13px 7px rgba(0, 0, 0, .38));
  user-select: none;
}

.masthead__slogan {
  position: absolute;
  right: -4%;
  bottom: 18%;
  margin: 0;
  transform: rotate(-8deg);
  display: block;
  width: min(35vw, 720px);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(3px 3px 0 #111);
}

.main-menu {
  position: absolute;
  z-index: 4;
  top: 69.5%;
  left: 50%;
  display: grid;
  width: min(38vw, 760px);
  min-width: 430px;
  gap: 9px;
  transform: translateX(-50%);
}

.pixel-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--black);
  border-radius: 0;
  background: var(--button);
  box-shadow:
    inset 4px 4px 0 var(--button-light),
    inset -4px -4px 0 var(--button-dark),
    6px 7px 0 rgba(0, 0, 0, .72);
  color: var(--button-ink);
  font: inherit;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, .48);
  cursor: pointer;
  transition: transform 90ms ease, background 90ms ease, color 90ms ease;
}

.pixel-button:hover,
.pixel-button:focus-visible,
.pixel-button.is-active {
  z-index: 2;
  outline: 4px solid #fff;
  outline-offset: 2px;
  background: var(--purple);
  box-shadow:
    inset 4px 4px 0 var(--purple-light),
    inset -4px -4px 0 var(--purple-dark),
    6px 7px 0 rgba(0, 0, 0, .76);
  color: #fff;
  text-shadow: 3px 3px 0 #321771;
}

.pixel-button:active { transform: translate(3px, 3px); }

.pixel-button--main {
  min-height: clamp(78px, 8.8vh, 105px);
  padding: 8px 20px;
}

.button-label { display: block; width: auto; height: clamp(45px, 5.2vh, 62px); image-rendering: pixelated; }
.button-label--article { height: clamp(42px, 4.8vh, 57px); }
.pixel-button:hover .button-label,
.pixel-button:focus-visible .button-label,
.pixel-button.is-active .button-label { filter: brightness(0) invert(1) drop-shadow(3px 3px 0 #321771); }

.bottom-left {
  position: absolute;
  z-index: 5;
  left: clamp(18px, 4.8vw, 98px);
  bottom: clamp(88px, 10.8vh, 132px);
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.music-unit { position: relative; display: flex; }

.pixel-button--square {
  width: clamp(76px, 5vw, 102px);
  height: clamp(76px, 5vw, 102px);
  flex: 0 0 auto;
}

.music-button__block { display: block; width: 82%; height: 82%; object-fit: contain; }
.music-button.is-playing { outline: 4px solid var(--purple); outline-offset: 2px; }

.music-label {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  display: none;
  width: max-content;
  max-width: calc(100vw - 40px);
  padding: 8px 10px 7px;
  border: 3px solid #111;
  background: rgba(7, 7, 7, .84);
  box-shadow: 4px 5px 0 rgba(0, 0, 0, .58);
}

.music-unit:hover .music-label,
.music-unit:focus-within .music-label,
.music-button.is-playing + .music-label { display: grid; gap: 4px; }
.music-label strong,
.music-label span { width: max-content; white-space: nowrap; }
.music-label strong { font-size: 12px; }
.music-label span { color: #ddd; font-family: "STHeiti", "Hiragino Sans GB", sans-serif; font-size: 11px; }

.pixel-button--contact {
  width: clamp(240px, 16vw, 330px);
  min-height: clamp(76px, 5vw, 102px);
  justify-content: flex-start;
  gap: clamp(12px, 1.2vw, 24px);
  padding: 9px 22px 9px 13px;
  font-family: "Arial Black", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: clamp(21px, 1.65vw, 34px);
  font-weight: 900;
}

.contact-icon {
  display: grid;
  place-items: center;
  width: clamp(52px, 3.6vw, 72px);
  height: clamp(52px, 3.6vw, 72px);
  flex: 0 0 auto;
  border: 4px solid #171717;
  background: #f0f0f0;
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #8a8a8a;
}

.contact-icon img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.contact-label { display: block; width: auto; height: clamp(42px, 3.6vw, 70px); max-width: calc(100% - 80px); object-fit: contain; image-rendering: pixelated; }
.contact-label--email { height: clamp(40px, 3.4vw, 66px); }
.pixel-button:hover .contact-label,
.pixel-button:focus-visible .contact-label,
.pixel-button.is-active .contact-label { filter: brightness(0) invert(1) drop-shadow(3px 3px 0 #321771); }

.email-button {
  position: absolute;
  z-index: 5;
  right: clamp(18px, 5.6vw, 115px);
  bottom: clamp(88px, 10.8vh, 132px);
  width: clamp(260px, 17vw, 350px);
  font-family: "KenPixel", ui-monospace, Menlo, monospace;
  font-weight: 400;
}

.site-footer {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  font-size: clamp(19px, 1.55vw, 32px);
  line-height: 1;
  text-shadow: 3px 3px 0 #111;
}

.site-footer__edge {
  display: flex;
  align-items: center;
  width: max-content;
  min-height: 58px;
  padding: 5px 9px 3px;
  background: rgba(0, 0, 0, .64);
}

.site-footer__edge img {
  display: block;
  width: auto;
  height: clamp(34px, 2.55vw, 52px);
  image-rendering: pixelated;
}

.site-footer__edge--right { justify-self: end; }
.site-footer__legal {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 9px;
}

.site-footer__legal img {
  display: block;
  width: auto;
  height: clamp(24px, 1.75vw, 36px);
  image-rendering: pixelated;
}

.site-footer__legal a {
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, .42);
  text-decoration: none;
}

.site-footer__legal a:hover img,
.site-footer__legal a:focus-visible img { filter: sepia(1) saturate(8) hue-rotate(4deg) brightness(1.35); }

.wechat-dialog {
  width: min(460px, calc(100vw - 30px));
  max-height: 92svh;
  padding: 0;
  border: 4px solid #111;
  border-radius: 0;
  background: transparent;
  color: #262626;
  box-shadow: 10px 12px 0 rgba(0, 0, 0, .62);
}

.wechat-dialog::backdrop { background: rgba(3, 10, 25, .72); backdrop-filter: blur(5px); }

.wechat-dialog__frame {
  position: relative;
  padding: 30px;
  max-height: calc(92svh - 8px);
  overflow-y: auto;
  background: #c9c9c9;
  box-shadow: inset 4px 4px 0 #f4f4f4, inset -4px -4px 0 #707070;
  text-align: center;
}

.wechat-dialog__close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #292929;
  font: 32px/1 Arial, sans-serif;
  cursor: pointer;
}

.dialog-kicker { margin: 0; color: #666; font-size: 9px; letter-spacing: .14em; }
.wechat-dialog h2 { margin: 12px 0 20px; font-family: "Microsoft YaHei", sans-serif; font-size: 25px; }

.wechat-qr {
  display: block;
  width: min(330px, 100%);
  height: auto;
  margin: 0 auto;
  border: 8px solid #fff;
  background: #fff;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, .28);
}
.dialog-note { margin: 16px 0 0; font-family: "Microsoft YaHei", sans-serif; font-size: 12px; }

@media (max-width: 900px) {
  body { overflow-y: auto; }
  .game-menu { min-height: 100svh; padding: 18px 14px 160px; overflow-y: auto; }
  .game-menu__background { position: fixed; background-position: 60% center; }
  .game-menu__vignette { position: fixed; background: rgba(3, 11, 27, .28); }

  .masthead { position: relative; top: auto; left: auto; width: min(96vw, 820px); margin: -26px auto -40px; transform: none; }
  .masthead__slogan { right: 0; bottom: 15%; font-size: clamp(12px, 2.8vw, 20px); }

  .main-menu {
    position: relative;
    top: auto;
    left: auto;
    width: min(560px, 92vw);
    min-width: 0;
    margin: 8vh auto 0;
    transform: none;
  }

  .bottom-left,
  .email-button { position: relative; right: auto; bottom: auto; }
  .bottom-left { left: auto; width: min(560px, 92vw); margin: 22px auto 0; }
  .email-button { width: min(560px, 92vw); margin: 10px auto 0; }
  .pixel-button--contact { flex: 1; }
}

@media (max-width: 560px) {
  .game-menu { padding-top: 6px; padding-bottom: 130px; }
  .masthead { width: 112vw; margin-left: -6vw; }
  .masthead__slogan { right: 10%; bottom: 8%; max-width: 260px; white-space: normal; text-align: right; }
  .main-menu { width: 100%; margin-top: 7vh; }
  .pixel-button--main { min-height: 76px; }

  .bottom-left {
    width: 100%;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  .pixel-button--square { width: 76px; height: 76px; }
  .pixel-button--contact { width: 100%; min-width: 0; min-height: 76px; font-size: 21px; }
  .email-button { width: 100%; }
  .site-footer { grid-template-columns: 1fr 1fr; font-size: 14px; }
  .site-footer__legal { grid-column: 1 / -1; grid-row: 2; justify-self: center; padding: 7px 0 2px; font-size: 10px; }
  .site-footer__legal > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .game-menu__background { animation-duration: 38s; }
  .pixel-button { transition: none; }
}
