/* Dunkel, groß, ruhig. Das Ding wird mit einer Hand auf einem iPhone bedient
   und auf einem Laptop mit der Maus - beides ohne Nachdenken.
   Tap-Ziele nie unter 44 px, das ist Apples Untergrenze fuer treffsicher. */

:root {
  --grund: #11141a;
  --karte: #1a1f28;
  --rand: #2a3140;
  --schrift: #e8ecf3;
  --leise: #93a0b4;
  --akzent: #4f8cff;
  --warn: #f5c451;
  --gefahr: #ff6b6b;
  --gut: #4ade80;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--grund);
  color: var(--schrift);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Safari zoomt beim Fokus in ein Feld, wenn die Schrift kleiner als 16px ist. */
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.ansicht { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; }
.ansicht[hidden] { display: none; }

h1, h2 { margin: 0 0 16px; font-size: 22px; }

/* --- Formulare --- */

.karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mitte { margin-top: 12vh; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--leise); }

input, textarea, select {
  font: inherit;
  color: var(--schrift);
  background: #0e1218;
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: 12px;
  min-height: 44px;
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
textarea { resize: vertical; }

button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.haupt { background: var(--akzent); color: #fff; }
.zweit { background: #232b38; color: var(--schrift); border-color: var(--rand); }
.leise { background: transparent; color: var(--leise); border-color: var(--rand); }
.gefahr { background: transparent; color: var(--gefahr); border-color: #48242a; }
button:active { transform: translateY(1px); }

.reihe { display: flex; gap: 10px; }
.reihe > button { flex: 1; }

.fehler { color: var(--gefahr); margin: 0; font-size: 14px; }
.hinweis { color: var(--leise); font-size: 14px; margin: 0 0 4px; }
.leer { color: var(--leise); text-align: center; margin-top: 40px; }

/* --- Kopf und Liste --- */

.kopf { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.kopf input { flex: 1; }
.kopf button { white-space: nowrap; }

.liste { display: flex; flex-direction: column; gap: 10px; }

.eintrag {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eintrag h3 { margin: 0; font-size: 17px; }
.eintrag .zeile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eintrag .wert {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  color: var(--leise);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eintrag .knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.eintrag .knoepfe button { flex: 1 1 auto; min-width: 120px; }

/* --- Prüfmaske --- */

.pruef-zeile {
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pruef-kopf { display: flex; align-items: center; gap: 10px; }
.pruef-kopf input[type="checkbox"] { width: 22px; height: 22px; min-height: 22px; }
.pruef-warnung { color: var(--warn); font-size: 13px; margin: 0; }
.vorschau {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  background: #0e1218;
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 8px 10px;
  word-break: break-all;
}
.vorschau mark { background: var(--warn); color: #11141a; border-radius: 3px; padding: 0 1px; }

/* --- Fußleiste, Toast, Lader --- */

.fussleiste {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--grund) 70%, transparent);
  max-width: 760px;
  margin: 0 auto;
}
.fussleiste button { flex: 1; }
.fussleiste .zweit { flex: 0 0 90px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #0e1218;
  border: 1px solid var(--rand);
  color: var(--gut);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 20;
}
.toast[hidden] { display: none; }
.toast.schlecht { color: var(--gefahr); }

.lader {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 18, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 30;
}
.lader[hidden] { display: none; }
.lader span {
  width: 34px; height: 34px;
  border: 3px solid var(--rand);
  border-top-color: var(--akzent);
  border-radius: 50%;
  animation: dreh 0.8s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .lader span { animation: none; }
}
