@font-face { font-family: "Lato"; font-weight: 400; font-display: swap; src: url(../fonts/lato-400.woff2) format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 700; font-display: swap; src: url(../fonts/lato-700.woff2) format("woff2"); }

:root {
  --c: #b81616;          /* Farbe des gewählten Kellerstöckls (kopf) */
  --c-res: #ebadad;
  --c-soft: #fdf5f5;
  --bg: #f5fafd;
  --card: #fff;
  --ink: #0c1416;
  --muted: #686868;
  --line: #dfdfdf;
  --ok: #2f6b3a;
  --err: #9b1c1c;
  --err-bg: #fdeceb;
  --warn: #7a5a00;
  --warn-bg: #fff6df;
  font-family: "Lato", Arial, Helvetica, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
button, input, textarea { font: inherit; }

.pz { max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.pz-head { text-align: center; margin: 4px 0 14px; }
.pz-head h1 { margin: 0; font-size: 1.6rem; }
.pz-sub { margin: 2px 0 0; color: var(--muted); }
.pz-muted { color: var(--muted); font-size: .9rem; }

.pz-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.pz-card h2 { font-size: 1.1rem; margin: 0 0 12px; }
.pz-card h2 small { font-weight: 400; color: var(--muted); }

/* Häuser: große Kacheln in Kalenderfarbe */
.pz-houses { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pz-house { --hc: #888; --hres: #ddd; --hsoft: #fafafa; min-height: 72px; text-align: left; border: 2px solid var(--hres); border-top-width: 8px; border-radius: 12px; background: var(--hsoft); padding: 10px 12px; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; justify-content: center; }
.pz-house b { font-size: 1.1rem; }
.pz-house span { font-size: .85rem; color: var(--muted); }
.pz-house[aria-checked="true"] { background: var(--hc); border-color: var(--hc); color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .18); }
.pz-house[aria-checked="true"] span { color: rgba(255, 255, 255, .9); }
.pz-house:last-child:nth-child(odd), .pz-house:only-child { grid-column: 1 / -1; }
.pz-houses:has(.pz-house[hidden]) .pz-house:not([hidden]) { grid-column: 1 / -1; }

/* Aufnahme */
.pz-rec { display: flex; align-items: center; gap: 16px; }
.pz-mic { width: 84px; height: 84px; flex: none; border-radius: 50%; border: 0; background: var(--c); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); touch-action: manipulation; }
.pz-mic svg { width: 40px; height: 40px; fill: currentColor; }
.pz-mic.rec { background: #d11a1a; animation: pulse 1.2s infinite; }
.pz-mic.rec svg { display: none; }
.pz-mic.rec::after { content: ""; width: 26px; height: 26px; border-radius: 5px; background: #fff; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(209, 26, 26, .55); } 70% { box-shadow: 0 0 0 18px rgba(209, 26, 26, 0); } 100% { box-shadow: 0 0 0 0 rgba(209, 26, 26, 0); } }
.pz-rec-info { display: flex; flex-direction: column; gap: 2px; font-size: 1.05rem; }
.pz-clips { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.pz-clips li { min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--c-soft); border: 1px solid var(--c-res); border-radius: 10px; padding: 6px 8px; }
.pz-clips audio { flex: 1; min-width: 0; height: 40px; }

/* Fotos */
.pz-photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pz-file { position: relative; overflow: hidden; }
.pz-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pz-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 10px; }
.pz-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eee; }
.pz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pz-x { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .06); color: var(--ink); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.pz-thumb .pz-x { position: absolute; top: 4px; right: 4px; background: rgba(0, 0, 0, .55); color: #fff; width: 30px; height: 30px; }

textarea, .pz-input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 1rem; resize: vertical; color: var(--ink); background: #fff; }
textarea:focus, .pz-input:focus { outline: none; border-color: var(--c); }

/* Buttons */
.pz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 20px; border-radius: 12px; font-weight: 700; font-size: 1.05rem; border: 2px solid var(--c); cursor: pointer; text-decoration: none; }
.pz-btn svg { width: 22px; height: 22px; fill: currentColor; }
.pz-btn-primary { background: var(--c); color: #fff; width: 100%; }
.pz-btn-primary:disabled { background: #c9c9c9; border-color: #c9c9c9; cursor: not-allowed; }
.pz-btn-outline { background: #fff; color: var(--c); width: 100%; }
.pz-link { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 4px; }

.pz-send { position: sticky; bottom: 0; padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 22%); }
.pz-send p { text-align: center; margin: 0 0 6px; min-height: 1.2em; }

.pz-msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.pz-msg.err { background: var(--err-bg); color: var(--err); }
.pz-outbox { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: .95rem; }

.pz-done { text-align: center; padding: 28px 16px; }
.pz-check { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2.4rem; display: grid; place-items: center; }
.pz-done.queued .pz-check { background: var(--warn); }
.pz-done p { color: var(--muted); }
.pz-foot { text-align: center; margin-top: 18px; font-size: .75rem; }

/* Admin & Einzelansicht */
.pz-wide { max-width: 980px; }
.pz-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.pz-filter label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 700; }
.pz-filter select, .pz-filter input { min-height: 42px; border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; }
.pz-entry { border-left: 6px solid var(--hc, var(--c)); }
.pz-entry-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.pz-entry-head h3 { margin: 0; font-size: 1.1rem; color: var(--hc, var(--ink)); }
.pz-entry p { margin: 8px 0; white-space: pre-wrap; }
.pz-entry audio { width: 100%; margin-top: 6px; }
.pz-tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: #eee; color: var(--muted); margin-left: 6px; }
.pz-tag.err { background: var(--err-bg); color: var(--err); }
.pz-tag.ok { background: #e6f2e6; color: var(--ok); }
.pz-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.pz-gallery a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #eee; }
.pz-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pz-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: .9rem; }
.pz-qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pz-qr canvas, .pz-qr img { width: 180px; height: 180px; image-rendering: pixelated; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.pz-transcript { background: #f7f7f7; border-radius: 8px; padding: 8px 10px; }

@media print {
  .pz-filter, .pz-actions, .pz-foot, #printBtn { display: none !important; }
  .pz-card { break-inside: avoid; }
}

/* Assistent: Zugänge & QR-Codes */
.pz-stepnr { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .8rem; margin-right: 6px; }
#wizard h3 { margin: 18px 0 4px; }
.pz-zlist { display: grid; gap: 10px; margin-top: 8px; }
.pz-zcard { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.pz-zqr img { display: block; width: 130px; height: 130px; image-rendering: pixelated; background: #fff; }
.pz-hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 8px; }
.pz-hcard { border: 2px solid var(--hc); border-top-width: 8px; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.pz-hcard-head { font-weight: 700; color: var(--hc); }
.pz-hcard-head small { display: block; font-weight: 400; color: var(--muted); }
.pz-hcard .pz-btn { width: 100%; border-color: var(--hc); color: var(--hc); }
.pz-hcard .pz-actions { justify-content: center; }
.pz-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Druckbogen */
.pz-print-sheet { display: none; }
@media print {
  body.printing-sheet main { display: none !important; }
  body.printing-sheet .pz-print-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; padding: 5mm; }
  .pz-print-card { border: 2mm solid var(--hc); border-top-width: 8mm; border-radius: 6mm; padding: 6mm; text-align: center; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-family: Lato, Arial, sans-serif; }
  .pz-print-title { font-size: 18pt; font-weight: 700; color: var(--hc); margin-bottom: 4mm; }
  .pz-print-qr img { width: 55mm; height: 55mm; image-rendering: pixelated; }
  .pz-print-sub { font-size: 11pt; font-weight: 700; margin-top: 3mm; }
  .pz-print-hint { font-size: 9pt; color: #555; margin-top: 2mm; }
}

/* PIN-Anmeldung */
.pz-login { max-width: 360px; margin: 30px auto; text-align: center; }
.pz-login label { display: block; font-weight: 700; margin-bottom: 6px; }
.pz-pin { text-align: center; font-size: 1.6rem; letter-spacing: .4em; }
.pz-msg-inline { color: var(--err); min-height: 1.2em; margin: 10px 0 0; }
