/* Teams einteilen: Wartebank oben, Teamkarten darunter, Namen fliegen hinüber. */

.buehne-teams {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 6px 12px 10px;
}

/* ---------- Wartebank ---------- */
.wartebank-rahmen {
  width: min(100%, 820px);
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .5);
  -webkit-backdrop-filter: var(--glas-blur);
  backdrop-filter: var(--glas-blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .85), 0 10px 30px rgba(80, 60, 160, .12);
  overflow: visible;
}
.wartebank-rahmen[hidden] { display: none; }
.wartebank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.wartebank:empty { display: none; }
.wartebank-leer { display: grid; justify-items: center; gap: 10px; margin: 6px; text-align: center; font-weight: 550; color: var(--tusche-weich); text-wrap: balance; }
.wartebank-leer[hidden] { display: none; }

/* ---------- Namensschild ---------- */
.person {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35em;
  max-width: 100%;
  padding: .42em .95em;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(80, 60, 160, .14), inset 0 0 0 1px rgba(80, 60, 160, .08);
  font-weight: 620;
  line-height: 1.2;
  white-space: nowrap;
}
.person span { overflow: hidden; text-overflow: ellipsis; }
.team-liste .person {
  background: color-mix(in oklab, var(--team) 14%, #fff);
  color: color-mix(in oklab, var(--team) 55%, #1e1b3a);
  box-shadow: 0 3px 8px color-mix(in oklab, var(--team) 22%, transparent), inset 0 0 0 1px color-mix(in oklab, var(--team) 25%, transparent);
}
.team-liste .person.unterwegs {
  background: #fff;
  color: var(--tusche);
  box-shadow: 0 3px 10px rgba(80, 60, 160, .14), inset 0 0 0 1px rgba(80, 60, 160, .08);
}
.team-liste .person { transition: background .25s ease, color .25s ease; }
.team-liste .person.kapitaen {
  background: linear-gradient(135deg, var(--team), color-mix(in oklab, var(--team) 72%, #fff));
  color: #fff;
  animation: kapitaen-pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes kapitaen-pop { from { scale: .6; } }
.stern { display: inline-grid; place-items: center; }
.stern svg { width: 1.05em; height: 1.05em; }
.stern svg path { fill: #fde047; stroke: #f59e0b; stroke-width: 1.6; }

/* ---------- Teamkarten ---------- */
.teams-raster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 14px;
  width: min(100%, 820px);
}
/* zwei Teams am Handy nebeneinander, mehr dürfen umbrechen */
@media (max-width: 520px) {
  .teams-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .teams-raster[data-anzahl="3"] .team-karte:last-child:nth-child(odd),
  .teams-raster[data-anzahl="5"] .team-karte:last-child:nth-child(odd),
  .teams-raster[data-anzahl="7"] .team-karte:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.team-karte {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: var(--glas-blur);
  backdrop-filter: var(--glas-blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .85), 0 12px 30px color-mix(in oklab, var(--team) 22%, transparent);
  overflow: visible;
}
.team-karte header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: .7em 1em;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(135deg, var(--team), color-mix(in oklab, var(--team) 70%, #fff));
  color: #fff;
}
.team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--schrift-titel);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -.01em;
}
.team-zahl {
  min-width: 1.8em;
  padding: .1em .55em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .25);
  text-align: center;
  font-weight: 700;
  font-size: .9rem;
}
.team-zahl:empty { display: none; }
.team-liste {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-height: 72px;
  margin: 0;
  padding: 12px;
  list-style: none;
}
.team-liste:empty {
  margin: 12px;
  min-height: 48px;
  border: 2px dashed color-mix(in oklab, var(--team) 30%, transparent);
  border-radius: 14px;
}

/* ---------- Knöpfe, Hinweis ---------- */
.teams-knoepfe { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.einteil-knopf {
  min-width: min(80vw, 300px);
  min-height: 60px;
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -.01em;
}
#ergebnisTeilen { min-height: 52px; }
#ergebnisTeilen[hidden] { display: none; }
.teams-hinweis { max-width: 36em; margin: 0; text-align: center; font-weight: 550; color: var(--tusche-weich); }

/* ---------- Werkbank ---------- */
.namen-liste { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }
.namen-liste li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.namen-liste .platz-nr { font-weight: 550; text-align: center; color: var(--tusche-weich); }
.namen-liste .feld-text, .team-namen .feld-text { grid-area: auto; }
.teams-zahl-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-weight: 600; }
.teams-zahl-zeile output { font-size: 1.1rem; }
.team-namen { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.team-namen li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: center; }
.team-punkt { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); }

/* Rechner: die Bühne füllt die Höhe, alles etwas größer */
@media (min-width: 980px) {
  .buehne-teams { min-height: calc(100dvh - 140px); justify-content: center; gap: 22px; }
  .person { font-size: 1.08rem; }
  .team-name { font-size: 1.22rem; }
  .team-liste { min-height: 120px; padding: 16px; gap: 10px; }
  .team-liste:empty { min-height: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .team-liste .person.kapitaen { animation: none; }
}

/* ---------- Regeln + Stärke (A.15.0.0) ---------- */
.namen-liste li.mit-staerke { grid-template-columns: 30px minmax(0, 1fr) auto auto; }
.staerke { display: inline-flex; }
.staerke button { width: 20px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; }
.staerke button::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: auto;
  border-radius: 50%;
  background: rgba(139, 92, 246, .16);
  box-shadow: inset 0 0 0 1.5px rgba(139, 92, 246, .3);
}
.staerke button[aria-pressed="true"]::before { background: var(--verlauf); box-shadow: none; }
.staerke button:focus-visible { outline: 2px solid var(--akzent); outline-offset: -2px; border-radius: 6px; }
@media (pointer: coarse) { .staerke button { width: 24px; height: 40px; } .staerke button::before { width: 14px; height: 14px; } }
.regel-liste { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.regel-liste:empty { display: none; }
.regel-liste li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 14px; background: var(--flaeche); box-shadow: var(--schatten-klein); font-weight: 650; }
.regel-liste li.weg { opacity: .55; }
.regel-neu { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; margin-bottom: 6px; }
.regel-neu[hidden] { display: none; }
.regel-neu > span { font-weight: 750; color: var(--tusche-weich); }
.regel-neu select { min-height: 44px; min-width: 0; padding: 0 8px; border: 1px solid rgba(139, 92, 246, .22); border-radius: 12px; background: rgba(255, 255, 255, .75); font: inherit; font-weight: 600; color: var(--tusche); }
.regel-neu .knopf { grid-column: 1 / -1; justify-self: start; }
.team-karte header[data-kraft] { flex-wrap: wrap; }
.team-karte header[data-kraft]::after { content: attr(data-kraft); flex-basis: 100%; font-size: .78rem; font-weight: 600; opacity: .85; }

/* Handy (A.14.4.0): Stärke-Punkte unter dem Namen, damit sie groß genug zum Tippen sind. */
@media (max-width: 520px) {
  .namen-liste li.mit-staerke { grid-template-columns: 30px minmax(0, 1fr) auto; row-gap: 0; }
  .namen-liste li.mit-staerke .staerke { grid-column: 2; grid-row: 2; }
  .namen-liste li.mit-staerke > .ikon-knopf { grid-column: 3; grid-row: 1; }
}
@media (pointer: coarse) { .staerke button { width: 44px; height: 44px; } }
