:root {
  /* Colors - Cyberpunk / Sci-Fi Palette */
  --bg-deep: #050b18;
  --bg-panel: #0a192f;
  --bg-panel-light: #162c4a;
  
  --neon-cyan: #00f2ff;
  --neon-blue: #0072ff;
  --neon-gold: #ffcc00;
  --neon-orange: #ff8c00;
  --neon-green: #39ff14;
  --neon-red: #ff3131;
  
  --text-main: #e0f2ff;
  --text-muted: #8ba4b9;
  
  --border-cyan: rgba(0, 242, 255, 0.4);
  --border-glow: 0 0 10px rgba(0, 242, 255, 0.3);
  
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  
  --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Orbitron', sans-serif; /* Fallback to sans-serif if not available */
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-main);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Base Styles */
h1, h2, h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

/* Layout Containers */
.app-container {
  width: 100%;
  max-width: 450px; /* Mobile focused */
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center, #0f2a4a 0%, #050b18 100%);
  border-left: 1px solid var(--border-cyan);
  border-right: 1px solid var(--border-cyan);
}

/* Header / Stats Bar */
.header-stats {
  padding: var(--space-md);
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border-cyan);
  position: sticky;
  top: 0;
  z-index: 100;
}

.stat-item {
  display: flex;
  align-items: center;
  background: rgba(0, 30, 60, 0.8);
  border: 1px solid var(--border-cyan);
  border-radius: 4px;
  padding: 2px 8px;
  flex: 1;
  position: relative;
}

.stat-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.stat-value {
  font-weight: bold;
  font-size: 0.85rem;
}

.stat-add {
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--neon-orange);
  color: white;
  border-radius: 2px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* UI Components */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-cyan);
  border-radius: 8px;
  padding: var(--space-md);
  box-shadow: var(--border-glow);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(to bottom, var(--neon-cyan), var(--neon-blue));
  color: #000;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: 4px;
  text-transform: uppercase;
  box-shadow: 0 0 15px var(--neon-cyan);
  transition: transform 0.1s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

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

.btn-secondary {
  background: var(--bg-panel-light);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  text-align: center;
}

/* Placeholders */
.placeholder-avatar {
  width: 48px;
  height: 48px;
  background: var(--bg-panel-light);
  border: 2px solid var(--neon-cyan);
  border-radius: 50%;
}

.placeholder-image {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-panel-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 4px;
  position: relative;
}

.placeholder-image::after {
  content: attr(data-label);
  font-size: 0.8rem;
}

.placeholder-icon {
  width: 24px;
  height: 24px;
  background: var(--text-muted);
  opacity: 0.5;
}

/* Map / Level Select */
.map-view {
  flex: 1;
  padding: var(--space-xl) var(--space-lg);
  position: relative;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='1' fill='white' fill-opacity='0.2'/%3E%3C/svg%3E");
}

.map-path {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.level-node {
  position: absolute;
  width: 40px;
  height: 40px;
  background: var(--bg-panel);
  border: 2px solid var(--neon-cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 0 10px var(--neon-cyan);
}

.level-node.active {
  background: var(--neon-cyan);
  color: black;
  font-weight: bold;
}

.level-node.locked {
  border-color: #444;
  color: #444;
}

/* Bottom Navigation */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  background: var(--bg-panel);
  border-top: 2px solid var(--neon-cyan);
  padding: var(--space-sm);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-decoration: none;
}

.nav-item.active {
  color: var(--neon-cyan);
}

.nav-icon {
  width: 28px;
  height: 28px;
  padding: 4px;
  background: var(--bg-panel-light);
  border-radius: 4px;
}

.active .nav-icon {
  background: var(--neon-cyan);
  color: #000;
}

/* Shop Grid */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  padding: var(--space-md);
}

.shop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

/* Starship View */
.starship-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-md);
  gap: var(--space-lg);
}

.ship-display {
  width: 200px;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ship-glow {
  position: absolute;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(0, 242, 255, 0.4) 0%, transparent 70%);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0.6; }
  100% { transform: scale(1); opacity: 0.4; }
}

.ship-placeholder {
  z-index: 2;
  width: 100px;
  height: 120px;
  background: var(--neon-cyan);
  clip-path: polygon(50% 0%, 100% 70%, 80% 100%, 20% 100%, 0% 70%);
}

.stats-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.1);
  margin: 0 12px;
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--neon-cyan);
}

/* Tabs */
.tabs {
  display: flex;
  background: rgba(0,0,0,0.3);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: var(--space-md);
}

.tab-btn {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: bold;
}

.tab-btn.active {
  background: var(--neon-blue);
  color: white;
}

/* Grid for Items */
.item-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.item-slot {
  aspect-ratio: 1;
  background: var(--bg-panel-light);
  border: 1px solid var(--border-cyan);
  border-radius: 4px;
  position: relative;
}

.item-slot.locked::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
}

/* Modal / Overlay */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
}

.modal {
  width: 100%;
  background: var(--bg-panel);
  border: 2px solid var(--neon-cyan);
  border-radius: 12px;
  padding: var(--space-lg);
  box-shadow: 0 0 30px rgba(0, 242, 255, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  color: var(--neon-cyan);
}

.close-btn {
  color: var(--neon-red);
  font-size: 1.5rem;
  font-weight: bold;
}

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.range-slider {
  flex: 0.6;
  height: 8px;
  background: #333;
  border-radius: 4px;
  position: relative;
}

.range-fill {
  height: 100%;
  background: var(--neon-cyan);
  width: 70%;
  border-radius: 4px;
}

.checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--neon-cyan);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox.checked::after {
  content: '✓';
  color: var(--neon-cyan);
  font-weight: bold;
}
