/* ============================================================================
   styles.css — Dunkles Layout, auf schnelles Scannen ausgelegt
   ========================================================================= */

:root {
  --grund:      #0b0f16;
  --flaeche:    #141a24;
  --flaeche-2:  #1c2431;
  --rand:       #26303f;
  --text:       #e6ebf2;
  --text-leise: #8d9aad;
  --akzent:     #c8a04a;
  --gut:        #4ea86b;
  --mittel:     #c8a04a;
  --schlecht:   #d1596b;
  --partner:    #5aa8d8;   /* Supports — bewusst weder rot noch grün, es ist
                              keine Matchup-Wertung, sondern eine Empfehlung */
  --radius:     10px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 clamp(12px, 3vw, 32px) 48px;
  background: var(--grund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }

/* -------------------------------------------------------------- Kopfbereich */
.kopf {
  position: sticky; top: 0; z-index: 20;
  margin: 0 calc(clamp(12px, 3vw, 32px) * -1);
  padding: 16px clamp(12px, 3vw, 32px) 12px;
  background: color-mix(in srgb, var(--grund) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rand);
}

.kopf-zeile { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Das Logo ist einfarbig (#c79b3b) und trägt die Wortmarke selbst — daher
   kein zusätzlicher Titeltext. Höhe steuert die Größe, Breite folgt. */
.logo { margin: 0; line-height: 0; }
.logo img {
  height: clamp(30px, 5.2vw, 42px); width: auto; display: block;
}

.patch {
  font-size: .75rem; font-variant-numeric: tabular-nums;
  color: var(--akzent); border: 1px solid color-mix(in srgb, var(--akzent) 40%, transparent);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}

/* ------------------------------------------------------------------- Suche */
.suche-wrap { position: relative; margin: 12px 0 10px; }

.suche {
  width: 100%; padding: 10px 36px 10px 14px;
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand); border-radius: var(--radius);
  font: inherit;
}
.suche::placeholder { color: var(--text-leise); }
.suche:focus { border-color: var(--akzent); outline: none; }
.suche::-webkit-search-cancel-button { display: none; }

.suche-x {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 6px;
  color: var(--text-leise); font-size: 20px; line-height: 1; cursor: pointer;
}
.suche-x:hover { color: var(--text); background: var(--flaeche-2); }

/* ------------------------------------------------------------------ Filter */
.filter { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  background: var(--flaeche); color: var(--text-leise);
  border: 1px solid var(--rand); border-radius: 999px;
  font: inherit; font-size: .84rem; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { color: var(--text); border-color: #36435a; }
.chip--aktiv {
  background: var(--flaeche-2); color: var(--text);
  border-color: color-mix(in srgb, var(--akzent) 55%, transparent);
}

/* Die Spieler sind die Hauptnavigation — deutlich größer als der Rollenfilter,
   der nur nachschärft. */
.filter--haupt { gap: 8px; }
.filter--haupt .chip {
  padding: 9px 17px; font-size: 1.02rem; font-weight: 600; gap: 9px;
  border-radius: 12px; color: var(--text);
}
.filter--haupt .chip:not(.chip--aktiv) { color: var(--text-leise); }
.filter--haupt .chip--aktiv {
  border-color: var(--akzent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--akzent) 30%, transparent);
}

/* Spieler-Buttons tragen ihre eigene Farbe dezent im Hintergrund und Rand.
   --sp-farbe setzt js/app.js per CSSOM aus roster.js (siehe farbenAnwenden). */
.filter--haupt .chip[data-tint] {
  background: color-mix(in srgb, var(--sp-farbe) 10%, var(--flaeche));
  border-color: color-mix(in srgb, var(--sp-farbe) 32%, var(--rand));
}
.filter--haupt .chip[data-tint]:hover {
  background: color-mix(in srgb, var(--sp-farbe) 16%, var(--flaeche));
  border-color: color-mix(in srgb, var(--sp-farbe) 50%, var(--rand));
}
.filter--haupt .chip[data-tint].chip--aktiv {
  background: color-mix(in srgb, var(--sp-farbe) 22%, var(--flaeche-2));
  border-color: color-mix(in srgb, var(--sp-farbe) 75%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sp-farbe) 35%, transparent);
}
.filter--haupt .chip[data-tint].chip--aktiv .chip-zahl {
  color: color-mix(in srgb, var(--sp-farbe) 80%, var(--text));
}
.filter--haupt .punkt { width: 11px; height: 11px; }
.filter--haupt .chip-zahl { font-size: .82rem; }

.filter--klein { margin-top: 7px; }
.filter--klein .chip { padding: 3px 9px; font-size: .78rem; }

.chip-zahl {
  font-size: .72rem; font-variant-numeric: tabular-nums;
  color: var(--text-leise); padding-left: 2px;
}
.chip--aktiv .chip-zahl { color: var(--akzent); }

.punkt { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ------------------------------------------------------- Hinweis / Status */
.hinweis {
  margin: 16px 0 0;
  background: color-mix(in srgb, var(--schlecht) 10%, var(--flaeche));
  border: 1px solid color-mix(in srgb, var(--schlecht) 35%, transparent);
  border-radius: var(--radius); padding: 10px 14px; font-size: .875rem;
}
/* Reiner Ladehinweis (offline, alter Patch) — informativ, nicht alarmierend. */
.hinweis--info {
  background: color-mix(in srgb, var(--akzent) 9%, var(--flaeche));
  border-color: color-mix(in srgb, var(--akzent) 35%, transparent);
}
.hinweis-zeile { margin: 0; color: var(--text); }
.hinweis--info + * , .hinweis-zeile + details { margin-top: 8px; }

.hinweis summary { cursor: pointer; color: #f0b3bd; }
.hinweis ul { margin: 8px 0 4px; padding-left: 20px; color: var(--text-leise); }
.hinweis li { margin: 2px 0; }
.hinweis code { background: var(--grund); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

.status { color: var(--text-leise); margin: 32px 0; text-align: center; }
.status--fehler { color: #f0b3bd; }

/* -------------------------------------------------------------------- Grid */
.grid {
  display: grid; gap: 10px; margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
}

.karte {
  display: flex; flex-direction: column; align-items: stretch; gap: 7px;
  padding: 10px; text-align: left;
  background: var(--flaeche); color: inherit;
  border: 1px solid var(--rand); border-radius: var(--radius);
  font: inherit; cursor: pointer;
  transition: transform .12s, border-color .12s, background .12s;
}
.karte:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--akzent) 50%, transparent);
  background: var(--flaeche-2);
}

.karte-bild { position: relative; display: block; }
.karte-bild img {
  width: 100%; height: auto; aspect-ratio: 1; display: block;
  border-radius: 7px; background: var(--flaeche-2);
}

.karte-name { font-weight: 600; font-size: .95rem; line-height: 1.2; }

.karte-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  font-size: .74rem; color: var(--text-leise);
}
.rolle {
  background: var(--flaeche-2); border: 1px solid var(--rand);
  border-radius: 4px; padding: 1px 6px; color: var(--text-leise);
}
.spieler { display: inline-flex; align-items: center; gap: 4px; }

/* margin-top:auto hält die Counter-Leisten einer Reihe auf einer Linie, auch
   wenn bei langen Spielernamen die Meta-Zeile umbricht. */
.karte-counter {
  display: flex; gap: 4px; margin-top: auto; padding-top: 6px;
  border-top: 1px solid var(--rand);
}
.karte-counter img {
  width: 26px; height: 26px; border-radius: 5px;
  filter: grayscale(.45); opacity: .85;
}

/* Champions aus dem Verzeichnis, die noch niemand eingetragen hat: sichtbar,
   aber klar zurückgenommen, damit die eigenen Pools vorne im Blick bleiben. */
.karte--leer { background: transparent; border-style: dashed; }
.karte--leer .karte-bild img { filter: grayscale(.85); opacity: .45; }
.karte--leer .karte-name { color: var(--text-leise); font-weight: 550; }
.karte--leer:hover { background: var(--flaeche); border-style: solid; }
.karte--leer:hover .karte-bild img { filter: grayscale(.2); opacity: .9; }
.karte--leer .karte-counter { border-top-style: dashed; }
.karte--leer .karte-counter img { filter: grayscale(.8); opacity: .55; }
.karte--leer:hover .karte-counter img { filter: grayscale(.35); opacity: .9; }
.rolle--leer { border-style: dashed; opacity: .7; }

/* Überschrift zwischen beiden Blöcken, über die volle Rasterbreite */
.trenner {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 2px;
  color: var(--text-leise); font-size: .74rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .08em;
}
.trenner span {
  font-variant-numeric: tabular-nums; letter-spacing: 0;
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: 999px; padding: 1px 8px; font-size: .95em; font-weight: 600;
}
.trenner::after { content: ""; flex: 1; height: 1px; background: var(--rand); }

/* --------------------------------------------------------------- Winrate */
.wr {
  position: absolute; right: 5px; bottom: 5px;
  padding: 1px 6px; border-radius: 5px;
  font-size: .72rem; font-weight: 650; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--grund) 80%, transparent);
  backdrop-filter: blur(3px);
}
.wr--gut      { color: var(--gut); }
.wr--mittel   { color: var(--mittel); }
.wr--schlecht { color: var(--schlecht); }

