:root {
  --blau: #1f2a44;
  --gold: #d9a441;
  --grau: #f2f3f6;
  --text: #1b1d22;
  color-scheme: light dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
}
[hidden] { display: none !important; }
.mitte {
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  gap: 14px; padding: 32px 24px; max-width: 480px; margin: 0 auto; text-align: center;
}
h1 { margin: 0 0 8px; color: var(--blau); }
button { font: inherit; border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer; }
button.haupt { background: var(--blau); color: #fff; font-weight: 600; }
button.haupt:disabled { opacity: .5; }
button.leise { background: none; color: var(--blau); padding: 6px 8px; font-size: 15px; }
input, textarea {
  font: inherit; border: 1px solid #c9ccd4; border-radius: 12px; padding: 12px; width: 100%;
  background: transparent; color: inherit;
}
#code { text-align: center; letter-spacing: 3px; text-transform: uppercase; }
.fehler { color: #b3261e; min-height: 1.2em; }

main { height: 100%; display: flex; flex-direction: column; }
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px 16px;
  background: var(--blau); color: #fff;
}
header strong { font-size: 20px; }
header button.leise { color: #fff; }
#verlauf { flex: 1; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
details { background: var(--grau); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
summary { font-weight: 600; color: var(--blau); }
pre { white-space: pre-wrap; font: 14px/1.4 inherit; margin: 8px 0 0; }

.karte {
  border: 2px solid var(--gold); border-radius: 14px; padding: 12px; margin-bottom: 12px; background: #fffaf0;
}
.karte .titel { font-weight: 600; margin-bottom: 6px; }
.karte .inhalt { white-space: pre-wrap; font-size: 15px; }
.karte .grund { font-size: 14px; color: #555; margin-top: 6px; }
.karte .knoepfe { display: flex; gap: 10px; margin-top: 10px; }
.karte .knoepfe button { flex: 1; }
.karte .ja { background: #1e7d32; color: #fff; font-weight: 600; }
.karte .nein { background: #e3e5ea; color: var(--text); }

.nachricht { max-width: 85%; padding: 10px 12px; border-radius: 16px; margin: 6px 0; white-space: pre-wrap; word-wrap: break-word; }
.nachricht.ich { margin-left: auto; background: var(--blau); color: #fff; border-bottom-right-radius: 4px; }
.nachricht.james { background: var(--grau); border-bottom-left-radius: 4px; }
.nachricht.info { margin: 4px auto; font-size: 13px; color: #777; background: none; text-align: center; }

form#eingabe {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px);
  border-top: 1px solid #dde0e6; background: inherit;
}
#text { resize: none; max-height: 40vh; }

@media (prefers-color-scheme: dark) {
  body { background: #111318; --text: #e8e9ec; --grau: #1f232b; }
  .karte { background: #2a2416; }
  .karte .grund { color: #aaa; }
  .karte .nein { background: #333843; color: #e8e9ec; }
  button.leise { color: #9fb3e0; }
  form#eingabe { border-color: #2a2e37; }
}
