:root {
  --primary: #F59E0B;
  --secondary: #3B82F6;
  --accent: #10B981;
  --danger: #EF4444;
  --bg: #0B0D17;
  --glass-bg: rgba(11, 13, 23, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  color: #FFF;
  overflow: hidden;
  touch-action: none; /* Prevent scroll on mobile */
}

/* Helpers */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.mt-4 { margin-top: 2rem; }
.hidden { display: none !important; }

.text-gradient {
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

/* Base Layout */
#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#game-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* UI Layer */
#ui-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 5;
  padding: 20px;
}

#top-bar {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-box {
  background: var(--glass-bg);
  backdrop-filter: blur(5px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
}

.stat-box .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9CA3AF;
}

.stat-box .value {
  font-size: 1.2rem;
  font-weight: 800;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

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

.progress-bar.fuel { background: var(--secondary); }
.progress-bar.hull { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.progress-bar.cargo { background: var(--accent); }

#minimap-container {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: rgba(11, 13, 23, 0.8);
  overflow: hidden;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

#minimap-canvas {
  width: 150px;
  height: 150px;
  border-radius: 50%;
}

#station-alert {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 30px;
  font-weight: 600;
  letter-spacing: 1px;
  animation: pulse 2s infinite;
  text-align: center;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Overlays */
.overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(11, 13, 23, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  text-align: center;
}

.overlay h1 {
  font-size: 3rem;
  margin-bottom: 10px;
}

.overlay p {
  font-size: 1.1rem;
  color: #D1D5DB;
  max-width: 500px;
  line-height: 1.6;
}

.controls-info {
  margin: 30px 0;
  padding: 20px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
}

.btn {
  background: transparent;
  color: #FFF;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 10px;
}

.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
  font-size: 1.2rem;
  padding: 16px 32px;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn.primary:hover {
  background: #fbbf24;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

/* Station Grid */
.station-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  max-width: 800px;
  width: 100%;
  margin-top: 30px;
}

.station-panel {
  flex: 1;
  min-width: 300px;
  padding: 24px;
  text-align: left;
}

.station-panel h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--secondary);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 10px;
}

#cargo-list {
  list-style: none;
  margin-bottom: 20px;
}

#cargo-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
  color: #D1D5DB;
}

#cargo-list li span {
  font-weight: 600;
  color: #FFF;
}

.upgrade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
}

.lvl-badge {
  background: rgba(59, 130, 246, 0.2);
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-left: 8px;
}

.upg-btn {
  width: auto;
  margin: 0;
  padding: 6px 12px;
  font-size: 0.9rem;
}

/* Touch Controls */
#touch-controls {
  position: absolute;
  bottom: 0; left: 0; width: 100%; height: 30%;
  padding: 20px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 800px) {
  #touch-controls { display: flex; }
  .station-grid { flex-direction: column; }
}

#joystick-zone { pointer-events: auto; }
#joystick-base {
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  position: relative;
  backdrop-filter: blur(4px);
}
#joystick-stick {
  width: 50px; height: 50px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  position: absolute;
  top: 35px; left: 35px;
  pointer-events: none;
}

#action-zone { pointer-events: auto; }
.touch-btn {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.2);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: bold;
  backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: center;
}
.touch-btn:active {
  background: rgba(245, 158, 11, 0.4);
}
