/* ==========================================================
   Graniej - porownywarka cen gier PC
   Paleta zweryfikowana pod katem kontrastow WCAG 2.1 AA
   ========================================================== */

:root {
    color-scheme: light;
    --bg:             #f4f6f9;
    --surface:        #ffffff;
    --panel:          #1a2130;
    --panel-hi:       #273044;
    --panel-text:     #c9d1de;
    --panel-dim:      #9aa5b6;
    --accent:         #3a5bd9;   /* tekst, ikony, obrysy */
    --accent-solid:   #3a5bd9;   /* tlo przyciskow z bialym tekstem */
    --accent-hover:   #2f4bbb;
    --accent-bg:      #e9edfd;
    --text:           #131922;
    --text-dim:       #55606f;
    --border:         #dde2ea;
    --border-ui:      #767f8f;
    --zielony:        #0f6e56;   /* tekst na zielony-bg */
    --zielony-solid:  #0f6e56;   /* tlo plakietek z bialym tekstem */
    --zielony-bg:     #e3f3ee;
    --zloty:          #8a6209;
    --zloty-bg:       #fdf3dd;
    --reklama-bg:     #e8ebf0;
    --reklama-border: #b3bcc9;
    --szkielet-a:     #eef1f5;
    --szkielet-b:     #e2e6ec;
    --cien:           rgba(19, 25, 34, 0.16);
    --radius:         10px;
}

/* Paleta ciemna - kontrasty zweryfikowane tak samo jak jasna (min. 4,5:1 tekst, 3:1 UI) */
[data-theme="dark"] {
    color-scheme: dark;
    --bg:             #0e1219;
    --surface:        #161c27;
    --panel:          #090c12;
    --panel-hi:       #1a2130;
    --panel-text:     #c9d1de;
    --panel-dim:      #9aa5b6;
    --accent:         #8ea3f5;
    --accent-solid:   #3a5bd9;
    --accent-hover:   #4a6be3;
    --accent-bg:      #1c2648;
    --text:           #e8ecf3;
    --text-dim:       #a6b0c0;
    --border:         #252d3b;
    --border-ui:      #667485;
    --zielony:        #5fd3ae;
    --zielony-solid:  #0f6e56;
    --zielony-bg:     #10302a;
    --zloty:          #f0c060;
    --zloty-bg:       #3a2d0f;
    --reklama-bg:     #1b2230;
    --reklama-border: #3a4557;
    --szkielet-a:     #1b2230;
    --szkielet-b:     #232c3c;
    --cien:           rgba(0, 0, 0, 0.5);
}

/* Plynne przejscie miedzy motywami - tylko na czas przelaczania (klasa zdejmowana po 400 ms)
   i tylko dla tla oraz obramowan. Kolor tekstu celowo bez przejscia: Chrome potrafi
   zostawic dziedziczony "color" na starej wartosci, gdy zmienna CSS zmieni sie w trakcie. */
html.motyw-przejscie,
html.motyw-przejscie *,
html.motyw-przejscie *::before,
html.motyw-przejscie *::after {
    transition: background-color 0.35s ease, border-color 0.35s ease !important;
}

* { box-sizing: border-box; }

/* strona glowna nie ma filtrow - panel boczny znika, tresc sie rozszerza */
body.widok-start {
    grid-template-columns: minmax(0, 1fr) 316px;
    grid-template-areas:
        "header header"
        "navbar navbar"
        "main   aside"
        "footer footer";
}

body.widok-lista {
    grid-template-columns: 232px minmax(0, 1fr) 316px;
    grid-template-areas:
        "header  header  header"
        "navbar  navbar  navbar"
        "sidebar main    aside"
        "footer  footer  footer";
}

body.widok-start #sidebar,
body.widok-start .tylko-lista { display: none; }

body {
    display: grid;
    height: 100vh;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

/* ---------- dostepnosc ---------- */

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 12px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--accent-solid);
    color: #ffffff;
    font-weight: 500;
    border-radius: 0 0 var(--radius) var(--radius);
    text-decoration: none;
    transition: top 0.15s;
}

.skip-link:focus { top: 0; }

:where(a, button, input, select, [tabindex]):focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

#sidebar :where(a, button, input):focus-visible {
    outline-color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- header ---------- */

