/* Liga FPL 4x4 — tablica statystyczna.
   Lekkosc bierze sie z jasnych kafelkow na miekkim granacie i z odstepow
   zamiast kresek. Natezenie zieleni koduje wartosc punktowa.
   Bursztyn i blekit oznaczaja strony meczu — jedyna para czytelna przy
   kazdym typie daltonizmu. */

:root {
    --ink: #121926;
    --panel: #1a2333;
    --raise: #222c3e;
    --line: #2a3546;

    --text: #e9edf5;
    --muted: #8d9aae;
    --faint: #616e83;

    --mine: #f5a524;
    --mine-soft: rgba(245, 165, 36, 0.12);
    --theirs: #38bdf8;
    --theirs-soft: rgba(56, 189, 248, 0.12);

    --ui: 'Manrope', system-ui, -apple-system, sans-serif;

    --r: 10px;
    --r-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font-family: var(--ui);
    font-size: 13px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- nawigacja ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 12px 24px;
    background: var(--panel);
}

.brand {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
}

.topbar nav { display: flex; gap: 8px; }

.topbar nav a {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 5px 11px;
    border-radius: 99px;
}

.topbar nav a:hover { background: var(--raise); color: var(--text); }

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 22px 24px 72px;
}

/* ---------- typografia ---------- */

h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 14px; }

h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 26px 0 8px;
}

h3 { font-size: 12px; font-weight: 700; margin: 0 0 8px; }

.hint { color: var(--muted); margin: 0; font-size: 12px; }

/* ---------- pasek meczu ---------- */

.panel {
    background: var(--panel);
    border-radius: var(--r);
    padding: 14px 16px;
    margin-bottom: 6px;
}

.scoreline {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 9px;
    font-size: 18px;
    font-weight: 800;
}

.scoreline .mine { color: var(--mine); }
.scoreline .opponent { color: var(--theirs); }
.scoreline .record { color: var(--text); font-size: 22px; }

/* podzial 28 punktow ligowych; kreska w miejscu remisu */
.spine {
    display: flex;
    height: 6px;
    border-radius: 99px;
    overflow: hidden;
    background: var(--raise);
    position: relative;
    margin: 0 0 9px;
}

.spine__mine { background: var(--mine); }
.spine__opponent { background: var(--theirs); }
.spine::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--panel);
}

.stale { color: var(--faint); font-size: 11px; margin: 4px 0 0; }

/* Wiek danych i przycisk odswiezania czytamy razem, wiec stoja w jednym
   wierszu. Przycisk jest wyciszony — to nie jest glowna akcja strony. */
.freshness {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 0;
}

.refresh {
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.refresh:hover { border-color: var(--mine); color: var(--mine); }

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 99px;
    background: var(--raise);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.flash {
    padding: 10px 14px;
    margin: 0 0 16px;
    border-radius: var(--r);
    background: var(--panel);
    border-left: 3px solid var(--muted);
    font-size: 12px;
}

.flash--success { border-left-color: var(--mine); }
.flash--error { border-left-color: var(--theirs); }

/* ---------- wartosci punktowe ---------- */

/* Jednolite pudelko o stalej szerokosci — wszystkie wartosci ustawiaja sie
   w jednej pionowej kolumnie niezaleznie od liczby cyfr i od mnoznika. */
.pts, .chip--wait {
    display: inline-block;
    min-width: 34px;
    padding: 2px 6px;
    border-radius: var(--r-sm);
    background: var(--raise);
    font-weight: 700;
    text-align: center;
}

.pts { background: #2b3749; color: var(--text); }
.pts--zero { background: var(--raise); color: var(--faint); font-weight: 400; }
.pts--neg { color: #ff8b8b; }

/* Zawodnik, ktory jeszcze nie wyszedl na boisko: puste, obrysowane pole.
   Rozniac ma sie od zera nie odcieniem, tylko brakiem wypelnienia — inaczej
   przy szesnastu wierszach nie widac, na kogo jeszcze czekamy. */
.chip--wait {
    background: transparent;
    border: 1px dashed #3a465c;
    color: #4d586e;
    font-weight: 400;
}

/* slot mnoznika istnieje zawsze, takze pusty, zeby pudelka sie nie przesuwaly */
.ptcell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.ptcell .mult { width: 16px; flex: none; text-align: right; }

/* trzy poziomy czytelnosci: zagral > lawka > jeszcze nie zagral */
.squad-picks .bench td { opacity: 0.8; }
.waiting td, .squad-picks .waiting td { opacity: 0.42; }

.waiting-count {
    font-size: 10px;
    font-weight: 700;
    color: var(--faint);
    border: 1px dashed var(--line);
    border-radius: 99px;
    padding: 0 6px;
    white-space: nowrap;
}

.ratio {
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
}

.bucket .club { color: var(--faint); font-size: 10px; margin-left: 4px; }

/* ---------- tabele ---------- */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 13px;
}

thead th {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
    text-align: left;
    padding: 0 10px 2px;
    white-space: nowrap;
}

tbody td { padding: 7px 10px; background: var(--panel); }
tbody td:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
tbody td:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.num, th.num { text-align: right; }

.standings tbody td:first-child { position: relative; padding-left: 16px; color: var(--faint); font-weight: 700; }

.standings tbody tr.side--mine td:first-child::before,
.standings tbody tr.side--opponent td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
}

.standings tbody tr.side--mine td:first-child::before { background: var(--mine); }
.standings tbody tr.side--opponent td:first-child::before { background: var(--theirs); }

/* Strone niesie wylacznie paseczek na krawedzi. Barwienie calego wiersza
   dokladalo drugi, konkurujacy sygnal i robilo z tabeli szachownice. */
.standings tbody td:nth-child(2) { font-weight: 600; width: 100%; }
.standings tbody td, .standings thead th { white-space: nowrap; }

/* w tabeli kolejki liczby stoja w swoich kolumnach — pudelka sa tu zbedne */
.standings .pts {
    background: transparent;
    padding: 0;
    min-width: 0;
    border-radius: 0;
}

.fixtures tbody tr:hover td { background: var(--raise); }
.fixtures a { color: var(--mine); text-decoration: none; font-weight: 600; }
.fixtures a:hover { text-decoration: underline; }

/* ---------- roznice w skladach ---------- */

.buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

.bucket { background: var(--panel); border-radius: var(--r); padding: 12px 14px; }
.bucket--mine h3 { color: var(--mine); }
.bucket--opponent h3 { color: var(--theirs); }
.bucket--shared h3 { color: var(--muted); }
.bucket tbody td { background: transparent; padding: 3px 6px; }
.bucket tbody td:first-child { padding-left: 0; }

/* ---------- sklady: osiem kolumn ---------- */

.squads__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 16px 0 7px;
}

