/* ============================================================
   GAMINGPROSTO - design system
   "Tryb nocny gracza": grafit-fiolet nocy + elektryczny błękit
   + neon cyan + magenta. Chakra Petch (display) + Saira (body).
   Light mode domyślny (AdSense readability), dark via
   prefers-color-scheme. WCAG 2.1 AA (kontrast >= 4.5:1).
   ============================================================ */

:root {
  /* Light */
  --bg: #f5f4f8;
  --surface: #ffffff;
  --sidebar-bg: #eceaf2;
  --text: #1c1826;
  --muted: #585264;
  --border: #e0dce8;
  --accent: #2563eb;
  --accent-hi: #1d4ed8;
  --cyan: #0e7490;
  --cyan-soft: #e0f2f6;
  --magenta: #a21caf;
  --magenta-soft: #f6e4f8;
  --amber: #92610a;
  --amber-soft: #f8eeda;
  --red: #b91c1c;
  --red-soft: #fbe4e4;
  --green: #15803d;
  --green-soft: #e3f3e8;
  --hero-bg: #16121f;
  --hero-text: #e9e6f2;
  --hero-muted: #b8b0cc;
  --hero-accent: #22d3ee;
  --hero-magenta: #e879f9;
  --hero-blue: #3b82f6;
  --shadow-card: 0 1px 2px rgba(28,24,38,.05), 0 4px 14px rgba(28,24,38,.06);
  --shadow-card-hover: 0 6px 22px rgba(37,99,235,.14), 0 1px 3px rgba(28,24,38,.07);
  --radius: 10px;
  --radius-sm: 7px;
  --header-h: 62px;
  --sidebar-w: 268px;
  --transition: all .2s ease-out;
  --font-display: 'Chakra Petch', 'Segoe UI', sans-serif;
  --font-body: 'Saira', 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0b14;
    --surface: #15121f;
    --sidebar-bg: #12101b;
    --text: #e9e6f2;
    --muted: #a49dbb;
    --border: #262138;
    --accent: #3b82f6;
    --accent-hi: #60a5fa;
    --cyan: #22d3ee;
    --cyan-soft: #122c33;
    --magenta: #e879f9;
    --magenta-soft: #311a36;
    --amber: #e0b45c;
    --amber-soft: #332a17;
    --red: #f87171;
    --red-soft: #3a1a1a;
    --green: #4ade80;
    --green-soft: #16301e;
    --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.35);
    --shadow-card-hover: 0 6px 22px rgba(59,130,246,.22), 0 1px 3px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 700px 420px at -10% -5%, rgba(37,99,235,.07), transparent 60%),
    radial-gradient(ellipse 700px 420px at 110% 105%, rgba(162,28,175,.06), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; text-wrap: balance; margin: 0 0 .55em; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: .6em 1.1em; border-radius: 0 0 8px 0;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ============ HEADER ============ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--magenta), transparent);
  opacity: .35; pointer-events: none;
}
.header-inner {
  max-width: 1280px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 18px; padding: 0 22px;
}
.mark { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; flex-shrink: 0; }
.mark-glyph { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--hero-bg); color: var(--hero-accent); }
.mark-text { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
.mark-text em { font-style: normal; color: var(--accent); }

/* search */
.search-wrap { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search-wrap .search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#search-input {
  width: 100%; height: 38px; padding: 0 14px 0 37px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font: inherit; font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover); z-index: 120; overflow: hidden; max-height: 340px; overflow-y: auto;
}
.search-results a { display: block; padding: 9px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--bg); }
.search-results strong { display: block; font-size: .92rem; font-weight: 600; }
.search-results small { color: var(--muted); font-size: .78rem; }
.sr-empty { padding: 12px 14px; color: var(--muted); font-size: .9rem; }