header {
    grid-area: header;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.marka { display: flex; align-items: center; gap: 11px; }

.marka-znak {
    width: 30px; height: 30px;
    fill: var(--accent);
    flex-shrink: 0;
}

.marka-nazwa {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.marka-opis {
    margin: 0;
    font-size: 12px;
    color: var(--text-dim);
}

.waluta-box { display: flex; align-items: center; gap: 8px; }
.waluta-box label { font-size: 13px; color: var(--text-dim); }

/* ---------- kontrolki ---------- */

select, input[type="search"] {
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-ui);
    border-radius: 7px;
}

select { cursor: pointer; padding-right: 28px; }

/* ---------- navbar ---------- */

#navbar {
    grid-area: navbar;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.pole-szukaj { position: relative; flex: 0 1 340px; }

.pole-szukaj input { width: 100%; padding-left: 36px; }

.ikona-lupa {
    position: absolute;
    left: 11px; top: 50%;
    transform: translateY(-50%);
    width: 17px; height: 17px;
    fill: var(--text-dim);
    pointer-events: none;
}

.pole-sort { display: flex; align-items: center; gap: 8px; }
.pole-sort label { font-size: 13px; color: var(--text-dim); }

.sidebar-belka {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--panel-hi);
}

.sidebar-belka p { margin: 0; font-size: 15px; font-weight: 600; color: #ffffff; }

.sidebar-x {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    background: var(--panel-hi);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.sidebar-x svg { width: 18px; height: 18px; fill: #ffffff; }

.zaslona { display: none; }
@media (max-width: 780px) { .zaslona { display: block; } }

.btn-filtry {
    display: none;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-ui);
    border-radius: 7px;
    cursor: pointer;
}

.btn-filtry svg { width: 17px; height: 17px; fill: var(--text); }

/* ---------- sidebar ---------- */

#sidebar {
    grid-area: sidebar;
    background: var(--panel);
    color: var(--panel-text);
    padding: 18px 14px 24px;
    overflow-y: auto;
}

.filtr-grupa { margin-bottom: 24px; }

.side-tytul {
    margin: 0 0 9px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--panel-dim);
}

.side-tytul label { cursor: pointer; }

.filtry { list-style: none; margin: 0; padding: 0; }

.filtry button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 2px;
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    color: var(--panel-text);
    background: none;
    border: none;
    border-radius: 7px;
    cursor: pointer;
}

.filtry button:hover { background: var(--panel-hi); }

.filtry button[aria-pressed="true"] {
    background: var(--panel-hi);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--panel-text);
}

.ikona-sklep {
    width: 19px; height: 19px;
    fill: currentColor;
    flex-shrink: 0;
}

.monogram {
    width: 19px; height: 19px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    background: var(--panel-text);
    color: var(--panel);
}

.suwak { padding: 0 6px; }

.suwak input[type="range"] {
    width: 100%;
    accent-color: #8fa4ee;
    margin: 4px 0 6px;
}

