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

:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1a2a3a;
  --text-muted: #5a6a7a;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #d1d9e6;
  --error: #dc2626;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.controls label {
  font-weight: 600;
  white-space: nowrap;
}

.controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

#resort-select {
  flex: 1;
  max-width: 360px;
}

.chart-wrapper {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  min-height: 400px;
}

canvas {
  width: 100% !important;
}

#heatmap-canvas {
  image-rendering: pixelated;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.heatmap-legend .gradient {
  width: 120px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Loading */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  z-index: 10;
  font-weight: 500;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* Error / Warning */
.error {
  text-align: center;
  padding: 0.75rem 1rem;
  color: var(--error);
  font-weight: 500;
}

.error.warning {
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.4rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls select {
    max-width: 100%;
  }

  .chart-wrapper {
    padding: 0.75rem;
    min-height: 300px;
  }
}
