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

body {
  background: #0a0a14;
  color: #c0c0d0;
  font-family: 'VT323', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

#game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

#header {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0f3460;
}

#header h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  color: #ffd700;
  text-shadow: 0 0 10px #ffd70066, 2px 2px 0 #8b4513;
  letter-spacing: 2px;
}

#seed-display {
  font-size: 0.9rem;
  color: #666;
}

#main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#canvas-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a14 100%);
  position: relative;
}

#canvas {
  border: 3px solid #0f3460;
  box-shadow: 0 0 20px #0f346066, inset 0 0 50px rgba(0,0,0,0.5);
  image-rendering: pixelated;
}

#mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 15px;
}

.dpad-row {
  display: flex;
  gap: 5px;
}

.dpad-btn {
  width: 50px;
  height: 50px;
  background: #16213e;
  border: 2px solid #0f3460;
  color: #ffd700;
  font-size: 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s;
}

.dpad-btn:active {
  background: #0f3460;
  transform: scale(0.95);
}

#ui-panel {
  width: 280px;
  background: linear-gradient(180deg, #16213e 0%, #1a1a2e 100%);
  border-left: 2px solid #0f3460;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  overflow-y: auto;
}

section {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 10px;
}

.section-header {
  font-size: 1rem;
  color: #ffd700;
  margin-bottom: 8px;
  font-weight: bold;
}

.stat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.stat-bar label {
  width: 35px;
  font-size: 0.9rem;
  color: #888;
}

.bar-container {
  flex: 1;
  height: 18px;
  background: #0a0a14;
  border: 1px solid #333;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.bar {
  height: 100%;
  transition: width 0.3s ease;
}

.hp-bar {
  background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
}

.hp-bar.critical {
  animation: pulse 0.5s infinite;
}

.stamina-bar {
  background: linear-gradient(180deg, #ffaa00 0%, #cc8800 100%);
}

.hunger-bar {
  background: linear-gradient(180deg, #8b4513 0%, #654321 100%);
}

.hunger-bar.critical {
  background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
  animation: pulse 0.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bar-text {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: white;
  text-shadow: 1px 1px 1px black;
}

#floor-display {
  text-align: center;
  font-size: 1.1rem;
  color: #aaa;
  padding-top: 5px;
}

#floor-display strong {
  color: #ffd700;
  font-size: 1.3rem;
}

.equip-slot {
  display: flex;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.equip-label {
  color: #888;
}

#inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#inventory-grid.hidden {
  display: none;
}

.inv-item {
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 3px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  cursor: pointer;
}

.inv-item.selected {
  border-color: #ffd700;
  box-shadow: 0 0 5px #ffd70066;
}

.inv-empty {
  color: #444;
  font-style: italic;
  text-align: center;
  padding: 10px;
}

.toggle-hint {
  font-size: 0.8rem;
  color: #666;
}

#log-section {
  flex: 1;
  min-height: 120px;
}

#event-log {
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.4;
}

#event-log div {
  padding: 2px 0;
  border-bottom: 1px solid #1a1a2e;
}

.log-system { color: #aaaaaa; }
.log-damage { color: #ff6666; }
.log-attack { color: #ffaa44; }
.log-kill { color: #44ff44; }
.log-item { color: #44ffff; }
.log-heal { color: #88ff88; }
.log-buff { color: #ffff44; }

#footer {
  background: #16213e;
  padding: 10px 20px;
  border-top: 2px solid #0f3460;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

#controls-area {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

#new-run-btn {
  background: linear-gradient(180deg, #ffd700 0%, #cc9900 100%);
  color: #1a1a2e;
  border: none;
  padding: 10px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

#new-run-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px #ffd70066;
}

#seed-input-area {
  display: flex;
  gap: 5px;
}

#seed-input {
  background: #0a0a14;
  border: 1px solid #0f3460;
  color: #c0c0d0;
  padding: 8px 12px;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  width: 150px;
  border-radius: 3px;
}

#seed-btn {
  background: #0f3460;
  border: 1px solid #1a4a80;
  color: #ffd700;
  padding: 8px 15px;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  border-radius: 3px;
}

#controls-help {
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

.remix-link {
  color: #0f3460;
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.remix-link:hover {
  color: #ffd700;
}

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border: 3px solid #ffd700;
  padding: 40px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 0 50px #ffd70033;
}

#overlay-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.5rem;
  color: #ff4444;
  margin-bottom: 20px;
  text-shadow: 2px 2px 0 #000;
}

#overlay-stats {
  font-size: 1.1rem;
  color: #c0c0d0;
  margin-bottom: 25px;
  line-height: 1.8;
}

#overlay-stats hr {
  border: none;
  border-top: 1px solid #333;
  margin: 15px 0;
}

#overlay-btn {
  background: linear-gradient(180deg, #ffd700 0%, #cc9900 100%);
  color: #1a1a2e;
  border: none;
  padding: 15px 30px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 5px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  #main-content {
    flex-direction: column;
  }
  
  #ui-panel {
    width: 100%;
    max-height: 200px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    border-left: none;
    border-top: 2px solid #0f3460;
  }
  
  #ui-panel section {
    flex: 1;
    min-width: 140px;
  }
  
  #log-section {
    min-height: 80px;
    flex: 2;
  }
  
  #mobile-controls {
    display: flex;
  }
}

@media (max-width: 600px) {
  #header h1 {
    font-size: 0.9rem;
  }
  
  #controls-help {
    font-size: 0.7rem;
  }
  
  #ui-panel {
    padding: 8px;
  }
  
  #ui-panel section {
    padding: 6px;
  }
}