.suwak output {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.ptaszek {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
}

.ptaszek:hover { background: var(--panel-hi); }
.ptaszek input { accent-color: #8fa4ee; width: 16px; height: 16px; }

.btn-reset {
    width: 100%;
    padding: 9px;
    font-size: 13px;
    font-family: inherit;
    color: var(--panel-text);
    background: none;
    border: 1px solid #4a5568;
    border-radius: 7px;
    cursor: pointer;
}

.btn-reset:hover { background: var(--panel-hi); }

/* ---------- glowna tresc ---------- */

main {
    grid-area: main;
    background: var(--surface);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 18px 22px 28px;
    overflow-y: auto;
}

.sekcja-naglowek {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sekcja-naglowek h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
}

.licznik { margin: 0; font-size: 13px; color: var(--text-dim); }

.siatka {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

/* ---------- kafelek gry ---------- */

.gra {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.gra:hover {
    border-color: var(--border-ui);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px var(--cien);
}

.gra:focus-within { border-color: var(--accent); }

.gra-obraz {
    position: relative;
    height: 118px;
    background: var(--panel);
}

.gra-obraz img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.rabat {
    position: absolute;
    top: 8px; left: 8px;
    padding: 3px 7px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: var(--zielony-solid);
    border-radius: 5px;
}

.btn-obserwuj {
    position: absolute;
    top: 6px; right: 6px;
    z-index: 2;
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    background: rgba(26, 33, 48, 0.82);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #ffffff;
}

.btn-obserwuj svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn-obserwuj[aria-pressed="true"] { color: #ffd166; }
.btn-obserwuj[aria-pressed="true"] svg { fill: currentColor; }

.gra-tresc {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 9px;
    padding: 11px 12px 13px;
}

.gra-tytul {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.gra-tytul button {
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gra-tytul button::after { content: ""; position: absolute; inset: 0; }
.gra-tytul button:hover { text-decoration: underline; }

.gra-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.plakietka {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.plakietka-ocena { background: var(--zielony-bg); color: var(--zielony); }
.plakietka-min   { background: var(--zloty-bg); color: var(--zloty); }

.gra-dol {
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.cena-blok { display: flex; flex-direction: column; gap: 1px; }

.cena-etykieta {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.cena-teraz { font-size: 18px; font-weight: 700; line-height: 1.1; }
.cena-stara { font-size: 13px; color: var(--text-dim); text-decoration: line-through; }

.gra-sklep {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
}

.gra-sklep svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- stany ---------- */

.stan {
    grid-column: 1 / -1;
    padding: 54px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 15px;
    line-height: 1.6;
}

.stan strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

.szkielet {
    height: 232px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--szkielet-a) 25%, var(--szkielet-b) 50%, var(--szkielet-a) 75%);
    background-size: 200% 100%;
    animation: puls 1.3s infinite;
}

@keyframes puls {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ---------- aside / reklamy ---------- */

aside {
    grid-area: aside;
    padding: 18px 16px;
    overflow-y: auto;
}

.reklama-etykieta {
    margin: 0 0 8px;
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.reklama {
    width: 100%;
    max-width: 300px;
    height: 250px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--reklama-bg);
    border: 1px dashed var(--reklama-border);
    border-radius: var(--radius);
}

.reklama-wysoka { height: 600px; }

/* po wpieciu prawdziwej reklamy znika ramka i szare tlo placeholdera */
.reklama-aktywna {
    background: none;
    border: none;
    display: block;
}

/* ---------- footer ---------- */

footer {
    grid-area: footer;
    background: var(--panel);
    color: var(--panel-dim);
    padding: 12px 20px;
    font-size: 12.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

footer p { margin: 0; }
footer strong { color: var(--panel-text); }
footer a { color: var(--panel-text); }

/* ---------- modal z ofertami ---------- */

#modal {
    width: min(560px, calc(100vw - 32px));
    padding: 0;
    border: none;
    border-radius: 14px;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 18px 50px var(--cien);
}

#modal::backdrop { background: rgba(19, 25, 34, 0.55); }

.modal-belka {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.modal-belka h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.3; }

.modal-podtytul { margin: 4px 0 0; font-size: 12.5px; color: var(--text-dim); }

.modal-x {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: none;
    border: 1px solid var(--border-ui);
    border-radius: 7px;
    cursor: pointer;
}

.modal-x svg { width: 17px; height: 17px; fill: var(--text); }
.modal-x:hover { background: var(--bg); }

.modal-tresc { padding: 16px 20px 20px; max-height: 60vh; overflow-y: auto; }

.oferta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
}

.oferta:hover { border-color: var(--accent); background: var(--accent-bg); }
.oferta-najlepsza { border-color: var(--zielony); background: var(--zielony-bg); }

.oferta-sklep { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.oferta-sklep svg { width: 19px; height: 19px; fill: currentColor; }

.oferta-cena { margin-left: auto; text-align: right; }
.oferta-cena b { display: block; font-size: 16px; }
.oferta-cena span { font-size: 12px; color: var(--text-dim); text-decoration: line-through; }

.znacznik {
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    background: var(--zielony-solid);
    color: #ffffff;
}

.znacznik-rabat { background: var(--bg); color: var(--text-dim); }

.modal-fakt {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    background: var(--bg);
    border-radius: 9px;
}

.modal-fakt-ok { background: var(--zielony-bg); color: var(--zielony); }

/* ---------- responsywnosc ---------- */

@media (max-width: 1100px) {
    body {
        grid-template-columns: 210px minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "header  header"
            "navbar  navbar"
            "sidebar main"
            "aside   aside"
            "footer  footer";
    }

    aside { display: flex; gap: 16px; align-items: flex-start; border-top: 1px solid var(--border); }
    .reklama-etykieta { display: none; }
    .reklama-wysoka { display: none; }
}

@media (max-width: 780px) {
    /* Oba widoki jawnie - selektor z klasa (body.widok-lista) jest silniejszy
       niz samo "body", wiec bez tego desktopowe trzy kolumny zostawaly na telefonie. */
    body,
    body.widok-start,
    body.widok-lista {
        height: auto;
        min-height: 100vh;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, auto) auto auto;
        grid-template-areas: "header" "navbar" "main" "aside" "footer";
    }

    main { overflow-y: visible; border-left: none; border-right: none; }

    .pole-szukaj { flex: 1 1 100%; }
    .btn-filtry { display: inline-flex; }

    /* ---- panel filtrow jako szuflada z lewej ---- */
    #sidebar {
        display: block;
        position: fixed;
        top: 0; bottom: 0; left: 0;
        z-index: 80;
        width: min(310px, 86vw);
        overflow-y: auto;
        padding-top: 14px;
        transform: translateX(-100%);
        visibility: hidden;
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.35);
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.3s;
    }

    body.widok-lista #sidebar.jest-otwarty {
        transform: none;
        visibility: visible;
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
    }

    .sidebar-belka { display: flex; }

    .zaslona {
        position: fixed;
        inset: 0;
        z-index: 75;
        background: rgba(9, 12, 18, 0.55);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    }

    body.szuflada-otwarta .zaslona {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease, visibility 0s;
    }

    body.szuflada-otwarta { overflow: hidden; }
}


/* ==========================================================
   Nowe komponenty: naglowek, zakladki, panel ceny, karuzele
   ========================================================== */

/* ---------- marka jako link ---------- */

.marka { text-decoration: none; color: inherit; }
.marka > span { display: flex; flex-direction: column; }
.marka-nazwa { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.marka-opis { font-size: 12px; color: var(--text-dim); }

.header-ustawienia { display: flex; align-items: center; gap: 16px; margin-left: auto; }

.pole-select { display: flex; align-items: center; gap: 8px; }
.pole-select label { font-size: 13px; color: var(--text-dim); white-space: nowrap; }

/* ---------- zakladki widokow ---------- */

.zakladki { display: flex; gap: 4px; }

.zakladka {
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-dim);
    background: none;
    border: none;
    border-radius: 7px;
    cursor: pointer;
}

.zakladka:hover { background: var(--bg); color: var(--text); }

.zakladka[aria-selected="true"] {
    color: var(--accent);
    background: var(--accent-bg);
    font-weight: 600;
}

/* ---------- rozwijany panel ceny ---------- */

.cena-dropdown { position: relative; }

#btn-cena {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-ui);
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
}

#btn-cena:hover { background: var(--bg); }
#btn-cena svg { width: 18px; height: 18px; fill: var(--text-dim); }
#btn-cena[aria-expanded="true"] { border-color: var(--accent); }

.panel-cena {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    width: 288px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px var(--cien);
}

.panel-tytul {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.panel-pola { display: flex; align-items: flex-end; gap: 8px; }

.panel-pola label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    font-size: 12px;
    color: var(--text-dim);
}

.panel-pola input {
    width: 100%;
    height: 36px;
    padding: 0 9px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-ui);
    border-radius: 7px;
}

.panel-waluta { padding-bottom: 9px; font-size: 13px; font-weight: 600; color: var(--text-dim); }

.panel-cena input[type="range"] { width: 100%; margin: 14px 0 10px; accent-color: var(--accent); }

.panel-stopka { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-stopka output { font-size: 13px; font-weight: 600; }

.btn-glowny {
    padding: 8px 15px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    color: #ffffff;
    background: var(--accent-solid);
    border: none;
    border-radius: 7px;
    cursor: pointer;
}

.btn-glowny:hover { background: var(--accent-hover); }

/* ---------- rzedy i karuzele ---------- */

.rzad { margin-bottom: 34px; }

.rzad-belka {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 13px;
}

.rzad-belka h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.rzad-opis { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }

.rzad-strzalki { display: flex; gap: 6px; flex-shrink: 0; }

.strzalka {
    width: 34px; height: 34px;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--border-ui);
    border-radius: 50%;
    cursor: pointer;
}

.strzalka svg { width: 20px; height: 20px; fill: var(--text); }
.strzalka:hover:not(:disabled) { background: var(--bg); }
.strzalka:disabled { opacity: 0.35; cursor: default; }

.link-wiecej {
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.link-wiecej:hover { background: var(--accent-bg); }

.tor {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding: 2px 2px 10px;
    scrollbar-width: thin;
}

.tor > .gra {
    flex: 0 0 208px;
    scroll-snap-align: start;
}

.tor-duzy > .gra { flex: 0 0 296px; }
.tor-duzy .gra-obraz { height: 166px; }

.szkielet-tor { flex: 0 0 208px; }
.tor-duzy .szkielet-tor { flex: 0 0 296px; height: 280px; }

.plakietka-rec { background: var(--accent-bg); color: var(--accent); }

/* ---------- responsywnosc nowych elementow ---------- */

@media (max-width: 1100px) {
    body.widok-start {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "header" "navbar" "main" "aside" "footer";
    }
}

@media (max-width: 780px) {
    .zakladki { order: -1; width: 100%; }
    .header-ustawienia { gap: 10px; flex-wrap: wrap; }
    .pole-select label { display: none; }
    .rzad-belka h2 { font-size: 18px; }
    .tor-duzy > .gra { flex: 0 0 250px; }
    .panel-cena { width: min(288px, calc(100vw - 40px)); }
}


/* ==========================================================
   Przelacznik motywu: dzien / noc
   ========================================================== */

.motyw {
    position: relative;
    flex-shrink: 0;
    width: 62px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 16px;
    cursor: pointer;
}

.motyw:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.motyw-tor {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(180deg, #74bbff 0%, #3d8de6 100%);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.22);
    transition: background 0.45s ease;
}

[data-theme="dark"] .motyw-tor { background: linear-gradient(180deg, #1e2447 0%, #0b0f24 100%); }

/* chmurki - widoczne tylko w dzien */
.motyw-chmury {
    position: absolute;
    right: 9px;
    bottom: 6px;
    width: 22px;
    height: 8px;
    background: #ffffff;
    border-radius: 8px;
    opacity: 0.95;
    transition: transform 0.45s ease, opacity 0.35s ease;
}

.motyw-chmury::before {
    content: "";
    position: absolute;
    left: 5px; top: -5px;
    width: 10px; height: 10px;
    background: #ffffff;
    border-radius: 50%;
}

[data-theme="dark"] .motyw-chmury { transform: translateY(16px); opacity: 0; }

/* gwiazdy - pojawiaja sie w nocy */
.motyw-gwiazdy {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, #ffffff 40%, transparent 60%),
        radial-gradient(circle, #ffffff 40%, transparent 60%),
        radial-gradient(circle, #ffffff 40%, transparent 60%),
        radial-gradient(circle, #ffffff 40%, transparent 60%);
    background-size: 3px 3px, 2px 2px, 2px 2px, 2.5px 2.5px;
    background-position: 12px 8px, 22px 18px, 8px 21px, 19px 6px;
    background-repeat: no-repeat;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.4s ease 0.05s, transform 0.45s ease;
}

[data-theme="dark"] .motyw-gwiazdy { opacity: 1; transform: none; }

/* galka: slonce w dzien, ksiezyc w nocy */
.motyw-galka {
    position: absolute;
    top: 4px; left: 4px;
    width: 24px; height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffd75e;
    box-shadow: 0 0 0 4px rgba(255, 215, 94, 0.28), 0 2px 4px rgba(0, 0, 0, 0.28);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.45s ease, box-shadow 0.45s ease;
}

[data-theme="dark"] .motyw-galka {
    transform: translateX(30px);
    background: #eef1f9;
    box-shadow: 0 0 0 4px rgba(238, 241, 249, 0.14), 0 2px 4px rgba(0, 0, 0, 0.45);
}

.motyw-galka svg {
    position: absolute;
    width: 15px; height: 15px;
    transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.motyw-slonce  { color: #a66a0c; opacity: 1; transform: rotate(0) scale(1); }
.motyw-ksiezyc { color: #3c4560; opacity: 0; transform: rotate(-110deg) scale(0.5); }

[data-theme="dark"] .motyw-slonce  { opacity: 0; transform: rotate(110deg) scale(0.5); }
[data-theme="dark"] .motyw-ksiezyc { opacity: 1; transform: rotate(0) scale(1); }


/* ==========================================================
   Baner mobilny przyklejony do dolu (tylko ekrany <= 780px)
   Wysokosc 50px = standardowa jednostka 320x50, plus margines
   bezpieczenstwa pod "notch" / pasek gestow w iPhone.
   ========================================================== */

.reklama-dol { display: none; }

@media (max-width: 780px) {
    .reklama-dol {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 60;
        height: calc(50px + 12px + env(safe-area-inset-bottom, 0px));
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 16px var(--cien);
    }

    .reklama-mobilna {
        width: 320px;
        max-width: calc(100vw - 60px);
        height: 50px;
        margin: 0;
        border-radius: 6px;
        font-size: 11px;
    }

    .reklama-dol-x {
        flex-shrink: 0;
        width: 34px; height: 34px;
        display: grid; place-items: center;
        background: var(--bg);
        border: 1px solid var(--border-ui);
        border-radius: 50%;
        cursor: pointer;
    }

    .reklama-dol-x svg { width: 16px; height: 16px; fill: var(--text); }

    /* tresc nie moze chowac sie pod banerem - odsuwamy dol strony */
    body { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

    body.bez-banera { padding-bottom: 0; }
    body.bez-banera .reklama-dol { display: none; }
}
