/* Foto-Voting – Gestaltung. Farben kannst du oben bei :root anpassen. */
:root {
  --hg: #f5f1ea;
  --karte: #ffffff;
  --text: #1d1b18;
  --grau: #6a645b;
  --linie: #e1d9cc;
  --gruen: #1d8539;
  --gruen-d: #14672b;
  --gruen-h: #e2f2e5;
  --rot: #c3302a;
  --rot-d: #99211c;
  --rot-h: #fbe4e2;
  --blau: #1f5b92;
  --gold: #c9951c;
  --buehne: #151515;
  --r: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 20px;
  line-height: 1.4;
  color: var(--text);
  background: var(--hg);
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--blau); }
[hidden] { display: none !important; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 24px; margin: 0 0 14px; }

/* ---------- Einfache Seiten (Passwort, Name, Fertig) ---------- */
.mitte {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px calc(40px + env(safe-area-inset-bottom));
  text-align: center;
}
.logo { font-size: 56px; margin-bottom: 4px; }
.unter { color: var(--grau); margin: 0 0 24px; }
.login { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 24px; }
.login input[type=password], .login input[type=text] {
  font-size: 26px;
  padding: 16px 18px;
  border: 3px solid #bfb5a5;
  border-radius: var(--r);
  background: #fff;
  width: 100%;
}
.login input:focus { outline: none; border-color: var(--blau); }
.zeigen { font-size: 18px; color: var(--grau); display: flex; gap: 10px; align-items: center; }
.zeigen input { width: 24px; height: 24px; }
.fehler { background: var(--rot-h); color: var(--rot-d); padding: 12px 16px; border-radius: 12px; margin: 0; font-weight: 600; }
.gross-btn {
  display: block;
  width: 100%;
  min-height: 72px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--r);
  background: var(--blau);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .2);
}
.gross-btn.hell { background: #fff; color: var(--text); border: 3px solid var(--linie); box-shadow: none; }
.gross-btn + .gross-btn { margin-top: 14px; }

.namen { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 32px; }
.name-btn {
  min-height: 80px;
  border: 3px solid var(--linie);
  border-radius: var(--r);
  background: #fff;
  font-size: 26px;
  font-weight: 700;
  padding: 10px;
  box-shadow: 0 3px 0 var(--linie);
  word-break: break-word;
}
.name-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--linie); }
.name-btn.zuletzt { border-color: var(--blau); }
@media (min-width: 700px) { .namen { grid-template-columns: 1fr 1fr 1fr; } .mitte { max-width: 760px; } }

.fertig-zahlen { font-size: 22px; margin: 6px 0 28px; }

/* ---------- Abstimmung ---------- */
body.im-viewer { overflow: hidden; overscroll-behavior: none; }
.vote {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "kopf" "buehne" "steuerung";
  background: var(--karte);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.vote-kopf {
  grid-area: kopf;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--linie);
}
.wer-btn {
  flex: 0 1 auto;
  max-width: 36vw;
  border: 2px solid var(--linie);
  background: var(--hg);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fortschritt { flex: 1; min-width: 0; text-align: center; }
.fortschritt-text { font-size: 19px; white-space: nowrap; }
.fortschritt-text b { font-size: 23px; }
.balken { height: 10px; background: #e9e3d8; border-radius: 99px; overflow: hidden; margin-top: 3px; }
.balken > div { height: 100%; width: 0; background: var(--gruen); border-radius: 99px; transition: width .3s; }
.nur-breit { display: none; }
@media (min-width: 430px) { .nur-breit { display: inline; } }
.kopf-link {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--linie);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--blau);
}

.buehne {
  grid-area: buehne;
  position: relative;
  overflow: hidden;
  background: var(--buehne);
  touch-action: none;
  cursor: zoom-in;
}
.buehne.gezoomt { cursor: grab; }
.buehne.gezoomt:active { cursor: grabbing; }
.buehne img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transition: opacity .15s;
}
.buehne img.unsichtbar { opacity: 0; }
.laden {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ddd;
  font-size: 20px;
  pointer-events: none;
}
.buehne-markierung {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  pointer-events: none;
}
.buehne-markierung.ja { background: var(--gruen); }
.buehne-markierung.nein { background: var(--rot); }

