:root {
  --grund: #f4f0ea;
  --karte: #ffffff;
  --text: #1c1b1a;
  --leise: #6f6a63;
  --linie: #ddd6cb;
  --dunkel: #1c1b1a;
  --hell: #ece4d6;
  --akzent: #8a5a2b;
  --warn: #9b2c1f;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--grund); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.45;
  padding: env(safe-area-inset-top) 0 calc(24px + env(safe-area-inset-bottom));
  -webkit-user-select: none; user-select: none;
}
.kopf {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--dunkel); color: var(--hell);
}
.kopf h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .04em; }
.kopf button { background: none; border: 1px solid #4a4744; color: var(--hell); border-radius: 10px;
  min-width: 44px; min-height: 36px; font-size: 15px; }
.kopf .zurueck { font-size: 26px; line-height: 1; border: none; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
.ansicht { display: flex; flex-direction: column; gap: 14px; }
[hidden] { display: none !important; }

button, .gross, .mittel { font: inherit; cursor: pointer; }
.gross {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 14px 18px; border: none; border-radius: var(--radius);
  background: var(--dunkel); color: var(--hell); font-size: 19px; font-weight: 600; text-decoration: none;
}
.gross.hell { background: var(--karte); color: var(--text); border: 1px solid var(--linie); }
.gross:disabled { opacity: .35; }
.gross .sym { font-size: 24px; width: 28px; text-align: center; }
.mittel {
  flex: 1; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 14px;
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--karte); color: var(--text);
  font-size: 16px; font-weight: 500;
}
.mittel.aktiv { border-color: var(--dunkel); box-shadow: inset 0 0 0 1px var(--dunkel); }
.leise { background: none; border: none; color: var(--leise); text-decoration: underline; min-height: 44px; }
.reihe { display: flex; gap: 10px; }
.hinweis { margin: 0; color: var(--leise); font-size: 14px; text-align: center; }
.schritt { margin: 4px 0 0; font-weight: 600; text-align: center; }
.warnung { margin: 0; padding: 12px 14px; border-radius: 12px; background: #f6e2dd; color: var(--warn); font-weight: 600; }
.karte { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--radius);
  background: var(--karte); border: 1px solid var(--linie); }
.datei { position: relative; }
.vorschau { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 12px; background: #e7e1d7; }
.vorschau.klein { max-height: 160px; }

input[type=text], textarea, select {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); -webkit-user-select: text; user-select: text;
}
textarea { resize: none; }

.reiter { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.reiter button { flex: none; min-height: 40px; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); font-size: 15px; }
.reiter button.aktiv { background: var(--dunkel); color: var(--hell); border-color: var(--dunkel); }
.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gross-kacheln { grid-template-columns: repeat(2, 1fr); }
.kachel { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 12px; border: 2px solid transparent;
  background: var(--karte); font-size: 13px; text-align: center; color: var(--text); }
.kachel img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 8px; }
.kachel.aktiv { border-color: var(--dunkel); }
.kachel .unter { color: var(--leise); font-size: 12px; }

.bildrahmen { position: relative; border-radius: 12px; overflow: hidden; background: #e7e1d7; touch-action: manipulation; }
.bildrahmen img { display: block; width: 100%; height: auto; -webkit-touch-callout: none; pointer-events: none; }
#markierung { position: absolute; border: 2px solid #fff; outline: 2px solid var(--dunkel); border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.28); pointer-events: none; }
#vergleich img { pointer-events: auto; }
.regler { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--leise); }
.regler input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px 6px 8px;
  border-radius: 20px; border: 1px solid var(--linie); background: var(--karte); font-size: 15px; }
.chips i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }

.teil { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; padding: 10px;
  border-radius: var(--radius); background: var(--karte); border: 1px solid var(--linie); }
.teil img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 10px; }
.teil .name { font-weight: 600; }
.teil .werkzeuge { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.teil .werkzeuge button { min-height: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--linie);
  background: var(--grund); font-size: 14px; }
.gruppe { margin: 10px 0 2px; font-size: 14px; color: var(--leise); font-weight: 600; letter-spacing: .03em; }

.kreisel { width: 56px; height: 56px; margin: 40px auto 12px; border-radius: 50%;
  border: 5px solid var(--linie); border-top-color: var(--dunkel); animation: drehen 1s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
#meldung { position: fixed; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 9;
  padding: 14px 16px; border-radius: 12px; background: var(--dunkel); color: var(--hell); text-align: center; }

/* Zugangsseite und Verwaltung */
.zugang { min-height: 80vh; justify-content: center; text-align: center; }
.zugang-icon { width: 88px; height: 88px; margin: 0 auto 8px; border-radius: 20px; }
.code { margin: 8px 0; font-size: 44px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.sprache-unten { margin-top: 24px; background: none; border: none; color: var(--leise); min-height: 44px; }
.kopf-link { color: var(--hell); text-decoration: none; border: 1px solid #4a4744; border-radius: 10px; padding: 6px 12px; }
.admin-geraet { grid-template-columns: 1fr; }
.hinweis.links { text-align: left; }
.protokoll { font-size: 13px; color: var(--leise); gap: 4px; }
#z-anmelden, #z-wartet, #z-registrieren { display: flex; flex-direction: column; gap: 14px; }
