/* css/style.css — CHIPQUEST styling (sections 3.2, 3.3, 12) */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Disable text selection (section 12) */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Disable context menu handled by JS */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0F1020; /* INK */
  font-family: 'Press Start 2P', monospace;
  /* Prevent pull-to-refresh */
  overscroll-behavior: none;
  touch-action: manipulation;
}

#game {
  position: absolute;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* Canvas is positioned by JS */
}

/* Touch controls (section 3.3) */
#touch-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 112px;
  justify-content: space-between;
  align-items: flex-end;
  padding: 8px 14px;
  pointer-events: none;
  z-index: 100;
}

#dpad {
  position: relative;
  width: 96px;
  height: 96px;
  pointer-events: auto;
}

.dpad-btn {
  position: absolute;
  width: 32px;
  height: 32px;
  background: rgba(244, 244, 250, 0.25);
  border: 2px solid rgba(244, 244, 250, 0.45);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: rgba(244, 244, 250, 0.85);
  pointer-events: auto;
  touch-action: none;
}

.dpad-btn:active {
  background: rgba(244, 244, 250, 0.5);
}

.dpad-up { top: 0; left: 32px; }
.dpad-down { bottom: 0; left: 32px; }
.dpad-left { top: 32px; left: 0; }
.dpad-right { top: 32px; right: 0; }

/* Center of D-pad */
.dpad-center {
  position: absolute;
  width: 32px;
  height: 32px;
  top: 32px;
  left: 32px;
  background: rgba(244, 244, 250, 0.08);
  border-radius: 4px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}

.action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(244, 244, 250, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: rgba(244, 244, 250, 0.9);
  pointer-events: auto;
  touch-action: none;
}

.action-btn:active {
  transform: scale(0.95);
}

#btn-a {
  background: rgba(0, 113, 197, 0.45); /* BLUE */
}

#btn-b {
  background: rgba(230, 57, 70, 0.4); /* RED */
  width: 36px;
  height: 36px;
  font-size: 11px;
  margin-bottom: 4px;
}

/* Mute button (section 3.3) */
#btn-mute {
  position: fixed;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(244, 244, 250, 0.2);
  border: 1px solid rgba(244, 244, 250, 0.4);
  border-radius: 4px;
  color: rgba(244, 244, 250, 0.8);
  font-size: 16px;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

/* Fullscreen & Pause buttons */
#btn-fullscreen, #btn-pause {
  position: fixed;
  top: 8px;
  right: 48px;
  width: 32px;
  height: 32px;
  background: rgba(244, 244, 250, 0.2);
  border: 1px solid rgba(244, 244, 250, 0.4);
  border-radius: 4px;
  color: rgba(244, 244, 250, 0.8);
  font-size: 14px;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rotate device overlay (section 3.3) */
#rotate-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0F1020;
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #F4F4FA;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  text-align: center;
  padding: 20px;
  line-height: 2;
}

#rotate-overlay .rotate-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

@media (orientation: portrait) and (max-width: 600px) {
  #rotate-overlay {
    display: flex !important;
  }
  #game, #touch-controls {
    display: none !important;
  }
}

/* Loading screen */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0F1020;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F4F4FA;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  z-index: 1000;
}

/* Disable double-tap zoom */
* {
  touch-action: manipulation;
}

/* Pokemon-style Player Name Modal */
#name-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 16, 32, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}

#name-modal.hidden {
  display: none;
}

#name-card {
  background: #F4F4FA;
  border: 4px solid #0071C5;
  box-shadow: 0 0 0 3px #0F1020, 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 18px 20px;
  width: min(320px, 92vw);
  text-align: center;
  color: #0F1020;
}

#name-title {
  font-size: 13px;
  color: #0071C5;
  margin-bottom: 10px;
}

#name-sub {
  font-size: 8px;
  line-height: 1.6;
  color: #2B2D4A;
  margin-bottom: 10px;
}

#gender-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}

.gender-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: #FFFFFF;
  color: #2B2D4A;
  border: 2px solid #5B5F8E;
  cursor: pointer;
}

.gender-btn.selected {
  background: #FFD23F;
  color: #0F1020;
  border-color: #0071C5;
  box-shadow: 0 0 0 1px #0071C5;
}

.gender-prev {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#name-input {
  width: 100%;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  text-align: center;
  text-transform: uppercase;
  padding: 10px 8px;
  border: 3px solid #0F1020;
  background: #FFFFFF;
  color: #0F1020;
  outline: none;
  margin-bottom: 10px;
  -webkit-user-select: text;
  user-select: text;
}

#name-input:focus {
  border-color: #0071C5;
}

#name-presets {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}

.name-preset {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 8px;
  background: #FFD23F;
  color: #0F1020;
  border: 2px solid #0F1020;
  cursor: pointer;
}

#name-ok {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  width: 100%;
  padding: 10px;
  background: #0071C5;
  color: #F4F4FA;
  border: 2px solid #0F1020;
  cursor: pointer;
}

#name-ok:active, .name-preset:active {
  transform: scale(0.97);
}
