* {
  box-sizing: border-box;
}

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

body {
  background: #f7f7f4;
}

:root {
  --corner-left: max(12px, env(safe-area-inset-left));
  --corner-right: max(12px, env(safe-area-inset-right));
  --corner-top: max(12px, env(safe-area-inset-top));
  --corner-bottom: max(12px, env(safe-area-inset-bottom));
}

.world-layer {
  position: fixed;
  inset: 0;
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.ui-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.shortcut-widget {
  position: fixed;
  left: var(--corner-left);
  bottom: var(--corner-bottom);
  pointer-events: auto;
}

.guide-widget {
  position: fixed;
  left: var(--corner-left);
  top: var(--corner-top);
  pointer-events: auto;
}

.info-widget {
  position: fixed;
  right: var(--corner-right);
  top: var(--corner-top);
  pointer-events: auto;
}

.shortcut-emoji {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.62);
  font-size: 28px;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.save-emoji {
  font-size: 21px;
}

@media (min-width: 761px) {
  .save-emoji {
    font-size: 19px;
  }
}

.guide-emoji {
  font-size: 22px;
}

.shortcut-emoji:focus,
.shortcut-emoji:focus-visible,
.shortcut-emoji:active {
  outline: none;
  box-shadow: none;
}

.shortcut-hint {
  position: absolute;
  left: 0;
  bottom: 52px;
  padding: 6px 8px;
  font: 11px/1.25 monospace;
  letter-spacing: 0.02em;
  color: rgba(0, 0, 0, 0.45);
  background: rgba(247, 247, 244, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.shortcut-hint p {
  margin: 0;
}

.shortcut-hint p + p {
  margin-top: 8px;
}

.shortcut-widget .shortcut-hint {
  left: 8px;
  bottom: 48px;
  transform: translateY(4px);
}

.info-hint {
  left: auto;
  right: 8px;
  top: 42px;
  bottom: auto;
  text-align: left;
  pointer-events: auto;
  white-space: normal;
  width: 320px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(62vh, 520px);
  overflow: auto;
}

.guide-hint {
  left: 8px;
  top: 42px;
  bottom: auto;
  white-space: normal;
  width: 300px;
  max-width: min(300px, calc(100vw - 24px));
}

.info-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-link:visited {
  color: inherit;
}

.shortcut-hint div + div {
  margin-top: 2px;
}

.shortcut-widget:hover .shortcut-hint,
.shortcut-widget:focus-within .shortcut-hint {
  opacity: 1;
  transform: translateY(0);
}

.guide-widget:hover .shortcut-hint,
.guide-widget:focus-within .shortcut-hint {
  opacity: 1;
  transform: translateY(0);
}

.info-widget:hover .shortcut-hint,
.info-widget:focus-within .shortcut-hint {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  :root {
    --corner-left: max(8px, env(safe-area-inset-left));
    --corner-right: max(8px, env(safe-area-inset-right));
    --corner-top: max(8px, env(safe-area-inset-top));
    --corner-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .shortcut-widget {
    left: var(--corner-left);
    right: auto;
  }

  .guide-widget {
    left: var(--corner-left);
    right: auto;
    top: var(--corner-top);
  }

  .info-widget {
    left: auto;
    right: var(--corner-right);
    top: var(--corner-top);
    bottom: auto;
  }

  .shortcut-hint {
    left: 0;
    right: auto;
    width: 270px;
    max-width: calc(100vw - var(--corner-left) - var(--corner-right) - 8px);
    text-align: left;
    font-size: 10px;
    white-space: normal;
  }

  .info-hint {
    left: auto;
    right: 0;
    top: 42px;
    text-align: left;
    max-height: calc(100vh - var(--corner-top) - 56px);
  }

  .guide-hint {
    top: 40px;
    width: 270px;
    max-width: calc(100vw - var(--corner-left) - var(--corner-right) - 8px);
  }

  .shortcut-widget .shortcut-hint {
    left: 8px;
    bottom: 48px;
  }
}

@media (hover: none), (pointer: coarse) {
  .shortcut-widget .shortcut-hint {
    display: none;
  }
}

.void-button {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: auto;
  cursor: pointer;
  z-index: 20;
}

.void-button:focus,
.void-button:focus-visible,
.void-button:active {
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
}

.void-button #voidTile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}
