:root {
  --bg: #f4f3ef;
  --karte: #ffffff;
  --text: #1c1d1a;
  --leise: #6f716a;
  --linie: #e2e1da;
  --akzent: #1f5e48;
  --akzent-weich: #dcebe3;
  --gold: #b9741c;
  --gold-weich: #f6e8d2;
  --warn: #9b2c2c;
  --warn-weich: #fbe6e4;
  --radius: 14px;
  --schrift: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171816;
    --karte: #232521;
    --text: #eceee8;
    --leise: #9da096;
    --linie: #373a34;
    --akzent: #6cc39c;
    --akzent-weich: #1f3a2e;
    --gold: #e8ad5c;
    --gold-weich: #3a2d1b;
    --warn: #f0a39b;
    --warn-weich: #3b2322;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--schrift);
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 96px);
}
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 14px; letter-spacing: -0.02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--leise); margin: 24px 4px 8px; font-weight: 600; }
p { margin: 0 0 8px; }
a { color: var(--akzent); }
.leise { color: var(--leise); }
.klein { font-size: 14px; }
.zahl { font-variant-numeric: tabular-nums; }

.kopf { display: flex; align-items: center; gap: 8px; }
.kopf h1 { flex: 1; min-width: 0; }
.kopf .zurueck { font-size: 17px; text-decoration: none; padding: 8px 4px; }
.symbolknopf {
  border: 0; background: transparent; color: var(--leise); font-size: 22px; padding: 8px; cursor: pointer;
}

.karte {
  background: var(--karte);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 0 var(--linie);
}
.karte.hinweis { background: var(--gold-weich); box-shadow: none; }
.karte.aktiv { background: var(--akzent-weich); box-shadow: none; }
a.karte, button.karte { display: block; text-decoration: none; color: inherit; width: 100%; text-align: left; border: 0; font: inherit; cursor: pointer; }

.liste { background: var(--karte); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.liste > a, .liste > div, .liste > button {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 0; border-top: 1px solid var(--linie); background: none; width: 100%;
  text-decoration: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.liste > :first-child { border-top: 0; }
.liste .mitte { flex: 1; min-width: 0; }
.liste .titel { font-weight: 550; }
.liste .unter { font-size: 14px; color: var(--leise); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.liste .rechts { color: var(--leise); font-size: 15px; white-space: nowrap; }
.pfeil::after { content: "›"; color: var(--leise); font-size: 22px; margin-left: 4px; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 0; background: var(--akzent); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .knopf { color: #0f1a15; } }
.knopf.zweit { background: var(--akzent-weich); color: var(--akzent); }
.knopf.leise { background: transparent; color: var(--leise); }
.knopf.warn { background: var(--warn-weich); color: var(--warn); }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: 0.45; }
.knopfreihe { display: flex; gap: 8px; margin: 10px 0; }
.knopfreihe > * { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chip {
  border: 1px solid var(--linie); background: var(--karte); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 15px; cursor: pointer;
}
.chip.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.an { color: #0f1a15; } }

label.feld { display: block; margin-bottom: 12px; }
label.feld > span { display: block; font-size: 14px; color: var(--leise); margin: 0 4px 4px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--karte);
  border: 1px solid var(--linie); border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; }
.zeile2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.zeile4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.zeile4 input { padding: 10px 8px; text-align: center; }

/* Tagesstand */
.stand { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stand .karte { margin: 0; }
.gross { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.balken { height: 6px; background: var(--linie); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.balken > i { display: block; height: 100%; background: var(--akzent); border-radius: 3px; }
.balken.drueber > i { background: var(--gold); }

/* Training: Sätze */
.uebung-karte h3 { margin: 0; font-size: 18px; }
.naechstes { background: var(--gold-weich); border-radius: 10px; padding: 8px 12px; margin: 10px 0; font-size: 15px; }
.saetze { display: grid; grid-template-columns: 28px 1fr 1fr 52px; gap: 8px; align-items: center; margin-top: 8px; }
.saetze .kopfzeile { font-size: 13px; color: var(--leise); text-align: center; }
.saetze .nr { color: var(--leise); text-align: center; font-variant-numeric: tabular-nums; }
.saetze input { padding: 10px 6px; text-align: center; font-variant-numeric: tabular-nums; }
.saetze input::placeholder { color: var(--leise); opacity: 0.7; }
.haken {
  width: 52px; height: 46px; border-radius: 12px; border: 1px solid var(--linie);
  background: var(--karte); font-size: 22px; color: var(--leise); cursor: pointer;
}
.haken.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.saetze .fertig input { background: var(--akzent-weich); border-color: transparent; }

.skala { display: flex; gap: 6px; }
.skala button { flex: 1; min-height: 46px; font-size: 22px; border-radius: 12px; border: 1px solid var(--linie); background: var(--karte); cursor: pointer; }
.skala button.an { background: var(--akzent-weich); border-color: var(--akzent); }

/* Essen */
.mahlzeit { display: flex; gap: 12px; align-items: center; }
.vorschau { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--linie); flex: none; }
.vorschau.leer { display: flex; align-items: center; justify-content: center; font-size: 24px; }
.grossbild { width: 100%; border-radius: var(--radius); display: block; margin-bottom: 10px; background: var(--linie); }
.marke { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--linie); color: var(--leise); }
.marke.warten { background: var(--gold-weich); color: var(--gold); }
.tagnav { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.tagnav button { border: 0; background: var(--karte); border-radius: 10px; width: 44px; height: 40px; font-size: 20px; color: var(--text); cursor: pointer; }
.tagnav button:disabled { opacity: 0.3; }
.dateiwahl { position: relative; overflow: hidden; }
.dateiwahl input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Diagramm */
.diagramm { width: 100%; height: auto; display: block; }
.diagramm .linie { fill: none; stroke: var(--akzent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .punkt { fill: var(--akzent); }
.diagramm .achse { stroke: var(--linie); stroke-width: 1; }
.diagramm text { fill: var(--leise); font-size: 11px; font-family: var(--schrift); }

.fotoreihe { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fotoreihe img, .fotoreihe .platz { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; background: var(--linie); display: block; }
.fotoreihe a { text-decoration: none; }
.fotoreihe figure { margin: 0; }
.fotoreihe figcaption { font-size: 12px; color: var(--leise); text-align: center; margin-top: 2px; }

/* Leiste unten */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--linie);
}
#tabs[hidden] { display: none; }
#tabs a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 11px; color: var(--leise); text-decoration: none; padding: 4px 0;
}
#tabs a span { font-size: 20px; line-height: 1.2; }
#tabs a.an { color: var(--akzent); font-weight: 600; }

#meldung {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 10;
}
#meldung.sichtbar { opacity: 1; transform: translate(-50%, 0); }

.status { font-size: 13px; color: var(--leise); text-align: center; margin: 18px 0 0; }
.leerzustand { text-align: center; color: var(--leise); padding: 24px 8px; }