.steuerung {
  grid-area: steuerung;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--linie);
}
.steuerung > * { width: 100%; max-width: 760px; margin: 0 auto; }
.nav-zeile { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-btn {
  min-height: 50px;
  padding: 0 16px;
  border-radius: 12px;
  border: 2px solid #cdc3b4;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}
.nav-btn:disabled { opacity: .3; cursor: default; }
.status { flex: 1; min-width: 0; text-align: center; font-size: 16px; color: var(--grau); line-height: 1.2; }
.zoom-btn { background: #fff3c4; border-color: #e0c56b; }

.vote-zeile { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vote-btn {
  min-height: clamp(78px, 12vh, 112px);
  border: none;
  border-radius: var(--r);
  color: #fff;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .22);
  transition: transform .08s, opacity .2s, box-shadow .2s;
}
.vote-btn .ico { font-size: 38px; line-height: 1.05; }
.vote-btn .lbl { font-size: 19px; line-height: 1.15; }
.vote-btn .taste { display: none; font-size: 13px; font-weight: 600; opacity: .85; }
.vote-btn.ja { background: var(--gruen); }
.vote-btn.nein { background: var(--rot); }
.vote-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .22); }
.vote-btn.gewaehlt { box-shadow: 0 0 0 5px #fff, 0 0 0 9px currentColor; }
.vote-btn.ja.gewaehlt { color: #fff; box-shadow: inset 0 0 0 5px #fff, 0 0 0 4px var(--gruen-d); background: var(--gruen-d); }
.vote-btn.nein.gewaehlt { color: #fff; box-shadow: inset 0 0 0 5px #fff, 0 0 0 4px var(--rot-d); background: var(--rot-d); }
.vote-btn.blass { opacity: .38; }
@media (hover: hover) and (pointer: fine) {
  .vote-btn .taste, .nav-btn .taste { display: inline; }
  .vote-btn:hover { filter: brightness(1.08); }
}
.nav-btn .taste { display: none; font-size: 13px; color: var(--grau); font-weight: 600; }

.meldung {
  position: fixed;
  left: 50%;
  top: max(70px, calc(env(safe-area-inset-top) + 60px));
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100% - 32px);
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
  text-align: center;
}
.meldung.fehler-meldung { background: var(--rot-d); }

/* Handy quer: Knöpfe rechts neben das Foto */
@media (orientation: landscape) and (max-height: 560px) {
  .vote {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 28vw);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "kopf kopf" "buehne steuerung";
  }
  .vote-kopf { padding-top: 6px; padding-bottom: 6px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .fortschritt { display: flex; align-items: center; gap: 12px; }
  .fortschritt-text { font-size: 17px; }
  .fortschritt-text b { font-size: 19px; }
  .balken { flex: 1; margin: 0; }
  .steuerung {
    border-top: none;
    border-left: 1px solid var(--linie);
    padding: 8px;
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .vote-zeile { order: 1; flex: 1; grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .vote-zeile .ja { order: 1; }
  .vote-zeile .nein { order: 2; }
  .vote-btn { min-height: 0; }
  .nav-zeile { order: 2; }
  .nav-btn { flex: 1; padding: 0 8px; min-height: 44px; font-size: 16px; }
  .status { display: none; }
  .zoom-btn { position: absolute; top: 8px; right: 8px; z-index: 2; }
}

/* ---------- Ergebnis ---------- */
.erg-kopf {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--linie);
  backdrop-filter: blur(6px);
}
.erg-kopf h1 { font-size: 24px; margin: 0; flex: 1; }
.erg-kopf .stand { font-size: 15px; color: var(--grau); white-space: nowrap; }
.erg { max-width: 1120px; margin: 0 auto; padding: 16px 14px calc(40px + env(safe-area-inset-bottom)); }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 20px; padding: 18px 16px; margin-bottom: 18px; }
.karte h2 .klein { display: block; margin-top: 2px; font-size: 16px; font-weight: 500; color: var(--grau); }
.hinweis { background: #fff6d6; border: 1px solid #ecd486; color: #6c5410; padding: 10px 14px; border-radius: 12px; font-size: 17px; margin: 0 0 14px; }
.leer-text { color: var(--grau); font-size: 18px; }

.top-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 620px) { .top-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px) { .top-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kachel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--linie);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  text-align: left;
}
.kachel .bildbox { display: block; aspect-ratio: 1 / 1; background: var(--buehne); width: 100%; overflow: hidden; }
.kachel .unten { display: block; }
.kachel img { width: 100%; height: 100%; object-fit: contain; display: block; }
.kachel .unten { padding: 8px 10px 10px; font-size: 17px; }
.kachel .titel { font-weight: 700; }
.kachel .zahlen { font-size: 16px; color: var(--grau); }
.platz {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 42px;
  height: 42px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.platz.p1 { background: var(--gold); color: #fff; }
.platz.p2 { background: #9aa3ad; color: #fff; }
.platz.p3 { background: #b07642; color: #fff; }
.kopier-btn { margin-top: 14px; border: 2px solid var(--linie); background: #fff; border-radius: 12px; padding: 10px 16px; font-size: 17px; font-weight: 600; }

.personen { display: grid; gap: 10px; }
@media (min-width: 760px) { .personen { grid-template-columns: 1fr 1fr; column-gap: 28px; } }
.person-zeile {
  display: grid;
  grid-template-columns: minmax(70px, 120px) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  border: none;
  background: none;
  text-align: left;
  border-radius: 10px;
  font-size: 18px;
}
.person-zeile:hover { background: var(--hg); }
.person-zeile .n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-zeile .balken { height: 16px; margin: 0; }
.person-zeile .wert { font-size: 16px; color: var(--grau); white-space: nowrap; min-width: 92px; text-align: right; }
.person-zeile.fertig .balken > div { background: var(--gruen); }
.person-zeile:not(.fertig) .balken > div { background: var(--blau); }
.haken { color: var(--gruen-d); font-weight: 800; }

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filter .lbl { font-size: 16px; color: var(--grau); width: 100%; }
@media (min-width: 700px) { .filter .lbl { width: auto; min-width: 96px; } }
.chip {
  border: 2px solid var(--linie);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 17px;
  font-weight: 600;
}
.chip.aktiv { background: var(--text); border-color: var(--text); color: #fff; }
.liste-info { font-size: 17px; color: var(--grau); margin: 4px 0 12px; }

.rangliste { list-style: none; margin: 0; padding: 0; }
.zeile {
  display: grid;
  grid-template-columns: 44px 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 4px;
  border-top: 1px solid var(--linie);
}
.zeile.top { background: linear-gradient(90deg, #fff7df, transparent 70%); }
.zeile .rang { font-size: 22px; font-weight: 800; text-align: center; padding-top: 8px; }
.zeile .rang.leer { color: #b3aa9c; }
.zeile .vorschau { width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--buehne); border: none; padding: 0; }
.zeile .vorschau img { width: 100%; height: 100%; object-fit: cover; display: block; }
.zeile .kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.zeile .titel { font-weight: 700; font-size: 19px; }
.zeile .datei { font-size: 13px; color: var(--grau); word-break: break-all; }
.zeile .zahlen { font-size: 17px; margin: 2px 0 4px; }
.quote { height: 8px; background: var(--rot-h); border-radius: 99px; overflow: hidden; max-width: 260px; margin-bottom: 6px; }
.quote > div { height: 100%; background: var(--gruen); }
.bubbles { display: flex; flex-wrap: wrap; gap: 4px; }
.bubble { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 14px; font-weight: 600; line-height: 1.6; }
.bubble.ja { background: var(--gruen-h); color: var(--gruen-d); border: 1px solid #b3dbbd; }
.bubble.nein { background: var(--rot-h); color: var(--rot-d); border: 1px solid #efbcb8; }
.mehr-btn { margin-top: 12px; width: 100%; }

/* Großansicht auf der Ergebnisseite */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "kopf" "buehne" "fuss";
  background: var(--buehne);
  color: #fff;
  touch-action: none;
}
.lb-kopf, .lb-fuss {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #222;
}
.lb-kopf { grid-area: kopf; padding-top: max(8px, env(safe-area-inset-top)); }
.lb-fuss { grid-area: fuss; flex-wrap: wrap; padding-bottom: max(12px, env(safe-area-inset-bottom)); font-size: 17px; }
.lb-kopf .titel { flex: 1; font-weight: 700; font-size: 19px; min-width: 0; }
.lb-btn {
  min-height: 48px;
  min-width: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid #555;
  background: #333;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lb-btn:disabled { opacity: .3; }
.lb-fuss .bubbles { flex: 1 1 100%; }
.lb-fuss .lb-btn { font-size: 16px; }

/* ---------- Herunterladen ---------- */
.person-pill { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pakete { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .pakete { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.paket-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 72px;
  padding: 12px 16px;
  border: 3px solid var(--linie);
  border-radius: var(--r);
  background: #fff;
  text-align: left;
  box-shadow: 0 3px 0 var(--linie);
}
.paket-btn .t { font-size: 22px; font-weight: 800; }
.paket-btn .i { font-size: 16px; color: var(--grau); }
.paket-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--linie); }
.paket-btn:disabled { opacity: .45; cursor: default; }
.dl-link { font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }

.dialog-hg {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog {
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  font-size: 19px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.dialog p { margin: 0 0 12px; }
.dl-offen { margin: 0 0 16px; padding-left: 22px; font-size: 18px; }
.dialog .gross-btn { margin-top: 10px; }
