:root {
  --bg: #f6f6fb;
  --bg-elev: #ffffff;
  --bg-soft: #eeeef6;
  --border: #dddcea;
  --text: #17162a;
  --text-muted: #5f5d78;
  --accent: #5b4bf0;
  --accent-soft: #e9e6ff;
  --accent-text: #ffffff;
  --mobile: #0f8a5f;
  --desktop: #b55d00;
  --web: #1d6fd1;
  --console: #6b6a80;
  --shadow: 0 1px 2px rgba(20, 18, 50, .06), 0 6px 24px rgba(20, 18, 50, .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0e0d17;
  --bg-elev: #171624;
  --bg-soft: #201f31;
  --border: #2c2a42;
  --text: #ecebf7;
  --text-muted: #a3a1bd;
  --accent: #8b7dff;
  --accent-soft: #2a2550;
  --accent-text: #0e0d17;
  --mobile: #3ccf91;
  --desktop: #ffa64d;
  --web: #63a8ff;
  --console: #a3a1bd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code, kbd { font-family: var(--mono); font-size: .9em; }
code { background: var(--bg-soft); padding: .1em .35em; border-radius: 5px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: 8px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo {
  display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--accent); color: var(--accent-text);
  font-family: var(--mono); font-weight: 700; font-size: 13px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text small { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
:root[data-theme="dark"] .i-moon, :root[data-theme="light"] .i-sun { display: none; }

/* Hero */
.hero { padding: 40px 0 20px; }
.hero h1 { font-size: clamp(26px, 4.2vw, 42px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; }
.hero p { color: var(--text-muted); max-width: 680px; margin: 0; font-size: 17px; }
.accent { color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.stat {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; min-width: 0; flex: 1 1 120px; max-width: 200px;
}
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-muted); font-size: 13px; }

/* Toolbar */
.toolbar {
  position: sticky; top: 64px; z-index: 10;
  background: var(--bg);
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 0 14px; height: 48px; color: var(--text-muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.search kbd { border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 12px; }
@media (max-width: 600px) { .search kbd { display: none; } }

.filters { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.result-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 14px; color: var(--text-muted); min-height: 22px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* Results */
.session-block { margin-bottom: 30px; }
.session-title {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 20px; margin: 0 0 12px;
}
.session-title small { color: var(--text-muted); font-weight: 400; font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.card.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.code {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  padding: 3px 8px; border-radius: 6px; border: 0; cursor: pointer;
}
.code:hover { text-decoration: underline; }
.variant { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.card h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.note { font-size: 13px; color: var(--text-muted); font-style: italic; margin: -6px 0 0; }

.parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.parts li { display: grid; grid-template-columns: auto 1fr; gap: 8px; font-size: 14px; align-items: baseline; }
.type {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 5px; border: 1px solid currentColor; white-space: nowrap;
}
.t-konsolowa { color: var(--console); }
.t-mobilna { color: var(--mobile); }
.t-desktopowa { color: var(--desktop); }
.t-webowa { color: var(--web); }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 12px; background: var(--bg-soft); color: var(--text-muted);
  border: 0; border-radius: 6px; padding: 2px 8px; cursor: pointer; font-family: inherit;
}
.tag:hover { color: var(--text); }

.files { border-top: 1px dashed var(--border); padding-top: 12px; display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.file-row .fname { font-family: var(--mono); font-size: 13px; }
.file-row .fnote { color: var(--text-muted); font-size: 12px; width: 100%; }
.pass {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 7px;
  padding: 2px 4px 2px 8px; color: var(--text); cursor: pointer;
}
.pass:hover { border-color: var(--accent); }
.pass svg { opacity: .7; }
.no-files { font-size: 13px; color: var(--text-muted); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 10px; padding: 8px 13px; font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn small { font-weight: 400; opacity: .75; font-size: 12px; }

.empty { text-align: center; padding: 60px 16px; color: var(--text-muted); }
.empty b { display: block; font-size: 18px; color: var(--text); margin-bottom: 6px; }

/* Info */
.info { margin: 50px 0 30px; }
.info h2 { font-size: 22px; margin: 32px 0 14px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.info-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.info-card h3 { margin: 0 0 8px; font-size: 16px; }
.info-card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.extras { display: grid; gap: 10px; }
.extra {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px;
}
.extra p { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; }

.footer { border-top: 1px solid var(--border); padding: 24px 0 40px; font-size: 14px; }
.footer p { margin: 0 0 6px; }
.muted { color: var(--text-muted); }

/* PDF viewer */
.viewer {
  width: min(1100px, 100vw - 24px); height: min(92vh, 1200px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--text);
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(10, 8, 25, .6); backdrop-filter: blur(3px); }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.viewer-actions { display: flex; gap: 8px; align-items: center; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #525659; }
@media (max-width: 600px) { #viewer-open { display: none; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .toolbar { position: static; }
  .hero { padding-top: 26px; }
}

/* Popup */
.sig {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--accent) 25%, transparent), rgba(8, 6, 20, .6) 70%);
  backdrop-filter: blur(4px);
  animation: sig-fade .3s ease both;
}
.sig.out { animation: sig-fade .35s ease reverse both; }
.sig-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  width: min(340px, 100%);
  padding: 30px 26px 24px;
  border-radius: 22px;
  background: var(--bg-elev);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 6px var(--accent-soft), 0 24px 70px rgba(10, 8, 30, .5);
  animation: sig-pop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.sig.out .sig-card { animation: sig-pop .35s ease reverse both; }
.sig-card .brand-logo { width: 64px; height: 64px; font-size: 17px; border-radius: 16px; margin-bottom: 16px; }
.sig-card small { color: var(--text-muted); font-size: 14px; }
.sig-name {
  display: block; font-size: 38px; line-height: 1.15; margin: 2px 0 20px; letter-spacing: .02em;
  font-family: var(--mono);
  background: linear-gradient(90deg, var(--accent), var(--web), var(--mobile), var(--accent));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sig-shine 2.4s linear infinite;
}
.sig-links { display: flex; gap: 10px; width: 100%; }
.sig-link {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; border-radius: 12px; font-weight: 600; font-size: 15px;
  text-decoration: none; color: #fff; transition: transform .15s, filter .15s;
}
.sig-link:hover { transform: translateY(-2px); filter: brightness(1.12); }
.sig-link:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.sig-link.gh { background: #24292f; }
.sig-link.dc { background: #5865f2; }
:root[data-theme="dark"] .sig-link.gh { background: #33383f; }
.sig-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 9px; border: 0;
  background: transparent; color: var(--text-muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.sig-close:hover { background: var(--bg-soft); color: var(--text); }
@keyframes sig-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sig-pop { from { opacity: 0; transform: scale(.85) translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes sig-shine { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) {
  .sig, .sig-card, .sig-name, .sig.out, .sig.out .sig-card { animation-duration: .01s; }
}
