@font-face {
  font-family: "Shop UI";
  src: url("./assets/operator.woff") format("woff");
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Shop UI", monospace;
  color: #fff;
  background: #000;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 240px; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible { outline: 2px solid #ffff00; outline-offset: 4px; }
[hidden] { display: none !important; }

.shop-shell {
  width: min(960px, calc(100vw - 32px), calc((100dvh - 100px) * 4 / 3));
  position: relative;
  padding-bottom: 4px;
}

.game { width: 100%; aspect-ratio: 4 / 3; position: relative; background: #000; isolation: isolate; }
#scene { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.loading { position: absolute; inset: 46% 0 auto; margin: 0; text-align: center; font-size: 16px; letter-spacing: 2px; }
.loading span { animation: blink 1s steps(2, end) infinite; }
.menu-hit, .topic-hit, .topic-page-hit, .continue-hit, .sprite-hit, .phone-hit {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  user-select: none;
}
.menu-hit { left: 66%; width: 32%; height: 10%; }
.menu-hit[data-menu="0"] { top: 53.5%; }
.menu-hit[data-menu="1"] { top: 63.5%; }
.menu-hit[data-menu="2"] { top: 73.5%; }
/* Selection and keyboard focus use the original red heart and yellow lettering. */
.menu-hit:focus, .topic-hit:focus, .topic-page-hit:focus { outline: none; }
.topic-hit { left: 6%; width: 54%; height: 8.3333%; }
.topic-page-hit { top: 86%; width: 10%; height: 8.3333%; }
.topic-page-hit[data-topic-page="-1"] { left: 69%; }
.topic-page-hit[data-topic-page="1"] { left: 88%; }
.topic-page-hit:disabled { cursor: default; }
.sprite-hit { left: 33%; top: 0; width: 38%; height: 50%; }
.phone-hit { left: 85%; top: 30%; width: 14%; height: 18%; }
.continue-hit { left: 2%; top: 53%; width: 96%; height: 44%; }
/* The canvas shows the dialogue's small continuation marker for keyboard focus. */
.continue-hit:focus-visible { outline: none; }

.controls { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #939393; font-size: 10px; line-height: 20px; letter-spacing: .5px; }
kbd { font: inherit; color: #c4c4c4; padding-right: 5px; }
.hint-gap { margin-left: 20px; }
.settings { display: flex; align-items: center; gap: 20px; }
.settings button { padding: 5px 0; background: transparent; border: 0; color: #a1a1a1; font-size: 10px; line-height: 20px; letter-spacing: .5px; cursor: pointer; }
.settings button:hover { color: #fff; }
#sound[data-state="blocked"], #sound[data-state="error"] { color: #ffff00; }
#fullscreen { font-family: monospace; font-size: 23px; line-height: 20px; }
.sound-hint { position: absolute; width: 100%; margin: 10px 0 0; font-size: 9px; letter-spacing: 1px; color: #777; text-align: center; }
.touch-hint { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

:fullscreen { background: #000; width: 100vw; height: 100dvh; display: grid; place-content: center; }
:fullscreen .game, :fullscreen .controls { width: min(100vw, calc((100dvh - 64px) * 4 / 3)); }
:fullscreen .sound-hint { bottom: 6px; }

@media (max-width: 600px) {
  .shop-shell { width: min(calc(100vw - 16px), calc((100dvh - 88px) * 4 / 3)); }
  .controls { margin-top: 14px; font-size: 8px; gap: 8px; }
  .hint-gap { margin-left: 8px; }
  .settings { gap: 12px; }
  .settings button { font-size: 8px; }
  .sound-hint { font-size: 7px; }
}

@media (pointer: coarse) { .keyboard-hint { display: none; } .touch-hint { display: inline; } }
@media (prefers-reduced-motion: reduce) { .loading span { animation: none; } }
@keyframes blink { to { opacity: .3; } }