.wr--gross {
  position: static; backdrop-filter: none;
  background: color-mix(in srgb, var(--grund) 55%, transparent);
  font-size: .78rem; padding: 2px 8px;
}

/* ---------------------------------------------------------------- Dialog */
.detail {
  width: min(680px, calc(100vw - 24px));
  /* Champions mit mehreren Varianten werden lang — der Dialog bleibt im Bild,
     gescrollt wird nur der Inhalt, damit der Schließen-Knopf stehen bleibt. */
  max-height: min(88vh, 940px);
  padding: 0; border: 1px solid var(--rand); border-radius: 14px;
  background: var(--flaeche); color: var(--text);
  overflow: hidden; position: relative;
}
/* Nur im geöffneten Zustand ein Flex-Container: ein unbedingtes display:flex
   würde das display:none überschreiben, das der Browser geschlossenen Dialogen
   gibt — der leere Dialog läge dann im Layout und würde die Seite verbreitern. */
.detail[open] { display: flex; flex-direction: column; }
.detail-inhalt { overflow-y: auto; overscroll-behavior: contain; }
.detail::backdrop { background: rgba(4, 6, 10, .72); backdrop-filter: blur(3px); }

.detail-x {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; display: grid; place-items: center;
  background: rgba(11, 15, 22, .6); color: #fff;
  border: 1px solid var(--rand); border-radius: 8px;
  font-size: 20px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px);
}
.detail-x:hover { background: rgba(11, 15, 22, .85); }

