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

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #2d3748;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
  height: 100%;
}

body {
  min-height: 100vh;
  background: inherit;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1 {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.lead {
  font-size: 1.125rem;
  color: #4a5568;
  line-height: 1.7;
}

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

#start-screen, #routes-screen {
  overflow-y: auto;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  background: #ffffff;
}

.hero-logo {
  max-width: 280px;
  height: auto;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

.hero-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.tagline {
  font-size: 1.25rem;
  color: #667eea;
  font-weight: 500;
  margin-top: 0.5rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.welcome-card {
  text-align: center;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  border-radius: 12px;
}

.feature-icon {
  font-size: 2rem;
}

/* Route Cards */
.route-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.route-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.route-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.route-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(104, 211, 145, 0.15);
  color: #2f855a;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.route-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.route-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #718096;
  font-size: 0.95rem;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-large {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.25rem;
}

.btn-back {
  background: white;
  border: 2px solid #e2e8f0;
  color: #4a5568;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
}

/* Header */
.header {
  background: white;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid #e8e4f0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.score-badge {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #744210;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* Map */
#map-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-toggle {
  position: absolute;
  bottom: 2rem;
  right: 1.5rem;
  background: white;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 1000;
  transition: all 0.2s;
}

.map-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#toggle-icon {
  font-size: 1.5rem;
}

/* Bingo Board */
#bingo-container {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: white;
}

#bingo-container.hidden {
  display: none;
}

.bingo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.bingo-progress {
  color: #667eea;
  font-weight: 600;
  font-size: 1.125rem;
}

#bingo-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.bingo-cell {
  aspect-ratio: 1;
  background: white;
  border: 3px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}

.bingo-cell:hover {
  border-color: #cbd5e0;
  transform: scale(1.02);
}

.bingo-cell.completed {
  background: linear-gradient(135deg, rgba(104, 211, 145, 0.1), rgba(72, 187, 120, 0.1));
  border-color: #48bb78;
}

.bingo-cell.completed::after {
  content: '✓';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #48bb78;
  color: white;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.cell-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.5rem;
}

.cell-task {
  font-size: 0.875rem;
  color: #4a5568;
  line-height: 1.4;
}

.bingo-cell.completed .cell-task {
  color: #2f855a;
}

#bingo-status {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  border-radius: 12px;
}

#bingo-status.has-bingo {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 193, 7, 0.2));
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Game Status */
.game-status {
  background: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #4a5568;
}

.status-icon {
  font-size: 1.5rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s;
}

.modal.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: #f7fafc;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #718096;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #2d3748;
}

.modal-body {
  padding: 2rem 1.5rem;
}

.station-number {
  width: 4rem;
  height: 4rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 1.5rem;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.station-task {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.6;
}

#task-input-container {
  margin-bottom: 1.5rem;
}

.task-input {
  width: 100%;
  padding: 1rem;
  font-size: 1.125rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: inherit;
  transition: all 0.2s;
}

.task-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.task-hint {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 8px;
  font-size: 0.95rem;
  color: #4a5568;
  text-align: center;
}

/* Congrats Modal */
.modal-content.congrats {
  text-align: center;
  padding: 3rem 2rem;
}

.congrats-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: celebration 0.6s ease-out;
}

@keyframes celebration {
  0% { transform: scale(0) rotate(0deg); }
  50% { transform: scale(1.2) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

.congrats h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.congrats p {
  font-size: 1.25rem;
  color: #4a5568;
  margin-bottom: 2rem;
}

.final-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat {
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  border-radius: 12px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: #718096;
  text-transform: uppercase;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 640px) {
  html { font-size: 14px; }
  
  h1 { font-size: 2.5rem; }
  
  .hero { padding: 2rem 1rem 1.5rem; }
  
  .features { grid-template-columns: 1fr; }
  
  .final-stats { grid-template-columns: 1fr; }
  
  .modal-content { margin: 0.5rem; }
  
  .congrats h2 { font-size: 2rem; }
}

/* Leaflet Customization */
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 1rem;
  font-size: 0.95rem;
}

/* Custom Marker Styles */
.station-marker {
  background: white;
  border: 3px solid #667eea;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: #667eea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.station-marker.completed {
  background: #48bb78;
  border-color: #48bb78;
  color: white;
}

.station-marker.active {
  background: #ffd700;
  border-color: #ffd700;
  color: #744210;
  animation: ping 1.5s infinite;
}

@keyframes ping {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 215, 0, 0.3); }
}