/* Mieter-WebApp: dunkel (Video), große Schrift und Knöpfe, hoher Kontrast */
:root {
  --bg: #111317;
  --card: #1b1e24;
  --line: #3a3f48;
  --text: #f3f4f6;
  --muted: #b8bec8;
  --accent: #4ea1ff;
  --on-accent: #06121f;
  --live: #3ccf6e;
  --error: #ff8a80;
  --ok: #7be39a;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
main {
  min-height: 100%;
}
.loading {
  padding: 40px 24px;
  color: var(--muted);
}

/* ---------- Karten (Anmelden, Einladung, Konto) ---------- */
.card {
  max-width: 520px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 22px max(36px, env(safe-area-inset-bottom));
}
.card.center {
  text-align: center;
}
h1 {
  margin: 8px 0 6px;
  font-size: 1.7rem;
  line-height: 1.2;
}
h2 {
  margin: 34px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 1.2rem;
}
.lead {
  margin: 0 0 16px;
  font-size: 1.15rem;
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
  color: var(--muted);
}
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}
input {
  height: 58px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #0c0e11;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
input:focus {
  outline: none;
  border-color: var(--accent);
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  font-weight: 400;
}
label.check input {
  width: 28px;
  height: 28px;
  accent-color: var(--accent);
}
.form .small {
  margin: -6px 0 0;
}
.error {
  min-height: 1.4em;
  margin: 0;
  color: var(--error);
  font-weight: 600;
}
.error.ok {
  color: var(--ok);
}

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 22px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.6;
}
.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.card .btn {
  width: 100%;
  margin-top: 10px;
}
.btn.ghost {
  min-height: 50px;
  padding: 0 16px;
  border-color: transparent;
  background: transparent;
}
.btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.card .btn.back {
  width: auto;
  margin: 0 0 8px -12px;
  padding: 0 12px;
}

/* ---------- Livebild ---------- */
.live {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 4px 8px 4px 18px;
}
.title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
}
.state {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}
.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
}
.dot.on {
  background: var(--live);
  box-shadow: 0 0 0 4px rgb(60 207 110 / 0.25);
}
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.media {
  position: absolute;
  top: 0;
  left: 0;
  width: 1536px;
  height: 432px;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}
.msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  font-size: 1.1rem;
  background: rgb(0 0 0 / 0.55);
}
.msg[hidden] {
  display: none;
}
.msg p {
  margin: 0;
}
.btn.float {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 50px;
  background: rgb(17 19 23 / 0.85);
}
.btn.float[hidden] {
  display: none;
}
.under {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}
.overview {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
  touch-action: none;
  cursor: pointer;
}
.overview canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1536 / 432;
  opacity: 0.75;
}
.window {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.35);
}
.btn.wide {
  width: 100%;
}
.hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* Hochformat: Fläche begrenzen, damit Übersicht und Knopf darunter Platz haben */
@media (orientation: portrait) {
  .stage {
    flex: none;
    height: min(100vw, calc(100dvh - 64px - 250px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    min-height: 220px;
  }
  .under {
    flex: 1;
  }
}
/* Querformat: ganzes Bild in voller Breite, keine Bedienleiste darunter */
@media (orientation: landscape) {
  .under {
    display: none;
  }
  .bar {
    min-height: 52px;
  }
}
