:root{
  --bg:#0b0f17;
  --surface:#111827;
  --surface2:#0f1621;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#1f2937;
  --accent:#38bdf8;
  --success:#22c55e;
  --fail:#ef4444;

  /* Personen-Farben kommen aus PERSON_COLOR_PALETTE in app.js und
     werden pro Zeile als --pColor gesetzt. */
}

*{ box-sizing: border-box; }
html,body{
  margin:0; padding:0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.container{
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0 14px;
}

/* ---- Header ---- */
.header{ padding: 16px 14px 12px; }
h1{ font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }

.headerTop{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.headerTop h1{ flex: 1 1 auto; min-width: 0; }

.seasonSelect{
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  background-size: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 26px 6px 12px;
  min-height: 32px;
  cursor: pointer;
}
.seasonSelect:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.seasonSelect[hidden]{ display: none; }

.archiveBadge{
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}
.archiveBadge[hidden]{ display: none; }

.adminNote{
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.adminNote[hidden]{ display: none; }

.lbEmptyHint{ margin-top: 12px; text-align: center; }
h2{ font-size: 15px; font-weight: 600; margin: 0; }
.muted{ color: var(--muted); font-size: 12px; margin: 4px 0 0; }

.seasonBar{
  margin-top: 10px;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.seasonBar > div{
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  width: 0%;
  transition: width 0.6s ease;
}

.statStrip{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.statCell{
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 8px;
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Vergleichswert der Vorsaison unter der Erfolgsrate */
.statVor{
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.75;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statV{
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statV .avDelta{ margin-left: 3px; vertical-align: 2px; }
.statV.statAccent{ color: var(--accent); }
.statL{
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* ---- Tab Bar ---- */
.tabBar{
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 8px auto 6px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tab{
  flex: 1;
  padding: 9px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.tab:hover{ color: var(--text); }
.tab.active{
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}

.tabPanel{
  padding: 6px 0 24px;
  animation: fadeIn 0.2s ease-out;
}
.tabPanel[hidden]{ display: none; }

@keyframes fadeIn{
  from{ opacity: 0; transform: translateY(4px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ---- Legende (in Detail-Matrix) ---- */
.legendDetails{
  margin-bottom: 10px;
}
.legendDetails summary{
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  user-select: none;
  padding: 4px 2px;
}
.legend{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 2px 2px;
}
.legendSetter{
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legendSwatch{
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--accent);
  background: rgba(56, 189, 248, 0.15);
}

.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.2;
}
.badgeAccent{
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--text);
}

code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

/* ---- Rangliste Zeilen ---- */
.lbList{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.lbRow{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}

.lbRow.lbRowFirst{
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.04);
}

.lbRank{
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

/* Rangveränderung seit der vorletzten Challenge */
.lbDelta{
  font-size: 10px;
  font-weight: 700;
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  letter-spacing: -0.02em;
}
.lbDeltaUp{ color: var(--success); }
.lbDeltaDown{ color: var(--fail); }
.lbDeltaSame{ color: var(--line); }
.lbDeltaEmpty{ visibility: hidden; }

/* Formkurve: letzte Challenges, jüngste rechts */
.lbForm{
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.lbFormDot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--line);
}
.lbFormDot.dotSuccess{ background: var(--success); }
.lbFormDot.dotFail{ background: var(--fail); }
.lbFormDot.dotOpen{ background: var(--line); }
.lbFormDot.dotImpossible{ background: var(--muted); opacity: 0.4; }
/* nachgeholt: als Ring statt gefüllt */
.lbFormDot.dotMakeup{ box-shadow: inset 0 0 0 2px var(--surface2); }
/* jüngste Challenge hervorheben */
.lbFormDot.dotLatest{
  outline: 2px solid rgba(255,255,255,0.16);
  outline-offset: 1px;
}

.lbAvatar{
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--pColor, var(--accent));
  background: color-mix(in srgb, var(--pColor, var(--accent)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--pColor, var(--accent)) 30%, transparent);
}

.lbName{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lbBarWrap{
  flex: 2;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  min-width: 40px;
}
.lbBar{
  height: 100%;
  border-radius: 999px;
  background: var(--pColor, var(--accent));
  transition: width 0.4s ease;
}

.lbPts{
  font-size: 14px;
  font-weight: 700;
  color: var(--pColor, var(--accent));
  min-width: 36px;
  text-align: right;
}

.lbRate{
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  min-width: 44px;
  text-align: center;
}

.lbDefined{
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* ---- Auswertung: Grad-Profil + Saisonvergleich ---- */

.avBlock{ margin-bottom: 18px; }
.avBlock:last-child{ margin-bottom: 0; }

.avTitle{
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.avLead{
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px;
  line-height: 1.4;
}
.avHint{ margin-top: 8px; line-height: 1.4; }

.avDelta{ font-size: 10px; font-weight: 700; }
.avDeltaUp{ color: var(--success); }
.avDeltaDown{ color: var(--fail); }
.avDeltaSame{ color: var(--muted); }
.avDeltaEmpty{ color: var(--line); }

/* Grad-Profil */
.gpTable{ display: flex; flex-direction: column; gap: 4px; }

.gpRow{
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.gpName{
  flex: 0 0 52px;
  width: 52px;
  font-size: 12px;
  font-weight: 700;
  color: var(--pColor, var(--muted));
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpHeadRow .gpName{ color: var(--muted); font-weight: 600; font-size: 11px; }
.gpHead{
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;   /* bei wenigen Graden nicht auseinanderziehen */
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 2px;
}

.gpCell{
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 3px 2px;
}

/* Messlatte: der Wert der Vorsaison unter dem laufenden Stand */
.gpVor{
  position: relative;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.75;
  line-height: 1;
}
.gpVorLeer{ color: var(--line); }

.gpHeadGesamt,
.gpCellGesamt{ flex: 0 0 78px; max-width: 78px; }
.gpCellGesamt{ border-color: rgba(255,255,255,0.14); }

/* Rate + Differenz zur Vorsaison in einer Zeile */
.gpTop{
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.gpFill{
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: color-mix(in srgb, var(--pColor, var(--accent)) 28%, transparent);
}
.gpTxt{
  position: relative;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
.gpCellLeer{ color: var(--line); font-size: 11px; }

/* Punktestand zum selben Zeitpunkt der Vorsaison */
.pvBlock{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.pvLead{
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 7px;
}
.pvRow{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pvItem{
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.pvName{ font-size: 11.5px; font-weight: 700; color: var(--pColor, var(--muted)); }
.pvJetzt{ font-size: 13px; font-weight: 700; color: var(--text); }
.pvDamals{ font-size: 10.5px; color: var(--muted); }

@media (max-width: 400px){
  .gpName{ flex-basis: 40px; width: 40px; font-size: 11px; }
  .gpTxt{ font-size: 10px; }
  .gpVor{ font-size: 9px; }
  .gpHeadGesamt,
  .gpCellGesamt{ flex-basis: 66px; max-width: 66px; }
  .pvRow{ gap: 5px; }
  .pvItem{ padding: 4px 8px; gap: 3px; }
}

/* ---- Team-Punkte: gemeinsames Saisonziel ---- */
.tpCard{
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}
.tpCard.tpGeschafft{ border-color: color-mix(in srgb, var(--success) 45%, var(--line)); }

.tpKopf{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.tpTitel{
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tpZahl{ font-size: 13px; color: var(--muted); white-space: nowrap; }
.tpZahl b{ font-size: 22px; font-weight: 700; color: var(--text); }

/* Gestapelt nach Person, damit man sieht, wer wie viel beiträgt */
.tpBar{
  position: relative;
  display: flex;
  gap: 2px;
  height: 12px;
  margin-top: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.tpSeg{
  height: 100%;
  background: var(--pColor, var(--accent));
  transition: width 0.6s ease;
}
/* Wo das Ziel lag, sobald es übertroffen ist */
.tpMarke{
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--text);
}

.tpLegende{
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.tpPerson{ display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tpPerson b{ color: var(--text); font-weight: 700; }
.tpDot{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pColor, var(--accent));
}

.tpStand{
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}
.tpStand b{ color: var(--text); }
.tpStand b.tpOk{ color: var(--success); }

.tpGrade{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tpGradeTitel{ font-size: 11.5px; color: var(--muted); margin-bottom: 1px; }
.tpGrad{
  display: grid;
  grid-template-columns: 26px 1fr 52px 112px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.tpGradNr{ font-weight: 700; color: var(--text); }
.tpGradBar{
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.tpGradBar > span{
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.tpGradZahl{ text-align: right; white-space: nowrap; }
.tpGradZahl b{ color: var(--text); font-weight: 700; }
.tpGradStatus{ white-space: nowrap; }
.tpGradOk .tpGradBar > span{ background: var(--success); }
.tpGradOk .tpGradStatus{ color: var(--success); font-weight: 600; }

.tpHint{ margin: 10px 0 0; font-size: 11px; line-height: 1.4; }

@media (max-width: 400px){
  .tpGrad{ grid-template-columns: 24px 1fr 46px 100px; gap: 6px; font-size: 11px; }
}

/* ---- Badges ---- */
.bdListe{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.bdRow{
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.bdName{
  flex: 0 0 40px;
  padding-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--pColor, var(--muted));
}
.bdNameTeam{ color: var(--muted); }
.bdChips{
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.bdChip{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  font-size: 11.5px;
  color: var(--text);
  white-space: nowrap;
}
.bdChip b{ font-weight: 700; color: var(--muted); }
.bdIcon{ font-size: 13px; line-height: 1; }
.bdLeer{ padding-top: 5px; font-size: 11.5px; color: var(--muted); }

.bdLegende{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.bdLegende summary{
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.bdRegeln{
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}
.bdRegel{
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}
.bdRegel b{ color: var(--text); }
.bdRegel .bdIcon{ flex: 0 0 18px; text-align: center; padding-top: 1px; }

/* ---- Matrix (ausklappbar) ---- */
.matrixToggle{
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.matrixToggle:hover{ color: var(--text); border-color: rgba(56,189,248,0.3); }
.matrixToggle .mtArrow{ display: inline-block; transition: transform 0.2s; }
.matrixToggle[aria-expanded="true"] .mtArrow{ transform: rotate(180deg); }

.matrixWrap{
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.matrixWrap[hidden]{ display: none; }

.matrix{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matrixHeaderRow{
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.matrixNameCol{
  width: 74px;
  min-width: 74px;
  flex: 0 0 74px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  padding-left: 2px;
}

.matrixScroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-radius: 12px;
}

.weekRow, .iconRow{
  display: flex;
  gap: 4px;
  padding: 4px 2px;
}

.weekCell{
  min-width: 48px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(0,0,0,0.18);
  white-space: nowrap;
}
.weekCellLatest{
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--text);
}

.playerBlock{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
}

.playerNameRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.playerName{
  font-weight: 700;
  font-size: 14px;
  color: var(--pColor, var(--text));
}

.playerBadges{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.playerRow{
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.iconCell{
  min-width: 48px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  font-size: 14px;
}

/* Kräftiger Setter-Highlight */
.iconCell.setterIcon{
  color: var(--accent);
  border: 2px solid var(--accent);
  background: rgba(56, 189, 248, 0.15);
  font-weight: 700;
}

/* ---- Challenges (einklappbar, Tap zum Umschalten) ---- */
.challengeCard{
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 8px 0;
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}

.challengeCard[open]{
  background: rgba(255,255,255,0.03);
  border-color: rgba(56, 189, 248, 0.2);
}

.challengeSummary{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.challengeSummary::-webkit-details-marker{ display: none; }
.challengeSummary::marker{ content: ""; }
.challengeSummary:hover{ background: rgba(255,255,255,0.02); }

.challengeKw{
  font-size: 11px;
  font-weight: 700;
  color: var(--pColor, var(--accent));
  background: color-mix(in srgb, var(--pColor, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--pColor, var(--accent)) 30%, transparent);
  border-radius: 7px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.challengeSummaryBody{
  flex: 1;
  min-width: 0;
}

.challengeTitle{
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.challengeCard[open] .challengeTitle{
  white-space: normal;
}

/* Schwierigkeitsgrad der Route */
.chGrade{
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  margin-right: 2px;
  vertical-align: 1px;
}

.challengeMeta{
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.challengeMeta .setterName{
  color: var(--pColor, var(--muted));
  font-weight: 600;
}

.chMiniDots{
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.challengeCard[open] .chMiniDots{ display: none; }

.chMiniDot{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid transparent;
}
.chMiniDot.dotSuccess{ background: var(--success); }
.chMiniDot.dotFail{ background: var(--fail); }
.chMiniDot.dotOpen{ background: var(--line); }
.chMiniDot.dotImpossible{ background: var(--muted); opacity: 0.4; }
.chMiniDot.dotSetter{
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.6);
  margin: 0 2px;
}

.chChevron{
  color: var(--muted);
  font-size: 13px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.challengeCard[open] .chChevron{ transform: rotate(180deg); }

.challengeBody{
  padding: 0 14px 12px;
  position: relative;
}

/* ---- Tags ---- */
.chTags{
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.chTag{
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.chTagAccent{
  color: #fbbf24;
  background: rgba(251,191,36,0.08);
  border-color: rgba(251,191,36,0.3);
}

/* ---- Result Chips (tap-fähig, zyklisieren Status) ---- */
.resultChips{
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.resultChip{
  flex: 1;
  border-radius: 10px;
  padding: 7px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
}
.resultChip:active{
  transform: scale(0.96);
  background: rgba(0,0,0,0.3);
}

.resultChip.rcOpen{ opacity: 0.55; }
.resultChip.rcImpossible{ opacity: 0.5; }

/* Archivierte Saison: nur Anzeige, nicht antippbar */
.resultChip.rcStatic{ cursor: default; }
.resultChip.rcStatic:active{ transform: none; background: rgba(0,0,0,0.2); }

/* Setter-Chip: kräftiger blauer Rand */
.resultChip.rcSetter{
  border: 2px solid var(--accent);
  background: rgba(56, 189, 248, 0.1);
}
.resultChip.rcSetter .rcIcon{ color: var(--accent); }
.resultChip.rcSetter .rcName{
  color: var(--text);
  font-weight: 700;
}

.rcIcon{
  font-size: 15px;
  line-height: 1;
}
.rcName{
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Edit-Button */
.challengeEditBtn{
  position: absolute;
  top: -6px;
  right: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 9px;
  line-height: 1;
}
.challengeEditBtn:hover{
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.4);
}

/* ---- Admin ---- */
.adminGrid{
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 520px){
  .adminGrid{ grid-template-columns: 1fr; }
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fieldWide{
  grid-column: 1 / -1;
}
.field span{
  font-size: 12px;
  color: var(--muted);
}
.field input, .field select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 14px;
}
.field input:focus, .field select:focus{
  border-color: rgba(56, 189, 248, 0.5);
}

.adminBlock{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.adminBlockTitle{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.adminResults{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 520px){
  .adminResults{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.resultBtn{
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
.resultBtn small{ color: var(--muted); font-weight: 600; font-size: 13px; }
.resultBtn:disabled{ opacity: 0.45; cursor: not-allowed; }

.field input:disabled,
.field select:disabled,
.btnPrimary:disabled{ opacity: 0.45; cursor: not-allowed; }

.adminActions{
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn, .btnPrimary{
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}
.btnPrimary{
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  font-weight: 600;
}
.btn:active, .btnPrimary:active{ transform: translateY(1px); }
.adminActions .btn, .adminActions .btnPrimary{ flex: 1 1 auto; }

.adminTextarea{
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

/* ---- Toast ---- */
.toast{
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 10px 9px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 50;
  animation: toastIn 0.2s ease-out;
  max-width: calc(100vw - 28px);
}
@keyframes toastIn{
  from{ opacity: 0; transform: translate(-50%, 8px); }
  to{ opacity: 1; transform: translate(-50%, 0); }
}
.toast[hidden]{ display: none; }
.toast button{
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ---- Footer ---- */
.footer{ padding: 18px 14px 28px; }
.footer{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.footer p{ margin: 0; }
/* Unauffällig: die Verwaltung braucht man selten */
.footerLink{
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footerLink:hover{ color: var(--text); }
body.gesperrt .footerLink{ display: none; }

.verwaltungKopf{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 4px;
}
.verwaltungKopf h2{ margin: 0; font-size: 17px; }

/* ---- Mobile compaction ---- */
@media (max-width: 520px){
  .header{ padding: 14px 14px 10px; }
  h1{ font-size: 19px; }
  .statV{ font-size: 16px; }
  .statL{ font-size: 9.5px; }
  .matrixNameCol{ width: 60px; min-width: 60px; flex: 0 0 60px; }
  .weekCell{ min-width: 42px; font-size: 10px; }
  .iconCell{ min-width: 42px; height: 30px; font-size: 13px; }
  .playerBlock{ padding: 9px; }
  .playerName{ font-size: 13px; }
  .badge{ font-size: 10.5px; padding: 3px 7px; }
  .lbBarWrap{ display: none; }
  .lbRate{ font-size: 10px; padding: 2px 7px; }
  .lbDefined{ font-size: 10px; padding: 2px 7px; }
  .lbRow{ gap: 8px; padding: 10px; }
  .lbDelta{ width: 18px; font-size: 9.5px; }
  .lbForm{ gap: 3px; }
  .challengeSummary{ padding: 10px 12px; }
  .challengeTitle{ font-size: 14px; }
  .resultChips{ gap: 3px; }
  .resultChip{ padding: 6px 2px 5px; }
  .rcIcon{ font-size: 14px; }
  .rcName{ font-size: 9.5px; }
  .challengeBody{ padding: 0 12px 12px; }
}

/* ---- Datenbank: Status, Anmeldung, Protokoll ---- */
.toast button[hidden],
.btn[hidden], .btnPrimary[hidden],
.field[hidden],
.adminBlock[hidden]{ display: none; }

.dbStatus{
  margin-top: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.dbStatus[hidden]{ display: none; }
.dbStatus:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.dbStatusFehler{ color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); }

.loginDialog{
  width: min(380px, calc(100% - 28px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}
.loginDialog::backdrop{ background: rgba(0, 0, 0, 0.6); }
.loginDialog form{ display: flex; flex-direction: column; gap: 12px; }
.loginDialog .adminActions{ margin-top: 2px; }
.loginFehler{ margin: 0; color: var(--fail); font-size: 13px; }
.loginFehler[hidden]{ display: none; }

.verlauf{ display: flex; flex-direction: column; gap: 6px; }
.verlaufZeile{
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 4px 10px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.verlaufWann{ color: var(--muted); font-variant-numeric: tabular-nums; }
.verlaufWer{ font-weight: 600; }
.verlaufWas{ min-width: 0; overflow-wrap: anywhere; }

/* ---- Anmeldeseite (Datenbank ohne Login) ---- */
.loginGate{ display: none; }
body.gesperrt .loginGate{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 28px 0;
  padding: 28px 20px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.loginGate h2{ margin: 0; font-size: 18px; }
.loginGate p{ margin: 0; max-width: 34ch; }
.loginGate .btnPrimary{ margin-top: 8px; min-width: 160px; }
.gateIcon{ font-size: 34px; line-height: 1; }
body.gesperrt .tabBar,
body.gesperrt .tabPanel,
body.gesperrt .seasonBar,
body.gesperrt #statStrip,
body.gesperrt #seasonSelect,
body.gesperrt #archiveBadge{ display: none !important; }