.squads__label.side--mine { color: var(--mine); }
.squads__label.side--opponent { color: var(--theirs); }

.squads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }

.squad-picks {
    background: var(--panel);
    border-radius: var(--r);
    padding: 0 10px 8px;
    min-width: 0;
}

.squad-picks summary {
    cursor: pointer;
    padding: 10px 0 8px;
    list-style: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}

.squad-picks summary::-webkit-details-marker { display: none; }

.squad-picks__name {
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.squad-picks__total { font-size: 16px; font-weight: 800; flex: none; }
.squad-picks.side--mine .squad-picks__total { color: var(--mine); }
.squad-picks.side--opponent .squad-picks__total { color: var(--theirs); }

.squad-picks table { font-size: 12px; border-spacing: 0 2px; }
.squad-picks tbody td { background: transparent; padding: 2px 0; }
.squad-picks tbody td:first-child { border-radius: 0; }
.squad-picks tbody td:last-child { border-radius: 0; }

.squad-picks .pos { width: 24px; color: var(--faint); font-size: 10px; font-weight: 700; }
.squad-picks .club { color: var(--faint); font-size: 10px; margin-left: 4px; }

.squad-picks .cap {
    display: inline-block;
    min-width: 13px;
    padding: 0 3px;
    border-radius: 3px;
    background: var(--mine);
    color: #16110a;
    font-size: 9px;
    font-weight: 800;
    text-align: center;
}

.squad-picks .cap--v { background: var(--raise); color: var(--muted); }
.squad-picks .mult { color: var(--faint); font-size: 10px; margin-left: 3px; }

/* rozbicie punktow przy nazwisku: gole, asysty, czyste konto, bonus, wklad
   defensywny — pokazywane tylko gdy niezerowe, wiec kolumna zostaje czytelna */

/* Rezerwowi jako osobny, wcisniety blok — tlo oddziela ich od jedenastki
   mocniej niz kreska. Przy chipie z grajaca lawka blok nie powstaje wcale,
   bo wszyscy licza sie do wyniku. */
.benchblock {
    background: var(--ink);
    border-radius: var(--r-sm);
    padding: 5px 8px 7px;
    margin: 8px -2px 2px;
}

.benchblock__label {
    margin: 0 0 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

.benchblock .pts { background: #232e3e; }

/* ---------- formularze ---------- */

.form-grid { display: grid; gap: 12px; max-width: 400px; margin-bottom: 16px; }

.form-grid label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}

.form-grid input {
    width: 100%;
    padding: 9px 12px;
    background: var(--panel);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.form-grid input:focus { outline: none; border-color: var(--mine); }

.button {
    padding: 9px 20px;
    background: var(--mine);
    border: 0;
    border-radius: var(--r-sm);
    color: #16110a;
    font-family: inherit;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
}

.button:hover { background: #ffb840; }

form ul { color: var(--theirs); font-size: 12px; padding-left: 16px; margin: 6px 0; }

/* ---------- dostepnosc i mniejsze ekrany ---------- */

:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }

@media (max-width: 1100px) { .squads { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 720px) {
    main { padding: 16px 14px 52px; }
    .buckets, .squads { grid-template-columns: 1fr; }
    .standings, .fixtures { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.bucket__meta {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--faint);
    margin-left: 6px;
}


/* Statystyki maja wlasna kolumne, zeby ustawialy sie w pionie miedzy wierszami
   i nie doklejaly do nazwiska. Kolejnosc jest stala: gol, asysta, bonus,
   czyste konto, wklad defensywny. Ikony pochodza z zestawu Lucide. */
/* Stala szerokosc kolumn: bez niej komorka nazwiska albo sie zwija do zera,
   albo rozpycha tabele. Nazwisko dostaje reszte miejsca i przycina sie
   wielokropkiem, zamiast lamac wiersz. */
.squad-picks table { table-layout: fixed; }
.squad-picks td.pos { width: 24px; }
.squad-picks td.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.squad-picks td.num { width: 54px; }

/* Najszersza mozliwa zawartosc to "3G 2A CS 18DC 3BP". Kolumna ma na to
   miejsce, a overflow ukryty jest zabezpieczeniem: gdy kiedys dojdzie kolejna
   statystyka, kolumna przytnie wlasna tresc, zamiast wylac sie na nazwisko. */
.squad-picks td.stats {
    width: 134px;
    white-space: nowrap;
    text-align: right;
    padding-right: 4px;
    overflow: hidden;
}

.squad-picks .stat {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}


.squad-picks .stat--goal { color: var(--text); }
.squad-picks .stat--assist { color: var(--muted); }
.squad-picks .stat--bonus { color: var(--mine); }
.squad-picks .stat--cs { color: var(--muted); }
.squad-picks .stat--dc { color: var(--faint); }
