/* Fernbedienung - mobil zuerst, Reiter unten, grosse Tastflaechen. */

:root {
  --grund: #0e1220;
  --flaeche: #171d31;
  --flaeche2: #1f2740;
  --linie: #2b3350;
  --schrift: #eef1fa;
  --gedaempft: #98a2c0;
  --akzent: #3d7bff;
  --warn: #d9463a;
  --gut: #24a35a;
  --heim: #2f6fed;
  --gast: #e0402f;
  --reiter: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--grund);
  color: var(--schrift);
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  overscroll-behavior-y: contain;
}
body { padding-bottom: calc(var(--reiter) + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; touch-action: manipulation; }

/* --- Kopf --------------------------------------------------------------- */
#kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: rgba(14,18,32,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linie);
}
.marke { font-weight: 700; letter-spacing: .02em; }
.pille {
  font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--flaeche2); color: var(--gedaempft);
  border: 1px solid var(--linie);
  white-space: nowrap;
}
.pille.ok { color: #9ff0c0; border-color: #1f6b42; background: #11301f; }
.pille.weg { color: #ffc9c4; border-color: #6b2119; background: #2c1310; }

/* --- Seiten ------------------------------------------------------------- */
#inhalt { padding: 12px 12px 20px; max-width: 720px; margin: 0 auto; }
.seite { display: none; }
.seite.aktiv { display: block; }

h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--gedaempft); margin-bottom: 10px; }
h3 { font-size: 14px; color: var(--gedaempft); margin: 12px 0 8px; }

.block {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
details.block > summary { cursor: pointer; font-weight: 600; color: var(--gedaempft); }
details.block[open] > summary { margin-bottom: 12px; }

.hinweis { color: var(--gedaempft); line-height: 1.5; padding: 8px 2px; }
.klein { font-size: 13px; color: var(--gedaempft); line-height: 1.5; margin-top: 8px; }
code { background: var(--flaeche2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* --- Moduswahl ---------------------------------------------------------- */
.modiwahl {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 12px;
}
.modiwahl button {
  border: 0; border-radius: 8px;
  background: transparent; color: var(--gedaempft);
  padding: 10px 2px; font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.modiwahl button.aktiv { background: var(--akzent); color: #fff; }

/* --- Live-Tafel in der Fernbedienung ------------------------------------ */
.mod { display: none; }
.mod.aktiv { display: block; }

.tafel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  padding: 12px 10px;
  margin-bottom: 12px;
}
.t-seite { text-align: center; min-width: 0; }
.t-name {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-seite.heim .t-name { color: var(--heim); }
.t-seite.gast .t-name { color: var(--gast); }
.t-punkte { font-size: 52px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.t-saetze { font-size: 12px; color: var(--gedaempft); }
.t-mitte { text-align: center; min-width: 84px; }
.t-satz { font-size: 12px; color: var(--gedaempft); text-transform: uppercase; letter-spacing: .06em; }
.t-uhr { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.t-historie { font-size: 12px; color: var(--gedaempft); margin-top: 4px; line-height: 1.6; }

/* --- Knoepfe ------------------------------------------------------------ */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--flaeche2);
  color: var(--schrift);
  border: 1px solid var(--linie);
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s ease, filter .12s ease;
}
.knopf:active { transform: scale(.97); filter: brightness(1.25); }
.knopf.gross { width: 100%; padding: 16px; font-size: 17px; }
.knopf.breit { flex: 1; }
.knopf.klein { padding: 10px 12px; font-size: 14px; }
.knopf.akzent { background: var(--akzent); border-color: transparent; color: #fff; }
.knopf.warnung { background: transparent; border-color: #5a2820; color: #ff9d92; }
.knopf.plus { font-size: 26px; padding: 26px 10px; font-weight: 800; border: 0; color: #fff; }
.knopf.plus.heim { background: var(--heim); }
.knopf.plus.gast { background: var(--gast); }
.knopf.minus { font-size: 20px; padding: 14px 10px; }
.knopf[disabled] { opacity: .45; pointer-events: none; }
.knopf.blinkt { animation: blinken 1.1s ease-in-out infinite; }
@keyframes blinken { 50% { filter: brightness(1.6); } }

.zweispalt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.reihe { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.reihe > .knopf { flex: 1 1 auto; }

/* --- Formularfelder ----------------------------------------------------- */
label { display: block; font-size: 13px; color: var(--gedaempft); margin-bottom: 10px; }
label > input, label > select, label > textarea {
  display: block; width: 100%; margin-top: 6px;
  background: var(--grund);
  border: 1px solid var(--linie);
  border-radius: 10px;
  padding: 12px;
  color: var(--schrift);
}
label > input[type="color"] { padding: 4px; height: 46px; }
textarea { resize: vertical; }
.feldreihe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feldreihe label:only-child { grid-column: 1 / -1; }

.schalter { display: flex; align-items: center; gap: 10px; color: var(--schrift); font-size: 15px; margin: 10px 0; }
.schalter input { width: 22px; height: 22px; accent-color: var(--akzent); }

/* --- Logoliste ---------------------------------------------------------- */
.hochladen { display: block; margin-bottom: 4px; }
.logoliste { list-style: none; margin-top: 12px; }
.logoliste li {
  display: flex; align-items: center; gap: 10px;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.logoliste li.aus { opacity: .45; }
.logoliste img {
  width: 56px; height: 40px; object-fit: contain;
  background: #fff; border-radius: 6px; padding: 3px; flex: none;
}
.logoliste .lname { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logoliste button {
  background: transparent; border: 1px solid var(--linie); color: var(--gedaempft);
  border-radius: 8px; width: 38px; height: 38px; font-size: 16px; cursor: pointer; flex: none;
}
.logoliste button.loeschen { color: #ff9d92; border-color: #5a2820; }

/* --- Reiterleiste ------------------------------------------------------- */
#reiter {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14,18,32,.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
#reiter button {
  background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px;
  color: var(--gedaempft); font-size: 11px; font-weight: 600;
}
#reiter button.aktiv { color: var(--akzent); }
#reiter svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- Toast -------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--reiter) + 18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: var(--flaeche2); border: 1px solid var(--linie);
  color: var(--schrift); font-size: 14px; font-weight: 600;
  padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 40; max-width: 88vw; text-align: center;
}
#toast.an { opacity: 1; transform: translate(-50%, 0); }

/* --- Anmeldeseite ------------------------------------------------------- */
body.anmeldeseite { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
body.anmeldeseite #formular {
  width: 100%; max-width: 360px;
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 16px; padding: 24px;
}
body.anmeldeseite h1 { font-size: 22px; }
body.anmeldeseite .unter { color: var(--gedaempft); margin-bottom: 20px; font-size: 14px; }
.fehler { color: #ff9d92; font-size: 14px; margin-top: 12px; min-height: 20px; }

/* --- Grosse Schirme ----------------------------------------------------- */
@media (min-width: 700px) {
  .knopf.plus { padding: 34px 10px; font-size: 30px; }
  .t-punkte { font-size: 64px; }
}

/* Nachtraege ------------------------------------------------------------- */
[hidden] { display: none !important; }
.logoliste li { flex-wrap: wrap; }
.logoliste .lname { flex: 1 1 130px; }
.logoliste .lknoepfe { display: flex; gap: 6px; margin-left: auto; }
