:root {
  /* Colors */
  --primary: #10B981; /* Emerald Green */
  --primary-dark: #059669;
  --secondary: #3B82F6; /* Sky Blue */
  --accent: #F59E0B; /* Amber/Gold */
  --danger: #EF4444;
  --surface: #FFFFFF;
  --background: #F0FDF4; /* Very pale green bg */
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --border: #E5E7EB;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 50px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-primary: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  /* Mobile-first centering wrapper */
  display: flex;
  justify-content: center;
}

/* Mobile App Container Simulation */
.app-container {
  width: 100%;
  max-width: 480px; /* Limit width to simulate mobile on desktop */
  background: var(--surface);
  min-height: 100vh;
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary-dark);
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

p {
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

.text-center { text-align: center; }
.text-white { color: white; }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.875rem; }

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.w-full { width: 100%; }
.mt-auto { margin-top: auto; }
.mb-md { margin-bottom: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.px-md { padding-left: var(--spacing-md); padding-right: var(--spacing-md); }

/* Components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--background);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  text-decoration: none;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-md);
  border: 1px solid rgba(0,0,0,0.03);
}

/* Badges */
.badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
}

.badge-primary { background: #DCFCE7; color: var(--primary-dark); }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }

/* Placeholder Images */
.placeholder-img {
  background-color: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-weight: 500;
  overflow: hidden;
  position: relative;
}

.placeholder-hero {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
}

.placeholder-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: #E2E8F0;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow-md);
}

.placeholder-icon {
  width: 40px;
  height: 40px;
  background: #E2E8F0;
  border-radius: 8px;
}

/* Navigation Bar */
.nav-bar {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: var(--spacing-sm) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

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

.nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* Game Elements */
.level-map {
  position: relative;
  padding: var(--spacing-lg) 0;
}

.map-node {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--spacing-xl);
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-md);
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}

.map-node.unlocked {
  border-color: var(--primary);
  color: var(--primary);
  background: white;
}

.map-node.current {
  background: var(--primary);
  border-color: #A7F3D0;
  color: white;
  transform: scale(1.1);
  box-shadow: var(--shadow-primary);
}

.map-node::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 4px;
  height: var(--spacing-xl);
  background: var(--border);
  transform: translateX(-50%);
  z-index: -1;
}

.map-node:last-child::after {
  display: none;
}

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}

/* Sorting Game Specifics */
.bin-container {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-sm);
  margin-top: auto;
  padding-bottom: var(--spacing-md);
}

.bin {
  flex: 1;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bin.highlight {
  border-color: var(--primary);
  background: #ECFDF5;
}

.trash-item {
  width: 100px;
  height: 100px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 40px auto;
  font-size: 32px; /* For icon */
  border: 1px solid var(--border);
}

/* Character Selection */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.avatar-option {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.avatar-option.selected {
  border-color: var(--primary);
  background: #ECFDF5;
}
