:root {
  --white: #fff;
  --black: #000;
  --red: #d62828;
  --yellow: #fcbf49;
  /* Semantische Tokens */
  --bg: #f8f8f8;
  --surface: #fff;
  --border: #ddd;
  --text: #000;
  --text-secondary: #444;
  --input-bg: #fff;
  --th-bg: #f7f7f7;
  --toolbar-bg: #f7f7f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --surface: #1c1c1e;
    --border: #38383a;
    --text: #f2f2f7;
    --text-secondary: #ababab;
    --input-bg: #2c2c2e;
    --th-bg: #2c2c2e;
    --toolbar-bg: #2c2c2e;
  }
}

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

body {
  font-family: system-ui, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: inherit;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}

header > div:first-child {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

header img {
  height: 30px;
  width: auto;
  margin-right: 8px;
  flex-shrink: 0;
  object-fit: contain;
}

h1 {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.wrap {
  padding: 12px;
  max-width: 900px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 4px 10px rgba(0,0,0,.05);
}

label {
  display: block;
  font-weight: 700;
  margin: 10px 0 6px;
}

input, select, button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 16px;
  min-height: 44px;
}

input, select {
  background: var(--input-bg);
  color: var(--text);
}

button {
  cursor: pointer;
  background: var(--red);
  color: var(--white);
  border: none;
  font-weight: 700;
}

button.secondary {
  background: var(--yellow);
  color: var(--black);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.toolbar a {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  background: var(--toolbar-bg);
  line-height: 1.4;
}

.muted {
  opacity: .75;
}

.ok {
  color: #2a9d2a;
  font-weight: 700;
}

.err {
  color: var(--red);
  font-weight: 700;
}

.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

th, td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

/* Gleichmäßige Spaltenverteilung für die Belegungstabellen */
th:nth-child(1), td:nth-child(1) { width: 35%; }
th:nth-child(2), td:nth-child(2) { width: 25%; }
th:nth-child(3), td:nth-child(3) { width: 25%; }
th:nth-child(4), td:nth-child(4) { width: 15%; }

/* Kuchenspenden-Tabelle */
.kuchen-table {
  table-layout: auto;
  min-width: 640px;
}
.kuchen-table td { white-space: nowrap; }
.kuchen-table .truncate {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Players Dinner Tabelle – auto layout statt fixer Pixel */
.players-dinner-table {
  table-layout: auto;
  min-width: 700px;
}

th {
  background: var(--th-bg);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.modal .close {
  float: right;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

/* Event-Auswahl */
.event-selection {
  text-align: center;
  padding: 32px 16px;
}

.event-selection-heading {
  font-size: 26px;
  margin-bottom: 24px;
  color: var(--red);
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.event-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  display: block;
}

.event-card:hover {
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
}

.event-card:active {
  transform: scale(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  border-color: var(--red);
}

.event-card--kuchen {
  border-color: var(--yellow);
  margin-top: 8px;
}

.event-card--kuchen:hover,
.event-card--kuchen:active {
  border-color: var(--yellow);
}

.event-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--red);
}

.event-card .event-date {
  font-size: 15px;
  color: var(--text);
  opacity: 0.65;
  margin-bottom: 10px;
  font-weight: 600;
}

.event-card .event-description {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Rezept-Optionen Styling */
.rezept-options {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.rezept-option {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.rezept-option:last-child {
  margin-bottom: 0;
}

.rezept-option input[type="radio"] {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  margin: 0 8px 0 0;
  padding: 0 !important;
  flex-shrink: 0;
  border-radius: 50% !important;
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
}

.rezept-option label {
  display: inline;
  margin: 0;
  font-weight: normal;
  line-height: 1.4;
  cursor: pointer;
}

.rezept-bereich {
  display: none;
  margin-bottom: 16px;
}

.name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 700px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .event-selection h1 {
    font-size: 32px;
  }

  header img {
    height: 40px;
    margin-right: 12px;
  }

  .toolbar a {
    font-size: 14px;
    padding: 5px 14px;
  }

  .event-card {
    padding: 22px;
  }
}
