:root {
  --sun: #F5A623;
  --sun-glow: #FFD93D;
  --sun-deep: #E8890C;
  --sky-day: #87CEEB;
  --sky-golden: #FDB777;
  --sky-night: #1a1a2e;
  --bg: #FFFBF0;
  --bg-card: #FFFFFF;
  --text: #2C1810;
  --text-soft: #6B5744;
  --text-muted: #A89279;
  --green: #4CAF50;
  --green-bg: #E8F5E9;
  --red: #E57373;
  --red-bg: #FFEBEE;
  --orange: #FF9800;
  --orange-bg: #FFF3E0;
  --radius: 20px;
  --shadow: 0 4px 24px rgba(44,24,16,0.06);
  --shadow-lg: 0 12px 48px rgba(44,24,16,0.1);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

.hero {
  position: relative;
  padding: 3rem 1.5rem 2rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(245,166,35,0.15) 0%, rgba(255,217,61,0.05) 40%, transparent 70%);
  border-radius: 50%;
  animation: pulse 6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.8; }
  50% { transform: translateX(-50%) scale(1.1); opacity: 1; }
}

.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 400;
  line-height: 1.05;
  position: relative;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hero h1 em {
  color: var(--sun-deep);
  font-style: italic;
}

.hero .subtitle {
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
  position: relative;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* Sun animation */
.sun-visual {
  width: 100px; height: 100px;
  margin: 1.5rem auto 2rem;
  position: relative;
}

.sun-core {
  width: 60px; height: 60px;
  background: radial-gradient(circle at 40% 40%, var(--sun-glow), var(--sun), var(--sun-deep));
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 30px rgba(245,166,35,0.4), 0 0 60px rgba(245,166,35,0.15);
  animation: sunGlow 3s ease-in-out infinite;
}

@keyframes sunGlow {
  0%, 100% { box-shadow: 0 0 30px rgba(245,166,35,0.4), 0 0 60px rgba(245,166,35,0.15); }
  50% { box-shadow: 0 0 40px rgba(245,166,35,0.5), 0 0 80px rgba(245,166,35,0.2); }
}

.sun-rays {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100px; height: 100px;
  animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow { to { transform: translate(-50%, -50%) rotate(360deg); } }

.sun-rays::before, .sun-rays::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 90px; height: 90px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px dashed rgba(245,166,35,0.25);
}

.sun-rays::after { width: 100px; height: 100px; border-color: rgba(245,166,35,0.12); }

/* Loading */
.loading-state {
  text-align: center;
  padding: 3rem 1rem;
}

.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(245,166,35,0.2);
  border-top-color: var(--sun);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-state p { color: var(--text-muted); font-size: 0.95rem; }

/* Status card */
.status-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.6s ease-out;
}

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

.status-card.active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--green), #81C784);
}

.status-card.inactive::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--orange), var(--red));
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.status-badge.available { background: var(--green-bg); color: #2E7D32; }
.status-badge.unavailable { background: var(--orange-bg); color: #E65100; }

.status-badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.status-badge.available .dot {
  background: var(--green);
  animation: blink 2s ease-in-out infinite;
}

.status-badge.unavailable .dot { background: var(--orange); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-main {
  font-family: 'Instrument Serif', serif;
  font-size: 1.8rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.status-detail {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Chart card */
.elevation-meter {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: slideUp 0.7s ease-out;
}

.meter-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.chart-container {
  position: relative;
  width: 100%;
}

.chart-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding: 0 4px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.chart-legend-item .swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-values {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.8rem;
}

.chart-value-block {
  display: flex;
  flex-direction: column;
}

.chart-value-num {
  font-family: 'Instrument Serif', serif;
  font-size: 1.6rem;
  color: var(--text);
  line-height: 1.1;
}

.chart-value-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Timeline accordion */
.timeline-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: slideUp 0.8s ease-out;
}

.timeline-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  font-weight: 500;
}

.timeline-row {
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.timeline-header {
  display: flex;
  align-items: center;
  padding: 0.7rem 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-radius: 6px;
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
}

.timeline-header:hover {
  background: rgba(0,0,0,0.02);
}

.timeline-info { flex: 1; }

.timeline-date {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
}

.timeline-hours {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-top: 2px;
}

.timeline-duration {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
  font-weight: 500;
  margin-right: 4px;
}

.timeline-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.timeline-row.open .timeline-chevron {
  transform: rotate(180deg);
}

.timeline-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 6px;
}

.timeline-row.open .timeline-detail {
  max-height: 300px;
  padding: 0 6px 0.8rem 6px;
}

.timeline-detail-inner {
  background: rgba(0,0,0,0.015);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-soft);
  margin-left: 0;
}

.timeline-detail-inner .detail-row {
  display: block;
  margin-bottom: 6px;
  line-height: 1.6;
}

.timeline-detail-inner .detail-row:last-child { margin-bottom: 0; }

.detail-icon {
  display: inline;
  margin-right: 3px;
  font-size: 0.85rem;
}

/* Info section */
.info-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  animation: slideUp 0.9s ease-out;
  margin-bottom: 1.5rem;
}

.info-card .meter-label { margin-bottom: 0.8rem; }

.info-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
}

