:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #e5edf5;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --text: #1e293b;
  --muted: #64748b;
  --good: #16a34a;
  --mid: #d97706;
  --bad: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overflow-x: hidden; /* verhindert, dass die Stunden-Leiste die Seite seitlich aufreißt */
  width: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  padding: 1.25rem 1.25rem 0.85rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

h1 { font-size: 1.25rem; margin: 0; }

.location-bar { position: relative; }

.location-bar input {
  width: 260px;
  max-width: 70vw;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
}

.location-results {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  text-align: left;
}

.location-results li {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.location-results li:hover { background: var(--accent-soft); }

.hidden { display: none !important; }

.current-location {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.tabs { display: flex; gap: 0.4rem; justify-content: center; }

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.tab-btn.active { color: #fff; background: var(--accent); }

main { padding: 1rem 1.25rem 3rem; max-width: 980px; margin: 0 auto; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.top-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.info-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1 1 auto;
}

.info-pill:empty { display: none; }

.warning-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
}

.warning-banner.markant { background: #fffbeb; border-color: #fde68a; }

.warning-item + .warning-item { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed #fecaca; }

.warning-headline { font-weight: 700; color: #991b1b; font-size: 0.95rem; }
.warning-banner.markant .warning-headline { color: #92400e; }
.warning-meta { font-size: 0.78rem; color: var(--muted); margin: 0.15rem 0 0.3rem; }
.warning-desc { font-size: 0.85rem; line-height: 1.4; }

/* --- Day cards --- */
.day-list { display: grid; gap: 0.6rem; }

.day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
  min-width: 0; /* verhindert, dass die Karte über die Grid-Spalte hinauswächst (CSS-Grid-Default ist min-width:auto) */
}

.day-card:hover { box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06); }

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

.day-icon svg { width: 56px; height: 56px; display: block; }

.day-main { flex: 1; min-width: 0; }

.day-name { font-weight: 600; font-size: 1rem; }
.day-date { color: var(--muted); font-size: 0.8rem; }

.day-temps { font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.day-temps .min { color: var(--muted); font-weight: 400; margin-left: 0.3rem; }

.day-extra {
  display: flex;
  gap: 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.day-chevron { color: var(--muted); transition: transform 0.15s ease; }
.day-card.expanded .day-chevron { transform: rotate(180deg); }

.hourly-panel {
  display: none;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.day-card.expanded .hourly-panel { display: flex; }

.hour-item {
  flex: 0 0 auto;
  text-align: center;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: var(--bg);
  min-width: 72px;
}

.hour-item.current-hour {
  background: var(--accent-soft);
  border: 1px solid #93c5fd;
}

.hour-item svg { width: 28px; height: 28px; }
.hour-item .h-time { font-size: 0.72rem; color: var(--muted); }
.hour-item.current-hour .h-time { color: var(--accent); font-weight: 600; }
.hour-item .h-temp { font-weight: 600; font-size: 0.85rem; margin: 0.15rem 0; }
.hour-item .h-precip { font-size: 0.68rem; color: var(--accent); }
.hour-item .h-wind { font-size: 0.65rem; color: var(--muted); }
.hour-item .h-schwuel { font-size: 0.63rem; color: #a855f7; margin-top: 0.1rem; }

.badge-hoch { color: var(--good); }
.badge-mittel { color: var(--mid); }
.badge-niedrig { color: var(--bad); }

/* --- Garden --- */
.garden-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.garden-controls label { color: var(--muted); }

#monthSelect, #filterSun, #filterNutrient, #filterColdFrame {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
}

.moon-info { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; width: 100%; flex: none; }

.plant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.85rem;
}

.plant-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.plant-card:hover { box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06); }

.plant-card-head { display: flex; align-items: center; gap: 0.7rem; }
.plant-icon svg { width: 44px; height: 44px; }
.plant-name { font-weight: 600; font-size: 1.05rem; }

.plant-table {
  width: 100%;
  margin-top: 0.75rem;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.plant-table tr { border-top: 1px solid var(--border); }
.plant-table tr:first-child { border-top: none; }

.plant-table th, .plant-table td {
  padding: 0.35rem 0;
  text-align: left;
  font-weight: 400;
}

.plant-table th {
  color: var(--muted);
  width: 45%;
  white-space: nowrap;
}

.plant-table td { color: var(--text); font-weight: 500; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.4rem;
  max-width: 420px;
  width: 100%;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  border: none;
  background: none;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
}

.companion-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.rel-gut { color: var(--good); font-weight: 600; }
.rel-neutral { color: var(--muted); }
.rel-schlecht { color: var(--bad); font-weight: 600; }

@media (max-width: 480px) {
  .location-bar input { width: 150px; }
  .day-icon svg { width: 44px; height: 44px; }
}

/* --- Garten-Tipp-Streifen (Wetter-Tab) --- */
.garden-tip-strip:empty { display: none; }

.garden-tip-strip {
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.garden-tip-strip.frost { background: #eff6ff; border-color: #93c5fd; }
.garden-tip-strip strong { color: var(--accent); }

/* --- Frühbeet / Bauernregeln --- */
.fruehbeet-info {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.fruehbeet-info summary { cursor: pointer; font-weight: 600; }
.fruehbeet-info p { margin: 0.6rem 0 0; color: var(--muted); }

.lore-section {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.lore-section:empty { display: none; }

.lore-card {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
}
.lore-name { font-weight: 600; }
.lore-summary { color: var(--muted); margin-top: 0.15rem; }
.lore-tip { margin-top: 0.3rem; color: #92400e; }

.moon-info { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
.moon-next { font-size: 0.78rem; color: var(--muted); }

/* --- Aktuelles Wetter am Standort --- */
.current-weather-card {
  background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.current-weather-card .cw-icon svg { width: 64px; height: 64px; }
.current-weather-card .cw-temp { font-size: 2.1rem; font-weight: 700; }
.current-weather-card .cw-feels { font-size: 0.82rem; opacity: 0.85; }

.cw-details {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  opacity: 0.95;
  margin-left: auto;
}

.cw-no-warning { opacity: 0.75; font-size: 0.8rem; margin-top: 0.4rem; }

/* --- Schwüle-Badge auf Tageskarte --- */
.day-schwuel-badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #a855f7;
  background: #f3e8ff;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
}

.day-change-note {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.3rem;
}

/* --- Ernte diese Woche --- */
.harvest-now-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
}

.harvest-now-title { font-weight: 600; color: #166534; margin-bottom: 0.4rem; }
.harvest-now-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.harvest-now-item {
  background: #dcfce7;
  color: #166534;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
}

.day-summary {
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 0.5rem;
  line-height: 1.4;
  background: var(--bg);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
}
