@font-face {
  font-family: "Fusion Pixel Small";
  src: url("assets/fonts/fusion-pixel-8px-zh_hans.woff2?v=2026.10.25") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Fusion Pixel";
  src: url("assets/fonts/fusion-pixel-10px-zh_hans.woff2?v=2026.10.25") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

:root {
  color-scheme: light;
  font-family: "Fusion Pixel", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  background: #e3e8df;
  color: #3f3027;
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  overflow-x: hidden;
  background: #e3e8df;
}

.loading-screen {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  padding: 24px;
  color: #000;
}

.loading-screen[hidden] {
  display: none;
}

.loading-screen img {
  width: min(72vw, 280px);
  height: auto;
}

.loading-screen p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.loading-dots {
  display: inline-block;
  width: 3ch;
  overflow: hidden;
  vertical-align: bottom;
  animation: loading-dots 1.2s steps(4, end) infinite;
}

@keyframes loading-dots {
  from { width: 0; }
  to { width: 3ch; }
}

.playground[hidden] {
  display: none;
}

button,
canvas,
.shell-image {
  -webkit-user-select: none;
  user-select: none;
}

button {
  font: inherit;
}

::selection {
  color: #fff;
  background: #8b4c27;
}

.playground {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: max(25px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.game-logo {
  display: block;
  width: min(72vw, 280px);
  height: auto;
  margin-bottom: 2px;
}

.machine {
  position: relative;
  width: min(88vw, 400px, calc((100dvh - 190px) * .7977));
  aspect-ratio: 1120 / 1404;
}

.device {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  touch-action: manipulation;
}

#lcd {
  position: absolute;
  z-index: 1;
  left: 22.4%;
  top: 33.55%;
  display: block;
  width: 50.6%;
  height: 33.55%;
  background: #b7c49a;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
}

.shell-image {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.controls {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.device-button {
  position: absolute;
  width: 17%;
  min-width: 44px;
  aspect-ratio: 1;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform 90ms ease-out, background 90ms ease-out, box-shadow 90ms ease-out;
}

.button-a {
  left: 30.45%;
  top: 80%;
}

.button-b {
  left: 48.9%;
  top: 82.1%;
}

.button-c {
  left: 66.4%;
  top: 80%;
}

.device-button span {
  display: none;
}

.device-button:active,
.device-button.is-pressed {
  transform: translate(-50%, -48%) scale(.95);
  background: rgba(55, 22, 6, .14);
  box-shadow: inset 0 4px 8px rgba(42, 16, 4, .3);
}

.device-button:focus-visible {
  outline: 3px solid rgba(255, 223, 151, .95);
  outline-offset: 2px;
}

.game-guide {
  max-width: min(100%, 420px);
  margin: 16px 0 0;
  text-align: center;
  color: #000;
  font: 400 15px/1.65 "Fusion Pixel Small", "PingFang SC", sans-serif;
}

.game-guide h1,
.game-guide h2 {
  margin: 0 0 8px;
  color: #000;
  font: 400 18px/1.4 "Fusion Pixel", "PingFang SC", sans-serif;
}

.game-guide h2 {
  margin-top: 18px;
}

.game-guide p {
  margin: 0 0 3px;
}

.dev-controls[hidden] {
  display: none;
}

.dev-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 2px;
}

.dev-btn {
  background: rgba(102, 80, 67, 0.08);
  border: 1px dashed #9a8170;
  border-radius: 4px;
  color: #665043;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 120ms ease, transform 90ms ease;
}

.dev-btn:hover {
  background: rgba(102, 80, 67, 0.18);
  color: #3f3027;
}

.dev-btn:active {
  transform: scale(0.96);
}

@media (max-height: 540px) {
  .playground {
    gap: 8px;
    padding-top: 20px;
  }

  .dev-btn {
    font-size: 11px;
    padding: 2px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .device-button,
  .dev-btn {
    transition: none;
  }
}
