/* Core resetting & layout constraints */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background-color: #030712;
  color: #f3f4f6;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
}

/* Master containment block */
.game-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px; /* Forces layout to remain beautifully aligned */
  gap: 14px;
}

/* Header HUD spacing */
.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid #00f3ff;
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.15);
}

.hud-stat {
  font-weight: bold;
  font-size: 14px;
  color: #00f3ff;
  text-shadow: 0 0 4px rgba(0, 243, 255, 0.4);
}

/* Canvas Area Boundaries */
.canvas-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  border: 2px solid #1f2937;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 400;
  touch-action: none;
}

/* Screens overlapping canvas perfectly inside borders */
.overlay-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 9, 20, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
  gap: 16px;
  z-index: 10;
}

.neon-text {
  color: #ff007f;
  font-size: 26px;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 0, 127, 0.5);
}

.subtitle {
  font-size: 13px;
  color: #9ca3af;
  max-width: 80%;
}

/* Sleek Cyber Buttons */
.cyber-btn {
  background: #111827;
  color: #00f3ff;
  border: 1px solid #00f3ff;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cyber-btn:active {
  background: #00f3ff;
  color: #000;
  box-shadow: 0 0 10px #00f3ff;
}

.cyber-btn.primary {
  border-color: #ff007f;
  color: #ff007f;
}
.cyber-btn.primary:active {
  background: #ff007f;
  color: #fff;
  box-shadow: 0 0 10px #ff007f;
}

/* Balanced 3-column control grid */
.control-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* Balanced 5-slot item hotbar grid */
.hotbar-wrapper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.hotbar-slot {
  background: #1f2937;
  border: 1px solid #4b5563;
  border-radius: 6px;
  aspect-ratio: 1 / 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px;
  text-align: center;
  font-size: 10px;
  cursor: pointer;
  overflow: hidden;
}

.hotbar-slot.active {
  border-color: #00ffcc;
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
  background: #064e3b;
}

.slot-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  color: #d1d5db;
  word-break: break-word;
}

.price-tag {
  color: #ffbe0b;
  font-weight: bold;
  margin-top: 3px;
  font-size: 9px;
}

/* UI Modals Alignment */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 999;
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: #0b0f19;
  border: 2px solid #ffbe0b;
  width: 100%;
  max-width: 440px;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.shop-card, .storage-card {
  background: #111827;
  border: 1px solid #374151;
  padding: 10px;
  border-radius: 6px;
  font-size: 11px;
}

.shop-card h4, .storage-card h4 {
  color: #ffbe0b;
  margin-bottom: 4px;
}

.shop-card.owned {
  border-color: #4b5563;
  opacity: 0.5;
}

.storage-card.selected {
  border-color: #00f3ff;
  background: rgba(0, 243, 255, 0.05);
}

.stats-panel {
  background: #111827;
  padding: 10px;
  border-radius: 4px;
  font-size: 11px;
}

.stats-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.close-btn {
  align-self: flex-end;
  margin-top: 4px;
}