/* burger */
.burger { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 42px; height: 42px; padding: 10px; background: none; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ LAYOUT ============ */
.page-wrap { display: flex; max-width: 1280px; margin: 0 auto; padding: calc(var(--header-h) + 26px) 22px 40px; gap: 30px; align-items: flex-start; }
.sidebar { position: sticky; top: calc(var(--header-h) + 26px); width: var(--sidebar-w); flex-shrink: 0; max-height: calc(100vh - var(--header-h) - 50px); overflow-y: auto; padding: 6px 4px; }
.sidebar-home { display: block; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 600; color: var(--text); font-size: .95rem; }
.sidebar-home:hover { background: var(--surface); text-decoration: none; }
.sidebar-sec { margin: 16px 12px 6px; font-family: var(--font-display); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sidebar-link { display: flex; align-items: center; gap: 9px; padding: 7px 12px; border-radius: var(--radius-sm); font-size: .9rem; color: var(--text); line-height: 1.35; }
.sidebar-link:hover { background: var(--surface); text-decoration: none; }
.sidebar-link.active { background: var(--surface); color: var(--accent-hi); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-link .sico { font-size: .95rem; flex-shrink: 0; }
.main { flex: 1; min-width: 0; }

/* ============ HERO (home) ============ */
.home-hero {
  position: relative; overflow: hidden;
  border-radius: 16px;
  background: var(--hero-bg);
  background-image:
    radial-gradient(ellipse 480px 300px at 88% -10%, rgba(59,130,246,.28), transparent 65%),
    radial-gradient(ellipse 420px 280px at 8% 115%, rgba(162,28,175,.22), transparent 65%);
  color: var(--hero-text);
  padding: 44px 46px 40px;
  display: grid; grid-template-columns: 1.25fr .75fr; gap: 26px; align-items: center;
  border: 1px solid rgba(255,255,255,.07);
}
.home-hero .badge {
  display: inline-block; font-family: var(--font-display); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--hero-accent); border: 1px solid rgba(34,211,238,.4); border-radius: 999px; padding: .3em .9em; margin-bottom: 14px;
}
.home-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); color: #fff; margin-bottom: .35em; }
.home-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--hero-accent), var(--hero-magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero .lead { color: var(--hero-muted); font-size: 1.05rem; max-width: 56ch; margin-bottom: 22px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-block; padding: .62em 1.35em; border-radius: 999px; font-weight: 600; font-size: .98rem; text-decoration: none; transition: var(--transition); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); transform: translateY(-1px); text-decoration: none; box-shadow: 0 4px 16px rgba(37,99,235,.35); }
.btn-ghost { border: 1px solid rgba(255,255,255,.28); color: var(--hero-text); }
.btn-ghost:hover { border-color: var(--hero-accent); color: var(--hero-accent); transform: translateY(-1px); text-decoration: none; }

/* hero signature: gamepad + health bar */
.hero-visual { display: flex; justify-content: center; }
.pad-wrap { width: 100%; max-width: 300px; }
.pad-wrap svg { display: block; width: 100%; }
.pad-body { fill: #221d33; stroke: rgba(255,255,255,.14); }
.pad-glow { fill: url(#padGrad); }
.pad-btn { fill: #16121f; stroke: rgba(255,255,255,.2); }
.pad-btn.lit { fill: var(--hero-blue); animation: btnPulse 2.4s ease-in-out infinite; }
.pad-btn.lit2 { fill: var(--hero-accent); animation: btnPulse 2.4s ease-in-out .5s infinite; }
.pad-btn.lit3 { fill: var(--hero-magenta); animation: btnPulse 2.4s ease-in-out 1s infinite; }
.pad-btn.lit4 { fill: var(--hero-accent); animation: btnPulse 2.4s ease-in-out 1.5s infinite; }
@keyframes btnPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.hb-track { fill: rgba(255,255,255,.1); }
.hb-fill { fill: url(#hbGrad); transform-origin: 0 50%; transform: scaleX(.72); animation: hbFill 3.2s cubic-bezier(.22,.9,.3,1) .3s both; }
@keyframes hbFill { from { transform: scaleX(0); } to { transform: scaleX(.72); } }
.hb-tick { fill: var(--hero-bg); }
.hb-label { font-family: var(--font-display); font-size: 8.5px; letter-spacing: .22em; fill: var(--hero-muted); }
.hb-val { font-family: var(--font-display); font-size: 10px; fill: var(--hero-accent); }

/* stats strip */
.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0 34px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); line-height: 1.1; margin-bottom: 4px; }
.stat span { color: var(--muted); font-size: .86rem; line-height: 1.45; display: block; }

/* ============ HOME SECTIONS ============ */
.home-section { margin-bottom: 36px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.section-head h2 { font-size: 1.3rem; margin: 0; color: var(--text); }
.sec-count { font-size: .78rem; color: var(--muted); font-family: var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.home-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 17px 15px; color: var(--text); text-decoration: none;
  box-shadow: var(--shadow-card); transition: var(--transition);
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); text-decoration: none; border-color: rgba(37,99,235,.45); }
.home-card .card-arrow { position: absolute; top: 15px; right: 15px; opacity: 0; transform: translateX(-6px); transition: var(--transition); color: var(--accent); font-size: 1.05rem; }
.home-card:hover .card-arrow { opacity: 1; transform: translateX(0); }
.home-card .ico { font-size: 1.5rem; margin-bottom: 8px; }
.home-card h3 { font-size: .95rem; margin: 0 0 5px; line-height: 1.35; }
.home-card p { font-size: .85rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* ============ ARTICLE ============ */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 38px 44px 44px; box-shadow: var(--shadow-card); animation: fadeUp .28s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent-hi); }
.breadcrumbs span[aria-hidden="true"] { margin: 0 6px; }
.article h1 { font-size: clamp(1.6rem, 3vw, 2.25rem); margin-bottom: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); font-size: .85rem; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.trust-badge { display: inline-block; background: var(--green-soft); color: var(--green); border-radius: 999px; padding: .15em .75em; font-size: .78rem; font-weight: 600; }
.article h2 { font-size: 1.32rem; margin: 1.7em 0 .55em; padding-top: .2em; }
.article h3 { font-size: 1.08rem; margin: 1.3em 0 .45em; }
.article ul, .article ol { padding-left: 1.35em; margin: 0 0 1.1em; }
.article li { margin-bottom: .4em; }
.article strong { font-weight: 600; }
.article blockquote { margin: 1.2em 0; padding: .6em 1.1em; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--muted); }

/* TOC */
.toc { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 26px; }
.toc b { font-family: var(--font-display); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 8px; }
.toc a { display: block; padding: 4px 0; font-size: .92rem; color: var(--text); }
.toc a:hover { color: var(--accent-hi); text-decoration: underline; }

/* boxes */
.info-box { background: var(--cyan-soft); border: 1px solid rgba(14,116,144,.35); border-left: 4px solid var(--cyan); border-radius: var(--radius-sm); padding: 14px 16px; margin: 1.2em 0; color: var(--text); }
.warn-box { background: var(--amber-soft); border: 1px solid rgba(146,97,10,.4); border-left: 4px solid var(--amber); border-radius: var(--radius-sm); padding: 14px 16px; margin: 1.2em 0; color: var(--text); }
.danger-box { background: var(--red-soft); border: 1px solid rgba(185,28,28,.4); border-left: 4px solid var(--red); border-radius: var(--radius-sm); padding: 14px 16px; margin: 1.2em 0; color: var(--text); }
.tip-box { background: var(--green-soft); border: 1px solid rgba(21,128,61,.35); border-left: 4px solid var(--green); border-radius: var(--radius-sm); padding: 14px 16px; margin: 1.2em 0; color: var(--text); }

/* tables (comparison + error) */
.table-responsive { overflow-x: auto; margin: 1.3em 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 520px; }
th, td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--bg); font-family: var(--font-display); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--bg); }
.error-table td:first-child, .cmp-table td:first-child { font-weight: 600; }
.cmp-table .yes { color: var(--green); font-weight: 600; }
.cmp-table .no { color: var(--red); font-weight: 600; }

