/* ============================================================
   leaderboard.css — das Leaderboard-Panel (dunkel: Nacht-Stil, hell: warmes Creme; Gold-Akzente)
   Gemeinsam für die Weekly Challenge (weekly/leaderboard.js) und die
   Daily-Leaderboards (js/daily-leaderboard.js). Platzierung macht die jeweilige Seite.
   ============================================================ */
.lb {
  --h-ink: #f3f1ff; --h-muted: #b8b3dd;
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; min-width: 0;
  padding: 22px 18px 16px; border-radius: calc(var(--radius) + 10px); color: var(--h-ink);
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(255, 200, 61, .16), transparent 70%),
    linear-gradient(170deg, #221d46 0%, #15122c 80%);
  border: 1px solid rgba(255, 200, 61, .35);
  box-shadow: 0 24px 60px rgba(10, 8, 30, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
}
:root[data-theme="light"] .lb { box-shadow: 0 18px 46px rgba(60, 45, 20, .22); }
.lb-kopf { display: flex; align-items: center; gap: 12px; margin: 0 4px 12px; }
.lb-pokal {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 217, 107, .25), rgba(255, 182, 39, .08)); border: 1px solid rgba(255, 200, 61, .5);
  box-shadow: 0 0 18px rgba(255, 200, 61, .25);
}
.lb-pokal svg { width: 24px; height: 24px; }
.lb-titel { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1.1; color: var(--h-ink); }
.lb-unter { margin: 2px 0 0; font-size: .85rem; color: var(--h-muted); }
.lb-unter strong { color: #ffd45e; font-variant-numeric: tabular-nums; }
.lb-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}
.lb-tabs button {
  font: inherit; font-size: .88rem; font-weight: 700; padding: 7px 0; border: none; border-radius: 9px; cursor: pointer;
  background: none; color: var(--h-muted); transition: color .15s ease, background .15s ease;
}
.lb-tabs button:hover { color: var(--h-ink); }
.lb-tabs button.an { background: linear-gradient(180deg, #ffd96b, #ffb627); color: #241a00; box-shadow: 0 4px 12px rgba(255, 182, 39, .3); }
.lb-tabs button:focus-visible, .lb-knopf:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 200, 61, .55); }
.lb-spalten {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; padding: 0 10px 6px;
  font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--h-muted); opacity: .8;
}
.lb-spalten span:last-child { text-align: right; }
.lb-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.lb-liste li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 10px; }
.lb-liste li.p1, .lb-liste li.p2, .lb-liste li.p3 { background: rgba(255, 255, 255, .05); }
.lb-liste li.ich { background: linear-gradient(90deg, rgba(255, 200, 61, .2), rgba(255, 200, 61, .06)); box-shadow: inset 0 0 0 1px rgba(255, 200, 61, .55); }
.lb-platz {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-weight: 800; font-size: .85rem; color: var(--h-muted); font-variant-numeric: tabular-nums;
}
.p1 .lb-platz { background: radial-gradient(circle at 35% 30%, #fff1b8, #ffc83d 55%, #c98a0c); color: #3a2600; box-shadow: 0 0 12px rgba(255, 200, 61, .55); }
.p2 .lb-platz { background: radial-gradient(circle at 35% 30%, #ffffff, #cfd6e6 55%, #8d97ad); color: #262a36; }
.p3 .lb-platz { background: radial-gradient(circle at 35% 30%, #ffe1c4, #d79a6a 55%, #9a5f33); color: #2e1a0a; }
.lb-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-name > span { min-width: 0; }
.lb-name img, .lb-flagge-leer { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); flex: none; }
.lb-flagge-leer { background: linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .06)); }
.lb-name b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--h-ink); }
.lb-name small { display: block; font-size: .74rem; color: var(--h-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-wert { text-align: right; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; color: var(--h-ink); }
.p1 .lb-wert { color: #ffd45e; text-shadow: 0 0 14px rgba(255, 200, 61, .4); }
.lb-luecke { text-align: center; color: var(--h-muted); letter-spacing: .3em; padding: 2px 0; opacity: .7; }

/* Laden: schimmernde Platzhalter */
.lb-skelett li > * , .lb-skelett i, .lb-skelett b, .lb-skelett small { color: transparent; }
.lb-skelett .lb-platz, .lb-skelett i, .lb-skelett b, .lb-skelett small {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .06) 0%, rgba(255, 255, 255, .14) 50%, rgba(255, 255, 255, .06) 100%);
  background-size: 200% 100%; animation: lb-schimmer 1.3s ease-in-out infinite;
}
.lb-skelett .lb-platz { border-radius: 50%; }
.lb-skelett .lb-name i { width: 22px; height: 16px; flex: none; }
.lb-skelett b { width: 90px; height: 12px; margin-bottom: 5px; }
.lb-skelett small { width: 64px; height: 9px; }
.lb-skelett .lb-wert i { width: 24px; height: 16px; margin-left: auto; }
@keyframes lb-schimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* leere Liste, Fehler, „Coming soon“ */
.lb-leer {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 26px 14px; margin: 4px 0; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08);
}
.lb-leer p { margin: 0; color: var(--h-muted); font-size: .9rem; line-height: 1.45; }
.lb-leer strong { color: var(--h-ink); }
.lb-leer-icon {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; font-size: 1.5rem;
  background: radial-gradient(circle, rgba(255, 200, 61, .22), rgba(255, 200, 61, .05)); border: 1px solid rgba(255, 200, 61, .4); color: #ffd45e;
}
.lb-bald { flex: 1; justify-content: center; }
.lb-bald-best { padding: 4px 12px; border-radius: 999px; background: rgba(255, 200, 61, .12); border: 1px solid rgba(255, 200, 61, .35); }
.lb-bald-best strong { color: #ffe39a; }
.lb-inhalt { display: flex; flex-direction: column; flex: 1 0 auto; }

/* „Du“ unten in der Liste */
.lb-du { margin-top: auto; padding-top: 12px; }
.lb-du:empty { display: none; }
.lb-du-zeile {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 200, 61, .2), rgba(255, 200, 61, .06)); border: 1px solid rgba(255, 200, 61, .55);
}
.lb-du-zeile .lb-platz { width: auto; min-width: 26px; height: 28px; padding: 0 8px; border-radius: 8px; background: rgba(255, 200, 61, .25); color: #ffe39a; font-size: .8rem; }
.lb-du-zeile .lb-wert { color: #ffd45e; }
.lb-top { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .7rem; font-weight: 800; background: rgba(126, 240, 198, .16); color: #7ef0c6; vertical-align: 1px; }
.lb-du-leer { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px dashed rgba(255, 200, 61, .45); background: rgba(255, 200, 61, .06); }
.lb-du-leer p { margin: 0; flex: 1; font-size: .88rem; color: var(--h-muted); line-height: 1.35; }
.lb-du-leer strong { color: var(--h-ink); }
.lb-du-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 200, 61, .18); color: #ffd45e; font-weight: 800; }
.lb-du-fehler { border-style: solid; border-color: rgba(255, 107, 107, .5); background: rgba(255, 107, 107, .08); }
.lb-du-fehler .lb-du-icon { background: rgba(255, 107, 107, .2); color: #ff9a9a; }
.lb-dreht::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgba(255, 212, 94, .3); border-top-color: #ffd45e; animation: lb-drehen .8s linear infinite; }
@keyframes lb-drehen { to { transform: rotate(360deg); } }

/* Name eingeben */
.lb-form { padding: 12px; border-radius: 12px; background: linear-gradient(180deg, rgba(255, 200, 61, .16), rgba(255, 200, 61, .05)); border: 1px solid rgba(255, 200, 61, .55); }
.lb-form-titel { margin: 0 0 8px; font-size: .9rem; color: var(--h-muted); }
.lb-form-titel strong { color: var(--h-ink); }
.lb-form-reihe { display: flex; align-items: center; gap: 8px; }
.lb-form-flagge { display: grid; place-items: center; flex: none; }
.lb-eingabe {
  flex: 1; min-width: 0; font: inherit; font-weight: 700; padding: 9px 12px; border-radius: 10px;
  background: rgba(10, 8, 30, .45); color: var(--h-ink); border: 1px solid rgba(255, 255, 255, .18);
}
.lb-eingabe::placeholder { color: rgba(184, 179, 221, .65); font-weight: 600; }
.lb-eingabe:focus { outline: none; border-color: #ffc83d; box-shadow: 0 0 0 3px rgba(255, 200, 61, .3); }
.lb-eingabe[aria-invalid="true"] { border-color: #ff8a8a; }
.lb-knopf {
  font: inherit; font-size: .88rem; font-weight: 800; cursor: pointer; padding: 9px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, .1); color: var(--h-ink); border: 1px solid rgba(255, 255, 255, .2);
}
.lb-knopf:hover { background: rgba(255, 255, 255, .16); }
.lb-knopf-gold { background: linear-gradient(180deg, #ffd96b, #ffb627); color: #241a00; border: none; box-shadow: 0 4px 12px rgba(255, 182, 39, .3); }
.lb-knopf-gold:hover { background: linear-gradient(180deg, #ffe08a, #ffbe3d); }
.lb-form-hinweis { margin: 7px 0 0; font-size: .75rem; color: var(--h-muted); }
.lb-form-hinweis.fehler { color: #ff9a9a; font-weight: 700; }
.lb-fuss { margin: 10px 4px 0; font-size: .76rem; color: var(--h-muted); text-align: center; opacity: .85; }

@media (max-width: 560px) {
  .lb { padding: 18px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-skelett .lb-platz, .lb-skelett i, .lb-skelett b, .lb-skelett small, .lb-dreht::after { animation: none; }
}

/* ---------- Hellmodus ---------- */
:root[data-theme="light"] .lb {
  --h-ink: #2a2140; --h-muted: #7b6a55;
  background: radial-gradient(80% 45% at 50% 0%, rgba(255, 196, 61, .25), transparent 70%), linear-gradient(170deg, #fffaf0 0%, #fbefd8 100%);
  border-color: rgba(214, 150, 30, .42); box-shadow: 0 18px 46px rgba(120, 80, 20, .14), inset 0 1px 0 #fff;
}
:root[data-theme="light"] .lb-pokal { background: linear-gradient(180deg, rgba(255, 217, 107, .5), rgba(255, 182, 39, .18)); border-color: rgba(214, 150, 30, .55); box-shadow: none; }
:root[data-theme="light"] .lb-pokal svg { stroke: #b07800; }
:root[data-theme="light"] .lb-unter strong { color: #a86e00; }
:root[data-theme="light"] .lb-tabs { background: rgba(120, 80, 20, .06); border-color: rgba(120, 80, 20, .12); }
:root[data-theme="light"] .lb-liste li.p1, :root[data-theme="light"] .lb-liste li.p2, :root[data-theme="light"] .lb-liste li.p3 { background: rgba(255, 255, 255, .7); }
:root[data-theme="light"] .lb-liste li.ich { background: linear-gradient(90deg, rgba(240, 180, 41, .25), rgba(240, 180, 41, .08)); box-shadow: inset 0 0 0 1px rgba(214, 150, 30, .6); }
:root[data-theme="light"] .p1 .lb-platz { box-shadow: 0 2px 6px rgba(200, 140, 20, .35); }
:root[data-theme="light"] .p1 .lb-wert { color: #c07f00; text-shadow: none; }
:root[data-theme="light"] .lb-flagge-leer { background: rgba(120, 80, 20, .1); }
:root[data-theme="light"] .lb-leer { background: rgba(255, 255, 255, .6); border-color: rgba(120, 80, 20, .12); }
:root[data-theme="light"] .lb-leer-icon { background: radial-gradient(circle, rgba(255, 200, 61, .35), rgba(255, 200, 61, .1)); border-color: rgba(214, 150, 30, .5); }
:root[data-theme="light"] .lb-bald-best { background: rgba(240, 180, 41, .14); border-color: rgba(214, 150, 30, .45); }
:root[data-theme="light"] .lb-bald-best strong { color: #8a5800; }
:root[data-theme="light"] .lb-du-zeile { background: linear-gradient(90deg, rgba(240, 180, 41, .22), rgba(240, 180, 41, .06)); border-color: rgba(214, 150, 30, .6); }
:root[data-theme="light"] .lb-du-zeile .lb-platz { background: rgba(240, 180, 41, .3); color: #7a4e00; }
:root[data-theme="light"] .lb-du-zeile .lb-wert { color: #c07f00; }
:root[data-theme="light"] .lb-top { background: rgba(15, 155, 110, .12); color: #0f8a60; }
:root[data-theme="light"] .lb-du-leer { background: rgba(240, 180, 41, .08); border-color: rgba(214, 150, 30, .5); }
:root[data-theme="light"] .lb-du-icon { background: rgba(240, 180, 41, .25); color: #9a6400; }
:root[data-theme="light"] .lb-form { background: linear-gradient(180deg, rgba(240, 180, 41, .18), rgba(240, 180, 41, .05)); border-color: rgba(214, 150, 30, .6); }
:root[data-theme="light"] .lb-eingabe { background: #fff; border-color: rgba(120, 80, 20, .25); }
:root[data-theme="light"] .lb-eingabe::placeholder { color: rgba(123, 106, 85, .7); }
:root[data-theme="light"] .lb-knopf { background: rgba(120, 80, 20, .06); border-color: rgba(120, 80, 20, .18); }
:root[data-theme="light"] .lb-skelett .lb-platz, :root[data-theme="light"] .lb-skelett i, :root[data-theme="light"] .lb-skelett b, :root[data-theme="light"] .lb-skelett small {
  background: linear-gradient(90deg, rgba(120, 80, 20, .06) 0%, rgba(120, 80, 20, .13) 50%, rgba(120, 80, 20, .06) 100%); background-size: 200% 100%; }

/* ---------- Daily-Leaderboards (js/daily-leaderboard.js) ----------
   Im Stil der Seite (Farben aus tokens, Akzent = Spielfarbe), nicht im Weekly-Look.
   Start: kompakter Hinweis unter dem Start-Knopf. Ende: eigener Abschnitt unter dem Ergebnis. */
.lb.dlb, :root[data-theme="light"] .lb.dlb {
  --h-ink: var(--ink); --h-muted: var(--ink-muted);
  background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; overflow: visible; color: var(--ink);
}
.lb.dlb .lb-kopf { margin: 0 0 10px; gap: 10px; }
.lb.dlb .lb-pokal { width: 34px; height: 34px; border-radius: 10px; box-shadow: none;
  background: color-mix(in srgb, var(--akzent) 20%, var(--bg-panel)); border: 1px solid color-mix(in srgb, var(--akzent) 45%, var(--line)); }
.lb.dlb .lb-pokal svg { width: 19px; height: 19px; stroke: color-mix(in srgb, var(--akzent) 75%, var(--ink)); }
.lb.dlb .lb-pokal svg path:first-child { fill: color-mix(in srgb, var(--akzent) 30%, transparent); }
.lb.dlb .lb-titel { font-size: 1.1rem; }
.lb.dlb .lb-unter { font-size: .8rem; }
.lb.dlb .lb-unter strong { color: color-mix(in srgb, var(--akzent) 75%, var(--ink)); }
.lb.dlb .lb-leer { flex-direction: row; text-align: left; align-items: center; gap: 14px; padding: 14px 16px; margin: 0;
  background: var(--bg-panel); border: 1px dashed color-mix(in srgb, var(--akzent) 55%, var(--line)); border-radius: var(--radius-sm); }
.lb.dlb .lb-leer p { font-size: .88rem; }
.lb.dlb .lb-leer-icon { width: 40px; height: 40px; flex: none; font-size: 1.15rem;
  background: color-mix(in srgb, var(--akzent) 16%, var(--bg-panel)); border-color: color-mix(in srgb, var(--akzent) 45%, var(--line)); }
.lb.dlb .lb-liste { gap: 6px; }
.lb.dlb .lb-liste li { padding: 7px 12px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lb.dlb .lb-liste li.p1, .lb.dlb .lb-liste li.p2, .lb.dlb .lb-liste li.p3 { background: var(--bg-panel); }
.lb.dlb .lb-liste li.ich { background: color-mix(in srgb, var(--akzent) 12%, var(--bg-panel)); border-color: var(--akzent); box-shadow: none; }
.lb.dlb .p1 .lb-platz { box-shadow: none; }
.lb.dlb .p1 .lb-wert { color: var(--ink); text-shadow: none; }
.lb.dlb .lb-wert { font-size: 1.05rem; }
.lb.dlb .lb-du { padding-top: 8px; }
.lb.dlb .lb-du-zeile { padding: 8px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--akzent) 12%, var(--bg-panel)); border: 1px solid var(--akzent); }
.lb.dlb .lb-du-zeile .lb-platz { background: color-mix(in srgb, var(--akzent) 25%, var(--bg-panel)); color: var(--ink); }
.lb.dlb .lb-du-zeile .lb-wert { color: var(--ink); }
.lb.dlb .lb-top { background: color-mix(in srgb, var(--mint) 15%, transparent); color: color-mix(in srgb, var(--mint) 70%, var(--ink)); }
.lb.dlb .lb-du-leer { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-panel); border: 1px dashed var(--line); }
.lb.dlb .lb-du-icon { width: 30px; height: 30px; background: color-mix(in srgb, var(--akzent) 18%, var(--bg-panel)); color: color-mix(in srgb, var(--akzent) 70%, var(--ink)); }
.lb.dlb .lb-fuss { margin-top: 8px; opacity: 1; }
.lb.dlb .lb-flagge-leer { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.lb.dlb .lb-form { background: color-mix(in srgb, var(--akzent) 10%, var(--bg-panel)); border: 1px solid var(--akzent); border-radius: var(--radius-sm); }
.lb.dlb .lb-eingabe { background: var(--bg); color: var(--ink); border-color: var(--line); }
.lb.dlb .lb-knopf { background: var(--bg-panel); color: var(--ink); border-color: var(--line); }

/* Ende: unter dem Ergebnis, gleiche Breite wie die Ergebnisliste */
#screen-ende .dlb { max-width: 520px; margin: 34px auto 0; padding-top: 26px; border-top: 1px solid var(--line); }
/* Start: nur kompakter Hinweis unter dem Start-Knopf */
#screen-start .dlb { max-width: 400px; margin-top: 26px; }
#screen-start .dlb .lb-inhalt, #screen-start .dlb .lb-fuss, #screen-start .dlb .lb-spalten { display: none !important; }
#screen-start .dlb .lb-kopf { margin-bottom: 8px; }
.dlb { width: 100%; text-align: left; }
.dlb[hidden] { display: none; }
