/* Fitness-Coach: eine Datei für App und Portal. Farben nur über Variablen, hell und dunkel. */
:root {
  color-scheme: light dark;
  --bg: #f3f5f1; --karte: #ffffff; --tinte: #1b231f; --grau: #68736c; --linie: #dfe4dd;
  --akzent: #1f6f5c; --akzent-hell: #e2f0eb; --akzent-dunkel: #174f42;
  --warn: #96500a; --warn-hell: #fbeed9; --gefahr: #a8271f; --gefahr-hell: #fbe7e4;
  --auf-akzent: #ffffff; --text2: #3d4741; --flaeche2: #f6f8f4; --linie2: #c9cfc9;
  --gefahr-linie: #e7bdb8; --akzent-mittel: #9cc7ba; --blass: #9aa39d;
}
/* Dunkel: wenn das Gerät es verlangt und nichts anderes gewählt ist … */
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --bg: #101513; --karte: #1a221f; --tinte: #e9eeea; --grau: #9aa69f; --linie: #2b3631;
    --akzent: #5cc4a8; --akzent-hell: #173630; --akzent-dunkel: #a6e0cf;
    --warn: #ecb86c; --warn-hell: #3b2c12; --gefahr: #f29186; --gefahr-hell: #42211d;
    --auf-akzent: #08130f; --text2: #c3ccc6; --flaeche2: #151c19; --linie2: #3a4640;
    --gefahr-linie: #6b3530; --akzent-mittel: #2f6e5f; --blass: #6f7a74;
  }
}
/* … oder wenn es in den Einstellungen fest gewählt ist. */
:root[data-thema="dunkel"] {
  --bg: #101513; --karte: #1a221f; --tinte: #e9eeea; --grau: #9aa69f; --linie: #2b3631;
  --akzent: #5cc4a8; --akzent-hell: #173630; --akzent-dunkel: #a6e0cf;
  --warn: #ecb86c; --warn-hell: #3b2c12; --gefahr: #f29186; --gefahr-hell: #42211d;
  --auf-akzent: #08130f; --text2: #c3ccc6; --flaeche2: #151c19; --linie2: #3a4640;
  --gefahr-linie: #6b3530; --akzent-mittel: #2f6e5f; --blass: #6f7a74;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--tinte); -webkit-text-size-adjust: 100%;
       font: 16px/1.4 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

/* ---------- Aufbau der App: Kopf, Inhalt, Reiter ---------- */
#app { height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column;
       padding-top: env(safe-area-inset-top); }
.kz { flex: none; padding: 12px 18px 10px; }
.kz .zurueck { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--akzent); font-weight: 600; min-height: 24px; }
.kz .zurueck button { background: none; border: 0; padding: 6px 8px 6px 0; color: var(--akzent); font-weight: 600; }
.kz h1 { font-size: 25px; letter-spacing: -.01em; margin-top: 2px; }
.kz .unter { color: var(--grau); font-size: 14px; }
.fortschritt { height: 4px; border-radius: 2px; background: var(--linie); margin-top: 10px; overflow: hidden; }
.fortschritt i { display: block; height: 100%; background: var(--akzent); }
.inhalt { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px;
          -webkit-overflow-scrolling: touch; }
.unten { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; gap: 9px;
         padding-bottom: env(safe-area-inset-bottom); }
.tabs { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-top: 1px solid var(--linie);
        background: var(--karte); padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }
.tabs button { background: none; border: 0; padding: 6px 0; font-size: 12px; color: var(--grau); }
.tabs button b { display: block; font-size: 18px; line-height: 1.1; font-weight: 400; }
.tabs button[aria-current="page"] { color: var(--akzent); font-weight: 700; }

/* ---------- Bausteine ---------- */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 16px; padding: 13px 14px; }
.karte h2 { font-size: 18px; }
.marke { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--akzent); }
.marke.ruhig { color: var(--grau); }
.klein { font-size: 13.5px; color: var(--grau); }
.mitte-text { text-align: center; }
.knopf { display: block; width: 100%; text-align: center; border: 0; border-radius: 14px; padding: 14px 10px; font-weight: 650;
         font-size: 17px; background: var(--akzent); color: var(--auf-akzent); }
