:root {
  --bg: #0A0E1F;
  --bg-2: #111634;
  --line: #26305C;
  --fg: #FFFFFF;
  --muted: #9AA3C7;
  --accent: #F2C846;
  --blue: #1A2376;
  --danger: #FF6B6B;
  --ok: #6FD38A;
  --header-h: 56px;
  --nav-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

button, a { -webkit-touch-callout: none; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- Installationsbildschirm ---------- */

.install {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 32px) 20px calc(env(safe-area-inset-bottom) + 32px);
}

.install-box {
  max-width: 460px;
  margin: 0 auto;
}

.install-logo {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  display: block;
  margin-bottom: 20px;
}

.install h1 {
  font-size: 26px;
  letter-spacing: 0.12em;
  margin: 0 0 10px;
}

.install-steps ol {
  list-style: none;
  margin: 20px 0;
  padding: 0;
}

.install-steps li {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.step-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* ---------- App-Gehaeuse ---------- */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-header {
  flex: 0 0 auto;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--blue);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.wordmark { font-weight: 700; letter-spacing: 0.18em; font-size: 17px; }
.subtitle { color: var(--accent); font-size: 10px; letter-spacing: 0.18em; }

.app-nav {
  flex: 0 0 auto;
  display: flex;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.nav-btn {
  flex: 1 1 0;
  min-height: 48px;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.nav-btn.is-active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.app-main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--bg);
}

.view { display: none; padding: 20px 16px calc(env(safe-area-inset-bottom) + 24px); }
.view.is-active { display: block; }

.app-footer {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

/* ---------- Inhalt ---------- */

h2 {
  font-size: 18px;
  letter-spacing: 0.14em;
  margin: 0 0 10px;
}

h3 {
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 24px 0 8px;
}

.lead { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 13px; }

.facts { margin: 0 0 18px; }
.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-size: 14px; text-align: right; word-break: break-word; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }

.btn {
  min-height: 48px;
  padding: 0 20px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  font-size: 14px;
  letter-spacing: 0.1em;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: #141414; font-weight: 600; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: 0.4; }

.status { color: var(--ok); font-size: 13px; min-height: 18px; white-space: pre-wrap; }
.error { color: var(--danger); font-size: 13px; white-space: pre-wrap; }

.msg {
  font-size: 13px;
  white-space: pre-wrap;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-2);
  margin: 0 0 8px;
}
.msg-ok { border-color: var(--ok); color: var(--ok); }
.msg-bad { border-color: var(--danger); color: var(--danger); }

/* ---------- Startseite ---------- */

.btn-scan {
  display: block;
  width: 100%;
  min-height: 140px;
  margin: 0 0 22px;
  padding: 20px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #141414;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.2em;
  box-shadow: 0 6px 0 #B89524;
}
.btn-scan:active { transform: translateY(3px); box-shadow: 0 3px 0 #B89524; }
.btn-scan:disabled { opacity: 0.45; box-shadow: none; }

/* ---------- Listen ---------- */

.list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }

.empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.row.is-active { border-color: var(--accent); }

.row input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.row-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-text b { font-size: 14px; letter-spacing: 0.04em; }
.row-text small { color: var(--muted); font-size: 12px; word-break: break-all; }

.row-actions { flex: 0 0 auto; display: flex; gap: 6px; }

.row-btn {
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.row-btn.is-danger { border-color: var(--danger); color: var(--danger); }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.1em;
}

/* ---------- Formular ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
}
.field > span { color: var(--muted); font-size: 13px; }

.field input {
  min-height: 48px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field input:disabled { opacity: 0.5; }