/* FAQ accordion */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; background: var(--surface); }
.faq-q { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: .97rem; color: var(--text); text-align: left; }
.faq-q::after { content: '+'; font-size: 1.25rem; color: var(--accent); flex-shrink: 0; transition: var(--transition); }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a { display: none; padding: 0 16px 14px; color: var(--muted); font-size: .94rem; }
.faq-item.open .faq-a { display: block; }

/* glossary */
dl.glossary { margin: 0; }
dl.glossary dt { font-family: var(--font-display); font-weight: 600; color: var(--accent-hi); margin-top: 1em; font-size: 1rem; }
dl.glossary dd { margin: .15em 0 0; color: var(--muted); font-size: .95rem; }

/* 404 */
.error-page { text-align: center; padding: 70px 20px; }
.error-page h1 { font-size: 3.2rem; color: var(--accent); }
.error-page p { color: var(--muted); }

/* ============ FOOTER ============ */
.footer { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .86rem; line-height: 1.6; }
.footer-links { margin-top: 8px; font-size: .86rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent-hi); }
.footer-links span[aria-hidden="true"] { margin: 0 8px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .page-wrap { padding-top: calc(var(--header-h) + 16px); }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 90;
    width: min(320px, 85vw); max-height: none;
    background: var(--sidebar-bg); border-right: 1px solid var(--border);
    transform: translateX(-102%); transition: transform .24s ease-out;
    padding: 18px 14px 40px; overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.18); }
  .burger { display: flex; margin-left: auto; }
  .home-hero { grid-template-columns: 1fr; padding: 34px 28px; }
  .hero-visual { max-width: 260px; margin: 0 auto; }
  .stats-strip { grid-template-columns: 1fr; }
  .article { padding: 28px 24px 32px; }
}
@media (max-width: 600px) {
  .header-inner { padding: 0 14px; gap: 10px; }
  .mark-text { font-size: 1rem; }
  .search-wrap { max-width: none; }
  #search-input { font-size: .88rem; }
  .home-hero { padding: 28px 20px; border-radius: 12px; }
  .home-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1; text-align: center; }
  .article { padding: 24px 18px 28px; border-radius: 10px; }
  .stat b { font-size: 1.3rem; }
}

@media print {
  .header, .sidebar, .burger, .footer-links { display: none; }
  body { background: #fff; }
  .article { border: 0; box-shadow: none; padding: 0; }
}
