/* app.css — Aufbau. Farben und Schrift kommen aus thema-app.css (App) und
   thema-folien.css (Bühne); hier stehen keine festen Farbwerte. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 var(--app-schrift);
  color: var(--app-text);
  background: var(--app-grund);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* ── Übersicht ─────────────────────────────────────────────────────────────── */
#haupt {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) max(20px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left));
}
.kopf { display: flex; align-items: baseline; gap: 16px; margin-bottom: 8px; }
.kopf h1 { font-size: 26px; margin: 0; letter-spacing: -0.01em; }
.kopf.fest {
  position: sticky; top: 0; z-index: 2;
  margin: 0 -20px 16px; padding: 12px 20px;
  background: var(--app-grund); border-bottom: 1px solid var(--app-linie);
}
.kopf.fest h1 { font-size: 18px; }
.zurueck { color: var(--app-akzent); text-decoration: none; font-weight: 600; }
section { margin-top: 28px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h2 small, .zeile small, footer small { font-weight: 400; color: var(--app-text-leise); font-size: 14px; }
h3 { font-size: 14px; margin: 18px 0 6px; color: var(--app-text-leise); text-transform: uppercase; letter-spacing: 0.05em; }

.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.karte {
  display: grid; gap: 2px; padding: 10px 10px 12px;
  background: var(--app-flaeche); border: 1px solid var(--app-linie); border-radius: var(--app-radius);
  box-shadow: var(--app-schatten); color: inherit; text-decoration: none;
}
.karte img { width: 100%; aspect-ratio: 1.414; object-fit: cover; border-radius: calc(var(--app-radius) - 6px); border: 1px solid var(--app-linie); margin-bottom: 8px; background: #fff; }
.karte small { color: var(--app-text-leise); }

.marken { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.zeile .marken { margin-top: 0; }
.marke {
  display: inline-block; padding: 7px 13px; border-radius: 999px;
  background: var(--app-flaeche); border: 1px solid var(--app-linie);
  color: var(--app-text); text-decoration: none; font-size: 15px; cursor: pointer;
}
.marke.leise { background: none; color: var(--app-text-leise); }
.marke:disabled { opacity: 0.6; }
.zeile { display: grid; grid-template-columns: 62px 104px 1fr; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--app-linie); }
footer { margin-top: 36px; display: flex; gap: 14px; align-items: center; }
.hinweis { color: var(--app-text-leise); }

.blatt { display: grid; gap: 14px; justify-items: center; }
.blatt img { width: min(100%, 900px); height: auto; background: #fff; border: 1px solid var(--app-linie); border-radius: 6px; }
.rahmen { width: 100%; height: calc(100dvh - 90px); border: 1px solid var(--app-linie); border-radius: var(--app-radius); background: #fff; }

.anmeldung { max-width: 340px; margin: 18vh auto 0; display: grid; gap: 12px; }
.anmeldung input, .anmeldung button { font: inherit; padding: 12px 14px; border-radius: var(--app-radius); border: 1px solid var(--app-linie); }
.anmeldung input { background: var(--app-flaeche); color: var(--app-text); }
.anmeldung button { background: var(--app-akzent); color: var(--app-akzent-text); border-color: transparent; font-weight: 600; }

/* ── Bühne ─────────────────────────────────────────────────────────────────── */
.raum {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; overflow: hidden;
  background: var(--folie-umfeld);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.buehne {
  position: relative;
  aspect-ratio: 4 / 3;
  width: min(100vw, 100vh * 4 / 3);
  width: min(100dvw, 100dvh * 4 / 3);
  background: var(--folie-buehne);
}
.buehne.leer {
  background-image: linear-gradient(var(--folie-karo) 1px, transparent 1px), linear-gradient(90deg, var(--folie-karo) 1px, transparent 1px);
  background-size: calc(100% / 32) calc(100% / 24);
}
.buehne .folie { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.buehne canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.buehne .basis { pointer-events: none; }
.buehne .live { touch-action: none; cursor: crosshair; }
.buehne .live[data-werkzeug="radierer"] { cursor: cell; }

.leiste {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px;
  background: var(--leiste-grund); color: var(--leiste-text);
  border-radius: 15px; box-shadow: 0 4px 18px rgb(0 0 0 / 0.3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.leiste.rechts { left: auto; right: 6px; }
.leiste > button {
  width: 40px; height: 40px; padding: 8px; border: 0; border-radius: 10px;
  background: none; color: inherit; display: grid; place-items: center; cursor: pointer;
}
.leiste > button svg { width: 24px; height: 24px; }
.leiste > button.aktiv { background: var(--leiste-aktiv); }
.leiste > button:disabled { color: var(--leiste-aus); }
.leiste > button.zahl { font-size: 12px; font-variant-numeric: tabular-nums; padding: 0; height: 30px; }
.leiste hr { width: 24px; border: 0; border-top: 1px solid var(--leiste-aus); margin: 3px 0; }
.tupfer { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--leiste-text); }
.stand { width: 8px; height: 8px; border-radius: 50%; margin: 4px 0 2px; background: var(--leiste-aus); }
.stand.gut { background: var(--app-gut); }
.stand.lokal { background: #e0a100; }
.stand.warn { background: var(--app-warn); }

.klappe {
  position: absolute; left: calc(100% + 8px); top: 0;
  background: var(--leiste-grund); color: var(--leiste-text);
  border-radius: 14px; padding: 8px; box-shadow: 0 4px 18px rgb(0 0 0 / 0.3);
  display: grid; gap: 6px; width: max-content;
}
.leiste.rechts .klappe { left: auto; right: calc(100% + 8px); }
.klappe .reihe { display: flex; gap: 6px; }
.klappe .reihe button {
  width: 44px; height: 44px; border-radius: 10px; border: 2px solid transparent; background: rgb(255 255 255 / 0.9);
  display: grid; place-items: center; padding: 0; cursor: pointer;
}
.klappe .reihe button.aktiv { border-color: var(--leiste-aktiv); box-shadow: 0 0 0 2px var(--leiste-aktiv); }
.klappe [data-farbe] i { width: 24px; height: 24px; border-radius: 50%; }
.klappe [data-stufe] i { width: 28px; height: calc(var(--b) * 0.6px); min-height: 2px; max-height: 26px; border-radius: 99px; background: #222; }
.klappe.menue button { background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.klappe.menue button:active { background: var(--leiste-aktiv); }

.griff {
  position: absolute; left: 6px; bottom: 6px; width: 36px; height: 36px; padding: 6px;
  border: 0; border-radius: 50%; background: var(--leiste-grund); color: var(--leiste-text); opacity: 0.45;
}
.griff.rechts { left: auto; right: 6px; }

.uebersicht { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; background: var(--app-grund); color: var(--app-text); padding: 16px 20px 40px; }
.uebersicht header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 18px; }
.uebersicht header button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--app-linie); background: var(--app-flaeche); }
.gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.gitter button {
  position: relative; padding: 0; border: 2px solid var(--app-linie); border-radius: 10px; overflow: hidden;
  background: #fff; aspect-ratio: 4 / 3; cursor: pointer; display: grid; place-items: center;
}
.gitter button.aktiv { border-color: var(--app-akzent); }
.gitter img { width: 100%; height: 100%; object-fit: contain; }
.gitter .karo { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 11px, rgb(40 80 160 / 0.2) 11px 12px), repeating-linear-gradient(90deg, transparent 0 11px, rgb(40 80 160 / 0.2) 11px 12px); }
.gitter b { position: absolute; left: 6px; bottom: 5px; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: rgb(0 0 0 / 0.65); color: #fff; }
.gitter .beschrieben { position: absolute; right: 7px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--app-akzent); }
