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

body {
  background: #000;
  overflow: hidden;
  font-family: 'Courier New', Courier, monospace;
  color: #ccc;
  cursor: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#battery-indicator {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.5s;
}

#battery-indicator.visible {
  opacity: 1;
}

#battery-bar {
  width: 40px;
  height: 18px;
  border: 2px solid #555;
  border-radius: 3px;
  position: relative;
  background: #111;
}

#battery-bar::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 4px;
  width: 3px;
  height: 8px;
  background: #555;
  border-radius: 0 2px 2px 0;
}

#battery-fill {
  height: 100%;
  width: 100%;
  background: #4a4;
  border-radius: 1px;
  transition: width 0.3s, background 0.3s;
}

#battery-text {
  font-size: 13px;
  color: #888;
  min-width: 36px;
}

#inventory-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(0, 0, 0, 0.85);
  border-top: 1px solid #333;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.5s;
}

#inventory-bar.visible {
  opacity: 1;
}

.inv-item {
  width: 48px;
  height: 48px;
  border: 2px solid #444;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  text-align: center;
  color: #aaa;
  background: #1a1a1a;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s;
  line-height: 1.1;
  padding: 2px;
}

.inv-item:hover {
  border-color: #777;
}

.inv-item.selected {
  border-color: #fc0;
  box-shadow: 0 0 6px rgba(255, 204, 0, 0.4);
}

.inv-item .item-icon {
  font-size: 18px;
  display: block;
}

#message-box {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  color: #ccc;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}

#message-box.visible {
  opacity: 1;
}

#start-screen {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: default;
}

#start-content {
  text-align: center;
}

#title-text {
  font-size: 64px;
  letter-spacing: 12px;
  color: #ddd;
  animation: fadeIn 2s ease-in;
}

#subtitle-text {
  font-size: 16px;
  color: #666;
  margin-top: 20px;
  animation: fadeIn 3s ease-in;
}

#start-btn {
  margin-top: 40px;
  padding: 12px 32px;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  background: none;
  border: 1px solid #555;
  color: #888;
  cursor: pointer;
  animation: fadeIn 4s ease-in;
  transition: color 0.2s, border-color 0.2s;
}

#start-btn:hover {
  color: #ccc;
  border-color: #999;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

#end-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: default;
}

#end-screen.win {
  background: #fff;
  color: #222;
}

#end-screen.lose {
  background: #000;
  color: #444;
}

#end-content {
  text-align: center;
}

#end-message {
  font-size: 22px;
  margin-bottom: 16px;
}

#end-stats {
  font-size: 14px;
  margin-bottom: 30px;
  color: inherit;
  opacity: 0.7;
}

#restart-btn {
  padding: 10px 28px;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

#restart-btn:hover {
  opacity: 1;
}

.hidden {
  display: none !important;
}

#keypad-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  cursor: default;
}

#keypad {
  background: #1a1a1a;
  border: 2px solid #444;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

#keypad-display {
  font-size: 32px;
  letter-spacing: 8px;
  color: #0f0;
  background: #0a0a0a;
  padding: 10px 20px;
  border: 1px solid #333;
  margin-bottom: 16px;
  border-radius: 4px;
}

#keypad-buttons {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.keypad-btn {
  width: 56px;
  height: 48px;
  font-family: 'Courier New', monospace;
  font-size: 20px;
  background: #222;
  border: 1px solid #444;
  color: #aaa;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.keypad-btn:hover {
  background: #333;
}

#keypad-submit, #keypad-clear, #keypad-close {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 8px 16px;
  background: none;
  border: 1px solid #444;
  color: #888;
  cursor: pointer;
  margin: 4px;
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}

#keypad-submit:hover, #keypad-clear:hover, #keypad-close:hover {
  color: #ccc;
  border-color: #888;
}