.info-item .icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }

.info-item p {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.55;
}

/* Phototype selector */
.phototype-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: slideUp 0.5s ease-out;
}

.phototype-bar .meter-label { margin-bottom: 0.6rem; }

.phototype-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.phototype-btn {
  flex: 1;
  min-width: 44px;
  padding: 8px 4px;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  background: #F8F4EE;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text-soft);
}

.phototype-btn:hover { background: #F0EAE0; }

.phototype-btn.active {
  border-color: var(--sun-deep);
  background: #FFF8EE;
  color: var(--text);
  font-weight: 600;
}

.phototype-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  margin: 0 auto 4px;
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.phototype-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Score gauge */
.score-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: slideUp 0.65s ease-out;
  text-align: center;
}

.score-ring {
  position: relative;
  width: 130px; height: 130px;
  margin: 0.5rem auto 0.8rem;
}

.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-ring .score-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Instrument Serif', serif;
  font-size: 2.4rem;
  color: var(--text);
  line-height: 1;
}

.score-ring .score-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.score-desc {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.45;
}

.score-breakdown {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.8rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.score-breakdown span { display: flex; align-items: center; gap: 4px; }

/* Location */
.location-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding: 8px 16px;
  background: rgba(255,255,255,0.7);
  border-radius: 100px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  animation: slideUp 0.5s ease-out;
}

.location-bar svg { width: 14px; height: 14px; }

/* Error state */
.error-state {
  text-align: center;
  padding: 2rem;
}

.error-state .emoji { font-size: 2.5rem; margin-bottom: 1rem; }
.error-state h3 { font-family: 'Instrument Serif', serif; font-size: 1.4rem; margin-bottom: 0.5rem; }
.error-state p { color: var(--text-soft); font-size: 0.95rem; line-height: 1.6; margin-bottom: 1.5rem; }

.btn-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--sun);
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-retry:hover { background: var(--sun-deep); transform: translateY(-1px); }

/* Day names */
.day-label { font-weight: 600; }

/* Search location */
.location-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2rem;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  animation: slideUp 0.5s ease-out;
}

.search-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 2px solid rgba(44,24,16,0.08);
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--sun);
  box-shadow: 0 0 0 4px rgba(245,166,35,0.1);
}

.search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(245,166,35,0.06); }

.search-result-item .result-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--orange-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.search-result-item .result-info { flex: 1; min-width: 0; }

.search-result-item .result-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item .result-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-geolocate {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(44,24,16,0.08);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-geolocate:hover {
  border-color: var(--sun);
  color: var(--sun-deep);
  background: rgba(245,166,35,0.05);
}

.btn-geolocate.active {
  border-color: var(--sun);
  background: var(--orange-bg);
  color: var(--sun-deep);
}

.search-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-bottom: 2rem;
}
.app-footer a { color: inherit; }

@media (max-width: 480px) {
  .hero { padding: 2rem 1rem 1.5rem; }
  .container { padding: 0 1rem 3rem; }
  .status-card, .elevation-meter, .timeline-card, .info-card { padding: 1.25rem 1.5rem; }
}
