:root {
  --bg: #0b0f14;
  --bg-soft: #121922;
  --card: #161f2b;
  --card-2: #1b2735;
  --line: #25303f;
  --text: #e8eef5;
  --muted: #9fb0c3;
  --accent: #e10600; /* Audi red */
  --accent-soft: #ff3b35;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --bad: #ff5a4d;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #16202c 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-soft); }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-text strong { display: block; font-size: 1.05rem; letter-spacing: 0.3px; }
.brand-text small { color: var(--muted); font-size: 0.78rem; }

.rings { display: inline-flex; }
.rings span {
  width: 16px; height: 16px;
  border: 2.5px solid var(--text);
  border-radius: 50%;
  margin-left: -6px;
}
.rings span:first-child { margin-left: 0; }

.search-wrap { margin-left: auto; flex: 1 1 260px; max-width: 420px; }
#search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}
#search:focus { border-color: var(--accent); }

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 18px;
  position: sticky;
  top: 64px;
  z-index: 15;
  background: rgba(11, 15, 20, 0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tab {
  white-space: nowrap;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: 0.15s;
}
.tab:hover { color: var(--text); border-color: #34465c; }
.tab.active {
  color: #fff;
  background: linear-gradient(180deg, var(--accent), #b30500);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(225, 6, 0, 0.35);
}

/* Layout */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}
.panel { display: none; animation: fade 0.25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 26px 0 12px; }
.lead { color: var(--muted); margin-top: 0; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 1.02rem; }
.card ul { margin: 6px 0 0; padding-left: 18px; }
.card li { margin-bottom: 6px; }

.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } }

/* Spec table */
.spec {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 6px;
}
.spec .item {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.spec .k { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.5px; }
.spec .v { font-weight: 600; }
@media (max-width: 560px) { .spec { grid-template-columns: 1fr; } }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.badge.accent { background: rgba(225, 6, 0, 0.16); color: var(--accent-soft); border: 1px solid rgba(225,6,0,0.4); }
.badge.ok { background: rgba(46,204,113,0.15); color: var(--ok); border: 1px solid rgba(46,204,113,0.4); }
.badge.warn { background: rgba(241,196,15,0.15); color: var(--warn); border: 1px solid rgba(241,196,15,0.4); }
.badge.bad { background: rgba(255,90,77,0.15); color: var(--bad); border: 1px solid rgba(255,90,77,0.4); }

/* Karty wariantów dostępu */
.access-grid { display: grid; gap: 14px; margin: 12px 0 6px; }
@media (min-width: 760px) { .access-grid { grid-template-columns: repeat(3, 1fr); } }
.access-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-top: 4px solid var(--line);
}
.access-card.ok { border-top-color: var(--ok); }
.access-card.warn { border-top-color: var(--warn); }
.access-card.bad { border-top-color: var(--bad); }
.access-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.access-head strong { font-size: 1.02rem; }
.access-card p { color: var(--muted); margin: 0 0 8px; font-size: 0.92rem; }
.access-card ul { margin: 0; padding-left: 18px; }
.access-card li { margin-bottom: 5px; font-size: 0.9rem; }

/* Sketch / SVG */
.sketch-wrap {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  overflow: hidden;
}
.sketch-wrap svg { width: 100%; height: auto; display: block; }
.hotspot { cursor: pointer; }
.hotspot circle { transition: 0.15s; }
.hotspot:hover circle, .hotspot.active circle { fill: var(--accent); r: 15; }
.hotspot text { fill: #fff; font-weight: 700; font-size: 13px; pointer-events: none; }

.belt-wheel, .exp-dot { cursor: pointer; }
.belt-wheel circle:first-of-type { transition: 0.15s; }
.belt-wheel.active circle:first-of-type { fill: #2b6cb0; stroke: var(--accent); }
.exp-dot circle { transition: 0.15s; }
.exp-dot:hover circle, .exp-dot.active circle { fill: var(--accent); r: 16; }

.part-detail {
  margin-top: 14px;
  border-left: 3px solid var(--accent);
}
.part-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
@media (min-width: 720px) { .part-list { grid-template-columns: 1fr 1fr; } }
.part-list button {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: 0.15s;
}
.part-list button:hover, .part-list button.active { border-color: var(--accent); background: var(--card-2); }
.part-list .pl-loc { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

/* Przełącznik widoków silnika */
.view-switch {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin: 6px 0 4px;
}
.view-btn {
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: 0.15s;
}
.view-btn:hover { color: var(--text); border-color: #34465c; }
.view-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #2b6cb0, #1f5a96);
  border-color: #2b6cb0;
}

/* Steps */
.step {
  display: flex;
  gap: 14px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.step .num {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff; font-weight: 800;
}
.step h3 { margin: 2px 0 8px; }

/* Voltage table */
.volt-row {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 2fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--bg-soft);
}
.volt-row .v { font-weight: 800; font-size: 1.05rem; }
.volt-row.ok { border-left: 4px solid var(--ok); }
.volt-row.warn { border-left: 4px solid var(--warn); }
.volt-row.bad { border-left: 4px solid var(--bad); }
.volt-row small { color: var(--muted); }
@media (max-width: 600px) {
  .volt-row { grid-template-columns: 1fr; gap: 4px; }
}

.dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.callout {
  border: 1px solid rgba(225,6,0,0.4);
  background: rgba(225,6,0,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 14px 0;
}
.callout strong { color: var(--accent-soft); }

.linklike {
  background: none;
  border: none;
  color: var(--accent-soft);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
.linklike:hover { color: #fff; }

.src-link {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--accent);
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: 0.15s;
}
.src-link:hover { background: var(--accent); color: #fff; }

mark { background: var(--accent); color:#fff; border-radius:3px; padding:0 2px; }

.footer {
  border-top: 1px solid var(--line);
  padding: 18px;
  text-align: center;
}
.footer p { color: var(--muted); font-size: 0.82rem; max-width: 720px; margin: 0 auto; }

.empty { color: var(--muted); text-align: center; padding: 30px; }


/* Galeria osadzonych diagramów */
.gallery {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin: 14px 0;
}
.gal-item {
  margin: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gal-item .embed-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #0b0f14;
  cursor: zoom-in;
  display: block;
}
.gal-item .embed-pdf {
  width: 100%;
  height: 260px;
  border: 0;
  background: #fff;
}
.gal-item figcaption {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gal-item figcaption strong { font-size: 0.95rem; }
.gal-desc { color: var(--muted); font-size: 0.82rem; }
.gal-src { color: var(--accent-soft); font-size: 0.74rem; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  transition: 0.15s;
  margin: 10px 0;
}
.dropzone.drag { border-color: var(--accent); background: rgba(225,6,0,0.06); color: var(--text); }

code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.86em;
  color: var(--accent-soft);
}

/* Lightbox (powiększenie) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 85vh; object-fit: contain; border-radius: 8px; }
.lightbox .lb-cap { color: #e8eef5; margin-top: 12px; font-size: 0.95rem; }
.lightbox .lb-close {
  position: absolute;
  top: 18px; right: 22px;
  background: none; border: none;
  color: #fff; font-size: 2rem; cursor: pointer;
}
