/* Grimoire Arena — page shell: black letterbox, 16:9 pixel-perfect canvas, no scrolling/selection. */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #ccc;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
}

/* Fallback sizing before JS runs (engine.js then snaps to whole device pixels). */
#game {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  transform: translate(-50%, -50%);
  background: #000;
  overflow: hidden;
  touch-action: none;
  contain: layout size;
}
@supports (height: 100dvh) {
  #game {
    width: min(100dvw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100dvw * 9 / 16));
  }
}

#screen {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

/* Touch overlay (owned by input.js). Transparent to the canvas except for its controls. */
#touch {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  touch-action: none;
}
#touch > * {
  pointer-events: auto;
}

/* Gentle hint on phones held in portrait (game still works, letterboxed). */
#rotate-hint {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: max(10px, env(safe-area-inset-top));
  z-index: 10;
  text-align: center;
  font: bold 13px/1.4 monospace;
  letter-spacing: 1px;
  color: #ffd36b;
  text-shadow: 0 0 4px #4a1ea0, 1px 1px 0 #000;
  pointer-events: none;
  animation: ga-pulse 1.6s ease-in-out infinite;
}
@media (orientation: portrait) and (pointer: coarse) {
  #rotate-hint { display: block; }
}
@keyframes ga-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.noscript {
  position: fixed;
  inset: 0;
  margin: auto;
  height: 2em;
  text-align: center;
  font: 16px monospace;
  color: #fff;
}
