/* Midnight Run — portfolio embed: letterboxed, crisp pixels, no smoothing */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

#wrap {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(56px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
}

#game-stack {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.close-btn {
  position: absolute;
  top: -46px;
  right: 0;
  z-index: 2;
  padding: 8px 10px;
  min-width: 40px;
  min-height: 40px;
  font-size: 16px;
  line-height: 1.2;
  font-family: ui-monospace, monospace;
  cursor: pointer;
  color: #ffe6e6;
  background: rgba(36, 8, 16, 0.88);
  border: 1px solid rgba(220, 110, 130, 0.7);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(180, 70, 90, 0.25);
  touch-action: manipulation;
}

.close-btn:hover {
  background: rgba(56, 10, 22, 0.95);
  border-color: rgba(240, 140, 160, 0.82);
}

.close-btn:focus-visible {
  outline: 2px solid #ff9ab3;
  outline-offset: 2px;
}

.mute-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  padding: 8px 10px;
  min-width: 40px;
  min-height: 40px;
  font-size: 16px;
  line-height: 1.2;
  font-family: ui-monospace, monospace;
  cursor: pointer;
  color: #e8d8ff;
  background: rgba(12, 6, 28, 0.82);
  border: 1px solid rgba(140, 100, 200, 0.55);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(100, 60, 160, 0.25);
  touch-action: manipulation;
}

.mute-btn:hover {
  background: rgba(30, 18, 48, 0.92);
  border-color: rgba(180, 140, 255, 0.65);
}

.mute-btn:focus-visible {
  outline: 2px solid #c8a0f0;
  outline-offset: 2px;
}

.mute-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

canvas#game {
  display: block;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  max-width: 100%;
  width: min(900px, calc(100vw - 16px), calc((100dvh - 72px) * 2.25));
  height: auto;
  aspect-ratio: 9 / 4;
  box-shadow: 0 0 0 2px #2a1848, 0 0 48px rgba(120, 60, 180, 0.15);
}

.game-phone-hint { display: none; }
@media (max-width: 600px) and (orientation: portrait) {
  .game-phone-hint { display: block; position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 16px; right: 16px; margin: 0; color: #c8b7dd; font: 13px/1.7 ui-monospace, monospace; text-align: center; }
}

.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;
}