.knopf:disabled { opacity: .45; cursor: default; }
.knopf.zweit { background: var(--karte); color: var(--tinte); border: 1px solid var(--linie); }
.knopf.schmerz { background: var(--gefahr-hell); color: var(--gefahr); }
.knopf.flach { padding: 11px 6px; font-size: 15px; }
.knopf.text { background: none; color: var(--grau); font-weight: 400; font-size: 14.5px; padding: 8px; }
.drei { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.zwei { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 8px 13px; border-radius: 999px; border: 1px solid var(--linie); background: var(--karte); font-size: 14.5px; white-space: nowrap; color: var(--tinte); }
button.chip[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); font-weight: 600; }
.chip.ruhig { background: var(--akzent-hell); border-color: transparent; color: var(--akzent-dunkel); }
.hinweis { border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.hinweis b { display: block; }
.hinweis.info { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.hinweis.warn { background: var(--warn-hell); color: var(--warn); }
.hinweis.gefahr { background: var(--gefahr-hell); color: var(--gefahr); }
.frage { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.frage span { font-weight: 400; color: var(--grau); font-size: 13px; }
.skala { display: flex; gap: 4px; }
.skala button { flex: 1; min-width: 0; height: 40px; padding: 0; border-radius: 9px; background: var(--karte); border: 1px solid var(--linie);
                font-size: 14px; color: var(--grau); }
.skala button.bis { background: var(--akzent-hell); border-color: transparent; }
.skala button[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); font-weight: 700; }
.skala.rot button.bis { background: var(--gefahr-hell); }
.skala.rot button[aria-pressed="true"] { background: var(--gefahr); border-color: var(--gefahr); }
.skala.rot button[aria-pressed="true"][data-wert="0"] { background: var(--grau); border-color: var(--grau); }
.liste { display: flex; flex-direction: column; }
.liste > * { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--linie); font-size: 15px; }
.liste > *:first-child { border-top: 0; }
.liste .weg { color: var(--blass); text-decoration: line-through; }
.liste button.zeile { background: none; border: 0; border-top: 1px solid var(--linie); width: 100%; text-align: left; }
.liste button.zeile:first-child { border-top: 0; }
.ok { color: var(--akzent); font-weight: 700; }
.zaehler { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; text-align: center;
           border: 1px solid var(--linie); border-radius: 14px; overflow: hidden; background: var(--karte); }
.zaehler button { font-size: 24px; padding: 9px 0; border: 0; background: var(--bg); color: var(--akzent); font-weight: 700; }
.zaehler output { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; }
.zaehler small { display: block; font-size: 12px; color: var(--grau); }
.feld { width: 100%; border: 1px solid var(--linie); background: var(--karte); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
textarea.feld { min-height: 84px; resize: vertical; }
.feld::placeholder { color: var(--blass); }
/* Fragen an den Coach (A16): Gespräch in Blasen, die Eingabe bleibt unten stehen. */
.blasen { display: flex; flex-direction: column; gap: 9px; }
.blase { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: 15.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.blase .klein { margin-top: 4px; }
.blase.ich { align-self: flex-end; background: var(--akzent); color: var(--auf-akzent); border-bottom-right-radius: 5px; }
.blase.ich .klein { color: inherit; opacity: .8; }
.blase.coach { align-self: flex-start; background: var(--karte); border: 1px solid var(--linie); border-bottom-left-radius: 5px; }
.blase.offen { color: var(--grau); border-style: dashed; }
.blase .knopf.text { display: block; padding: 6px 0 0; text-align: left; }
.eingabe { flex: none; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px;
           border-top: 1px solid var(--linie); background: var(--bg); }
.eingabe .zeile-e { display: flex; gap: 8px; align-items: flex-end; }
.eingabe textarea.feld { flex: 1; min-height: 46px; max-height: 132px; resize: none; }
.eingabe .knopf { width: auto; flex: none; padding: 11px 17px; }
.eingabe .fehler:empty { display: none; }
.mitte { text-align: center; }
.ring { position: relative; width: 220px; height: 220px; margin: 6px auto 0; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .bahn { stroke: var(--linie); }
.ring .lauf { stroke: var(--akzent); stroke-linecap: round; stroke-dasharray: 553; }
.ring.belastung .lauf { stroke: var(--warn); }
.ring .mitte { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .mitte b { font-size: 52px; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .mitte span { color: var(--grau); font-size: 15px; margin-top: 4px; }
.punkte { display: flex; gap: 5px; justify-content: center; }
.punkte i { width: 28px; height: 6px; border-radius: 3px; background: var(--linie); }
.punkte i.an { background: var(--akzent); }
.wahl { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 11px 0; background: none; border: 0;
        border-top: 1px solid var(--linie); font-size: 15px; }
.wahl:first-of-type { border-top: 0; }
.wahl::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--linie2); }
.wahl[aria-pressed="true"]::before { border: 6px solid var(--akzent); }
.logo { width: 68px; height: 68px; border-radius: 20px; background: var(--akzent); margin: 0 auto 12px; color: var(--auf-akzent);
        font-size: 34px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.anmeldung { padding-top: 12vh; }
.anmeldung h1 { font-size: 24px; text-align: center; }
.fehler { color: var(--gefahr); font-size: 14.5px; }
.abz { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.abz.gruen { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.abz.gelb { background: var(--warn-hell); color: var(--warn); }
.abz.rot { background: var(--gefahr-hell); color: var(--gefahr); }
.abz.grau { background: var(--flaeche2); color: var(--grau); }
.anleitung { white-space: pre-line; font-size: 15px; margin-top: 4px; }

/* ---------- Portal am Rechner ---------- */
body.portal { background: var(--bg); }
.rahmen { display: grid; grid-template-columns: 210px 1fr; min-height: 100%; }
.seite { background: var(--flaeche2); border-right: 1px solid var(--linie); padding: 18px 10px; }
.seite strong { display: block; padding: 0 10px 14px; font-size: 17px; }
.seite button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none; font-size: 15px; }
.seite button[aria-current="page"] { background: var(--akzent-hell); color: var(--akzent-dunkel); font-weight: 650; }
.seite .fuss { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--linie); }
.haupt { padding: 20px 26px 40px; min-width: 0; font-size: 14.5px; }
.haupt h1 { font-size: 21px; }
.haupt h2 { font-size: 16px; margin: 0 0 8px; }
.titelzeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.schalter { display: inline-block; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--linie); background: var(--karte); font-size: 14px; }
.schalter.voll { background: var(--akzent); color: var(--auf-akzent); border-color: var(--akzent); font-weight: 600; }
.schalter.rot { color: var(--gefahr); border-color: var(--gefahr-linie); }
.woche { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.tag { border: 1px solid var(--linie); border-radius: 10px; padding: 8px; min-height: 170px; background: var(--karte); }
.tag.heute { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); }
.tag header { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.tag header span { font-weight: 400; color: var(--grau); }
.eh { display: block; width: 100%; text-align: left; border-radius: 8px; padding: 6px 7px; margin-bottom: 5px; font-size: 13px;
      background: var(--flaeche2); border: 1px solid var(--linie); border-left-width: 3px; }
.eh b { display: block; font-size: 13.5px; }
.eh[data-einheit="haupt"] { border-left-color: var(--akzent); }
.eh[data-einheit="leichter"] { border-left-color: var(--akzent-mittel); }
.eh[data-einheit="zusatz"] { border-left-color: var(--linie2); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--grau); font-weight: 600; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--linie); }
td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--linie); vertical-align: top; }
.spalten { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; align-items: start; }
.kasten { border: 1px solid var(--linie); border-radius: 12px; padding: 14px 16px; background: var(--karte); margin-top: 16px; }
.kasten dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 10px; margin: 0; }
.kasten dt { color: var(--grau); }
.kasten dd { margin: 0; }
.zeile-p { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--linie); }
.zeile-p:first-of-type { border-top: 0; }
.wert { width: 72px; text-align: center; padding: 5px 8px; border: 1px solid var(--linie); border-radius: 7px; background: var(--karte); font-weight: 600; }
.wert.breit { width: 100%; text-align: left; font-weight: 400; }
code, .schluessel { font: 13px/1.4 Consolas, "SF Mono", monospace; word-break: break-all; }
@media (max-width: 900px) {
  .rahmen { grid-template-columns: 1fr; }
  .seite { border-right: 0; border-bottom: 1px solid var(--linie); }
  .woche { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spalten { grid-template-columns: 1fr; }
}

/* Verweis in einer Liste (Video in der Anleitung) und Knopf in einem Hinweis */
.liste a { color: inherit; text-decoration: none; }
.hinweis .knopf { margin-top: 10px; }
.liste button.zeile { padding: 11px 0; font-size: 15px; color: var(--tinte); }
.liste button.zeile:disabled { color: var(--grau); cursor: default; }

/* Portal: Formulare, Auswahl, Anmeldung */
#portal { height: 100%; }
.portal-anmeldung { max-width: 420px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; }
.portal .haupt .feld { padding: 7px 10px; font-size: 14.5px; border-radius: 8px; }
.portal .haupt textarea.feld { min-height: 96px; }
.feld.schmal { width: auto; flex: 1; min-width: 0; }
.titelzeile .feld.schmal { flex: none; }
.haupt > .hinweis { margin-bottom: 14px; }
.kasten .hinweis { margin-top: 10px; }
.kasten p { margin-top: 10px; }
.spalten > div > .kasten:first-child { margin-top: 0; }
[data-detail] + .spalten { margin-top: 16px; }
.zeile-p.umbruch { flex-wrap: wrap; }
.zeile-p.umbruch label { flex-basis: 100%; }
.spalten.gleich { grid-template-columns: 1fr 1fr; }
.formular { display: grid; grid-template-columns: 190px 1fr; gap: 8px 12px; align-items: start; }
.formular label, .formular > span { padding-top: 7px; }
.formular label .klein { display: block; font-size: 12px; }
.stapel { display: flex; flex-direction: column; gap: 6px; }
.verweis { background: none; border: 0; padding: 0; color: var(--akzent-dunkel); font-weight: 600; text-align: left; text-decoration: none; font-size: inherit; }
tr.gewaehlt td { background: var(--akzent-hell); }
tr.gewaehlt td:first-child { box-shadow: inset 3px 0 0 var(--akzent); padding-left: 8px; }
button.schalter { cursor: pointer; }
.seite .fuss a, .seite .fuss button { display: block; padding: 7px 10px; font-size: 14px; color: var(--grau); font-weight: 400; }
.wert.zeit { width: 110px; }
.kreuz { background: none; border: 0; padding: 0 0 0 4px; color: var(--grau); font-size: 13px; }
.schluessel { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: var(--karte); color: var(--tinte); user-select: all; }
.woche + [data-detail] .kasten { margin-bottom: 0; }
@media (max-width: 900px) { .spalten.gleich { grid-template-columns: 1fr; } .formular { grid-template-columns: 1fr; } }
.haupt .spalten > div > p { margin-top: 12px; }
/* Portal, Seite „Fragen“ */
.frage-text { font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.antwort { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--akzent-hell); color: var(--akzent-dunkel);
           white-space: pre-wrap; overflow-wrap: anywhere; }
.antwort .klein { margin-top: 4px; color: inherit; opacity: .8; }
.haupt > p.klein { margin-top: 14px; }

/* Mehr: Karte „Erinnerungen“ (Mockup A19) */
[data-erinnerungen] p.klein { margin: 6px 0 0; }
[data-erinnerungen] p.klein:empty { display: none; }
[data-erinnerungen] > .knopf, [data-erinnerungen] > .zwei { margin-top: 10px; }
