:root {
  color-scheme: dark;
  --ink: #080a08;
  --frame: #171a15;
  --amber: #dda02b;
  --bone: #e1dcc9;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: #090b09;
}

body {
  display: grid;
  place-items: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  background:
    radial-gradient(circle at 50% 40%, rgba(111, 95, 59, 0.14), transparent 45%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 7px),
    #090b09;
}

#game-shell {
  --frame-gap: 20px;
  position: relative;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

#game {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: #12140f;
  outline: 1px solid rgba(221, 160, 43, 0.35);
  box-shadow:
    0 0 0 5px #11130f,
    0 0 0 6px rgba(221, 160, 43, 0.16),
    0 28px 90px rgba(0, 0, 0, 0.7);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 7px;
}

.loading-note {
  position: absolute;
  left: 50%;
  bottom: 25px;
  translate: -50% 0;
  margin: 0;
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.2em;
  pointer-events: none;
  animation: pulse 1s steps(2, end) infinite;
}

body.ready .loading-note {
  display: none;
}

.arcade-back {
  position: fixed;
  z-index: 20;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  padding: 7px 9px 6px;
  border: 1px solid rgba(221, 160, 43, 0.72);
  color: #f6c44f;
  background: rgba(8, 10, 8, 0.9);
  font: 700 9px/1 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.arcade-back:focus-visible {
  outline: 2px solid #f6c44f;
  outline-offset: 3px;
}

.arcade-mode #game-shell {
  padding-top: max(38px, env(safe-area-inset-top));
}

@keyframes pulse {
  50% {
    opacity: 0.28;
  }
}

@media (max-width: 700px) {
  #game-shell {
    --frame-gap: 4px;
    padding:
      max(2px, env(safe-area-inset-top))
      max(2px, env(safe-area-inset-right))
      max(2px, env(safe-area-inset-bottom))
      max(2px, env(safe-area-inset-left));
  }

  #game {
    outline: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-note {
    animation: none;
  }
}