.detail-kopf {
  min-height: 168px; display: flex; align-items: flex-end;
  background-size: cover; background-position: center 22%;
}
.detail-kopf-text { padding: 16px 18px 12px; }
.detail-kopf h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.titel { margin: 1px 0 8px; color: var(--text-leise); font-size: .85rem; }

.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: .8rem; }

.detail-body { padding: 4px 18px 20px; }

.leer-hinweis {
  margin: 18px 0 6px; padding: 14px 16px;
  background: var(--flaeche-2); border: 1px dashed var(--rand); border-radius: 10px;
  color: var(--text-leise); font-size: .9rem;
}

.notiz {
  margin: 12px 0 4px; padding: 10px 12px;
  background: var(--flaeche-2);
  border-left: 3px solid var(--akzent); border-radius: 0 8px 8px 0;
  font-size: .9rem;
}

/* Ein Block je Variante (Spieler/Rolle) — nur sichtbar getrennt, wenn es
   wirklich mehrere gibt. */
.variante + .variante {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rand);
}
.variante-titel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 2px; font-size: .9rem; font-weight: 600;
}
.variante-titel .spieler { font-size: .9rem; color: var(--text); }

.block { margin-top: 18px; }
.block-titel {
  margin: 0 0 9px; font-size: .76rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .07em;
}
.ist-schlecht { color: var(--schlecht); }
.ist-gut      { color: var(--gut); }
.ist-partner  { color: var(--partner); }
.ist-neutral  { color: var(--akzent); }

.reihe { display: flex; flex-wrap: wrap; gap: 8px; }

.mini {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 74px; text-align: center;
  font-size: .7rem; line-height: 1.25; color: var(--text-leise);
}
.mini img {
  width: 48px; height: 48px; border-radius: 7px;
  background: var(--flaeche-2); border: 1px solid var(--rand);
}
.mini--item { cursor: help; }
/* Label wachsen lassen, damit die Goldpreise trotz zweizeiliger Item-Namen
   alle auf einer Linie stehen. */
.mini--item span:first-of-type { flex: 1; }
.gold { color: var(--akzent); font-variant-numeric: tabular-nums; font-size: .68rem; }

/* ------------------------------------------------------------------- Fuss */
.fuss {
  margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--rand);
  color: var(--text-leise); font-size: .72rem; opacity: .5;
  text-align: center;
}
.fuss p { margin: 0; }
.fein { font-size: .92em; opacity: .75; }

/* ------------------------------------------------------------------ Klein */
/* Auf dem Handy zählt Dichte: liegende Zeilen statt großer Kacheln — so sind
   rund neun Champions auf einen Blick sichtbar statt zwei. */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 7px; }

  .karte {
    display: grid; align-items: center;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    grid-template-areas: "bild name counter"
                         "bild meta counter";
    column-gap: 11px; row-gap: 2px; padding: 8px 10px;
    /* Ohne min-width:0 schrumpft der Button nicht unter seine Min-Content-
       Breite und schiebt die Counter-Icons aus dem Bildschirm. */
    min-width: 0;
  }
  .karte:hover { transform: none; }

  .karte-bild    { grid-area: bild; }
  .karte-name    { grid-area: name; align-self: end; min-width: 0; }
  .karte-meta    { grid-area: meta; align-self: start; min-width: 0; }
  .karte-counter {
    grid-area: counter; margin-top: 0; padding-top: 0; border-top: 0;
  }
  .karte-counter img { width: 24px; height: 24px; }

  .wr { right: 2px; bottom: 2px; padding: 0 4px; font-size: .65rem; }

  .detail-kopf { min-height: 132px; }
  .mini { width: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .karte:hover { transform: none; }
}
