/* ============================================
   Global Styles
   ============================================ */

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

:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary-color: #10b981;
  --secondary-dark: #059669;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.3s ease;
}

html,
body {
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
}

/* ============================================
   Container & Layout
   ============================================ */

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

.game-container {
  flex: 1;
  display: flex;
  position: relative;
  /* overflow: hidden; */
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  width: 100%;
  overflow-y: auto;
}

.game-layout.locked {
  filter: blur(1px) grayscale(0.5);
  pointer-events: none;
  user-select: none;
}

.access-gate {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.55);
}

.access-gate-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  max-width: 520px;
  text-align: center;
}

.access-gate-content h2 {
  margin-bottom: 0.75rem;
}

/* ============================================
   Header
   ============================================ */

.header {
  background: var(--surface);
  border-bottom: 2px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

.header-stats {
  display: flex;
  gap: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.auth-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-status {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-right: 0.25rem;
}

.auth-btn {
  flex: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

/* ============================================
   Map Section
   ============================================ */

.map-section {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.map-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.map-controls {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  background: var(--background);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.control-btn:hover {
  background: var(--border-color);
  transform: translateY(-2px);
}

.map-container {
  flex: 1;
  position: relative;
  background: #f0f0f0;
  min-height: 400px;
  overflow: hidden;
}

.street-view-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.map-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 1.125rem;
}

#streetview-container {
  height: 100%;
  width: 100%;
  min-height: 400px;
}

/* ============================================
   Guess Section
   ============================================ */

.guess-section {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.guess-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.guess-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.guess-map-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.guess-map {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  background: #f0f0f0;
  border: 2px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.map-hint {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--background);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

/* ============================================
   Buttons
   ============================================ */

.button-group {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

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

.btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--text-secondary);
}

/* ============================================
   Results Section
   ============================================ */

.results-section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.results-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.result-header {
  padding: 2rem 1.5rem 1rem;
  border-bottom: 2px solid var(--border-color);
}

.result-header h2 {
  font-size: 1.875rem;
  color: var(--primary-color);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.5rem;
}

.result-item {
  text-align: center;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius);
}

.result-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.result-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
}

.result-map-container {
  padding: 1.5rem;
}

.result-map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  background: #f0f0f0;
}

.result-details {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.detail-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
   Game Over Section
   ============================================ */

.game-over-section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.game-over-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
}

.game-over-content h2 {
  font-size: 2.25rem;
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.final-score {
  margin-bottom: 2rem;
}

.final-score-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.final-score-value {
  font-size: 3.75rem;
  font-weight: 700;
  color: var(--secondary-color);
}

.score-breakdown {
  background: var(--background);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.score-breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.score-breakdown-row:last-child {
  border-bottom: none;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  background: var(--surface);
  border-top: 2px solid var(--border-color);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   Leaflet Map Overrides
   ============================================ */

.leaflet-container {
  font-family: inherit;
}

.leaflet-control-container .leaflet-control {
  background: var(--surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .header-controls {
    flex-direction: column;
    width: 100%;
  }

  .header-stats {
    width: 100%;
    justify-content: center;
  }

  .auth-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .game-layout {
    padding: 1rem;
  }

  .coordinates {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .map-controls {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.5rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .header-stats {
    gap: 1rem;
  }

  .game-over-content h2 {
    font-size: 1.875rem;
  }

  .final-score-value {
    font-size: 2.5rem;
  }
}
