:root {
  --bg: #F4EEE1;
  --surface: #FFFFFF;
  --surface-2: #EAE2CE;
  --primary: #0F4C4F;
  --primary-dark: #093234;
  --primary-light: #4C8A8C;
  --accent: #E2703A;
  --accent-dark: #C25A28;
  --good: #3E8F5D;
  --amber: #D99A2B;
  --danger: #C64A3D;
  --text: #1E2B2A;
  --muted: #6B7570;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(15, 76, 79, 0.10);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--primary);
  color: #fff;
  padding: 14px 20px 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  box-shadow: var(--shadow);
}
.brand { font-family: 'Space Grotesk', sans-serif; font-size: 1.3rem; font-weight: 700; }
.brand-accent { color: var(--accent); }
.brand-hook { margin-right: 2px; }
.topbar-sub { font-size: 0.78rem; opacity: 0.75; }

main.view { display: none; padding: 20px 16px 96px; max-width: 720px; margin: 0 auto; }
main.view.active { display: block; }

.hero h1 { font-size: 1.6rem; margin-top: 6px; }
.hero-sub { margin-bottom: 22px; }

.search-box { position: relative; margin-bottom: 14px; }
.search-box input {
  width: 100%;
  padding: 16px 16px;
  font-size: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
}
.search-box input:focus { outline: none; border-color: var(--primary-light); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 30;
}
.search-results:empty { display: none; }
.search-result-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
  font-size: 0.95rem;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:active, .search-result-item:hover { background: var(--bg); }
.search-result-item small { display: block; color: var(--muted); }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-height: 52px;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: var(--primary); color: #fff; }

.manual-coords { margin: 18px 0; color: var(--muted); }
.manual-coords summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: var(--primary); }
.manual-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.manual-row input { flex: 1; min-width: 120px; padding: 12px; border-radius: 10px; border: 2px solid var(--surface-2); }

.quick-picks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.chip {
  background: var(--surface);
  border: 2px solid var(--surface-2);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
}
.chip:active { background: var(--surface-2); }

.loading-state, .error-state { text-align: center; padding: 60px 20px; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 4px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { color: var(--danger); font-weight: 600; }
.hidden { display: none !important; }

.place-header { margin-bottom: 18px; }
.place-header h1 { font-size: 1.4rem; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); color: var(--primary-dark);
  border-radius: 999px; padding: 5px 12px; font-size: 0.78rem; font-weight: 600;
}

.day-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; }
.day-tab {
  flex: 0 0 auto;
  background: var(--surface);
  border: 2px solid var(--surface-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--muted);
  text-align: center;
}
.day-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; margin-bottom: 12px; font-weight: 700; }
.card-title .em { font-size: 1.25rem; }

.weather-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.weather-stat { background: var(--bg); border-radius: 12px; padding: 12px; }
.weather-stat .label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.weather-stat .value { font-size: 1.15rem; font-weight: 700; margin-top: 2px; }

.ampel-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.ampel-light { width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto; }
.ampel-light.green { background: var(--good); box-shadow: 0 0 0 6px rgba(62,143,93,0.15); }
.ampel-light.amber { background: var(--amber); box-shadow: 0 0 0 6px rgba(217,154,43,0.15); }
.ampel-light.red { background: var(--danger); box-shadow: 0 0 0 6px rgba(198,74,61,0.15); }
.ampel-status { font-size: 1.15rem; font-weight: 700; text-transform: capitalize; }
.why { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

.score-ring-wrap { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.score-num { font-size: 2.3rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; color: var(--primary); }
.score-label { color: var(--muted); font-size: 0.85rem; }
.factor-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.factor-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; gap: 10px; }
.factor-name { color: var(--text); font-weight: 600; flex: 0 0 120px; }
.factor-bar-wrap { flex: 1; background: var(--surface-2); border-radius: 6px; height: 8px; overflow: hidden; }
.factor-bar { height: 100%; background: var(--primary-light); border-radius: 6px; }
.factor-detail { flex: 0 0 auto; color: var(--muted); font-size: 0.78rem; max-width: 130px; text-align: right; }

.species-list { display: flex; flex-direction: column; gap: 10px; }
.species-item { border: 2px solid var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.species-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.species-name { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.species-score { font-weight: 700; color: var(--accent); font-family: 'Space Grotesk', sans-serif; }
.species-detail { margin-top: 10px; font-size: 0.85rem; display: none; }
.species-item.open .species-detail { display: block; }
.species-detail ul { margin: 6px 0 10px; padding-left: 18px; color: var(--muted); }
.species-meta { display: grid; grid-template-columns: 1fr; gap: 4px; color: var(--text); }
.species-meta b { color: var(--primary-dark); }

.hitra-head { margin-bottom: 12px; }
#hitra-map { height: 46vh; min-height: 300px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hitra-info { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; box-shadow: var(--shadow); font-size: 0.88rem; }
.hitra-info .spot-title { font-weight: 700; margin-bottom: 4px; color: var(--primary-dark); }
.hitra-info .catch-badge {
  display: inline-block; background: #FCEFD8; color: #8A5A17;
  border-radius: 999px; padding: 3px 10px; font-size: 0.72rem; font-weight: 700; margin-top: 6px;
}

.fuel-panel { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.fuel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.fuel-grid label { font-size: 0.75rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.fuel-grid input { padding: 10px; border-radius: 10px; border: 2px solid var(--surface-2); font-size: 0.95rem; }
.fuel-grid span { font-weight: 700; color: var(--primary-dark); padding-top: 4px; }
.fuel-result { margin-top: 12px; font-size: 0.95rem; }
.fuel-result .cost { font-size: 1.6rem; font-weight: 700; color: var(--accent); font-family: 'Space Grotesk', sans-serif; }

.soon-card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); position: relative; }
.soon-badge { display: inline-block; background: var(--primary); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.footer-note { font-size: 0.75rem; margin-top: 20px; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--surface);
  box-shadow: 0 -4px 16px rgba(15,76,79,0.10);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 25;
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-radius: 12px;
}
.nav-item span { font-size: 1.3rem; }
.nav-item.active { color: var(--accent); background: var(--bg); }

@media (min-width: 600px) {
  main.view { padding-top: 32px; }
  .weather-grid { grid-template-columns: repeat(4, 1fr); }
}

.leaflet-popup-content { font-family: 'Inter', sans-serif; font-size: 0.85rem; }
