@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/PressStart2P-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Alagard';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/alagard.ttf') format('truetype');
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0A0A0A;
  font-family: 'Press Start 2P', monospace;
}

#gameContainer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100lvh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #1A0000;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* UI Buttons */
#muteBtn {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  right: max(16px, env(safe-area-inset-right, 16px));
  z-index: 20;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
  color: #fff;
  font-size: 22px;
  width: 48px;
  height: 48px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#muteBtn:hover,
#muteBtn:active {
  background: rgba(0, 0, 0, 0.7);
}

#authBtn {
  position: absolute;
  top: max(3%, env(safe-area-inset-top, 0px));
  right: max(3%, env(safe-area-inset-right, 0px));
  z-index: 20;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #555;
  color: #ccc;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 12px 16px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
}

#authBtn:hover,
#authBtn:active {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

#authBtn.connected {
  border-color: #39FF14;
  color: #39FF14;
}

/* Portrait rotation overlay */
#rotateOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0A0A0A;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

#rotateOverlay .rotate-icon {
  font-size: 48px;
  margin-bottom: 20px;
  animation: rotateAnim 2s ease-in-out infinite;
}

@keyframes rotateAnim {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

@media (max-width: 768px) and (orientation: portrait) {
  #rotateOverlay {
    display: flex;
  }
}

/* Prevent text selection and context menu on game */
#gameContainer {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
