/* QR-Code-Scanner — schlicht, mobil zuerst, hell/dunkel nach Systemeinstellung */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16191f;
  --muted: #5d6573;
  --line: #dfe3ea;
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --warn-bg: #fff4e5;
  --warn-ink: #8a4b00;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #181c22;
    --ink: #e8ebf0;
    --muted: #9aa3b2;
    --line: #2a3039;
    --accent: #3fbf8f;
    --accent-ink: #06231a;
    --warn-bg: #3a2a12;
    --warn-ink: #ffcf8a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
[hidden] { display: none !important; }

/* Mobile first, an der Mittelachse ausgerichtet; auf hohen Bildschirmen vertikal zentriert */
.wrap {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  text-align: center;
}
.head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; text-wrap: balance; }
.sub { margin: 4px 0 0; color: var(--muted); text-wrap: balance; }

.scanner, .result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.viewport {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.viewport video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame {
  position: absolute;
  inset: 16%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}

/* sichtbare Buttons einer Zeile teilen sich die Breite gleichmässig (1, 2 oder 3 Spalten) */
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--accent); min-height: 56px; }
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  /* Icon oben, Text klein darunter */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 10px 8px;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}
.ico {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.status { margin: 0; color: var(--muted); }
.status:empty { display: none; }
.kind { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.host { margin: 0; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); }
.text {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  font: 0.95rem/1.45 var(--mono);
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 40vh;
  overflow: auto;
}
.foot { color: var(--muted); font-size: 0.85rem; text-align: center; }
.foot p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
}
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .toast { transition: opacity 0.2s; }
}
