.color-calendar {
  width: 80%;
  margin: auto;
  margin-bottom: 30px;
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.5em;
  margin-bottom: 10px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  aspect-ratio: 3;
}
.calendar-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #353535;
  font-size: 1.4rem;
}
.calendar-cell.header {
  background: transparent;
}
.calendar-cell.empty {
  background: transparent;
}
.calendar-legend {
  margin-top: 15px;
  font-size: 0.9em;
}

/* frühere inline-block-Variante bleibt ungenutzt; kann entfernt werden,
   aber hier belassen, falls woanders gebraucht. */
.legend-item {
  display: inline-block;
  margin-right: 10px;
}
.legend-item span {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 5px;
  vertical-align: middle;
  border: 1px solid #999;
}

/* ---------- NEU: Grafik-Legende mit sauberer Ausrichtung ---------- */
.calendar-legend-graphic {
  display: flex;
  gap: 50px;
  margin-top: 40px;
  font-size: 18px;
  justify-content: center;
}

/* Jedes Legendenelement ist ein 2-Spalten-Grid:
   links Box/Icon, rechts Text + Subtext exakt untereinander */
.calendar-legend-graphic .legend-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 10px;
  margin: 0;            /* überschreibt das inline-block spacing oben */
}

.row {
  display: contents;    /* Kinder (Box/Icon + .text) direkt ins Grid heben */
}

.color-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.box-geoeffnet    { background-color: #7ad1d1; }
.box-winter       { background-color: #82bced; }
.box-verlaengert  { background-color: #cc9dc7; }
.box-geschlossen  { background-color: #eaeaea; }

.text {
  font-weight: bold;
}

.calender-skip { /* ja, hier steht wirklich calender… ich fass es nicht an */
  text-decoration: none;
  font-weight: 1000;
  color: black;
}

.subtext {
  grid-column: 2;       /* exakt unter der Uhrzeit/der .text-Zeile starten */
  font-size: 16px;
  color: #333;
  margin-top: 3px;
}

.icon-star {
  width: 28px;          /* sorgt für gleiche Spaltenbreite wie color-box */
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

/* ---------- Kalender-Events etc. bleibt unverändert ---------- */
.calendar-events {
  list-style: none;
  padding: 0;
  margin: 2px 0 0 0;
  font-size: 0.7em;
  color: #333;
}

.calendar-events li {
  margin: 1px 0;
}

.calendar-star {
  color: black;
  margin-left: 4px;
}

.calendar-cell {
  position: relative;
  overflow: hidden;
  height: 80px; /* fixierte Höhe */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.calendar-day {
  font-weight: bold;
  font-size: 1.2em;
  line-height: 1.2;
}

.calendar-event {
  font-size: 0.7em;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.event-title {
  margin-top: 2px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.2rem;
}

.calendar-star {
  position: absolute;
  top: -6%;
  left: 8%;
  font-size: 1.5em;
  color: black;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .color-calendar {
    width: 100%;
  }

  .calendar-cell {
    position: relative;
    overflow: hidden;
    height: 80px; /* fixierte Höhe */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
  }

  .calendar-day {
    font-size: 1.0em;
    line-height: 1.0;
  }

  .calendar-event {
    font-size: 0.4em;
    font-weight: 800;
  }

  .event-title {
    margin-top: 2px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
  }

  .calendar-star {
    top: -3px;
    left: -8%;
    font-size: 0.5em;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-legend-graphic {
    display: block; /* wie vorher */
  }

  /* mobile Optik bleibt wie gewünscht:
     wir lassen legend-item als Grid für die Ausrichtung,
     übernehmen aber deine Abstände/Links-Einrückung */
  .calendar-legend-graphic .legend-item {
    margin-bottom: 10px;
    margin-left: 20vw;
  }
}
