:root {
  --bg: #f6f7f9; --surface: #fff; --surface-2: #f0f2f5; --text: #15181d; --muted: #66707c; --line: #e3e6ea;
  --accent: #0f766e; --accent-ink: #fff; --accent-soft: #e2f3f1;
  --deal: #c2410c; --deal-soft: #fdeee4; --low: #1d4ed8; --low-soft: #e5edfd; --ok: #15803d; --no: #b91c1c;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 2px 8px rgba(16,24,40,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1e232b; --text: #e8eaed; --muted: #9aa4b0; --line: #2a3039;
    --accent: #2dd4bf; --accent-ink: #062a27; --accent-soft: #123a37;
    --deal: #fb923c; --deal-soft: #3a2314; --low: #93b4ff; --low-soft: #1b2744; --ok: #4ade80; --no: #f87171;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
section { margin: 28px 0; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 1.15rem; text-decoration: none; color: var(--accent); }
.logo svg { width: 26px; height: 26px; }
.search { flex: 1; min-width: 200px; }
.search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 550; }
.nav a:hover { background: var(--surface-2); }
.nav a.hot { color: var(--deal); }

/* Hero */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center; margin-top: 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 70ch; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.kpis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpis li { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; }
.kpis b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.kpis span { color: var(--muted); font-size: .85rem; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 650;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 650; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head a { color: var(--accent); text-decoration: none; font-weight: 550; font-size: .92rem; }
.page-head { margin: 26px 0 8px; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card { min-width: 0; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.card-title { display: flex; flex-direction: column; line-height: 1.3; }
.card-title .brand { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card-meta { color: var(--muted); font-size: .82rem; }
.card-price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; }
.price { font-size: 1.25rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.perkg { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.card-foot { display: flex; justify-content: space-between; gap: 6px; font-size: .8rem; flex-wrap: wrap; }
.chg.down { color: var(--ok); font-weight: 600; }
.chg.up { color: var(--no); }

.badge { display: inline-block; font-size: .72rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.deal { background: var(--deal-soft); color: var(--deal); }
.badge.low { background: var(--low-soft); color: var(--low); }
.badge.cheap { background: var(--accent-soft); color: var(--accent); }
.badge.out { background: var(--surface-2); color: var(--muted); }

/* Swatches – szpula w kolorze filamentu */
.sw { --c: #999; display: inline-block; width: 18px; height: 18px; border-radius: 50%; flex: none; vertical-align: middle;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0 22%, transparent 23%), var(--c);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.sw.sm { width: 14px; height: 14px; }
.sw.lg { width: 44px; height: 44px; }
.sw.xl { width: 96px; height: 96px; }
.sw-silk { background: radial-gradient(circle at 50% 50%, var(--surface) 0 22%, transparent 23%),
  conic-gradient(from 30deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff), var(--c), color-mix(in srgb, var(--c) 70%, #000), var(--c)); }
.sw-multi { background: radial-gradient(circle at 50% 50%, var(--surface) 0 22%, transparent 23%),
  conic-gradient(#e63946, #f4a261, #e9c46a, #2a9d8f, #457b9d, #9b5de5, #e63946); }
.sw-clear { background: radial-gradient(circle at 50% 50%, var(--surface) 0 22%, transparent 23%),
  repeating-linear-gradient(45deg, #dfe7ea 0 4px, #f7fafb 4px 8px); }

/* Materials */
.mat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mat { display: flex; flex-direction: column; gap: 2px; padding: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; font-size: .85rem; }
.mat:hover { border-color: var(--accent); }
.mat-name { font-weight: 750; font-size: 1.1rem; }
.mat-min b { font-size: 1rem; color: var(--accent); }

.two-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.rank { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.rank ol { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.rank li { counter-increment: r; border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; }
.rank li a { display: flex; align-items: center; gap: 10px; padding: 8px 0; text-decoration: none; }
.rank li a::before { content: counter(r); color: var(--muted); width: 1.2em; font-variant-numeric: tabular-nums; }
.r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.r-price small { color: var(--muted); font-weight: 400; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { text-decoration: none; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.chip span { color: var(--muted); font-size: .8rem; }
.chip:hover { border-color: var(--accent); }

/* List layout */
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 22px; align-items: start; }
.filters { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 92px); overflow: auto; }
.filters summary { font-weight: 700; cursor: pointer; margin-bottom: 6px; }
.filters fieldset { border: 0; padding: 0; margin: 12px 0; }
.filters legend { font-weight: 650; font-size: .85rem; margin-bottom: 4px; }
.filters label { display: flex; align-items: center; gap: 6px; font-size: .88rem; padding: 2px 0; cursor: pointer; }
.filters .n { margin-left: auto; color: var(--muted); font-size: .78rem; }
.filters select { width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; }
.opts.scroll { max-height: 190px; overflow: auto; padding-right: 4px; }
.opts.tall { max-height: 280px; }
.opt-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 2px; font-weight: 650; }
.origin-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.origin { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.origin:hover { border-color: var(--accent); }
.origin .o-title { font-weight: 750; font-size: 1.1rem; }
.origin.pl { border-left: 4px solid #dc143c; }
.origin.eu { border-left: 4px solid #2f5fd0; }
.origin.swiat { border-left: 4px solid var(--muted); }
.badge.origin-pl { background: #fde8ec; color: #b3122f; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag-chips a { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); text-decoration: none; }
.reset { display: block; margin-top: 10px; font-size: .85rem; color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sorts { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; font-size: .88rem; color: var(--muted); }
.sorts a { text-decoration: none; padding: 4px 10px; border-radius: 999px; color: var(--text); border: 1px solid var(--line); background: var(--surface); }
.sorts a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pager { display: flex; justify-content: center; gap: 18px; align-items: center; margin: 24px 0; }
.pager a { color: var(--accent); font-weight: 600; }
.empty { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Product */
.crumbs { margin: 20px 0 0; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.p-head { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: start; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-top: 12px; box-shadow: var(--shadow); }
.attrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 14px 0 0; }
.attrs dt { font-size: .78rem; color: var(--muted); }
.attrs dd { margin: 0; font-weight: 600; }
.attrs a { text-decoration: none; }
.p-buy { text-align: right; min-width: 210px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.p-buy .big { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.p-buy .btn { margin-top: 8px; }
.verdict { border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); }
.verdict.v-good { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.verdict.v-bad { border-color: var(--deal); background: color-mix(in srgb, var(--deal) 7%, var(--surface)); }
.verdict h2 { font-size: 1.05rem; }
.verdict p { margin: 0 0 12px; }
.mini-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mini-stats li { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.mini-stats span { display: block; font-size: .78rem; color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.best td { background: var(--accent-soft); }
tr.dim td { opacity: .55; }
.ok { color: var(--ok); font-weight: 600; }
.no { color: var(--no); }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line-shop { opacity: .55; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--accent); fill-opacity: .25; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.hist { margin-top: 10px; }
.hist table { max-width: 420px; }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.color-link { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: .9rem; }
.color-link span:not(.sw):not(.badge) { flex: 1; }
.color-link:hover { border-color: var(--accent); }
.ad { margin: 24px 0; min-height: 90px; }
.prose { max-width: 760px; background: var(--surface); padding: 28px; border-radius: 18px; border: 1px solid var(--line); margin-top: 26px; }
.prose h2 { margin-top: 1.4em; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 22px 0 40px; font-size: .86rem; background: var(--surface); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .filters details:not([open]) summary { margin: 0; }
  .p-head { grid-template-columns: 1fr; }
  .p-head .sw.xl { width: 64px; height: 64px; }
  .p-buy { align-items: flex-start; text-align: left; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .nav { width: 100%; overflow-x: auto; }
  .top { position: static; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .badge { white-space: normal; }
  .card-top .sw.lg { width: 34px; height: 34px; }
  .card { padding: 10px; }
  .price { font-size: 1.05rem; }
  .card-badges .badge.cheap { display: none; }
}

@media (prefers-color-scheme: dark) {
  .sw { box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
}

@media (prefers-color-scheme: dark) {
  .badge.origin-pl { background: #3a1820; color: #ff8a9d; }
}
